diff --git a/rhel8-playbook-stig.yml b/rhel8-playbook-stig.yml index 4d96250..fd49196 100644 --- a/rhel8-playbook-stig.yml +++ b/rhel8-playbook-stig.yml @@ -36643,7 +36643,7 @@ create: true dest: /etc/modprobe.d/atm.conf regexp: install\s+atm - line: install atm /bin/true + line: install atm /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82028-2 @@ -36680,7 +36680,7 @@ create: true dest: /etc/modprobe.d/can.conf regexp: install\s+can - line: install can /bin/true + line: install can /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82059-7 @@ -36717,7 +36717,7 @@ create: true dest: /etc/modprobe.d/firewire-core.conf regexp: install\s+firewire-core - line: install firewire-core /bin/true + line: install firewire-core /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82005-0 @@ -36754,7 +36754,7 @@ create: true dest: /etc/modprobe.d/sctp.conf regexp: install\s+sctp - line: install sctp /bin/true + line: install sctp /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80834-5 @@ -36803,7 +36803,7 @@ create: true dest: /etc/modprobe.d/tipc.conf regexp: install\s+tipc - line: install tipc /bin/true + line: install tipc /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82297-3 @@ -36844,7 +36844,7 @@ create: true dest: /etc/modprobe.d/bluetooth.conf regexp: install\s+bluetooth - line: install bluetooth /bin/true + line: install bluetooth /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80832-9 @@ -38707,7 +38707,7 @@ create: true dest: /etc/modprobe.d/cramfs.conf regexp: install\s+cramfs - line: install cramfs /bin/true + line: install cramfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-81031-7 @@ -38750,7 +38750,7 @@ create: true dest: /etc/modprobe.d/usb-storage.conf regexp: install\s+usb-storage - line: install usb-storage /bin/true + line: install usb-storage /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80835-2 @@ -41402,7 +41402,7 @@ create: true dest: /etc/modprobe.d/uvcvideo.conf regexp: install\s+uvcvideo - line: install uvcvideo /bin/true + line: install uvcvideo /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86960-2 diff --git a/rhel8-script-stig.sh b/rhel8-script-stig.sh index f5ab792..0010696 100644 --- a/rhel8-script-stig.sh +++ b/rhel8-script-stig.sh @@ -31023,7 +31023,7 @@ if LC_ALL=C grep -q -m 1 "^install atm" /etc/modprobe.d/atm.conf ; then sed -i 's#^install atm.*#install atm /bin/true#g' /etc/modprobe.d/atm.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/atm.conf - echo "install atm /bin/true" >> /etc/modprobe.d/atm.conf + echo "install atm /bin/false" >> /etc/modprobe.d/atm.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist atm$" /etc/modprobe.d/atm.conf ; then @@ -31048,7 +31048,7 @@ if LC_ALL=C grep -q -m 1 "^install can" /etc/modprobe.d/can.conf ; then sed -i 's#^install can.*#install can /bin/true#g' /etc/modprobe.d/can.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/can.conf - echo "install can /bin/true" >> /etc/modprobe.d/can.conf + echo "install can /bin/false" >> /etc/modprobe.d/can.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist can$" /etc/modprobe.d/can.conf ; then @@ -31073,7 +31073,7 @@ if LC_ALL=C grep -q -m 1 "^install firewire-core" /etc/modprobe.d/firewire-core. sed -i 's#^install firewire-core.*#install firewire-core /bin/true#g' /etc/modprobe.d/firewire-core.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/firewire-core.conf - echo "install firewire-core /bin/true" >> /etc/modprobe.d/firewire-core.conf + echo "install firewire-core /bin/false" >> /etc/modprobe.d/firewire-core.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist firewire-core$" /etc/modprobe.d/firewire-core.conf ; then @@ -31098,7 +31098,7 @@ if LC_ALL=C grep -q -m 1 "^install sctp" /etc/modprobe.d/sctp.conf ; then sed -i 's#^install sctp.*#install sctp /bin/true#g' /etc/modprobe.d/sctp.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/sctp.conf - echo "install sctp /bin/true" >> /etc/modprobe.d/sctp.conf + echo "install sctp /bin/false" >> /etc/modprobe.d/sctp.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist sctp$" /etc/modprobe.d/sctp.conf ; then @@ -31123,7 +31123,7 @@ if LC_ALL=C grep -q -m 1 "^install tipc" /etc/modprobe.d/tipc.conf ; then sed -i 's#^install tipc.*#install tipc /bin/true#g' /etc/modprobe.d/tipc.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/tipc.conf - echo "install tipc /bin/true" >> /etc/modprobe.d/tipc.conf + echo "install tipc /bin/false" >> /etc/modprobe.d/tipc.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist tipc$" /etc/modprobe.d/tipc.conf ; then @@ -31148,7 +31148,7 @@ if LC_ALL=C grep -q -m 1 "^install bluetooth" /etc/modprobe.d/bluetooth.conf ; t sed -i 's#^install bluetooth.*#install bluetooth /bin/true#g' /etc/modprobe.d/bluetooth.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/bluetooth.conf - echo "install bluetooth /bin/true" >> /etc/modprobe.d/bluetooth.conf + echo "install bluetooth /bin/false" >> /etc/modprobe.d/bluetooth.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist bluetooth$" /etc/modprobe.d/bluetooth.conf ; then @@ -31620,7 +31620,7 @@ if LC_ALL=C grep -q -m 1 "^install cramfs" /etc/modprobe.d/cramfs.conf ; then sed -i 's#^install cramfs.*#install cramfs /bin/true#g' /etc/modprobe.d/cramfs.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cramfs.conf - echo "install cramfs /bin/true" >> /etc/modprobe.d/cramfs.conf + echo "install cramfs /bin/false" >> /etc/modprobe.d/cramfs.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist cramfs$" /etc/modprobe.d/cramfs.conf ; then @@ -31645,7 +31645,7 @@ if LC_ALL=C grep -q -m 1 "^install usb-storage" /etc/modprobe.d/usb-storage.conf sed -i 's#^install usb-storage.*#install usb-storage /bin/true#g' /etc/modprobe.d/usb-storage.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/usb-storage.conf - echo "install usb-storage /bin/true" >> /etc/modprobe.d/usb-storage.conf + echo "install usb-storage /bin/false" >> /etc/modprobe.d/usb-storage.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist usb-storage$" /etc/modprobe.d/usb-storage.conf ; then @@ -32861,7 +32861,7 @@ if LC_ALL=C grep -q -m 1 "^install uvcvideo" /etc/modprobe.d/uvcvideo.conf ; the sed -i 's#^install uvcvideo.*#install uvcvideo /bin/true#g' /etc/modprobe.d/uvcvideo.conf else echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/uvcvideo.conf - echo "install uvcvideo /bin/true" >> /etc/modprobe.d/uvcvideo.conf + echo "install uvcvideo /bin/false" >> /etc/modprobe.d/uvcvideo.conf fi if ! LC_ALL=C grep -q -m 1 "^blacklist uvcvideo$" /etc/modprobe.d/uvcvideo.conf ; then diff --git a/ssg-rhel8-ds-1.2.xml b/ssg-rhel8-ds-1.2.xml index 24d9ffa..9d620a2 100644 --- a/ssg-rhel8-ds-1.2.xml +++ b/ssg-rhel8-ds-1.2.xml @@ -23,7 +23,7 @@ - + Red Hat Enterprise Linux 8 @@ -75,9 +75,9 @@ - + - draft + draft Guide to the Secure Configuration of Red Hat Enterprise Linux 8 This guide presents a catalog of security-relevant configuration settings for Red Hat Enterprise Linux 8. It is a rendering of @@ -145,63 +145,99 @@ respective companies. stigid stigref - + - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + - - - - + - + - + - + + - + - + - + - + - + - + - + - - + - + - - - - + + + + + + + + + + + + + + + + + + + + + @@ -210,6 +246,12 @@ respective companies. + + + + + + @@ -217,93 +259,91 @@ respective companies. - + - + + - + - + - + - + - + - - + - + - + + - + - + - + - + - + - - - - - - + + - + - + - + - + - + - + - + - - + - + + + + + - - + - + - + - - + - + - + @@ -312,22 +352,10 @@ respective companies. - - - - - - - - - - - - - - - - + + + + @@ -340,86 +368,69 @@ respective companies. - + - - + - + - + - + - - - - - - - - - - - + - + - - + - + - + - + - + - + - - - - - - + - + - - - + - + - + - + - + - + - + - + - + + + @@ -428,50 +439,26 @@ respective companies. - - - - - - - - - - - - - - - - + - + - + - + + - + - - - + + + + + - - - - - - - - - - - - @@ -480,48 +467,47 @@ respective companies. - + - + + - + - + - + - - + - + - - + - + - + - + - + - + - + - + - + @@ -529,59 +515,73 @@ respective companies. - - - - - - + - + - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - + - - + - + - + + - + - + - + + + + - - + - + + + + + + + @@ -646,6 +646,8 @@ respective companies. Eric Christensen <echriste@redhat.com> Dan Clark <danclark@redhat.com> Jayson Cofell <1051437+70k10@users.noreply.github.com> + David du Colombier <djc@datadoghq.com> + Commandcracker <lukas.fricke.dev@gmail.com> Caleb Cooper <coopercd@ornl.gov> cortesana <acortes@redhat.com> Richard Maciel Costa <richard.maciel.costa@canonical.com> @@ -669,6 +671,7 @@ respective companies. François Duthilleul <francoisduthilleul@gmail.com> Greg Elin <gregelin@gitmachines.com> eradot4027 <jrtonmac@gmail.com> + ermeratos <manuel.ermer@atos.net> Alexis Facques <alexis.facques@mythalesgroup.io> Henry Finucane <hfinucane@zscaler.com> Leah Fisher <lfisher047@gmail.com> @@ -754,6 +757,7 @@ respective companies. Takuya Mishina <tmishina@jp.ibm.com> Mixer9 <35545791+Mixer9@users.noreply.github.com> mmosel <mmosel@kde.example.com> + Thomas Montague <montague.thomas@gmail.com> Zbynek Moravec <zmoravec@redhat.com> Kazuo Moriwaka <moriwaka@users.noreply.github.com> Michael Moseley <michael@eclipse.ncsc.mil> @@ -780,6 +784,7 @@ respective companies. piggyvenus <piggyvenus@gmail.com> Vojtech Polasek <vpolasek@redhat.com> Orion Poplawski <orion@nwra.com> + Jennifer Power <barnabei.jennifer@gmail.com> Nick Poyant <npoyant@redhat.com> Martin Preisler <mpreisle@redhat.com> Wesley Ceraso Prudencio <wcerasop@redhat.com> @@ -798,12 +803,14 @@ respective companies. Pat Riehecky <riehecky@fnal.gov> rlucente-se-jboss <rlucente@redhat.com> Juan Antonio Osorio Robles <juan.osoriorobles@eu.equinix.com> + Paul Roche <paul.roche@menlosecurity.com> Jan Rodak <hony.com@seznam.cz> Matt Rogers <mrogers@redhat.com> Jesse Roland <jesse.roland@onyxpoint.com> Joshua Roys <roysjosh@gmail.com> rrenshaw <bofh69@yahoo.com> Chris Ruffalo <chris.ruffalo@gmail.com> + Benjamin Ruland <benjamin.ruland@gmail.com> rumch-se <77793453+rumch-se@users.noreply.github.com> Rutvik <32413084+rutvik23@users.noreply.github.com> rutvik23 <rutksh@gmail.com> @@ -830,6 +837,7 @@ respective companies. Jindrich Skacel <102800748+jskacel@users.noreply.github.com> Alexandre Skrzyniarz <alexandre.skrzyniarz@laposte.net> Francisco Slavin <fslavin@tresys.com> + sluetze <13255307+sluetze@users.noreply.github.com> Dave Smith <dsmith@eclipse.ncsc.mil> David Smith <dsmith@fornax.eclipse.ncsc.mil> Kevin Spargur <kspargur@redhat.com> @@ -894,246 +902,246 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - + + + - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - + - - - - - - - - - - - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + - - - + + + + + - - - - - - - + + + + - - - - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + @@ -1369,320 +1377,320 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + - + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + - - + - - + + - - - - - - - - + + + - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - + - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + @@ -1920,175 +1928,175 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - + + - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + - - + + + + + - - - - - - + + + + + + + + + + + + + + - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + @@ -2334,53 +2342,53 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + - - + + - - - - - + + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + @@ -2636,378 +2644,401 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + - + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + - - - - - - - - - - - + + + + + - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - + + - - - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - @@ -3105,7 +3136,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3137,7 +3167,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3151,22 +3180,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -3201,8 +3235,10 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - + + + @@ -3217,293 +3253,306 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + + - + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - + - - - - - - + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + - @@ -3649,7 +3698,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3664,22 +3712,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -3723,289 +3776,301 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - + - - - - - - + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + - @@ -4155,7 +4220,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4171,22 +4235,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -4230,372 +4299,395 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + - + + + + + + + + + + + + + - - - - - + + + + - - - - - - - - - - - - - - + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + - - - - - + + + + - - - - - - - - - - - + + + + + - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - + + - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - @@ -4695,7 +4787,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4728,7 +4819,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4744,22 +4834,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -4794,8 +4889,10 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - + + + @@ -4809,111 +4906,111 @@ Policy Resource Center: https://www.fbi.gov/services/cjis/cjis-security-policy-resource-center https://www.fbi.gov/services/cjis/cjis-security-policy-resource-center - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + - - + + + + + + + + - - - + + + - - - + + + + - - - - - + + + + + - + + + + + + + + - - + + + - - + + + + - - - - - - - - - - - - - - - + - - - - - + + + + + + - - - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + - @@ -5162,216 +5259,216 @@ in NIST Special Publication 800-53. This profile configures Red Hat Enterprise Linux 8 to the NIST Special Publication 800-53 controls identified for securing Controlled Unclassified Information (CUI)." - - - - - - - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - + + + - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - + + + + - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -5606,104 +5703,104 @@ ACSC website: https://www.cyber.gov.au/acsc/view-all-content/publications/hardening-linux-workstations-and-servers https://www.cyber.gov.au/acsc/view-all-content/publications/hardening-linux-workstations-and-servers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -5931,143 +6028,143 @@ This profile configures Red Hat Enterprise Linux 8 to the HIPAA Security Rule identified for securing of electronic protected health information. Use of this profile in no way guarantees or makes claims against legal compliance against the HIPAA Security Rule(s). https://www.hhs.gov/hipaa/for-professionals/index.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + + + + + + + + + - - - - + + + + + + + + + + - + + - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6291,171 +6388,171 @@ A copy of the ISM can be found at the ACSC website: https://www.cyber.gov.au/ism https://www.cyber.gov.au/ism - - + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + + + - - + + - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - + + - - + + + - - - - - - - - - - + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6650,216 +6747,216 @@ U.S. National Security Systems to adhere to certain configuration parameters. Accordingly, this configuration profile is suitable for use in U.S. National Security Systems. https://www.niap-ccevs.org/Profile/Info.cfm?PPID=442&id=442 - - - - - - - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - + + + - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - + + + + - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -7094,257 +7191,259 @@ financial information. This profile ensures Red Hat Enterprise Linux 8 is configured in alignment with PCI-DSS v4.0 requirements. https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0.pdf - - - - - + + + + - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + + - + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - - + + + + + + + - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - - + + + + - - - + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + - + + + + + + + + + + - - - - + + @@ -7551,77 +7650,77 @@ with PCI-DSS v4.0 requirements. configuration settings recommended by Red Hat, Inc for Red Hat Enterprise Linux 8 instances deployed by Red Hat Certified Cloud Providers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - + + + + + + + + + + + + + + + + + + - - + + + - - - - - + + + + + + + - - + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - + + + + @@ -7863,85 +7962,85 @@ Cloud Providers. This profile contains rules to ensure standard security baseline of a Red Hat Enterprise Linux 8 system. Regardless of your system's workload all of these checks should pass. - - - - + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - + + - - + + + + - - - - - - + + + + + + + + - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + + + + + + + + + + - - - - + - - - + + + + + + - - - + + + + + + + + + + + + + + + + + @@ -8182,416 +8281,416 @@ Red Hat technologies that are based on Red Hat Enterprise Linux 8, such as: - Red Hat Storage - Red Hat Containers with a Red Hat Enterprise Linux 8 image https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + @@ -8815,413 +8914,413 @@ your Information Systems Security Officer (ISSO) lacks a documented operational requirement for a graphical user interface, please consider using the standard DISA STIG for Red Hat Enterprise Linux 8 profile. https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + @@ -9570,19 +9669,6 @@ See https://access.redhat.com/articles/6999111. CCE-80857-6 - -# Find which files have incorrect hash (not in /etc, because of the system related config files) and then get files names -files_with_incorrect_hash="$(rpm -Va --noconfig | grep -E '^..5' | awk '{print $NF}' )" - -if [ -n "$files_with_incorrect_hash" ]; then - # From files names get package names and change newline to space, because rpm writes each package to new line - packages_to_reinstall="$(rpm -qf $files_with_incorrect_hash | tr '\n' ' ')" - - - yum reinstall -y $packages_to_reinstall - -fi - - name: 'Set fact: Package manager reinstall command' set_fact: package_manager_reinstall_cmd: yum reinstall -y @@ -9717,6 +9803,19 @@ fi - no_reboot_needed - restrict_strategy - rpm_verify_hashes + + +# Find which files have incorrect hash (not in /etc, because of the system related config files) and then get files names +files_with_incorrect_hash="$(rpm -Va --noconfig | grep -E '^..5' | awk '{print $NF}' )" + +if [ -n "$files_with_incorrect_hash" ]; then + # From files names get package names and change newline to space, because rpm writes each package to new line + packages_to_reinstall="$(rpm -qf $files_with_incorrect_hash | tr '\n' ' ')" + + + yum reinstall -y $packages_to_reinstall + +fi @@ -9848,28 +9947,6 @@ See https://access.redhat.com/articles/6999111. CCE-82196-7 - -# Declare array to hold set of RPM packages we need to correct permissions for -declare -A SETPERMS_RPM_DICT - -# Create a list of files on the system having permissions different from what -# is expected by the RPM database -readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }') - -for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" -do - RPM_PACKAGE=$(rpm -qf "$FILE_PATH") - # Use an associative array to store packages as it's keys, not having to care about duplicates. - SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 -done - -# For each of the RPM packages left in the list -- reset its permissions to the -# correct values -for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" -do - rpm --setugids "${RPM_PACKAGE}" -done - - name: Read list of files with incorrect ownership command: rpm -Va --nodeps --nosignature --nofiledigest --nosize --nomtime --nordev --nocaps --nolinkto --nomode @@ -9950,6 +10027,28 @@ done - no_reboot_needed - restrict_strategy - rpm_verify_ownership + + +# Declare array to hold set of RPM packages we need to correct permissions for +declare -A SETPERMS_RPM_DICT + +# Create a list of files on the system having permissions different from what +# is expected by the RPM database +readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }') + +for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" +do + RPM_PACKAGE=$(rpm -qf "$FILE_PATH") + # Use an associative array to store packages as it's keys, not having to care about duplicates. + SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 +done + +# For each of the RPM packages left in the list -- reset its permissions to the +# correct values +for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" +do + rpm --setugids "${RPM_PACKAGE}" +done @@ -10095,32 +10194,6 @@ See https://access.redhat.com/articles/6999111. CCE-80858-4 - -# Declare array to hold set of RPM packages we need to correct permissions for -declare -A SETPERMS_RPM_DICT - -# Create a list of files on the system having permissions different from what -# is expected by the RPM database -readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,2,1)=="M") print $NF }') - -for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" -do - # NOTE: some files maybe controlled by more then one package - readarray -t RPM_PACKAGES < <(rpm -qf "${FILE_PATH}") - for RPM_PACKAGE in "${RPM_PACKAGES[@]}" - do - # Use an associative array to store packages as it's keys, not having to care about duplicates. - SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 - done -done - -# For each of the RPM packages left in the list -- reset its permissions to the -# correct values -for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" -do - rpm --restore "${RPM_PACKAGE}" -done - - name: Read list of files with incorrect permissions command: rpm -Va --nodeps --nosignature --nofiledigest --nosize --nomtime --nordev --nocaps --nolinkto --nouser --nogroup @@ -10204,6 +10277,32 @@ done - no_reboot_needed - restrict_strategy - rpm_verify_permissions + + +# Declare array to hold set of RPM packages we need to correct permissions for +declare -A SETPERMS_RPM_DICT + +# Create a list of files on the system having permissions different from what +# is expected by the RPM database +readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,2,1)=="M") print $NF }') + +for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" +do + # NOTE: some files maybe controlled by more then one package + readarray -t RPM_PACKAGES < <(rpm -qf "${FILE_PATH}") + for RPM_PACKAGE in "${RPM_PACKAGES[@]}" + do + # Use an associative array to store packages as it's keys, not having to care about duplicates. + SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 + done +done + +# For each of the RPM packages left in the list -- reset its permissions to the +# correct values +for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" +do + rpm --restore "${RPM_PACKAGE}" +done @@ -10306,8 +10405,29 @@ $ sudo yum install aide SV-251710r880730_rule The AIDE package must be installed if it is to be available for integrity checking. CCE-80844-4 - -package --add=aide + - name: Ensure aide is installed + package: + name: aide + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80844-4 + - CJIS-5.10.1.3 + - DISA-STIG-RHEL-08-010359 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-11.5 + - PCI-DSSv4-11.5.2 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_aide_installed + + +[[packages]] +name = "aide" +version = "*" include install_aide @@ -10316,6 +10436,9 @@ class install_aide { ensure => 'installed', } } + + +package --add=aide # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -10327,30 +10450,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "aide" -version = "*" - - - name: Ensure aide is installed - package: - name: aide - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80844-4 - - CJIS-5.10.1.3 - - DISA-STIG-RHEL-08-010359 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-11.5 - - PCI-DSSv4-11.5.2 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_aide_installed @@ -10453,20 +10552,6 @@ If this check produces any unexpected output, investigate.For AIDE to be effective, an initial database of "known-good" information about files must be captured and it should be able to be verified against the installed files. CCE-80675-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -/usr/sbin/aide --init -/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Build and Test AIDE Database - Ensure AIDE Is Installed ansible.builtin.package: name: '{{ item }}' @@ -10547,6 +10632,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +/usr/sbin/aide --init +/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -10563,6 +10662,7 @@ fi AU-9(3).1 SRG-OS-000278-GPOS-00108 RHEL-08-030650 + 5.3.3 SV-230475r880722_rule Protecting the integrity of the tools used for auditing purposes is a critical step toward ensuring the integrity of audit information. Audit @@ -10584,68 +10684,6 @@ provide the capability to identify when the audit tools have been modified, manipulated, or replaced. An example is a checksum hash of the file or files. CCE-85964-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - - - - - - - - - - -if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure aide is installed package: name: '{{ item }}' @@ -10724,6 +10762,68 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + + + + + + + + + + +if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -10832,24 +10932,6 @@ system. The operating system's Information Management Officer (IMO)/Information Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. CCE-80676-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -if ! grep -q "/usr/sbin/aide --check" /etc/crontab ; then - echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab -else - sed -i '\!^.* --check.*$!d' /etc/crontab - echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure AIDE is installed package: name: '{{ item }}' @@ -10957,6 +11039,24 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +if ! grep -q "/usr/sbin/aide --check" /etc/crontab ; then + echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab +else + sed -i '\!^.* --check.*$!d' /etc/crontab + echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11036,36 +11136,6 @@ system. The operating system's Information Management Officer (IMO)/Information Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. CCE-82891-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi -var_aide_scan_notification_email='' - - - -CRONTAB=/etc/crontab -CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly' - -# NOTE: on some platforms, /etc/crontab may not exist -if [ -f /etc/crontab ]; then - CRONTAB_EXIST=/etc/crontab -fi - -if [ -f /var/spool/cron/root ]; then - VARSPOOL=/var/spool/cron/root -fi - -if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then - echo "0 5 * * * root /usr/sbin/aide --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_aide_scan_notification_email # promote to variable set_fact: var_aide_scan_notification_email: !!str @@ -11112,6 +11182,36 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi +var_aide_scan_notification_email='' + + + +CRONTAB=/etc/crontab +CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly' + +# NOTE: on some platforms, /etc/crontab may not exist +if [ -f /etc/crontab ]; then + CRONTAB_EXIST=/etc/crontab +fi + +if [ -f /var/spool/cron/root ]; then + VARSPOOL=/var/spool/cron/root +fi + +if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then + echo "0 5 * * * root /usr/sbin/aide --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11170,8 +11270,10 @@ submits to this process. PR.DS-6 PR.DS-8 SRG-OS-000480-GPOS-00227 + 5.3.3 File integrity tools use cryptographic hashes for verifying file contents and directories have not been altered. These hashes must be FIPS 140-2 approved cryptographic hashes. + CCE-86404-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -11258,37 +11360,6 @@ The remediation provided with this rule adds acl to all r ACLs can provide permissions beyond those permitted through the file mode and must be verified by the file integrity tools. CCE-84220-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -aide_conf="/etc/aide.conf" - -groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) - -for group in $groups -do - config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') - - if ! [[ $config = *acl* ]] - then - if [[ -z $config ]] - then - config="acl" - else - config=$config"+acl" - fi - fi - sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather list of packages package_facts: manager: auto @@ -11350,6 +11421,37 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +aide_conf="/etc/aide.conf" + +groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) + +for group in $groups +do + config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') + + if ! [[ $config = *acl* ]] + then + if [[ -z $config ]] + then + config="acl" + else + config=$config"+acl" + fi + fi + sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11400,37 +11502,6 @@ The remediation provided with this rule adds xattrs to al Extended attributes in file systems are used to contain arbitrary data and file metadata with security implications. CCE-83733-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -aide_conf="/etc/aide.conf" - -groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) - -for group in $groups -do - config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') - - if ! [[ $config = *xattrs* ]] - then - if [[ -z $config ]] - then - config="xattrs" - else - config=$config"+xattrs" - fi - fi - sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather list of packages package_facts: manager: auto @@ -11492,6 +11563,37 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +aide_conf="/etc/aide.conf" + +groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) + +for group in $groups +do + config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') + + if ! [[ $config = *xattrs* ]] + then + if [[ -z $config ]] + then + config="xattrs" + else + config=$config"+xattrs" + fi + fi + sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11519,21 +11621,6 @@ Audit tools must have the correct group owner. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86239-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /sbin/auditctl -chgrp 0 /sbin/aureport -chgrp 0 /sbin/ausearch -chgrp 0 /sbin/autrace -chgrp 0 /sbin/auditd -chgrp 0 /sbin/rsyslogd -chgrp 0 /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -11771,6 +11858,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /sbin/auditctl +chgrp 0 /sbin/aureport +chgrp 0 /sbin/ausearch +chgrp 0 /sbin/autrace +chgrp 0 /sbin/auditd +chgrp 0 /sbin/rsyslogd +chgrp 0 /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11798,21 +11900,6 @@ Audit tools must have the correct owner. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86259-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /sbin/auditctl -chown 0 /sbin/aureport -chown 0 /sbin/ausearch -chown 0 /sbin/autrace -chown 0 /sbin/auditd -chown 0 /sbin/rsyslogd -chown 0 /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -12050,6 +12137,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /sbin/auditctl +chown 0 /sbin/aureport +chown 0 /sbin/ausearch +chown 0 /sbin/autrace +chown 0 /sbin/auditd +chown 0 /sbin/rsyslogd +chown 0 /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12075,27 +12177,6 @@ Audit tools must have a mode of 0755 or less permissive. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86227-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-s,g-ws,o-wt /sbin/auditctl - -chmod u-s,g-ws,o-wt /sbin/aureport - -chmod u-s,g-ws,o-wt /sbin/ausearch - -chmod u-s,g-ws,o-wt /sbin/autrace - -chmod u-s,g-ws,o-wt /sbin/auditd - -chmod u-s,g-ws,o-wt /sbin/rsyslogd - -chmod u-s,g-ws,o-wt /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -12333,6 +12414,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-s,g-ws,o-wt /sbin/auditctl + +chmod u-s,g-ws,o-wt /sbin/aureport + +chmod u-s,g-ws,o-wt /sbin/ausearch + +chmod u-s,g-ws,o-wt /sbin/autrace + +chmod u-s,g-ws,o-wt /sbin/auditd + +chmod u-s,g-ws,o-wt /sbin/rsyslogd + +chmod u-s,g-ws,o-wt /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12398,19 +12500,6 @@ protect data. The operating system must implement cryptographic modules adhering standards approved by the federal government since this provides assurance they have been tested and validated. CCE-82155-3 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then - -fips-mode-setup --enable -FIPS_CONF="/etc/dracut.conf.d/40-fips.conf" -if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then - echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Check to see the current status of FIPS mode command: /usr/bin/fips-mode-setup --check register: is_fips_enabled @@ -12477,6 +12566,19 @@ fi - medium_disruption - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then + +fips-mode-setup --enable +FIPS_CONF="/etc/dracut.conf.d/40-fips.conf" +if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then + echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12530,37 +12632,6 @@ standards approved by the federal government since this provides assurance they and validated. CCE-80942-6 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_system_crypto_policy='' - - -fips-mode-setup --enable - -stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) -rc=$? - -if test "$rc" = 127; then - echo "$stderr_of_call" >&2 - echo "Make sure that the script is installed on the remediated system." >&2 - echo "See output of the 'dnf provides update-crypto-policies' command" >&2 - echo "to see what package to (re)install" >&2 - - false # end with an error code -elif test "$rc" != 0; then - echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 - false # end with an error code -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations] -fips = true - - name: XCCDF Value var_system_crypto_policy # promote to variable set_fact: var_system_crypto_policy: !!str @@ -12667,6 +12738,37 @@ fips = true - medium_disruption - reboot_required - restrict_strategy + + +[customizations] +fips = true + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_system_crypto_policy='' + + +fips-mode-setup --enable + +stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) +rc=$? + +if test "$rc" = 127; then + echo "$stderr_of_call" >&2 + echo "Make sure that the script is installed on the remediated system." >&2 + echo "See output of the 'dnf provides update-crypto-policies' command" >&2 + echo "to see what package to (re)install" >&2 + + false # end with an error code +elif test "$rc" != 0; then + echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 + false # end with an error code +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12850,8 +12952,23 @@ $ sudo yum install crypto-policies the applications that run on that operating system. Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data. CCE-82723-8 - -package --add=crypto-policies + - name: Ensure crypto-policies is installed + package: + name: crypto-policies + state: present + tags: + - CCE-82723-8 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_crypto-policies_installed + + +[[packages]] +name = "crypto-policies" +version = "*" include install_crypto-policies @@ -12860,29 +12977,14 @@ class install_crypto-policies { ensure => 'installed', } } + + +package --add=crypto-policies if ! rpm -q --quiet "crypto-policies" ; then yum install -y "crypto-policies" fi - - -[[packages]] -name = "crypto-policies" -version = "*" - - - name: Ensure crypto-policies is installed - package: - name: crypto-policies - state: present - tags: - - CCE-82723-8 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_crypto-policies_installed @@ -12993,46 +13095,6 @@ submits to this process. the applications that run on that operating system. Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data. CCE-80935-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: configure-crypto-policy.service - enabled: true - contents: | - [Unit] - Before=kubelet.service - [Service] - Type=oneshot - ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}} - RemainAfterExit=yes - [Install] - WantedBy=multi-user.target - - -var_system_crypto_policy='' - - -stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) -rc=$? - -if test "$rc" = 127; then - echo "$stderr_of_call" >&2 - echo "Make sure that the script is installed on the remediated system." >&2 - echo "See output of the 'dnf provides update-crypto-policies' command" >&2 - echo "to see what package to (re)install" >&2 - - false # end with an error code -elif test "$rc" != 0; then - echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 - false # end with an error code -fi - - name: XCCDF Value var_system_crypto_policy # promote to variable set_fact: var_system_crypto_policy: !!str @@ -13082,6 +13144,46 @@ fi - low_disruption - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: configure-crypto-policy.service + enabled: true + contents: | + [Unit] + Before=kubelet.service + [Service] + Type=oneshot + ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}} + RemainAfterExit=yes + [Install] + WantedBy=multi-user.target + + +var_system_crypto_policy='' + + +stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) +rc=$? + +if test "$rc" = 127; then + echo "$stderr_of_call" >&2 + echo "Make sure that the script is installed on the remediated system." >&2 + echo "See output of the 'dnf provides update-crypto-policies' command" >&2 + echo "to see what package to (re)install" >&2 + + false # end with an error code +elif test "$rc" != 0; then + echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 + false # end with an error code +fi @@ -13111,29 +13213,6 @@ line and is not commented out: library violate expectations, and makes system configuration more fragmented. CCE-84254-2 - -CONF_FILE=/etc/crypto-policies/back-ends/gnutls.config -correct_value='+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' - -grep -q ${correct_value} ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo ${correct_value} >> ${CONF_FILE} - fi -fi - - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: set_fact' set_fact: path: /etc/crypto-policies/back-ends/gnutls.config @@ -13215,6 +13294,29 @@ fi - medium_severity - reboot_required - restrict_strategy + + +CONF_FILE=/etc/crypto-policies/back-ends/gnutls.config +correct_value='+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' + +grep -q ${correct_value} ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo ${correct_value} >> ${CONF_FILE} + fi +fi @@ -13245,10 +13347,6 @@ If the symlink exists, Kerberos is configured to use the system-wide crypto poli Overriding the system crypto policy makes the behavior of Kerberos violate expectations, and makes system configuration more fragmented. CCE-80936-8 - -rm -f /etc/krb5.conf.d/crypto-policies -ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies - - name: Configure Kerberos to use System Crypto Policy file: src: /etc/crypto-policies/back-ends/krb5.config @@ -13266,6 +13364,10 @@ ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policie - low_complexity - low_disruption - reboot_required + + +rm -f /etc/krb5.conf.d/crypto-policies +ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies @@ -13302,18 +13404,6 @@ is not commented out or superseded by later includes: service violate expectations, and makes system configuration more fragmented. CCE-80937-6 - -function remediate_libreswan_crypto_policy() { - CONFIG_FILE="/etc/ipsec.conf" - if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then - # the file might not end with a new line - echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE" - fi - return 0 -} - -remediate_libreswan_crypto_policy - - name: Configure Libreswan to use System Crypto Policy lineinfile: path: /etc/ipsec.conf @@ -13334,6 +13424,18 @@ remediate_libreswan_crypto_policy - low_disruption - no_reboot_needed - restrict_strategy + + +function remediate_libreswan_crypto_policy() { + CONFIG_FILE="/etc/ipsec.conf" + if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then + # the file might not end with a new line + echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE" + fi + return 0 +} + +remediate_libreswan_crypto_policy @@ -13369,37 +13471,6 @@ if there is a [ crypto_policy ] section that contains the Overriding the system crypto policy makes the behavior of the Java runtime violates expectations, and makes system configuration more fragmented. CCE-80938-4 - -OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]' -OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]' - -OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config' - -OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$' - - - - - - -function remediate_openssl_crypto_policy() { - CONFIG_FILE=/etc/pki/tls/openssl.cnf - if test -f "$CONFIG_FILE"; then - if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then - printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE" - return 0 - elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then - sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE" - return 0 - fi - else - echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2 - return 1 - fi -} - -remediate_openssl_crypto_policy - - name: Configure OpenSSL library to use System Crypto Policy - Search for crypto_policy Section ansible.builtin.find: @@ -13504,6 +13575,37 @@ remediate_openssl_crypto_policy - medium_severity - no_reboot_needed - unknown_strategy + + +OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]' +OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]' + +OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config' + +OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$' + + + + + + +function remediate_openssl_crypto_policy() { + CONFIG_FILE=/etc/pki/tls/openssl.cnf + if test -f "$CONFIG_FILE"; then + if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then + printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE" + return 0 + elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then + sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE" + return 0 + fi + else + echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2 + return 1 + fi +} + +remediate_openssl_crypto_policy @@ -13588,16 +13690,11 @@ in the /etc/sysconfig/sshd. 2.2.7 SRG-OS-000250-GPOS-00093 RHEL-08-010287 - 5.2.14 + 4.2.22 SV-244526r877394_rule Overriding the system crypto policy makes the behavior of the SSH service violate expectations, and makes system configuration more fragmented. CCE-80939-2 - -SSH_CONF="/etc/sysconfig/sshd" - -sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF - - name: Configure SSH to use System Crypto Policy lineinfile: dest: /etc/sysconfig/sshd @@ -13619,6 +13716,11 @@ sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF - medium_disruption - medium_severity - reboot_required + + +SSH_CONF="/etc/sysconfig/sshd" + +sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF @@ -13653,15 +13755,6 @@ variable configured with predefined value. are configured e.g. cipher suites. Currently particular requirements specified by CC are stricter compared to any existing Crypto Policy. CCE-84286-4 - -cp="Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" -file="/etc/crypto-policies/local.d/opensslcnf-ospp.config" -backend_file="/etc/crypto-policies/back-ends/opensslcnf.config" - -sed -i "/Ciphersuites\s*=\s*/d" "$backend_file" -printf "\n%s\n" "$cp" >> "$file" -update-crypto-policies - - name: Remove configuration from backend file /etc/crypto-policies/back-ends/opensslcnf.config lineinfile: path: /etc/crypto-policies/back-ends/opensslcnf.config @@ -13708,6 +13801,15 @@ update-crypto-policies - medium_severity - reboot_required - restrict_strategy + + +cp="Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" +file="/etc/crypto-policies/local.d/opensslcnf-ospp.config" +backend_file="/etc/crypto-policies/back-ends/opensslcnf.config" + +sed -i "/Ciphersuites\s*=\s*/d" "$backend_file" +printf "\n%s\n" "$cp" >> "$file" +update-crypto-policies @@ -13803,25 +13905,6 @@ specifying a cipher list with the order of ciphers being in a “strongest weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections. CCE-85902-5 - -sshd_approved_ciphers='' - - -if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then - - LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" -else - touch "/etc/crypto-policies/back-ends/openssh.config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" - -cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" -# Insert at the end of the file -printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config" -# Clean up after ourselves. -rm "/etc/crypto-policies/back-ends/openssh.config.bak" - - name: XCCDF Value sshd_approved_ciphers # promote to variable set_fact: sshd_approved_ciphers: !!str @@ -13866,6 +13949,25 @@ rm "/etc/crypto-policies/back-ends/openssh.config.bak" - low_disruption - reboot_required - restrict_strategy + + +sshd_approved_ciphers='' + + +if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then + + LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" +else + touch "/etc/crypto-policies/back-ends/openssh.config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" + +cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" +# Insert at the end of the file +printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config" +# Clean up after ourselves. +rm "/etc/crypto-policies/back-ends/openssh.config.bak" @@ -13915,38 +14017,6 @@ specifying a cipher list with the order of ciphers being in a “strongest weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections. CCE-85897-7 - -sshd_approved_ciphers='' - - -CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config -correct_value="-oCiphers=${sshd_approved_ciphers}" - -# Test if file exists -test -f ${CONF_FILE} || touch ${CONF_FILE} - -# Ensure CRYPTO_POLICY is not commented out -sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} - -grep -q "'${correct_value}'" ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} - fi -fi - - name: XCCDF Value sshd_approved_ciphers # promote to variable set_fact: sshd_approved_ciphers: !!str @@ -14034,6 +14104,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_ciphers='' + + +CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config +correct_value="-oCiphers=${sshd_approved_ciphers}" + +# Test if file exists +test -f ${CONF_FILE} || touch ${CONF_FILE} + +# Ensure CRYPTO_POLICY is not commented out +sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} + +grep -q "'${correct_value}'" ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} + fi +fi @@ -14120,25 +14222,6 @@ submits to this process. client violate expectations, and makes system configuration more fragmented. CCE-85870-4 - -sshd_approved_macs='' - - -if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then - - LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" -else - touch "/etc/crypto-policies/back-ends/openssh.config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" - -cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" -# Insert at the end of the file -printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config" -# Clean up after ourselves. -rm "/etc/crypto-policies/back-ends/openssh.config.bak" - - name: XCCDF Value sshd_approved_macs # promote to variable set_fact: sshd_approved_macs: !!str @@ -14183,6 +14266,25 @@ rm "/etc/crypto-policies/back-ends/openssh.config.bak" - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_macs='' + + +if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then + + LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" +else + touch "/etc/crypto-policies/back-ends/openssh.config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" + +cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" +# Insert at the end of the file +printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config" +# Clean up after ourselves. +rm "/etc/crypto-policies/back-ends/openssh.config.bak" @@ -14230,38 +14332,6 @@ submits to this process. server violate expectations, and makes system configuration more fragmented. CCE-85899-3 - -sshd_approved_macs='' - - -CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config -correct_value="-oMACs=${sshd_approved_macs}" - -# Test if file exists -test -f ${CONF_FILE} || touch ${CONF_FILE} - -# Ensure CRYPTO_POLICY is not commented out -sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} - -grep -q "'${correct_value}'" ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} - fi -fi - - name: XCCDF Value sshd_approved_macs # promote to variable set_fact: sshd_approved_macs: !!str @@ -14349,6 +14419,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_macs='' + + +CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config +correct_value="-oMACs=${sshd_approved_macs}" + +# Test if file exists +test -f ${CONF_FILE} || touch ${CONF_FILE} + +# Ensure CRYPTO_POLICY is not commented out +sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} + +grep -q "'${correct_value}'" ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} + fi +fi @@ -14403,38 +14505,6 @@ openssl() SRG-OS-000480-GPOS-00227 This rule ensures that openssl invocations always uses SP800-90A compliant random number generator as a default behavior. CCE-82721-2 - -cat > /etc/profile.d/openssl-rand.sh <<- 'EOM' -# provide a default -rand /dev/random option to openssl commands that -# support it - -# written inefficiently for maximum shell compatibility -openssl() -( - openssl_bin=/usr/bin/openssl - - case "$*" in - # if user specified -rand, honor it - *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;; - esac - - cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '` - for i in `$openssl_bin list -commands`; do - if $openssl_bin list -options "$i" | grep -q '^rand '; then - cmds=" $i $cmds" - fi - done - - case "$cmds" in - *\ "$1"\ *) - cmd="$1"; shift - exec $openssl_bin "$cmd" -rand /dev/random "$@" ;; - esac - - exec $openssl_bin "$@" -) -EOM - - name: Put a file with shell wrapper to configure OpenSSL to always use strong entropy copy: dest: /etc/profile.d/openssl-rand.sh @@ -14475,6 +14545,38 @@ EOM - no_reboot_needed - openssl_use_strong_entropy - restrict_strategy + + +cat > /etc/profile.d/openssl-rand.sh <<- 'EOM' +# provide a default -rand /dev/random option to openssl commands that +# support it + +# written inefficiently for maximum shell compatibility +openssl() +( + openssl_bin=/usr/bin/openssl + + case "$*" in + # if user specified -rand, honor it + *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;; + esac + + cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '` + for i in `$openssl_bin list -commands`; do + if $openssl_bin list -options "$i" | grep -q '^rand '; then + cmds=" $i $cmds" + fi + done + + case "$cmds" in + *\ "$1"\ *) + cmd="$1"; shift + exec $openssl_bin "$cmd" -rand /dev/random "$@" ;; + esac + + exec $openssl_bin "$@" +) +EOM @@ -14811,31 +14913,6 @@ The nails service can be enabled with the following comma Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. - include enable_nails - -class enable_nails { - service {'nails': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'nails.service' -"$SYSTEMCTL_EXEC" start 'nails.service' -"$SYSTEMCTL_EXEC" enable 'nails.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["nails"] - - name: Enable service nails block: @@ -14862,6 +14939,31 @@ enabled = ["nails"] - medium_severity - no_reboot_needed - service_nails_enabled + + +[customizations.services] +enabled = ["nails"] + + include enable_nails + +class enable_nails { + service {'nails': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'nails.service' +"$SYSTEMCTL_EXEC" start 'nails.service' +"$SYSTEMCTL_EXEC" enable 'nails.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -15005,7 +15107,7 @@ automated remediation is not available for this configuration check.SI-2(2) SRG-OS-000191-GPOS-00080 RHEL-08-010001 - SV-245540r754730_rule + SV-245540r942951_rule Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. CCE-86260-7 @@ -15028,7 +15130,7 @@ automated remediation is not available for this configuration check.SI-2(2) SRG-OS-000191-GPOS-00080 RHEL-08-010001 - SV-245540r754730_rule + SV-245540r942951_rule Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. CCE-86261-5 @@ -15701,13 +15803,13 @@ option. Access to this partition should be restricted. CCE-83336-8 - -part /boot - [[customizations.filesystem]] mountpoint = "/boot" size = 1073741824 + + +part /boot @@ -15782,13 +15884,13 @@ setting of more restrictive mount options, and also helps ensure that users cannot trivially fill partitions used for log or audit data storage. CCE-81044-0 - -part /home - [[customizations.filesystem]] mountpoint = "/home" size = 1073741824 + + +part /home @@ -15808,13 +15910,13 @@ makes it easier to apply restrictions e.g. through the nosuid CCE-83340-0 - -part /opt - [[customizations.filesystem]] mountpoint = "/opt" size = 1073741824 + + +part /opt @@ -15837,13 +15939,13 @@ more restrictive mount options, and also helps ensure that users cannot trivially fill partitions used for log or audit data storage. CCE-83387-1 - -part /srv - [[customizations.filesystem]] mountpoint = "/srv" size = 1073741824 + + +part /srv @@ -15889,13 +15991,13 @@ Placing /tmp in its own partition enables the setting of restrictive mount options, which can help protect programs which use it. CCE-80851-9 - -part /tmp - [[customizations.filesystem]] mountpoint = "/tmp" size = 1073741824 + + +part /tmp @@ -15914,13 +16016,13 @@ Putting it on a separate partition allows limiting its size and applying restrictions through mount options. CCE-83343-4 - -part /usr - [[customizations.filesystem]] mountpoint = "/usr" size = 5368709120 + + +part /usr @@ -15968,13 +16070,13 @@ It is not uncommon for the /var directory to contain world-writable directories installed by other software packages. CCE-80852-7 - -part /var - [[customizations.filesystem]] mountpoint = "/var" size = 3221225472 + + +part /var @@ -16052,13 +16154,13 @@ enables better separation between log files and other files in /var/. CCE-80853-5 - -part /var/log - [[customizations.filesystem]] mountpoint = "/var/log" size = 5368709120 + + +part /var/log @@ -16151,13 +16253,13 @@ auditing cannot be halted due to the partition running out of space. CCE-80854-3 - -part /var/log/audit - [[customizations.filesystem]] mountpoint = "/var/log/audit" size = 10737418240 + + +part /var/log/audit @@ -16181,13 +16283,13 @@ Placing /var/tmp in its own partition enables the setting restrictive mount options, which can help protect programs which use it. CCE-82730-3 - -part /var/tmp - [[customizations.filesystem]] mountpoint = "/var/tmp" size = 1073741824 + + +part /var/tmp @@ -16230,36 +16332,6 @@ mode. To do so, run the following command: A graphical environment is unnecessary for certain types of systems including a virtualization hypervisor. CCE-82367-4 - -package --remove=gdm - - include remove_gdm - -class remove_gdm { - package { 'gdm': - ensure => 'purged', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# CAUTION: This remediation script will remove gdm -# from the system, and may remove any packages -# that depend on gdm. Execute this -# remediation AFTER testing on a non-production -# system! - -if rpm -q --quiet "gdm" ; then - - yum remove -y "gdm" - -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16291,6 +16363,36 @@ fi - medium_severity - no_reboot_needed - package_gdm_removed + + include remove_gdm + +class remove_gdm { + package { 'gdm': + ensure => 'purged', + } +} + + +package --remove=gdm + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# CAUTION: This remediation script will remove gdm +# from the system, and may remove any packages +# that depend on gdm. Execute this +# remediation AFTER testing on a non-production +# system! + +if rpm -q --quiet "gdm" ; then + + yum remove -y "gdm" + +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -16319,15 +16421,6 @@ configuration files have to be compliant, and the database needs to be more rece which gives confidence that it reflects them. CCE-81003-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16358,6 +16451,15 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -16468,68 +16570,6 @@ After the settings have been set, run dconf update. - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*disable-restart-buttons\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)disable-restart-buttons(\s*=)/#\1disable-restart-buttons\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-restart-buttons\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*disable-restart-buttons\\s*=\\s*.*/disable-restart-buttons=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-restart-buttons=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-restart-buttons$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/disable-restart-buttons$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/disable-restart-buttons$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/disable-restart-buttons" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16607,41 +16647,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable the GNOME3 Login User List - In the default graphical environment, users logging directly into the -system are greeted with a login screen that displays all known users. -This functionality should be disabled by setting disable-user-list -to true. - -To disable, add or edit disable-user-list to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -disable-user-list=true -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent -user modification. For example: -/org/gnome/login-screen/disable-user-list -After the settings have been set, run dconf update. - CM-6(a) - AC-23 - SRG-OS-000480-GPOS-00227 - RHEL-08-020032 - 1.8.3 - SV-244536r743857_rule - Leaving the user list enabled is a security risk since it allows anyone -with physical access to the system to quickly enumerate known user accounts -without logging in. - - CCE-86195-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -16657,10 +16663,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-restart-buttons\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-restart-buttons(\s*=)/#\1disable-restart-buttons\2/g" "${SETTINGSFILES[@]}" fi fi @@ -16671,16 +16677,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-restart-buttons\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-restart-buttons\\s*=\\s*.*/disable-restart-buttons=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-restart-buttons=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-restart-buttons$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" @@ -16689,12 +16695,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/disable-restart-buttons$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/login-screen/disable-restart-buttons$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/disable-restart-buttons" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -16703,6 +16709,40 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable the GNOME3 Login User List + In the default graphical environment, users logging directly into the +system are greeted with a login screen that displays all known users. +This functionality should be disabled by setting disable-user-list +to true. + +To disable, add or edit disable-user-list to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +disable-user-list=true +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent +user modification. For example: +/org/gnome/login-screen/disable-user-list +After the settings have been set, run dconf update. + CM-6(a) + AC-23 + SRG-OS-000480-GPOS-00227 + RHEL-08-020032 + 1.8.3 + SV-244536r743857_rule + Leaving the user list enabled is a security risk since it allows anyone +with physical access to the system to quickly enumerate known user accounts +without logging in. + + CCE-86195-5 - name: Gather the package facts package_facts: manager: auto @@ -16779,51 +16819,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Enable the GNOME3 Login Smartcard Authentication - In the default graphical environment, smart card authentication -can be enabled on the login screen by setting enable-smartcard-authentication -to true. - -To enable, add or edit enable-smartcard-authentication to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -enable-smartcard-authentication=true -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/login-screen/enable-smartcard-authentication -After the settings have been set, run dconf update. - CCI-000765 - CCI-000766 - CCI-000767 - CCI-000768 - CCI-000771 - CCI-000772 - CCI-000884 - CCI-001948 - CCI-001954 - IA-2(3) - IA-2(4) - IA-2(8) - IA-2(9) - IA-2(11) - Req-8.3 - SRG-OS-000375-GPOS-00160 - SRG-OS-000376-GPOS-00161 - SRG-OS-000377-GPOS-00162 - Smart card login provides two-factor authentication stronger than -that provided by a username and password combination. Smart cards leverage PKI -(public key infrastructure) in order to provide and verify credentials. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -16839,10 +16835,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)enable-smartcard-authentication(\s*=)/#\1enable-smartcard-authentication\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}" fi fi @@ -16853,16 +16849,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*enable-smartcard-authentication\\s*=\\s*.*/enable-smartcard-authentication=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\enable-smartcard-authentication=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/enable-smartcard-authentication$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" @@ -16871,12 +16867,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/enable-smartcard-authentication$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/enable-smartcard-authentication$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/login-screen/enable-smartcard-authentication" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -16885,6 +16881,50 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enable the GNOME3 Login Smartcard Authentication + In the default graphical environment, smart card authentication +can be enabled on the login screen by setting enable-smartcard-authentication +to true. + +To enable, add or edit enable-smartcard-authentication to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +enable-smartcard-authentication=true +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/login-screen/enable-smartcard-authentication +After the settings have been set, run dconf update. + CCI-000765 + CCI-000766 + CCI-000767 + CCI-000768 + CCI-000771 + CCI-000772 + CCI-000884 + CCI-001948 + CCI-001954 + IA-2(3) + IA-2(4) + IA-2(8) + IA-2(9) + IA-2(11) + Req-8.3 + SRG-OS-000375-GPOS-00160 + SRG-OS-000376-GPOS-00161 + SRG-OS-000377-GPOS-00162 + Smart card login provides two-factor authentication stronger than +that provided by a username and password combination. Smart cards leverage PKI +(public key infrastructure) in order to provide and verify credentials. + - name: Gather the package facts package_facts: manager: auto @@ -16969,92 +17009,60 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Enable the GNOME3 Screen Locking On Smartcard Removal - In the default graphical environment, screen locking on smartcard removal -can be enabled by setting removal-action -to 'lock-screen'. - -To enable, add or edit removal-action to -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/settings-daemon/peripherals/smartcard] -removal-action='lock-screen' -Once the setting has been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/settings-daemon/peripherals/smartcard/removal-action -After the settings have been set, run dconf update. - CCI-000056 - CCI-000058 - SRG-OS-000028-GPOS-00009 - SRG-OS-000030-GPOS-00011 - RHEL-08-020050 - SV-230351r792899_rule - Locking the screen automatically when removing the smartcard can -prevent undesired access to system. - - CCE-83910-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*removal-action\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)removal-action(\s*=)/#\1removal-action\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)enable-smartcard-authentication(\s*=)/#\1enable-smartcard-authentication\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/settings-daemon/peripherals/smartcard]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'lock-screen'")" -if grep -q "^\\s*removal-action\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*removal-action\\s*=\\s*.*/removal-action=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*enable-smartcard-authentication\\s*=\\s*.*/enable-smartcard-authentication=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/settings-daemon/peripherals/smartcard\\]|a\\removal-action=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\enable-smartcard-authentication=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" +LOCKFILES=$(grep -r "^/org/gnome/login-screen/enable-smartcard-authentication$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/enable-smartcard-authentication$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/login-screen/enable-smartcard-authentication$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/settings-daemon/peripherals/smartcard/removal-action" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/enable-smartcard-authentication" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -17063,6 +17071,38 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enable the GNOME3 Screen Locking On Smartcard Removal + In the default graphical environment, screen locking on smartcard removal +can be enabled by setting removal-action +to 'lock-screen'. + +To enable, add or edit removal-action to +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/settings-daemon/peripherals/smartcard] +removal-action='lock-screen' +Once the setting has been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/settings-daemon/peripherals/smartcard/removal-action +After the settings have been set, run dconf update. + CCI-000056 + CCI-000058 + SRG-OS-000028-GPOS-00009 + SRG-OS-000030-GPOS-00011 + RHEL-08-020050 + SV-230351r792899_rule + Locking the screen automatically when removing the smartcard can +prevent undesired access to system. + + CCE-83910-0 - name: Gather the package facts package_facts: manager: auto @@ -17216,90 +17256,60 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Set the GNOME3 Login Number of Failures - In the default graphical environment, the GNOME3 login -screen and be configured to restart the authentication process after -a configured number of attempts. This can be configured by setting -allowed-failures to 3 or less. - -To enable, add or edit allowed-failures to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -allowed-failures=3 -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/login-screen/allowed-failures -After the settings have been set, run dconf update. - 3.1.8 - FMT_MOF_EXT.1 - Setting the password retry prompts that are permitted on a per-session basis to a low value -requires some software, such as SSH, to re-connect. This can slow down and -draw additional attention to some types of password-guessing attacks. - - CCE-80771-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*allowed-failures\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*removal-action\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)allowed-failures(\s*=)/#\1allowed-failures\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)removal-action(\s*=)/#\1removal-action\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/settings-daemon/peripherals/smartcard]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "3")" -if grep -q "^\\s*allowed-failures\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'lock-screen'")" +if grep -q "^\\s*removal-action\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*allowed-failures\\s*=\\s*.*/allowed-failures=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*removal-action\\s*=\\s*.*/removal-action=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\allowed-failures=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/settings-daemon/peripherals/smartcard\\]|a\\removal-action=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/allowed-failures$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" +LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/allowed-failures$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/allowed-failures$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" /etc/dconf/db/local.d/ then - echo "/org/gnome/login-screen/allowed-failures" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/settings-daemon/peripherals/smartcard/removal-action" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -17308,6 +17318,36 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set the GNOME3 Login Number of Failures + In the default graphical environment, the GNOME3 login +screen and be configured to restart the authentication process after +a configured number of attempts. This can be configured by setting +allowed-failures to 3 or less. + +To enable, add or edit allowed-failures to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +allowed-failures=3 +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/login-screen/allowed-failures +After the settings have been set, run dconf update. + 3.1.8 + FMT_MOF_EXT.1 + Setting the password retry prompts that are permitted on a per-session basis to a low value +requires some software, such as SSH, to re-connect. This can slow down and +draw additional attention to some types of password-guessing attacks. + + CCE-80771-9 - name: Gather the package facts package_facts: manager: auto @@ -17375,6 +17415,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*allowed-failures\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)allowed-failures(\s*=)/#\1allowed-failures\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "3")" +if grep -q "^\\s*allowed-failures\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*allowed-failures\\s*=\\s*.*/allowed-failures=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\allowed-failures=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/allowed-failures$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/allowed-failures$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/allowed-failures$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/allowed-failures" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17423,24 +17525,6 @@ AutomaticLoginEnable=false system security. CCE-80823-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -if rpm --quiet -q gdm -then - if ! grep -q "^AutomaticLoginEnable=" /etc/gdm/custom.conf - then - sed -i "/^\[daemon\]/a \ - AutomaticLoginEnable=False" /etc/gdm/custom.conf - else - sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=False/g" /etc/gdm/custom.conf - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17484,6 +17568,24 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +if rpm --quiet -q gdm +then + if ! grep -q "^AutomaticLoginEnable=" /etc/gdm/custom.conf + then + sed -i "/^\[daemon\]/a \ + AutomaticLoginEnable=False" /etc/gdm/custom.conf + else + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=False/g" /etc/gdm/custom.conf + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17531,24 +17633,6 @@ TimedLoginEnable=false system security. CCE-80824-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -if rpm --quiet -q gdm -then - if ! grep -q "^TimedLoginEnable=" /etc/gdm/custom.conf - then - sed -i "/^\[daemon\]/a \ - TimedLoginEnable=false" /etc/gdm/custom.conf - else - sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=false/g" /etc/gdm/custom.conf - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17592,6 +17676,24 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +if rpm --quiet -q gdm +then + if ! grep -q "^TimedLoginEnable=" /etc/gdm/custom.conf + then + sed -i "/^\[daemon\]/a \ + TimedLoginEnable=false" /etc/gdm/custom.conf + else + sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=false/g" /etc/gdm/custom.conf + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17617,28 +17719,6 @@ remote session. If a privileged user were to login using XDMCP, the privileged user password could be compromised due to typed XEvents and keystrokes will traversing over the network in clear text. CCE-86007-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Try find '[xdmcp]' and 'Enable' in '/etc/gdm/custom.conf', if it exists, set -# to 'false', if it isn't here, add it, if '[xdmcp]' doesn't exist, add it there -if grep -qzosP '[[:space:]]*\[xdmcp]([^\n\[]*\n+)+?[[:space:]]*Enable' '/etc/gdm/custom.conf'; then - - sed -i "s/Enable[^(\n)]*/Enable=false/" '/etc/gdm/custom.conf' -elif grep -qs '[[:space:]]*\[xdmcp]' '/etc/gdm/custom.conf'; then - sed -i "/[[:space:]]*\[xdmcp]/a Enable=false" '/etc/gdm/custom.conf' -else - if test -d "/etc/gdm"; then - printf '%s\n' '[xdmcp]' "Enable=false" >> '/etc/gdm/custom.conf' - else - echo "Config file directory '/etc/gdm' doesnt exist, not remediating, assuming non-applicability." >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17668,6 +17748,28 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Try find '[xdmcp]' and 'Enable' in '/etc/gdm/custom.conf', if it exists, set +# to 'false', if it isn't here, add it, if '[xdmcp]' doesn't exist, add it there +if grep -qzosP '[[:space:]]*\[xdmcp]([^\n\[]*\n+)+?[[:space:]]*Enable' '/etc/gdm/custom.conf'; then + + sed -i "s/Enable[^(\n)]*/Enable=false/" '/etc/gdm/custom.conf' +elif grep -qs '[[:space:]]*\[xdmcp]' '/etc/gdm/custom.conf'; then + sed -i "/[[:space:]]*\[xdmcp]/a Enable=false" '/etc/gdm/custom.conf' +else + if test -d "/etc/gdm"; then + printf '%s\n' '[xdmcp]' "Enable=false" >> '/etc/gdm/custom.conf' + else + echo "Config file directory '/etc/gdm' doesnt exist, not remediating, assuming non-applicability." >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17744,68 +17846,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-89904-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*automount\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)automount(\s*=)/#\1automount\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*automount\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*automount\\s*=\\s*.*/automount=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/automount$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/automount$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/automount" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17889,6 +17929,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*automount\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)automount(\s*=)/#\1automount\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*automount\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*automount\\s*=\\s*.*/automount=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/automount$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/automount$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/automount" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17962,68 +18064,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-83693-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*automount-open\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)automount-open(\s*=)/#\1automount-open\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*automount-open\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*automount-open\\s*=\\s*.*/automount-open=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount-open=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount-open$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/automount-open$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/automount-open$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/automount-open" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18107,6 +18147,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*automount-open\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)automount-open(\s*=)/#\1automount-open\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*automount-open\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*automount-open\\s*=\\s*.*/automount-open=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount-open=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount-open$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/automount-open$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/automount-open$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/automount-open" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -18179,68 +18281,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-83742-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*autorun-never\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)autorun-never(\s*=)/#\1autorun-never\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*autorun-never\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*autorun-never\\s*=\\s*.*/autorun-never=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\autorun-never=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/autorun-never$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/autorun-never$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/autorun-never$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/autorun-never" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18320,6 +18360,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*autorun-never\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)autorun-never(\s*=)/#\1autorun-never\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*autorun-never\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*autorun-never\\s*=\\s*.*/autorun-never=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\autorun-never=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/autorun-never$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/autorun-never$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/autorun-never$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/autorun-never" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -18418,68 +18520,6 @@ file to exploit this flaw. Assuming the attacker could place the malicious file malicious file would exploit the thumbnailer with the potential for malicious code execution. It is best to disable these thumbnailer applications unless they are explicitly required. - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/thumbnailers\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*disable-all\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)disable-all(\s*=)/#\1disable-all\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/thumbnailers\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/thumbnailers]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-all\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*disable-all\\s*=\\s*.*/disable-all=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/thumbnailers\\]|a\\disable-all=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/thumbnailers/disable-all$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/thumbnailers/disable-all$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/thumbnailers/disable-all$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/thumbnailers/disable-all" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18552,42 +18592,13 @@ fi - unknown_severity - unknown_strategy - - - - - - - - - - GNOME Network Settings - GNOME network settings that apply to the graphical interface. - - Disable WIFI Network Connection Creation in GNOME3 - GNOME allows users to create ad-hoc wireless connections through the -NetworkManager applet. Wireless connections should be disabled by -adding or setting disable-wifi-create to true in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/nm-applet] -disable-wifi-create=true - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/nm-applet/disable-wifi-create -After the settings have been set, run dconf update. - 3.1.16 - Wireless network connections should not be allowed to be configured by general -users on a given system as it could open the system to backdoor attacks. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/nm-applet\\]" "/etc/dconf/db/" \ +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/thumbnailers\\]" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) DCONFFILE="/etc/dconf/db/local.d/00-security-settings" DBDIR="/etc/dconf/db/local.d" @@ -18597,30 +18608,30 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*disable-wifi-create\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-all\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)disable-wifi-create(\s*=)/#\1disable-wifi-create\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-all(\s*=)/#\1disable-all\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/nm-applet\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/thumbnailers\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/nm-applet]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/desktop/thumbnailers]" >> ${DCONFFILE} fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-wifi-create\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-all\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*disable-wifi-create\\s*=\\s*.*/disable-wifi-create=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-all\\s*=\\s*.*/disable-all=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/nm-applet\\]|a\\disable-wifi-create=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/desktop/thumbnailers\\]|a\\disable-all=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/nm-applet/disable-wifi-create$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/desktop/thumbnailers/disable-all$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18629,12 +18640,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/nm-applet/disable-wifi-create$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/desktop/thumbnailers/disable-all$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/nm-applet/disable-wifi-create$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/desktop/thumbnailers/disable-all$" /etc/dconf/db/local.d/ then - echo "/org/gnome/nm-applet/disable-wifi-create" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/desktop/thumbnailers/disable-all" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18643,6 +18654,35 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + GNOME Network Settings + GNOME network settings that apply to the graphical interface. + + Disable WIFI Network Connection Creation in GNOME3 + GNOME allows users to create ad-hoc wireless connections through the +NetworkManager applet. Wireless connections should be disabled by +adding or setting disable-wifi-create to true in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/nm-applet] +disable-wifi-create=true + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/nm-applet/disable-wifi-create +After the settings have been set, run dconf update. + 3.1.16 + Wireless network connections should not be allowed to be configured by general +users on a given system as it could open the system to backdoor attacks. + - name: Gather the package facts package_facts: manager: auto @@ -18707,34 +18747,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable WIFI Network Notification in GNOME3 - By default, GNOME disables WIFI notification. This should be permanently set -so that users do not connect to a wireless network when the system finds one. -While useful for mobile devices, this setting should be disabled for all other systems. -To configure the system to disable the WIFI notication, add or set -suppress-wireless-networks-available to true in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/nm-applet] -suppress-wireless-networks-available=true - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/nm-applet/suppress-wireless-networks-available -After the settings have been set, run dconf update. - 3.1.16 - Wireless network connections should not be allowed to be configured by general -users on a given system as it could open the system to backdoor attacks. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -18750,10 +18763,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-wifi-create\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)suppress-wireless-networks-available(\s*=)/#\1suppress-wireless-networks-available\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-wifi-create(\s*=)/#\1disable-wifi-create\2/g" "${SETTINGSFILES[@]}" fi fi @@ -18764,16 +18777,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-wifi-create\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*suppress-wireless-networks-available\\s*=\\s*.*/suppress-wireless-networks-available=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-wifi-create\\s*=\\s*.*/disable-wifi-create=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/nm-applet\\]|a\\suppress-wireless-networks-available=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/nm-applet\\]|a\\disable-wifi-create=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/nm-applet/suppress-wireless-networks-available$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/nm-applet/disable-wifi-create$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18782,12 +18795,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/nm-applet/suppress-wireless-networks-available$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/nm-applet/disable-wifi-create$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/nm-applet/suppress-wireless-networks-available$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/nm-applet/disable-wifi-create$" /etc/dconf/db/local.d/ then - echo "/org/gnome/nm-applet/suppress-wireless-networks-available" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/nm-applet/disable-wifi-create" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18796,6 +18809,33 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable WIFI Network Notification in GNOME3 + By default, GNOME disables WIFI notification. This should be permanently set +so that users do not connect to a wireless network when the system finds one. +While useful for mobile devices, this setting should be disabled for all other systems. +To configure the system to disable the WIFI notication, add or set +suppress-wireless-networks-available to true in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/nm-applet] +suppress-wireless-networks-available=true + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/nm-applet/suppress-wireless-networks-available +After the settings have been set, run dconf update. + 3.1.16 + Wireless network connections should not be allowed to be configured by general +users on a given system as it could open the system to backdoor attacks. + - name: Gather the package facts package_facts: manager: auto @@ -18860,49 +18900,13 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - - GNOME Remote Access Settings - GNOME remote access settings that apply to the graphical interface. - - Require Credential Prompting for Remote Access in GNOME3 - By default, GNOME does not require credentials when using Vino for -remote access. To configure the system to require remote credentials, add or set -authentication-methods to ['vnc'] in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/Vino] -authentication-methods=['vnc'] - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/Vino/authentication-methods -After the settings have been set, run dconf update. - 3.1.12 - 164.308(a)(4)(i) - 164.308(b)(1) - 164.308(b)(3) - 164.310(b) - 164.312(e)(1) - 164.312(e)(2)(ii) - Username and password prompting is required for remote access. Otherwise, non-authorized -and nefarious users can access the system freely. - - CCE-80772-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/nm-applet\\]" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) DCONFFILE="/etc/dconf/db/local.d/00-security-settings" DBDIR="/etc/dconf/db/local.d" @@ -18912,30 +18916,30 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*authentication-methods\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)authentication-methods(\s*=)/#\1authentication-methods\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)suppress-wireless-networks-available(\s*=)/#\1suppress-wireless-networks-available\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/nm-applet\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/nm-applet]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "['vnc']")" -if grep -q "^\\s*authentication-methods\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*authentication-methods\\s*=\\s*.*/authentication-methods=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*suppress-wireless-networks-available\\s*=\\s*.*/suppress-wireless-networks-available=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/Vino\\]|a\\authentication-methods=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/nm-applet\\]|a\\suppress-wireless-networks-available=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/Vino/authentication-methods$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/nm-applet/suppress-wireless-networks-available$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18944,12 +18948,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/Vino/authentication-methods$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/nm-applet/suppress-wireless-networks-available$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/Vino/authentication-methods$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/nm-applet/suppress-wireless-networks-available$" /etc/dconf/db/local.d/ then - echo "/org/gnome/Vino/authentication-methods" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/nm-applet/suppress-wireless-networks-available" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18958,6 +18962,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + GNOME Remote Access Settings + GNOME remote access settings that apply to the graphical interface. + + Require Credential Prompting for Remote Access in GNOME3 + By default, GNOME does not require credentials when using Vino for +remote access. To configure the system to require remote credentials, add or set +authentication-methods to ['vnc'] in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/Vino] +authentication-methods=['vnc'] + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/Vino/authentication-methods +After the settings have been set, run dconf update. + 3.1.12 + 164.308(a)(4)(i) + 164.308(b)(1) + 164.308(b)(3) + 164.310(b) + 164.312(e)(1) + 164.312(e)(2)(ii) + Username and password prompting is required for remote access. Otherwise, non-authorized +and nefarious users can access the system freely. + + CCE-80772-7 - name: Gather the package facts package_facts: manager: auto @@ -19025,6 +19065,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*authentication-methods\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)authentication-methods(\s*=)/#\1authentication-methods\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "['vnc']")" +if grep -q "^\\s*authentication-methods\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*authentication-methods\\s*=\\s*.*/authentication-methods=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/Vino\\]|a\\authentication-methods=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/Vino/authentication-methods$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/Vino/authentication-methods$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/Vino/authentication-methods$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/Vino/authentication-methods" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19099,68 +19201,6 @@ After the settings have been set, run dconf update. CCE-80773-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*require-encryption\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)require-encryption(\s*=)/#\1require-encryption\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*require-encryption\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*require-encryption\\s*=\\s*.*/require-encryption=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/Vino\\]|a\\require-encryption=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/Vino/require-encryption$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/Vino/require-encryption$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/Vino/require-encryption$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/Vino/require-encryption" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19240,6 +19280,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*require-encryption\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)require-encryption(\s*=)/#\1require-encryption\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*require-encryption\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*require-encryption\\s*=\\s*.*/require-encryption=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/Vino\\]|a\\require-encryption=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/Vino/require-encryption$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/Vino/require-encryption$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/Vino/require-encryption$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/Vino/require-encryption" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19350,68 +19452,6 @@ login session does not have administrator rights and the display station is loca controlled-access area. CCE-80774-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*idle-activation-enabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)idle-activation-enabled(\s*=)/#\1idle-activation-enabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*idle-activation-enabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*idle-activation-enabled\\s*=\\s*.*/idle-activation-enabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\idle-activation-enabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19499,6 +19539,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*idle-activation-enabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)idle-activation-enabled(\s*=)/#\1idle-activation-enabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*idle-activation-enabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*idle-activation-enabled\\s*=\\s*.*/idle-activation-enabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\idle-activation-enabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19555,48 +19657,21 @@ After the settings have been set, run dconf update.A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to logout because of the temporary nature of the absense. CCE-83858-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-83858-1 - - CJIS-5.5.5 - - NIST-800-171-3.1.10 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-8.1.8 - - dconf_gnome_screensaver_idle_activation_locked - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-83858-1 + - CJIS-5.5.5 + - NIST-800-171-3.1.10 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-8.1.8 + - dconf_gnome_screensaver_idle_activation_locked + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy - name: Prevent user modification of GNOME Screensaver idle-activation-enabled lineinfile: @@ -19633,6 +19708,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19702,52 +19804,6 @@ system session prior to vacating the vicinity, GNOME3 can be configured to ident a user's session has idled and take action to initiate a session lock. CCE-80775-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -inactivity_timeout_value='' - - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")" -if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19819,6 +19875,52 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +inactivity_timeout_value='' + + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")" +if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19885,52 +19987,6 @@ After the settings have been set, run dconf update. CCE-80776-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_screensaver_lock_delay='' - - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")" -if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19999,6 +20055,52 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_screensaver_lock_delay='' + + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")" +if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20069,68 +20171,6 @@ After the settings have been set, run dconf update. CCE-80777-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20336,6 +20376,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20396,33 +20498,6 @@ After the settings have been set, run dconf update.A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to logout because of the temporary nature of the absense. CCE-87261-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20477,6 +20552,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20545,68 +20647,6 @@ After the settings have been set, run dconf update. CCE-80778-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*picture-uri\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)picture-uri(\s*=)/#\1picture-uri\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "string ''")" -if grep -q "^\\s*picture-uri\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*picture-uri\\s*=\\s*.*/picture-uri=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\picture-uri=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/picture-uri$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/picture-uri$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/picture-uri$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/picture-uri" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20699,34 +20739,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable Full User Name on Splash Shield - By default when the screen is locked, the splash shield will show the user's -full name. This should be disabled to prevent casual observers from seeing -who has access to the system. This can be disabled by adding or setting -show-full-name-in-top-bar to false in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/desktop/screensaver] -show-full-name-in-top-bar=false - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/desktop/screensaver/show-full-name-in-top-bar -After the settings have been set, run dconf update. - FMT_MOF_EXT.1 - Setting the splash screen to not reveal the logged in user's name -conceals who has access to the system from passersby. - - CCE-80779-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -20742,10 +20755,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*picture-uri\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)show-full-name-in-top-bar(\s*=)/#\1show-full-name-in-top-bar\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)picture-uri(\s*=)/#\1picture-uri\2/g" "${SETTINGSFILES[@]}" fi fi @@ -20755,17 +20768,17 @@ then printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "string ''")" +if grep -q "^\\s*picture-uri\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*show-full-name-in-top-bar\\s*=\\s*.*/show-full-name-in-top-bar=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*picture-uri\\s*=\\s*.*/picture-uri=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\show-full-name-in-top-bar=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\picture-uri=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/picture-uri$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -20774,12 +20787,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/desktop/screensaver/picture-uri$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/desktop/screensaver/picture-uri$" /etc/dconf/db/local.d/ then - echo "/org/gnome/desktop/screensaver/show-full-name-in-top-bar" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/desktop/screensaver/picture-uri" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -20788,6 +20801,33 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Full User Name on Splash Shield + By default when the screen is locked, the splash shield will show the user's +full name. This should be disabled to prevent casual observers from seeing +who has access to the system. This can be disabled by adding or setting +show-full-name-in-top-bar to false in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/desktop/screensaver] +show-full-name-in-top-bar=false + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/desktop/screensaver/show-full-name-in-top-bar +After the settings have been set, run dconf update. + FMT_MOF_EXT.1 + Setting the splash screen to not reveal the logged in user's name +conceals who has access to the system from passersby. + + CCE-80779-2 - name: Gather the package facts package_facts: manager: auto @@ -20851,6 +20891,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)show-full-name-in-top-bar(\s*=)/#\1show-full-name-in-top-bar\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*show-full-name-in-top-bar\\s*=\\s*.*/show-full-name-in-top-bar=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\show-full-name-in-top-bar=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/show-full-name-in-top-bar" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20914,33 +21016,6 @@ GNOME desktops can be configured to identify when a user's session has idled and session lock. As such, users should not be allowed to change session settings. CCE-80780-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20993,6 +21068,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21058,33 +21160,6 @@ GNOME desktops can be configured to identify when a user's session has idled and session lock. As such, users should not be allowed to change session settings. CCE-80781-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21143,6 +21218,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21230,68 +21332,6 @@ the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-84028-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")" -if grep -q "^\\s*logout\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21375,6 +21415,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")" +if grep -q "^\\s*logout\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21407,6 +21509,101 @@ After the settings have been set, run dconf update. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Disable Geolocation in GNOME3 - location tracking + ini_file: + dest: /etc/dconf/db/local.d/00-security-settings + section: org/gnome/system/location + option: enabled + value: 'false' + create: true + no_extra_spaces: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Disable Geolocation in GNOME3 - clock location tracking + ini_file: + dest: /etc/dconf/db/local.d/00-security-settings + section: org/gnome/clocks + option: gelocation + value: 'false' + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Prevent user modification of GNOME geolocation - location tracking + lineinfile: + path: /etc/dconf/db/local.d/locks/00-security-settings-lock + regexp: ^/org/gnome/system/location/enabled$ + line: /org/gnome/system/location/enabled + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Prevent user modification of GNOME geolocation - clock location tracking + lineinfile: + path: /etc/dconf/db/local.d/locks/00-security-settings-lock + regexp: ^/org/gnome/clocks/geolocation$ + line: /org/gnome/clocks/geolocation + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Dconf Update + command: dconf update + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then @@ -21522,101 +21719,6 @@ dconf update else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Disable Geolocation in GNOME3 - location tracking - ini_file: - dest: /etc/dconf/db/local.d/00-security-settings - section: org/gnome/system/location - option: enabled - value: 'false' - create: true - no_extra_spaces: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Disable Geolocation in GNOME3 - clock location tracking - ini_file: - dest: /etc/dconf/db/local.d/00-security-settings - section: org/gnome/clocks - option: gelocation - value: 'false' - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Prevent user modification of GNOME geolocation - location tracking - lineinfile: - path: /etc/dconf/db/local.d/locks/00-security-settings-lock - regexp: ^/org/gnome/system/location/enabled$ - line: /org/gnome/system/location/enabled - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Prevent user modification of GNOME geolocation - clock location tracking - lineinfile: - path: /etc/dconf/db/local.d/locks/00-security-settings-lock - regexp: ^/org/gnome/clocks/geolocation$ - line: /org/gnome/clocks/geolocation - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Dconf Update - command: dconf update - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy @@ -21675,68 +21777,6 @@ unintended configuration changes as well as a nefarious user the capability to m changes such as adding new accounts, etc. CCE-80769-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/lockdown\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*user-administration-disabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)user-administration-disabled(\s*=)/#\1user-administration-disabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/lockdown\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/lockdown]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*user-administration-disabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*user-administration-disabled\\s*=\\s*.*/user-administration-disabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/lockdown\\]|a\\user-administration-disabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/lockdown/user-administration-disabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/lockdown/user-administration-disabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/lockdown/user-administration-disabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/lockdown/user-administration-disabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21888,6 +21928,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/lockdown\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*user-administration-disabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)user-administration-disabled(\s*=)/#\1user-administration-disabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/lockdown\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/lockdown]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*user-administration-disabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*user-administration-disabled\\s*=\\s*.*/user-administration-disabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/lockdown\\]|a\\user-administration-disabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/lockdown/user-administration-disabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/lockdown/user-administration-disabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/lockdown/user-administration-disabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/lockdown/user-administration-disabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21976,15 +22078,33 @@ $ sudo yum install sudo FMT_MOF_EXT.1 2.2.6 SRG-OS-000324-GPOS-00125 - 5.3.1 + 4.3.1 sudo is a program designed to allow a system administrator to give limited root privileges to users and log root activity. The basic philosophy is to give as few privileges as possible but still allow system users to get their work done. CCE-82214-8 - -package --add=sudo + - name: Ensure sudo is installed + package: + name: sudo + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82214-8 + - NIST-800-53-CM-6(a) + - PCI-DSSv4-2.2.6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_sudo_installed + + +[[packages]] +name = "sudo" +version = "*" include install_sudo @@ -21993,6 +22113,9 @@ class install_sudo { ensure => 'installed', } } + + +package --add=sudo # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -22004,27 +22127,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "sudo" -version = "*" - - - name: Ensure sudo is installed - package: - name: sudo - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82214-8 - - NIST-800-53-CM-6(a) - - PCI-DSSv4-2.2.6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_sudo_installed @@ -22045,6 +22147,21 @@ in /etc/sudoers.d/. Forcing sudo to reset the environment ensures that environment variables are not passed on to the command accidentaly, preventing leak of potentially sensitive information. CCE-83820-1 + - name: Ensure env_reset is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\benv_reset\b.*$ + line: Defaults env_reset + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83820-1 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_env_reset + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22065,21 +22182,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure env_reset is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\benv_reset\b.*$ - line: Defaults env_reset - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83820-1 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_env_reset @@ -22100,6 +22202,21 @@ in /etc/sudoers.d/. Ignoring the commands in the user's current directory prevents an attacker from executing commands downloaded locally. CCE-83810-2 + - name: Ensure ignore_dot is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\bignore_dot\b.*$ + line: Defaults ignore_dot + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83810-2 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_ignore_dot + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22120,21 +22237,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure ignore_dot is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\bignore_dot\b.*$ - line: Defaults ignore_dot - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83810-2 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_ignore_dot @@ -22154,6 +22256,21 @@ in /etc/sudoers.d/. Restricting the capability of sudo allowed commands to execute sub-commands prevents users from running programs with privileges they wouldn't have otherwise. CCE-83747-6 + - name: Ensure noexec is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\bnoexec\b.*$ + line: Defaults noexec + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83747-6 + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - restrict_strategy + - sudo_add_noexec + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22174,21 +22291,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure noexec is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\bnoexec\b.*$ - line: Defaults noexec - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83747-6 - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - restrict_strategy - - sudo_add_noexec @@ -22208,38 +22310,6 @@ The passwd_timeout should be configured by making sure that the in /etc/sudoers.d/. Reducing the time sudo waits for a a password reduces the time the process is exposed. CCE-83964-7 - - -var_sudo_passwd_timeout='' - - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\bpasswd_timeout=\w+\b\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option passwd_timeout - echo "Defaults passwd_timeout=${var_sudo_passwd_timeout}" >> /etc/sudoers - else - # sudoers file defines Option passwd_timeout, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\bpasswd_timeout=${var_sudo_passwd_timeout}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_passwd_timeout//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\bpasswd_timeout=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - - name: XCCDF Value var_sudo_passwd_timeout # promote to variable set_fact: var_sudo_passwd_timeout: !!str @@ -22277,6 +22347,38 @@ fi - no_reboot_needed - restrict_strategy - sudo_add_passwd_timeout + + + +var_sudo_passwd_timeout='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\bpasswd_timeout=\w+\b\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option passwd_timeout + echo "Defaults passwd_timeout=${var_sudo_passwd_timeout}" >> /etc/sudoers + else + # sudoers file defines Option passwd_timeout, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\bpasswd_timeout=${var_sudo_passwd_timeout}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_passwd_timeout//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\bpasswd_timeout=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi @@ -22297,6 +22399,21 @@ in /etc/sudoers.d/. Restricting the use cases in which a user is allowed to execute sudo commands reduces the attack surface. CCE-83790-6 + - name: Ensure requiretty is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\brequiretty\b.*$ + line: Defaults requiretty + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83790-6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_requiretty + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22317,21 +22434,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure requiretty is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\brequiretty\b.*$ - line: Defaults requiretty - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83790-6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_requiretty @@ -22354,38 +22456,6 @@ in /etc/sudoers.d/. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-83860-7 - - -var_sudo_umask='' - - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\bumask=\w+\b\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option umask - echo "Defaults umask=${var_sudo_umask}" >> /etc/sudoers - else - # sudoers file defines Option umask, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\bumask=${var_sudo_umask}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_umask//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\bumask=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - - name: XCCDF Value var_sudo_umask # promote to variable set_fact: var_sudo_umask: !!str @@ -22423,6 +22493,38 @@ fi - no_reboot_needed - restrict_strategy - sudo_add_umask + + + +var_sudo_umask='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\bumask=\w+\b\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option umask + echo "Defaults umask=${var_sudo_umask}" >> /etc/sudoers + else + # sudoers file defines Option umask, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\bumask=${var_sudo_umask}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_umask//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\bumask=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi @@ -22442,38 +22544,11 @@ in /etc/sudoers.d/. BP28(R58) Req-10.2.5 2.2.6 - 5.3.2 + 4.3.2 Requiring that sudo commands be run in a pseudo-terminal can prevent an attacker from retaining access to the user's terminal after the main program has finished executing. CCE-83798-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\buse_pty\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option use_pty - echo "Defaults use_pty" >> /etc/sudoers - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -22506,42 +22581,14 @@ fi - restrict_strategy - sudo_add_use_pty - - - - - - - - - Ensure Sudo Logfile Exists - sudo logfile - A custom log sudo file can be configured with the 'logfile' tag. This rule configures -a sudo custom logfile at the default location suggested by CIS, which uses -/var/log/sudo.log. - Req-10.2.5 - 2.2.6 - 5.3.3 - A sudo log file simplifies auditing of sudo commands. - - CCE-83601-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q sudo; then -var_sudo_logfile='' - - if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\blogfile\s*=\s*("(?:\\"|\\\\|[^"\\\n])*"\B|[^"](?:(?:\\,|\\"|\\ |\\\\|[^", \\\n])*)\b)\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option logfile - echo "Defaults logfile=${var_sudo_logfile}" >> /etc/sudoers - else - # sudoers file defines Option logfile, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\blogfile=${var_sudo_logfile}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_logfile//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\blogfile=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi + if ! grep -P '^[\s]*Defaults[\s]*\buse_pty\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option use_pty + echo "Defaults use_pty" >> /etc/sudoers fi # Check validity of sudoers and cleanup bak @@ -22561,6 +22608,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure Sudo Logfile Exists - sudo logfile + A custom log sudo file can be configured with the 'logfile' tag. This rule configures +a sudo custom logfile at the default location suggested by CIS, which uses +/var/log/sudo.log. + Req-10.2.5 + 2.2.6 + 4.3.3 + A sudo log file simplifies auditing of sudo commands. + + CCE-83601-5 - name: Gather the package facts package_facts: manager: auto @@ -22618,6 +22683,43 @@ fi - no_reboot_needed - restrict_strategy - sudo_custom_logfile + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +var_sudo_logfile='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\blogfile\s*=\s*("(?:\\"|\\\\|[^"\\\n])*"\B|[^"](?:(?:\\,|\\"|\\ |\\\\|[^", \\\n])*)\b)\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option logfile + echo "Defaults logfile=${var_sudo_logfile}" >> /etc/sudoers + else + # sudoers file defines Option logfile, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\blogfile=${var_sudo_logfile}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_logfile//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\blogfile=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -22707,22 +22809,6 @@ do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate. CCE-82202-3 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "!authenticate" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -22760,6 +22846,22 @@ done - no_reboot_needed - restrict_strategy - sudo_remove_no_authenticate + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "!authenticate" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -22833,22 +22935,6 @@ When operating systems provide the capability to escalate a functional capabilit is critical that the user re-authenticate. CCE-82197-5 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "NOPASSWD" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -22886,6 +22972,22 @@ done - no_reboot_needed - restrict_strategy - sudo_remove_nopasswd + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "NOPASSWD" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -22946,44 +23048,14 @@ in /etc/sudoers.d/." PR.AC-7 2.2.6 SRG-OS-000373-GPOS-00156 - 5.3.4 + 4.3.4 + 4.3.5 Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate. CCE-82279-1 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "NOPASSWD" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "!authenticate" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -23059,6 +23131,37 @@ done - no_reboot_needed - restrict_strategy - sudo_require_authentication + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "NOPASSWD" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "!authenticate" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -23084,8 +23187,7 @@ and the user will not have to re-authenticate for privileged actions until the u SRG-OS-000373-GPOS-00157 SRG-OS-000373-GPOS-00158 RHEL-08-010384 - 5.3.5 - 5.3.6 + 4.3.6 SV-237643r861088_rule Without re-authentication, users may access resources or perform tasks for which they do not have authorization. @@ -23094,64 +23196,25 @@ When operating systems provide the capability to escalate a functional capabilit is critical that the user re-authenticate. CCE-87838-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -var_sudo_timestamp_timeout='' - - -if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \; -fi - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then - # sudoers file doesn't define Option timestamp_timeout - echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers - else - # sudoers file defines Option timestamp_timeout, remediate wrong values if present - if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then - sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-87838-9 - - DISA-STIG-RHEL-08-010384 - - NIST-800-53-IA-11 - - PCI-DSSv4-2.2.6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_require_reauthentication -- name: XCCDF Value var_sudo_timestamp_timeout # promote to variable - set_fact: - var_sudo_timestamp_timeout: !!str - tags: - - always + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-87838-9 + - DISA-STIG-RHEL-08-010384 + - NIST-800-53-IA-11 + - PCI-DSSv4-2.2.6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_require_reauthentication +- name: XCCDF Value var_sudo_timestamp_timeout # promote to variable + set_fact: + var_sudo_timestamp_timeout: !!str + tags: + - always - name: Require Re-Authentication When Using the sudo Command - Find /etc/sudoers.d/* files containing 'Defaults timestamp_timeout' @@ -23257,6 +23320,45 @@ fi - no_reboot_needed - restrict_strategy - sudo_require_reauthentication + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +var_sudo_timestamp_timeout='' + + +if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \; +fi + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then + # sudoers file doesn't define Option timestamp_timeout + echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers + else + # sudoers file defines Option timestamp_timeout, remediate wrong values if present + if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then + sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -23274,13 +23376,6 @@ To properly set the permissions of /usr/bin/sudo, run the BP28(R57) Restricting the set of users able to execute commands as privileged user reduces the attack surface. CCE-83574-4 - - - - - -chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo - - name: Test for existence /usr/bin/sudo stat: path: /usr/bin/sudo @@ -23307,6 +23402,13 @@ chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo - medium_severity - no_reboot_needed - sudo_restrict_others_executable_permission + + + + + + +chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo @@ -23379,27 +23481,6 @@ Note that the '#' character doesn't denote a comment in the configuration file.< Use of these configuration options makes it easier for one compromised accound to be used to compromise other accounts. CCE-86377-9 - -sudoers_config_file="/etc/sudoers" -sudoers_config_dir="/etc/sudoers.d" -sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file") -if [ "$sudoers_includedir_count" -gt 1 ]; then - sed -i "/#includedir/d" "$sudoers_config_file" - echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" -elif [ "$sudoers_includedir_count" -eq 0 ]; then - echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" -else - if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then - sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file" - fi -fi - -sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file" - -if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then - sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/* -fi - - name: Check for duplicate values lineinfile: path: /etc/sudoers @@ -23517,6 +23598,27 @@ fi - medium_severity - no_reboot_needed - sudoers_default_includedir + + +sudoers_config_file="/etc/sudoers" +sudoers_config_dir="/etc/sudoers.d" +sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file") +if [ "$sudoers_includedir_count" -gt 1 ]; then + sed -i "/#includedir/d" "$sudoers_config_file" + echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" +elif [ "$sudoers_includedir_count" -eq 0 ]; then + echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" +else + if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then + sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file" + fi +fi + +sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file" + +if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then + sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/* +fi @@ -23620,75 +23722,6 @@ or if cvtsudoers not supported: the invoking user for the "root" user password. CCE-83422-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -if grep -x '^Defaults targetpw$' /etc/sudoers; then - sed -i "/Defaults targetpw/d" /etc/sudoers \; -fi -if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \; -fi -if grep -x '^Defaults rootpw$' /etc/sudoers; then - sed -i "/Defaults rootpw/d" /etc/sudoers \; -fi -if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \; -fi -if grep -x '^Defaults runaspw$' /etc/sudoers; then - sed -i "/Defaults runaspw/d" /etc/sudoers \; -fi -if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \; -fi - -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -24066,6 +24099,75 @@ fi - no_reboot_needed - restrict_strategy - sudoers_validate_passwd + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +if grep -x '^Defaults targetpw$' /etc/sudoers; then + sed -i "/Defaults targetpw/d" /etc/sudoers \; +fi +if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \; +fi +if grep -x '^Defaults rootpw$' /etc/sudoers; then + sed -i "/Defaults rootpw/d" /etc/sudoers \; +fi +if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \; +fi +if grep -x '^Defaults runaspw$' /etc/sudoers; then + sed -i "/Defaults runaspw/d" /etc/sudoers \; +fi +if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \; +fi + +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -24088,8 +24190,23 @@ $ sudo yum install binutils foundational system operator activities, such as ld, nm, objcopy and readelf. CCE-82989-5 - -package --add=binutils + - name: Ensure binutils is installed + package: + name: binutils + state: present + tags: + - CCE-82989-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_binutils_installed + + +[[packages]] +name = "binutils" +version = "*" include install_binutils @@ -24098,29 +24215,14 @@ class install_binutils { ensure => 'installed', } } + + +package --add=binutils if ! rpm -q --quiet "binutils" ; then yum install -y "binutils" fi - - -[[packages]] -name = "binutils" -version = "*" - - - name: Ensure binutils is installed - package: - name: binutils - state: present - tags: - - CCE-82989-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_binutils_installed @@ -24149,8 +24251,23 @@ $ sudo yum install dnf-plugin-subscription-manager CCE-82315-3 - -package --add=dnf-plugin-subscription-manager + - name: Ensure dnf-plugin-subscription-manager is installed + package: + name: dnf-plugin-subscription-manager + state: present + tags: + - CCE-82315-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dnf-plugin-subscription-manager_installed + + +[[packages]] +name = "dnf-plugin-subscription-manager" +version = "*" include install_dnf-plugin-subscription-manager @@ -24159,29 +24276,14 @@ class install_dnf-plugin-subscription-manager { ensure => 'installed', } } + + +package --add=dnf-plugin-subscription-manager if ! rpm -q --quiet "dnf-plugin-subscription-manager" ; then yum install -y "dnf-plugin-subscription-manager" fi - - -[[packages]] -name = "dnf-plugin-subscription-manager" -version = "*" - - - name: Ensure dnf-plugin-subscription-manager is installed - package: - name: dnf-plugin-subscription-manager - state: present - tags: - - CCE-82315-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dnf-plugin-subscription-manager_installed @@ -24206,8 +24308,23 @@ other required structures. This package contains command line TLS client and server and certificate manipulation tools. CCE-82395-5 - -package --add=gnutls-utils + - name: Ensure gnutls-utils is installed + package: + name: gnutls-utils + state: present + tags: + - CCE-82395-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_gnutls-utils_installed + + +[[packages]] +name = "gnutls-utils" +version = "*" include install_gnutls-utils @@ -24216,29 +24333,14 @@ class install_gnutls-utils { ensure => 'installed', } } + + +package --add=gnutls-utils if ! rpm -q --quiet "gnutls-utils" ; then yum install -y "gnutls-utils" fi - - -[[packages]] -name = "gnutls-utils" -version = "*" - - - name: Ensure gnutls-utils is installed - package: - name: gnutls-utils - state: present - tags: - - CCE-82395-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_gnutls-utils_installed @@ -24258,8 +24360,23 @@ posix capabilities of all the programs running on a system. libcap-ng-utils also lets system operators set the file system based capabilities. CCE-82979-6 - -package --add=libcap-ng-utils + - name: Ensure libcap-ng-utils is installed + package: + name: libcap-ng-utils + state: present + tags: + - CCE-82979-6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_libcap-ng-utils_installed + + +[[packages]] +name = "libcap-ng-utils" +version = "*" include install_libcap-ng-utils @@ -24268,29 +24385,14 @@ class install_libcap-ng-utils { ensure => 'installed', } } + + +package --add=libcap-ng-utils if ! rpm -q --quiet "libcap-ng-utils" ; then yum install -y "libcap-ng-utils" fi - - -[[packages]] -name = "libcap-ng-utils" -version = "*" - - - name: Ensure libcap-ng-utils is installed - package: - name: libcap-ng-utils - state: present - tags: - - CCE-82979-6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_libcap-ng-utils_installed @@ -24312,8 +24414,23 @@ server applications. Install the nss-tools package to install command-line tools to manipulate the NSS certificate and key database. CCE-82396-3 - -package --add=nss-tools + - name: Ensure nss-tools is installed + package: + name: nss-tools + state: present + tags: + - CCE-82396-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_nss-tools_installed + + +[[packages]] +name = "nss-tools" +version = "*" include install_nss-tools @@ -24322,29 +24439,14 @@ class install_nss-tools { ensure => 'installed', } } + + +package --add=nss-tools if ! rpm -q --quiet "nss-tools" ; then yum install -y "nss-tools" fi - - -[[packages]] -name = "nss-tools" -version = "*" - - - name: Ensure nss-tools is installed - package: - name: nss-tools - state: present - tags: - - CCE-82396-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_nss-tools_installed @@ -24366,8 +24468,23 @@ $ sudo yum install openscap-scanner configuration and vulnerability scanner, capable of performing compliance checking using SCAP content. CCE-82220-5 - -package --add=openscap-scanner + - name: Ensure openscap-scanner is installed + package: + name: openscap-scanner + state: present + tags: + - CCE-82220-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openscap-scanner_installed + + +[[packages]] +name = "openscap-scanner" +version = "*" include install_openscap-scanner @@ -24376,29 +24493,14 @@ class install_openscap-scanner { ensure => 'installed', } } + + +package --add=openscap-scanner if ! rpm -q --quiet "openscap-scanner" ; then yum install -y "openscap-scanner" fi - - -[[packages]] -name = "openscap-scanner" -version = "*" - - - name: Ensure openscap-scanner is installed - package: - name: openscap-scanner - state: present - tags: - - CCE-82220-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openscap-scanner_installed @@ -24416,8 +24518,28 @@ $ sudo yum install rear image of a system and restores from backup using this image. CCE-82883-0 - -package --add=rear + - name: Ensure rear is installed + package: + name: rear + state: present + when: not ( ( ( ansible_architecture == "aarch64" and ansible_distribution == 'OracleLinux' + and ansible_distribution_version is version('9.0', '>=') ) or ( ansible_architecture + == "aarch64" and ansible_distribution == 'RedHat' and ansible_distribution_version + is version('9.0', '>=') ) or ( ansible_distribution == 'RedHat' and ansible_distribution_version + is version('8.4', '<=') and ansible_architecture == "s390x" ) ) ) + tags: + - CCE-82883-0 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rear_installed + + +[[packages]] +name = "rear" +version = "*" include install_rear @@ -24426,6 +24548,9 @@ class install_rear { ensure => 'installed', } } + + +package --add=rear # Remediation is applicable only in certain platforms if ! ( ( ( grep -q aarch64 /proc/sys/kernel/osrelease && grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; printf "%s\n%s" "$expected" "$real" | sort -VC; } ) || ( grep -q aarch64 /proc/sys/kernel/osrelease && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; printf "%s\n%s" "$expected" "$real" | sort -VC; } ) || ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.4"; printf "%s\n%s" "$real" "$expected" | sort -VC; } && grep -q s390x /proc/sys/kernel/osrelease ) ) ); then @@ -24437,29 +24562,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rear" -version = "*" - - - name: Ensure rear is installed - package: - name: rear - state: present - when: not ( ( ( ansible_architecture == "aarch64" and ansible_distribution == 'OracleLinux' - and ansible_distribution_version is version('9.0', '>=') ) or ( ansible_architecture - == "aarch64" and ansible_distribution == 'RedHat' and ansible_distribution_version - is version('9.0', '>=') ) or ( ansible_distribution == 'RedHat' and ansible_distribution_version - is version('8.4', '<=') and ansible_architecture == "s390x" ) ) ) - tags: - - CCE-82883-0 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rear_installed @@ -24481,8 +24583,25 @@ $ sudo yum install rng-tools such as those used in the formation of x509/PKI certificates. CCE-82968-9 - -package --add=rng-tools + - name: Ensure rng-tools is installed + package: + name: rng-tools + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82968-9 + - DISA-STIG-RHEL-08-010472 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_rng-tools_installed + + +[[packages]] +name = "rng-tools" +version = "*" include install_rng-tools @@ -24491,6 +24610,9 @@ class install_rng-tools { ensure => 'installed', } } + + +package --add=rng-tools # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -24502,26 +24624,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rng-tools" -version = "*" - - - name: Ensure rng-tools is installed - package: - name: rng-tools - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82968-9 - - DISA-STIG-RHEL-08-010472 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_rng-tools_installed @@ -24548,8 +24650,23 @@ package, or the SCAP Workbench GUI tool from the scap-workbench CCE-82949-9 - -package --add=scap-security-guide + - name: Ensure scap-security-guide is installed + package: + name: scap-security-guide + state: present + tags: + - CCE-82949-9 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_scap-security-guide_installed + + +[[packages]] +name = "scap-security-guide" +version = "*" include install_scap-security-guide @@ -24558,29 +24675,14 @@ class install_scap-security-guide { ensure => 'installed', } } + + +package --add=scap-security-guide if ! rpm -q --quiet "scap-security-guide" ; then yum install -y "scap-security-guide" fi - - -[[packages]] -name = "scap-security-guide" -version = "*" - - - name: Ensure scap-security-guide is installed - package: - name: scap-security-guide - state: present - tags: - - CCE-82949-9 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_scap-security-guide_installed @@ -24611,8 +24713,23 @@ It communicates with the backend subscription service (the Customer Portal or an on-premise server such as Subscription Asset Manager) and works with content management tools such as . CCE-82316-1 - -package --add=subscription-manager + - name: Ensure subscription-manager is installed + package: + name: subscription-manager + state: present + tags: + - CCE-82316-1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_subscription-manager_installed + + +[[packages]] +name = "subscription-manager" +version = "*" include install_subscription-manager @@ -24621,29 +24738,14 @@ class install_subscription-manager { ensure => 'installed', } } + + +package --add=subscription-manager if ! rpm -q --quiet "subscription-manager" ; then yum install -y "subscription-manager" fi - - -[[packages]] -name = "subscription-manager" -version = "*" - - - name: Ensure subscription-manager is installed - package: - name: subscription-manager - state: present - tags: - - CCE-82316-1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_subscription-manager_installed @@ -24662,8 +24764,23 @@ can restore individual files (or all of the files) from the archive. includes multivolume support, automatic archive compression/decompression, the the ability to perform incremental and full backups. If CCE-82965-5 - -package --add=tar + - name: Ensure tar is installed + package: + name: tar + state: present + tags: + - CCE-82965-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tar_installed + + +[[packages]] +name = "tar" +version = "*" include install_tar @@ -24672,29 +24789,14 @@ class install_tar { ensure => 'installed', } } + + +package --add=tar if ! rpm -q --quiet "tar" ; then yum install -y "tar" fi - - -[[packages]] -name = "tar" -version = "*" - - - name: Ensure tar is installed - package: - name: tar - state: present - tags: - - CCE-82965-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tar_installed @@ -24710,8 +24812,23 @@ version = "*" $ sudo yum install vim-enhanced Vim (Vi IMproved) is an almost compatible version of the UNIX editor vi. CCE-82956-4 - -package --add=vim-enhanced + - name: Ensure vim-enhanced is installed + package: + name: vim-enhanced + state: present + tags: + - CCE-82956-4 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_vim_installed + + +[[packages]] +name = "vim-enhanced" +version = "*" include install_vim-enhanced @@ -24720,29 +24837,14 @@ class install_vim-enhanced { ensure => 'installed', } } + + +package --add=vim-enhanced if ! rpm -q --quiet "vim-enhanced" ; then yum install -y "vim-enhanced" fi - - -[[packages]] -name = "vim-enhanced" -version = "*" - - - name: Ensure vim-enhanced is installed - package: - name: vim-enhanced - state: present - tags: - - CCE-82956-4 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_vim_installed @@ -24763,8 +24865,19 @@ $ sudo yum erase abrt-addon-ccpp abrt-addon-ccpp contains hooks for C/C++ crashed programs and abrt's C/C++ analyzer plugin. CCE-82919-2 - -package --remove=abrt-addon-ccpp + - name: Ensure abrt-addon-ccpp is removed + package: + name: abrt-addon-ccpp + state: absent + tags: + - CCE-82919-2 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-addon-ccpp_removed include remove_abrt-addon-ccpp @@ -24773,6 +24886,9 @@ class remove_abrt-addon-ccpp { ensure => 'purged', } } + + +package --remove=abrt-addon-ccpp # CAUTION: This remediation script will remove abrt-addon-ccpp @@ -24786,20 +24902,6 @@ if rpm -q --quiet "abrt-addon-ccpp" ; then yum remove -y "abrt-addon-ccpp" fi - - - name: Ensure abrt-addon-ccpp is removed - package: - name: abrt-addon-ccpp - state: absent - tags: - - CCE-82919-2 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-addon-ccpp_removed @@ -24820,8 +24922,19 @@ $ sudo yum erase abrt-addon-kerneloops abrt-addon-kerneloops contains plugins for collecting kernel crash information and reporter plugin which sends this information to a specified server, usually to kerneloops.org. CCE-82926-7 - -package --remove=abrt-addon-kerneloops + - name: Ensure abrt-addon-kerneloops is removed + package: + name: abrt-addon-kerneloops + state: absent + tags: + - CCE-82926-7 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-addon-kerneloops_removed include remove_abrt-addon-kerneloops @@ -24830,6 +24943,9 @@ class remove_abrt-addon-kerneloops { ensure => 'purged', } } + + +package --remove=abrt-addon-kerneloops # CAUTION: This remediation script will remove abrt-addon-kerneloops @@ -24843,20 +24959,6 @@ if rpm -q --quiet "abrt-addon-kerneloops" ; then yum remove -y "abrt-addon-kerneloops" fi - - - name: Ensure abrt-addon-kerneloops is removed - package: - name: abrt-addon-kerneloops - state: absent - tags: - - CCE-82926-7 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-addon-kerneloops_removed @@ -24877,8 +24979,19 @@ $ sudo yum erase abrt-cli abrt-cli contains a command line client for controlling abrt daemon over sockets. CCE-82907-7 - -package --remove=abrt-cli + - name: Ensure abrt-cli is removed + package: + name: abrt-cli + state: absent + tags: + - CCE-82907-7 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-cli_removed include remove_abrt-cli @@ -24887,6 +25000,9 @@ class remove_abrt-cli { ensure => 'purged', } } + + +package --remove=abrt-cli # CAUTION: This remediation script will remove abrt-cli @@ -24900,20 +25016,6 @@ if rpm -q --quiet "abrt-cli" ; then yum remove -y "abrt-cli" fi - - - name: Ensure abrt-cli is removed - package: - name: abrt-cli - state: absent - tags: - - CCE-82907-7 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-cli_removed @@ -24932,8 +25034,18 @@ $ sudo yum erase abrt-plugin-logger abrt-plugin-logger is an ABRT plugin which writes a report to a specified file. CCE-82913-5 - -package --remove=abrt-plugin-logger + - name: Ensure abrt-plugin-logger is removed + package: + name: abrt-plugin-logger + state: absent + tags: + - CCE-82913-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-logger_removed include remove_abrt-plugin-logger @@ -24942,6 +25054,9 @@ class remove_abrt-plugin-logger { ensure => 'purged', } } + + +package --remove=abrt-plugin-logger # CAUTION: This remediation script will remove abrt-plugin-logger @@ -24955,19 +25070,6 @@ if rpm -q --quiet "abrt-plugin-logger" ; then yum remove -y "abrt-plugin-logger" fi - - - name: Ensure abrt-plugin-logger is removed - package: - name: abrt-plugin-logger - state: absent - tags: - - CCE-82913-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-logger_removed @@ -24986,8 +25088,18 @@ $ sudo yum erase abrt-plugin-rhtsupport abrt-plugin-rhtsupport is a ABRT plugin to report bugs into the Red Hat Support system. CCE-82916-8 - -package --remove=abrt-plugin-rhtsupport + - name: Ensure abrt-plugin-rhtsupport is removed + package: + name: abrt-plugin-rhtsupport + state: absent + tags: + - CCE-82916-8 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-rhtsupport_removed include remove_abrt-plugin-rhtsupport @@ -24996,6 +25108,9 @@ class remove_abrt-plugin-rhtsupport { ensure => 'purged', } } + + +package --remove=abrt-plugin-rhtsupport # CAUTION: This remediation script will remove abrt-plugin-rhtsupport @@ -25009,19 +25124,6 @@ if rpm -q --quiet "abrt-plugin-rhtsupport" ; then yum remove -y "abrt-plugin-rhtsupport" fi - - - name: Ensure abrt-plugin-rhtsupport is removed - package: - name: abrt-plugin-rhtsupport - state: absent - tags: - - CCE-82916-8 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-rhtsupport_removed @@ -25041,8 +25143,19 @@ $ sudo yum erase abrt-plugin-sosreport SV-230488r627750_rule abrt-plugin-sosreport provides a plugin to include an sosreport in an ABRT report. CCE-82910-1 - -package --remove=abrt-plugin-sosreport + - name: Ensure abrt-plugin-sosreport is removed + package: + name: abrt-plugin-sosreport + state: absent + tags: + - CCE-82910-1 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-sosreport_removed include remove_abrt-plugin-sosreport @@ -25051,6 +25164,9 @@ class remove_abrt-plugin-sosreport { ensure => 'purged', } } + + +package --remove=abrt-plugin-sosreport # CAUTION: This remediation script will remove abrt-plugin-sosreport @@ -25064,20 +25180,6 @@ if rpm -q --quiet "abrt-plugin-sosreport" ; then yum remove -y "abrt-plugin-sosreport" fi - - - name: Ensure abrt-plugin-sosreport is removed - package: - name: abrt-plugin-sosreport - state: absent - tags: - - CCE-82910-1 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-sosreport_removed @@ -25093,8 +25195,18 @@ fi $ sudo yum erase geolite2-city geolite2-city is part of the GeoLite2 database packages, offering geolocation databases and tooling. CCE-82939-0 - -package --remove=geolite2-city + - name: Ensure geolite2-city is removed + package: + name: geolite2-city + state: absent + tags: + - CCE-82939-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_geolite2-city_removed include remove_geolite2-city @@ -25103,6 +25215,9 @@ class remove_geolite2-city { ensure => 'purged', } } + + +package --remove=geolite2-city # CAUTION: This remediation script will remove geolite2-city @@ -25116,19 +25231,6 @@ if rpm -q --quiet "geolite2-city" ; then yum remove -y "geolite2-city" fi - - - name: Ensure geolite2-city is removed - package: - name: geolite2-city - state: absent - tags: - - CCE-82939-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_geolite2-city_removed @@ -25144,8 +25246,18 @@ fi $ sudo yum erase geolite2-country geolite2-country is part of the GeoLite2 database packages, offering geolocation databases and tooling. CCE-82936-6 - -package --remove=geolite2-country + - name: Ensure geolite2-country is removed + package: + name: geolite2-country + state: absent + tags: + - CCE-82936-6 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_geolite2-country_removed include remove_geolite2-country @@ -25154,6 +25266,9 @@ class remove_geolite2-country { ensure => 'purged', } } + + +package --remove=geolite2-country # CAUTION: This remediation script will remove geolite2-country @@ -25167,19 +25282,6 @@ if rpm -q --quiet "geolite2-country" ; then yum remove -y "geolite2-country" fi - - - name: Ensure geolite2-country is removed - package: - name: geolite2-country - state: absent - tags: - - CCE-82936-6 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_geolite2-country_removed @@ -25204,6 +25306,20 @@ RHV uses NFS storage, which has dependency on gssproxy. gssproxy is a proxy for GSS API credential handling. CCE-82943-2 + - name: Ensure gssproxy is removed + package: + name: gssproxy + state: absent + tags: + - CCE-82943-2 + - DISA-STIG-RHEL-08-040370 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_gssproxy_removed + include remove_gssproxy class remove_gssproxy { @@ -25224,20 +25340,6 @@ if rpm -q --quiet "gssproxy" ; then yum remove -y "gssproxy" fi - - - name: Ensure gssproxy is removed - package: - name: gssproxy - state: absent - tags: - - CCE-82943-2 - - DISA-STIG-RHEL-08-040370 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_gssproxy_removed @@ -25259,8 +25361,19 @@ $ sudo yum erase iprutils iprutils provides a suite of utlilities to manage and configure SCSI devices supported by the ipr SCSI storage device driver. CCE-82946-5 - -package --remove=iprutils + - name: Ensure iprutils is removed + package: + name: iprutils + state: absent + tags: + - CCE-82946-5 + - DISA-STIG-RHEL-08-040380 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iprutils_removed include remove_iprutils @@ -25269,6 +25382,9 @@ class remove_iprutils { ensure => 'purged', } } + + +package --remove=iprutils # CAUTION: This remediation script will remove iprutils @@ -25282,20 +25398,6 @@ if rpm -q --quiet "iprutils" ; then yum remove -y "iprutils" fi - - - name: Ensure iprutils is removed - package: - name: iprutils - state: absent - tags: - - CCE-82946-5 - - DISA-STIG-RHEL-08-040380 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iprutils_removed @@ -25320,8 +25422,19 @@ RHV hosts require ipa-client package, which has dependency on krb5-workstation.< Kerberos programs (kinit, klist, kdestroy, kpasswd). CCE-82931-7 - -package --remove=krb5-workstation + - name: Ensure krb5-workstation is removed + package: + name: krb5-workstation + state: absent + tags: + - CCE-82931-7 + - DISA-STIG-RHEL-08-010162 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_krb5-workstation_removed include remove_krb5-workstation @@ -25330,6 +25443,9 @@ class remove_krb5-workstation { ensure => 'purged', } } + + +package --remove=krb5-workstation # CAUTION: This remediation script will remove krb5-workstation @@ -25343,20 +25459,6 @@ if rpm -q --quiet "krb5-workstation" ; then yum remove -y "krb5-workstation" fi - - - name: Ensure krb5-workstation is removed - package: - name: krb5-workstation - state: absent - tags: - - CCE-82931-7 - - DISA-STIG-RHEL-08-010162 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_krb5-workstation_removed @@ -25377,8 +25479,19 @@ $ sudo yum erase libreport-plugin-logger libreport-plugin-logger is a ABRT plugin to report bugs into the Red Hat Support system. CCE-89201-8 - -package --remove=libreport-plugin-logger + - name: Ensure libreport-plugin-logger is removed + package: + name: libreport-plugin-logger + state: absent + tags: + - CCE-89201-8 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_libreport-plugin-logger_removed include remove_libreport-plugin-logger @@ -25387,6 +25500,9 @@ class remove_libreport-plugin-logger { ensure => 'purged', } } + + +package --remove=libreport-plugin-logger # CAUTION: This remediation script will remove libreport-plugin-logger @@ -25400,20 +25516,6 @@ if rpm -q --quiet "libreport-plugin-logger" ; then yum remove -y "libreport-plugin-logger" fi - - - name: Ensure libreport-plugin-logger is removed - package: - name: libreport-plugin-logger - state: absent - tags: - - CCE-89201-8 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_libreport-plugin-logger_removed @@ -25434,8 +25536,19 @@ $ sudo yum erase libreport-plugin-rhtsupport libreport-plugin-rhtsupport is a ABRT plugin to report bugs into the Red Hat Support system. CCE-88955-0 - -package --remove=libreport-plugin-rhtsupport + - name: Ensure libreport-plugin-rhtsupport is removed + package: + name: libreport-plugin-rhtsupport + state: absent + tags: + - CCE-88955-0 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_libreport-plugin-rhtsupport_removed include remove_libreport-plugin-rhtsupport @@ -25444,6 +25557,9 @@ class remove_libreport-plugin-rhtsupport { ensure => 'purged', } } + + +package --remove=libreport-plugin-rhtsupport # CAUTION: This remediation script will remove libreport-plugin-rhtsupport @@ -25457,20 +25573,6 @@ if rpm -q --quiet "libreport-plugin-rhtsupport" ; then yum remove -y "libreport-plugin-rhtsupport" fi - - - name: Ensure libreport-plugin-rhtsupport is removed - package: - name: libreport-plugin-rhtsupport - state: absent - tags: - - CCE-88955-0 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_libreport-plugin-rhtsupport_removed @@ -25490,8 +25592,18 @@ have not been compiled using recommended compiler flags. The binaries are compiled without sufficient stack protection and its address space layout randomization (ASLR) is weak. CCE-82397-1 - -package --remove=pigz + - name: Ensure pigz is removed + package: + name: pigz + state: absent + tags: + - CCE-82397-1 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_pigz_removed include remove_pigz @@ -25500,6 +25612,9 @@ class remove_pigz { ensure => 'purged', } } + + +package --remove=pigz # CAUTION: This remediation script will remove pigz @@ -25513,19 +25628,6 @@ if rpm -q --quiet "pigz" ; then yum remove -y "pigz" fi - - - name: Ensure pigz is removed - package: - name: pigz - state: absent - tags: - - CCE-82397-1 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_pigz_removed @@ -25546,8 +25648,19 @@ $ sudo yum erase python3-abrt-addon python3-abrt-addon contains python hook and python analyzer plugin for handling uncaught exceptions in python programs. CCE-86084-1 - -package --remove=python3-abrt-addon + - name: Ensure python3-abrt-addon is removed + package: + name: python3-abrt-addon + state: absent + tags: + - CCE-86084-1 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_python3-abrt-addon_removed include remove_python3-abrt-addon @@ -25556,6 +25669,9 @@ class remove_python3-abrt-addon { ensure => 'purged', } } + + +package --remove=python3-abrt-addon # CAUTION: This remediation script will remove python3-abrt-addon @@ -25569,20 +25685,6 @@ if rpm -q --quiet "python3-abrt-addon" ; then yum remove -y "python3-abrt-addon" fi - - - name: Ensure python3-abrt-addon is removed - package: - name: python3-abrt-addon - state: absent - tags: - - CCE-86084-1 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_python3-abrt-addon_removed @@ -25609,8 +25711,19 @@ on that information, components will then be put into lower or higher power savi modes to adapt to the current usage. CCE-82904-4 - -package --remove=tuned + - name: Ensure tuned is removed + package: + name: tuned + state: absent + tags: + - CCE-82904-4 + - DISA-STIG-RHEL-08-040390 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tuned_removed include remove_tuned @@ -25619,6 +25732,9 @@ class remove_tuned { ensure => 'purged', } } + + +package --remove=tuned # CAUTION: This remediation script will remove tuned @@ -25632,20 +25748,6 @@ if rpm -q --quiet "tuned" ; then yum remove -y "tuned" fi - - - name: Ensure tuned is removed - package: - name: tuned - state: absent - tags: - - CCE-82904-4 - - DISA-STIG-RHEL-08-040390 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tuned_removed @@ -25677,8 +25779,23 @@ $ sudo yum install dnf-automatic dnf-automatic is an alternative command line interface (CLI) to dnf upgrade suitable for automatic, regular execution. CCE-82985-3 - -package --add=dnf-automatic + - name: Ensure dnf-automatic is installed + package: + name: dnf-automatic + state: present + tags: + - CCE-82985-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dnf-automatic_installed + + +[[packages]] +name = "dnf-automatic" +version = "*" include install_dnf-automatic @@ -25687,29 +25804,14 @@ class install_dnf-automatic { ensure => 'installed', } } + + +package --add=dnf-automatic if ! rpm -q --quiet "dnf-automatic" ; then yum install -y "dnf-automatic" fi - - -[[packages]] -name = "dnf-automatic" -version = "*" - - - name: Ensure dnf-automatic is installed - package: - name: dnf-automatic - state: present - tags: - - CCE-82985-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dnf-automatic_installed @@ -25761,20 +25863,6 @@ to 1 in /etc/yum.conf. CCE-82476-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then - sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf -else - echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf - echo "clean_requirements_on_remove=1" >> /etc/yum.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -25816,6 +25904,20 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then + sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf +else + echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf + echo "clean_requirements_on_remove=1" >> /etc/yum.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -25849,6 +25951,25 @@ lack of prompt attention to patching could result in a system compromise. The automated installation of updates ensures that recent security patches are applied in a timely manner. CCE-82494-6 + - name: Configure dnf-automatic to Install Available Updates Automatically + ini_file: + dest: /etc/dnf/automatic.conf + section: commands + option: apply_updates + value: 'yes' + create: true + tags: + - CCE-82494-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-2(5) + - NIST-800-53-SI-2(c) + - dnf-automatic_apply_updates + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + found=false @@ -25876,25 +25997,6 @@ if ! $found ; then mkdir -p "$(dirname "$file")" echo -e "[commands]\napply_updates = yes" >> "$file" fi - - - name: Configure dnf-automatic to Install Available Updates Automatically - ini_file: - dest: /etc/dnf/automatic.conf - section: commands - option: apply_updates - value: 'yes' - create: true - tags: - - CCE-82494-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-2(5) - - NIST-800-53-SI-2(c) - - dnf-automatic_apply_updates - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy @@ -25918,6 +26020,25 @@ automatically, set upgrade_type to security CCE-82267-6 + - name: Configure dnf-automatic to Install Only Security Updates + ini_file: + dest: /etc/dnf/automatic.conf + section: commands + option: upgrade_type + value: security + create: true + tags: + - CCE-82267-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-2(5) + - NIST-800-53-SI-2(c) + - dnf-automatic_security_updates_only + - low_complexity + - low_severity + - medium_disruption + - no_reboot_needed + - unknown_strategy + found=false @@ -25945,25 +26066,6 @@ if ! $found ; then mkdir -p "$(dirname "$file")" echo -e "[commands]\nupgrade_type = security" >> "$file" fi - - - name: Configure dnf-automatic to Install Only Security Updates - ini_file: - dest: /etc/dnf/automatic.conf - section: commands - option: upgrade_type - value: security - create: true - tags: - - CCE-82267-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-2(5) - - NIST-800-53-SI-2(c) - - dnf-automatic_security_updates_only - - low_complexity - - low_severity - - medium_disruption - - no_reboot_needed - - unknown_strategy @@ -26055,35 +26157,6 @@ this requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA). CCE-80790-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" -else - if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" - fi - cce="CCE-80790-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" - printf '%s\n' "$formatted_output" >> "/etc/yum.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -26141,6 +26214,35 @@ fi - low_complexity - medium_disruption - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" +else + if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" + fi + cce="CCE-80790-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" + printf '%s\n' "$formatted_output" >> "/etc/yum.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -26198,35 +26300,6 @@ Accordingly, patches, service packs, device drivers, or operating system compone be signed with a certificate recognized and approved by the organization. CCE-80791-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" -else - if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" - fi - cce="CCE-80791-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" - printf '%s\n' "$formatted_output" >> "/etc/yum.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -26286,6 +26359,35 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" +else + if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" + fi + cce="CCE-80791-7" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" + printf '%s\n' "$formatted_output" >> "/etc/yum.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -26364,9 +26466,6 @@ trusted vendor. Self-signed certificates are disallowed by this requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA)." CCE-80792-5 - -sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* - - name: Grep for yum repo section names shell: | set -o pipefail @@ -26429,6 +26528,9 @@ sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* - low_complexity - medium_disruption - no_reboot_needed + + +sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* @@ -26587,34 +26689,6 @@ not been tampered with and that it has been provided by a trusted vendor. The Red Hat GPG key is necessary to cryptographically verify packages are from Red Hat. CCE-80795-8 - # The two fingerprints below are retrieved from https://access.redhat.com/security/team/key -readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51" -readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792" - -# Location of the key we would like to import (once it's integrity verified) -readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" - -RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")") - -# Verify /etc/pki/rpm-gpg directory permissions are safe -if [ "${RPM_GPG_DIR_PERMS}" -le "755" ] -then - # If they are safe, try to obtain fingerprints from the key file - # (to ensure there won't be e.g. CRC error). - - readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10) - - GPG_RESULT=$? - # No CRC error, safe to proceed - if [ "${GPG_RESULT}" -eq "0" ] - then - echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || { - # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it - rpm --import "${REDHAT_RELEASE_KEY}" - } - fi -fi - - name: Read permission of GPG key directory stat: path: /etc/pki/rpm-gpg/ @@ -26739,6 +26813,34 @@ fi - medium_disruption - no_reboot_needed - restrict_strategy + + # The two fingerprints below are retrieved from https://access.redhat.com/security/team/key +readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51" +readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792" + +# Location of the key we would like to import (once it's integrity verified) +readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" + +RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")") + +# Verify /etc/pki/rpm-gpg directory permissions are safe +if [ "${RPM_GPG_DIR_PERMS}" -le "755" ] +then + # If they are safe, try to obtain fingerprints from the key file + # (to ensure there won't be e.g. CRC error). + + readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10) + + GPG_RESULT=$? + # No CRC error, safe to proceed + if [ "${GPG_RESULT}" -eq "0" ] + then + echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || { + # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it + rpm --import "${REDHAT_RELEASE_KEY}" + } + fi +fi @@ -26801,10 +26903,6 @@ recent security patches and updates are not installed, unauthorized users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise. CCE-80865-9 - - -yum -y update - - name: Security patches are up to date package: name: '*' @@ -26825,6 +26923,10 @@ yum -y update - reboot_required - security_patches_up_to_date - skip_ansible_lint + + + +yum -y update @@ -26844,11 +26946,6 @@ The dnf-automatic timer can be enabled with the following The dnf-automatic is an alternative command line interface (CLI) to dnf upgrade with specific facilities to make it suitable to be executed automatically and regularly from systemd timers, cron jobs and similar. The tool is controlled by dnf-automatic.timer SystemD timer. CCE-82360-9 - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" start 'dnf-automatic.timer' -"$SYSTEMCTL_EXEC" enable 'dnf-automatic.timer' - - name: Enable timer dnf-automatic block: @@ -26874,6 +26971,11 @@ SYSTEMCTL_EXEC='/usr/bin/systemctl' - medium_severity - no_reboot_needed - timer_dnf-automatic_enabled + + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" start 'dnf-automatic.timer' +"$SYSTEMCTL_EXEC" enable 'dnf-automatic.timer' @@ -26935,20 +27037,6 @@ profiles instead of letting the administrator manually build the PAM stack. That way, it avoids potential breakage of configuration, as it ships several tested profiles that are well tested and supported to solve different use-cases. CCE-88248-0 - -var_authselect_profile='' - - -authselect select "$var_authselect_profile" - -if test "$?" -ne 0; then - if rpm --quiet --verify pam; then - authselect select --force "$var_authselect_profile" - else - echo "Files in the 'pam' package have been altered, so the authselect configuration won't be forced" >&2 - fi -fi - - name: XCCDF Value var_authselect_profile # promote to variable set_fact: var_authselect_profile: !!str @@ -27019,6 +27107,20 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + +var_authselect_profile='' + + +authselect select "$var_authselect_profile" + +if test "$?" -ne 0; then + if rpm --quiet --verify pam; then + authselect select --force "$var_authselect_profile" + else + echo "Files in the 'pam' package have been altered, so the authselect configuration won't be forced" >&2 + fi +fi @@ -27174,6 +27276,32 @@ with human users and are not required when such human interfaces do not exist. CCE-80763-6 + - @@ -27286,6 +27388,28 @@ with human users and are not required when such human interfaces do not exist. CCE-86147-6 + - @@ -27387,6 +27489,28 @@ with human users and are not required when such human interfaces do not exist. CCE-83496-0 + - @@ -27457,8 +27559,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-83708-8 - chgrp 0 /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27485,6 +27585,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/issue @@ -27506,8 +27608,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-86051-0 - chgrp 0 /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27536,6 +27636,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/issue.net @@ -27556,8 +27658,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-83728-6 - chgrp 0 /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27584,6 +27684,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/motd @@ -27604,8 +27706,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-83718-7 - chown 0 /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27632,6 +27732,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/issue @@ -27653,8 +27755,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-86054-4 - chown 0 /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27683,6 +27783,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/issue.net @@ -27703,8 +27805,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-83738-5 - chown 0 /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27731,6 +27831,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/motd @@ -27751,13 +27853,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-83348-3 - - - - - -chmod u-xs,g-xws,o-xwt /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27784,6 +27879,13 @@ chmod u-xs,g-xws,o-xwt /etc/issue - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/issue @@ -27805,13 +27907,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-86047-8 - - - - - -chmod u-xs,g-xws,o-xwt /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27840,6 +27935,13 @@ chmod u-xs,g-xws,o-xwt /etc/issue.net - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/issue.net @@ -27860,13 +27962,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-83338-4 - - - - - -chmod u-xs,g-xws,o-xwt /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27893,6 +27988,13 @@ chmod u-xs,g-xws,o-xwt /etc/motd - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/motd @@ -27980,68 +28082,6 @@ Executive Orders, directives, policies, regulations, standards, and guidance. For U.S. Government systems, system use notifications are required only for access via login interfaces with human users and are not required when such human interfaces do not exist. CCE-80768-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*banner-message-enable\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)banner-message-enable(\s*=)/#\1banner-message-enable\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*banner-message-enable\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*banner-message-enable\\s*=\\s*.*/banner-message-enable=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-enable=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-enable$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/banner-message-enable$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/banner-message-enable$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/banner-message-enable" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28119,6 +28159,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*banner-message-enable\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)banner-message-enable(\s*=)/#\1banner-message-enable\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*banner-message-enable\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*banner-message-enable\\s*=\\s*.*/banner-message-enable=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-enable=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-enable$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/banner-message-enable$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/banner-message-enable$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/banner-message-enable" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28195,87 +28297,6 @@ to begin and end the string with ' and use \n< An appropriate warning message reinforces policy awareness during the logon process and facilitates possible legal action against attackers. CCE-80770-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -login_banner_text='' - - -# Multiple regexes transform the banner regex into a usable banner -# 0 - Remove anchors around the banner text -login_banner_text=$(echo "$login_banner_text" | sed 's/^\^\(.*\)\$$/\1/g') -# 1 - Keep only the first banners if there are multiple -# (dod_banners contains the long and short banner) -login_banner_text=$(echo "$login_banner_text" | sed 's/^(\(.*\.\)|.*)$/\1/g') -# 2 - Add spaces ' '. (Transforms regex for "space or newline" into a " ") -login_banner_text=$(echo "$login_banner_text" | sed 's/\[\\s\\n\]+/ /g') -# 3 - Adds newline "tokens". (Transforms "(?:\[\\n\]+|(?:\\n)+)" into "(n)*") -login_banner_text=$(echo "$login_banner_text" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/(n)*/g') -# 4 - Remove any leftover backslash. (From any parethesis in the banner, for example). -login_banner_text=$(echo "$login_banner_text" | sed 's/\\//g') -# 5 - Removes the newline "token." (Transforms them into newline escape sequences "\n"). -# ( Needs to be done after 4, otherwise the escapce sequence will become just "n". -login_banner_text=$(echo "$login_banner_text" | sed 's/(n)\*/\\n/g') - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*banner-message-text\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)banner-message-text(\s*=)/#\1banner-message-text\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'${login_banner_text}'")" -if grep -q "^\\s*banner-message-text\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*banner-message-text\\s*=\\s*.*/banner-message-text=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-text=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-text$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/banner-message-text$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/banner-message-text$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/banner-message-text" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28405,6 +28426,87 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +login_banner_text='' + + +# Multiple regexes transform the banner regex into a usable banner +# 0 - Remove anchors around the banner text +login_banner_text=$(echo "$login_banner_text" | sed 's/^\^\(.*\)\$$/\1/g') +# 1 - Keep only the first banners if there are multiple +# (dod_banners contains the long and short banner) +login_banner_text=$(echo "$login_banner_text" | sed 's/^(\(.*\.\)|.*)$/\1/g') +# 2 - Add spaces ' '. (Transforms regex for "space or newline" into a " ") +login_banner_text=$(echo "$login_banner_text" | sed 's/\[\\s\\n\]+/ /g') +# 3 - Adds newline "tokens". (Transforms "(?:\[\\n\]+|(?:\\n)+)" into "(n)*") +login_banner_text=$(echo "$login_banner_text" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/(n)*/g') +# 4 - Remove any leftover backslash. (From any parethesis in the banner, for example). +login_banner_text=$(echo "$login_banner_text" | sed 's/\\//g') +# 5 - Removes the newline "token." (Transforms them into newline escape sequences "\n"). +# ( Needs to be done after 4, otherwise the escapce sequence will become just "n". +login_banner_text=$(echo "$login_banner_text" | sed 's/(n)\*/\\n/g') + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*banner-message-text\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)banner-message-text(\s*=)/#\1banner-message-text\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'${login_banner_text}'")" +if grep -q "^\\s*banner-message-text\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*banner-message-text\\s*=\\s*.*/banner-message-text=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-text=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-text$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/banner-message-text$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/banner-message-text$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/banner-message-text" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28488,6 +28590,7 @@ The libpwquality package can be installed with the follow $ sudo yum install libpwquality CCI-000366 SRG-OS-000480-GPOS-00225 + 4.4.2.3 Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and @@ -28495,33 +28598,6 @@ brute-force attacks. "pwquality" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system. CCE-86225-0 - -package --add=libpwquality - - include install_libpwquality - -class install_libpwquality { - package { 'libpwquality': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if ! rpm -q --quiet "libpwquality" ; then - yum install -y "libpwquality" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "libpwquality" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -28547,6 +28623,33 @@ version = "*" - medium_severity - no_reboot_needed - package_pam_pwquality_installed + + +[[packages]] +name = "libpwquality" +version = "*" + + include install_libpwquality + +class install_libpwquality { + package { 'libpwquality': + ensure => 'installed', + } +} + + +package --add=libpwquality + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if ! rpm -q --quiet "libpwquality" ; then + yum install -y "libpwquality" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28573,15 +28676,6 @@ have authorization. When operating systems provide the capability to escalate a capability, it is critical the user re-authenticate. CCE-86319-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -sed -i '/pam_succeed_if/d' /etc/pam.d/sudo - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28613,6 +28707,15 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +sed -i '/pam_succeed_if/d' /etc/pam.d/sudo + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28689,264 +28792,6 @@ account allows the user to determine if any unauthorized activity has occurred a an opportunity to notify administrators. CCE-80788-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -f /usr/bin/authselect ]; then - if authselect list-features minimal | grep -q with-silent-lastlog; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect disable-feature with-silent-lastlog - - authselect apply-changes -b - else - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - if [ -e "$PAM_FILE_PATH" ] ; then - PAM_FILE_PATH="$PAM_FILE_PATH" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" - else - echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" - fi - fi - fi - # Check the option - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$PAM_FILE_PATH was not found" >&2 - fi - if [ -e "$PAM_FILE_PATH" ] ; then - PAM_FILE_PATH="$PAM_FILE_PATH" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$PAM_FILE_PATH was not found" >&2 - fi - fi -else - if [ -e "/etc/pam.d/postlogin" ] ; then - PAM_FILE_PATH="/etc/pam.d/postlogin" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" - else - echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" - fi - fi - fi - # Check the option - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/postlogin was not found" >&2 - fi - if [ -e "/etc/pam.d/postlogin" ] ; then - PAM_FILE_PATH="/etc/pam.d/postlogin" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/postlogin was not found" >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -29333,6 +29178,264 @@ fi - low_disruption - low_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -f /usr/bin/authselect ]; then + if authselect list-features minimal | grep -q with-silent-lastlog; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect disable-feature with-silent-lastlog + + authselect apply-changes -b + else + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + if [ -e "$PAM_FILE_PATH" ] ; then + PAM_FILE_PATH="$PAM_FILE_PATH" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" + else + echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" + fi + fi + fi + # Check the option + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$PAM_FILE_PATH was not found" >&2 + fi + if [ -e "$PAM_FILE_PATH" ] ; then + PAM_FILE_PATH="$PAM_FILE_PATH" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$PAM_FILE_PATH was not found" >&2 + fi + fi +else + if [ -e "/etc/pam.d/postlogin" ] ; then + PAM_FILE_PATH="/etc/pam.d/postlogin" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" + else + echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" + fi + fi + fi + # Check the option + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/postlogin was not found" >&2 + fi + if [ -e "/etc/pam.d/postlogin" ] ; then + PAM_FILE_PATH="/etc/pam.d/postlogin" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/postlogin was not found" >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -29353,17 +29456,6 @@ SELinux, user name, security context or both. The polyinstatied directories can be used to dedicate separate temporary directories to each account. CCE-83744-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if ! grep -Eq '^\s*session\s+required\s+pam_namespace.so\s*$' '/etc/pam.d/login' ; then - echo "session required pam_namespace.so" >> "/etc/pam.d/login" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -29392,6 +29484,17 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if ! grep -Eq '^\s*session\s+required\s+pam_namespace.so\s*$' '/etc/pam.d/login' ; then + echo "session required pam_namespace.so" >> "/etc/pam.d/login" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -29602,99 +29705,6 @@ updates as of version 0.1.65. AC-7 (a) Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. CCE-86107-0 - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*audit" - line="audit" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" - fi - done -fi - - name: Account Lockouts Must Be Logged - Check if system relies on authselect tool ansible.builtin.stat: path: /usr/bin/authselect @@ -30250,6 +30260,99 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*audit" + line="audit" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + fi + done +fi @@ -30360,207 +30463,13 @@ updated. 8.3.7 SRG-OS-000077-GPOS-00045 RHEL-08-020220 - 5.5.3 + 4.4.3.3.1 + 4.4.3.3.3 SV-230368r902759_rule Preventing re-use of previous passwords helps ensure that a compromised password is not re-used by a user. CCE-83478-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_remember='' -var_password_pam_remember_control_flag='' - - -var_password_pam_remember_control_flag="$(echo $var_password_pam_remember_control_flag | cut -d \, -f 1)" - -if [ -f /usr/bin/authselect ]; then - if authselect list-features minimal | grep -q with-pwhistory; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect enable-feature with-pwhistory - - authselect apply-changes -b - else - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "$PAM_FILE_PATH" - else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "$PAM_FILE_PATH" - fi - fi - fi - fi -else - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/password-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/password-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/password-auth" - else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/password-auth" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/password-auth" - else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/password-auth" - fi - fi - fi -fi - -PWHISTORY_CONF="/etc/security/pwhistory.conf" -if [ -f $PWHISTORY_CONF ]; then - regex="^\s*remember\s*=" - line="remember = $var_password_pam_remember" - if ! grep -q $regex $PWHISTORY_CONF; then - echo $line >> $PWHISTORY_CONF - else - sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF - fi - if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*password\s.*\bpam_pwhistory.so\s.*\bremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*pam_pwhistory.so.*)\bremember\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/password-auth was not found" >&2 - fi -else - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_remember"'/' "$PAM_FILE_PATH" - else - sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_remember"' \3/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -31419,105 +31328,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - - Limit Password Reuse: system-auth - Do not allow users to reuse recent passwords. This can be accomplished by using the -remember option for the pam_pwhistory PAM module. - - -On systems with newer versions of authselect, the pam_pwhistory PAM module -can be enabled via authselect feature: -authselect enable-feature with-pwhistory - -Otherwise, it should be enabled using an authselect custom profile. - -Newer systems also have the /etc/security/pwhistory.conf file for setting -pam_pwhistory module options. This file should be used whenever available. -Otherwise, the pam_pwhistory module options can be set in PAM files. - -The value for remember option must be equal or greater than - - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. - Newer versions of authselect contain an authselect feature to easily and properly -enable pam_pwhistory.so module. If this feature is not yet available in your -system, an authselect custom profile must be used to avoid integrity issues in PAM files. - 1 - 12 - 15 - 16 - 5 - 5.6.2.1.1 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - 3.5.8 - CCI-000200 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - IA-5(f) - IA-5(1)(e) - PR.AC-1 - PR.AC-6 - PR.AC-7 - Req-8.2.5 - 8.3.7 - SRG-OS-000077-GPOS-00045 - RHEL-08-020221 - 5.5.3 - SV-251717r902749_rule - Preventing re-use of previous passwords helps ensure that a compromised password is not -re-used by a user. - - CCE-83480-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then var_password_pam_remember='' @@ -31565,7 +31376,7 @@ if [ -f /usr/bin/authselect ]; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31585,17 +31396,17 @@ if [ -f /usr/bin/authselect ]; then fi fi else - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/password-auth"; then # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/password-auth")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/system-auth" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/password-auth" else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/password-auth" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/system-auth" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/password-auth" else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/password-auth" fi fi fi @@ -31610,8 +31421,8 @@ if [ -f $PWHISTORY_CONF ]; then else sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF fi - if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -31638,7 +31449,7 @@ if [ -f $PWHISTORY_CONF ]; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31652,10 +31463,10 @@ if [ -f $PWHISTORY_CONF ]; then authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else - PAM_FILE_PATH="/etc/pam.d/system-auth" + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -31682,7 +31493,7 @@ else authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31712,6 +31523,105 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Limit Password Reuse: system-auth + Do not allow users to reuse recent passwords. This can be accomplished by using the +remember option for the pam_pwhistory PAM module. + + +On systems with newer versions of authselect, the pam_pwhistory PAM module +can be enabled via authselect feature: +authselect enable-feature with-pwhistory + +Otherwise, it should be enabled using an authselect custom profile. + +Newer systems also have the /etc/security/pwhistory.conf file for setting +pam_pwhistory module options. This file should be used whenever available. +Otherwise, the pam_pwhistory module options can be set in PAM files. + +The value for remember option must be equal or greater than + + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. + Newer versions of authselect contain an authselect feature to easily and properly +enable pam_pwhistory.so module. If this feature is not yet available in your +system, an authselect custom profile must be used to avoid integrity issues in PAM files. + 1 + 12 + 15 + 16 + 5 + 5.6.2.1.1 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + 3.5.8 + CCI-000200 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + IA-5(f) + IA-5(1)(e) + PR.AC-1 + PR.AC-6 + PR.AC-7 + Req-8.2.5 + 8.3.7 + SRG-OS-000077-GPOS-00045 + RHEL-08-020221 + 4.4.3.3.1 + 4.4.3.3.3 + SV-251717r902749_rule + Preventing re-use of previous passwords helps ensure that a compromised password is not +re-used by a user. + + CCE-83480-4 - name: Gather the package facts package_facts: manager: auto @@ -32569,95 +32479,15 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - - Limit Password Reuse - Do not allow users to reuse recent passwords. This can be accomplished by using the -remember option for the pam_unix or pam_pwhistory PAM modules. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. - Newer versions of authselect contain an authselect feature to easily and properly -enable pam_pwhistory.so module. If this feature is not yet available in your -system, an authselect custom profile must be used to avoid integrity issues in PAM files. - BP28(R18) - 1 - 12 - 15 - 16 - 5 - 5.6.2.1.1 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - 3.5.8 - CCI-000200 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - IA-5(f) - IA-5(1)(e) - PR.AC-1 - PR.AC-6 - PR.AC-7 - Req-8.2.5 - 8.3.7 - SRG-OS-000077-GPOS-00045 - 5.4.3 - Preventing re-use of previous passwords helps ensure that a compromised password is not -re-used by a user. - - CCE-80666-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_password_pam_unix_remember='' +var_password_pam_remember='' +var_password_pam_remember_control_flag='' +var_password_pam_remember_control_flag="$(echo $var_password_pam_remember_control_flag | cut -d \, -f 1)" + if [ -f /usr/bin/authselect ]; then if authselect list-features minimal | grep -q with-pwhistory; then if ! authselect check; then @@ -32701,33 +32531,33 @@ if [ -f /usr/bin/authselect ]; then PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then # Line matching group + control + module was not found. Check group + module. if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "$PAM_FILE_PATH" else LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "$PAM_FILE_PATH" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "$PAM_FILE_PATH" else - echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "$PAM_FILE_PATH" fi fi fi fi else - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then # Line matching group + control + module was not found. Check group + module. if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "/etc/pam.d/system-auth" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/system-auth" else LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "/etc/pam.d/system-auth" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/system-auth" else - echo 'password '"requisite"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" fi fi fi @@ -32736,11 +32566,11 @@ fi PWHISTORY_CONF="/etc/security/pwhistory.conf" if [ -f $PWHISTORY_CONF ]; then regex="^\s*remember\s*=" - line="remember = $var_password_pam_unix_remember" + line="remember = $var_password_pam_remember" if ! grep -q $regex $PWHISTORY_CONF; then echo $line >> $PWHISTORY_CONF else - sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_unix_remember"'|g' $PWHISTORY_CONF + sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF fi if [ -e "/etc/pam.d/system-auth" ] ; then PAM_FILE_PATH="/etc/pam.d/system-auth" @@ -32830,9 +32660,9 @@ else fi # Check the option if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_unix_remember"'/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_remember"'/' "$PAM_FILE_PATH" else - sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_remember"' \3/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_remember"' \3/' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -32844,6 +32674,89 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Limit Password Reuse + Do not allow users to reuse recent passwords. This can be accomplished by using the +remember option for the pam_unix or pam_pwhistory PAM modules. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. + Newer versions of authselect contain an authselect feature to easily and properly +enable pam_pwhistory.so module. If this feature is not yet available in your +system, an authselect custom profile must be used to avoid integrity issues in PAM files. + BP28(R18) + 1 + 12 + 15 + 16 + 5 + 5.6.2.1.1 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + 3.5.8 + CCI-000200 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + IA-5(f) + IA-5(1)(e) + PR.AC-1 + PR.AC-6 + PR.AC-7 + Req-8.2.5 + 8.3.7 + SRG-OS-000077-GPOS-00045 + 5.4.3 + Preventing re-use of previous passwords helps ensure that a compromised password is not +re-used by a user. + + CCE-80666-1 - name: Gather the package facts package_facts: manager: auto @@ -33663,124 +33576,217 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - Account Lockouts Must Be Logged - PAM faillock locks an account due to excessive password failures, this event must be logged. - CCI-000044 - AC-7 (a) - SRG-OS-000021-GPOS-00005 - RHEL-08-020021 - SV-230343r743981_rule - Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. - - CCE-86099-9 - # Remediation is applicable only in certain platforms -if grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.2"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; then + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_unix_remember='' + if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock + if authselect list-features minimal | grep -q with-pwhistory; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect enable-feature with-pwhistory -authselect apply-changes -b + authselect apply-changes -b + else + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "$PAM_FILE_PATH" + else + echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" + fi + fi + fi + fi else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "/etc/pam.d/system-auth" + else + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "/etc/pam.d/system-auth" + else + echo 'password '"requisite"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + fi + fi fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - fi -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*audit" - line="audit" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF +PWHISTORY_CONF="/etc/security/pwhistory.conf" +if [ -f $PWHISTORY_CONF ]; then + regex="^\s*remember\s*=" + line="remember = $var_password_pam_unix_remember" + if ! grep -q $regex $PWHISTORY_CONF; then + echo $line >> $PWHISTORY_CONF + else + sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_unix_remember"'|g' $PWHISTORY_CONF fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then + if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + authselect apply-changes -b + fi + + if grep -qP '^\s*password\s.*\bpam_pwhistory.so\s.*\bremember\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*pam_pwhistory.so.*)\bremember\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/system-auth was not found" >&2 + fi +else + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi - authselect apply-changes -b - fi + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" fi - done + fi + # Check the option + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_unix_remember"'/' "$PAM_FILE_PATH" + else + sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_remember"' \3/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Account Lockouts Must Be Logged + PAM faillock locks an account due to excessive password failures, this event must be logged. + CCI-000044 + AC-7 (a) + SRG-OS-000021-GPOS-00005 + RHEL-08-020021 + SV-230343r743981_rule + Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. + + CCE-86099-9 - name: Account Lockouts Must Be Logged - Check if system relies on authselect tool ansible.builtin.stat: path: /usr/bin/authselect @@ -34362,6 +34368,105 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.2"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*audit" + line="audit" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -34452,122 +34557,13 @@ parameters should be defined in faillock.conf file.SRG-OS-000329-GPOS-00128 SRG-OS-000021-GPOS-00005 RHEL-08-020011 - 5.4.2 - 5.5.2 + 4.4.3.1.1 SV-230333r743966_rule By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking the account. CCE-80667-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_passwords_pam_faillock_deny='' - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*deny\s*=" - line="deny = $var_accounts_passwords_pam_faillock_deny" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(deny\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_deny"'|g' $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdeny\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdeny\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*deny' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" - fi - done -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -35258,93 +35254,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Configure the root Account for Failed Password Attempts - This rule configures the system to lock out the root account after a number of -incorrect login attempts using pam_faillock.so. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - BP28(R18) - 1 - 12 - 15 - 16 - DSS05.04 - DSS05.10 - DSS06.10 - CCI-002238 - CCI-000044 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - 0421 - 0422 - 0431 - 0974 - 1173 - 1401 - 1504 - 1505 - 1546 - 1557 - 1558 - 1559 - 1560 - 1561 - A.18.1.4 - A.9.2.1 - A.9.2.4 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(b) - IA-5(c) - PR.AC-7 - FMT_MOF_EXT.1 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020023 - SV-230345r743984_rule - By limiting the number of failed logon attempts, the risk of unauthorized system access via -user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking -the account. - - CCE-80668-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_deny='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -35376,10 +35291,12 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*even_deny_root" - line="even_deny_root" + regex="^\s*deny\s*=" + line="deny = $var_accounts_passwords_pam_faillock_deny" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(deny\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_deny"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -35417,8 +35334,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\beven_deny_root\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\beven_deny_root\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdeny\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdeny\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -35431,9 +35348,12 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*even_deny_root' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ even_deny_root/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ even_deny_root/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*deny' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" fi done fi @@ -35442,6 +35362,91 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the root Account for Failed Password Attempts + This rule configures the system to lock out the root account after a number of +incorrect login attempts using pam_faillock.so. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + BP28(R18) + 1 + 12 + 15 + 16 + DSS05.04 + DSS05.10 + DSS06.10 + CCI-002238 + CCI-000044 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + 0421 + 0422 + 0431 + 0974 + 1173 + 1401 + 1504 + 1505 + 1546 + 1557 + 1558 + 1559 + 1560 + 1561 + A.18.1.4 + A.9.2.1 + A.9.2.4 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(b) + IA-5(c) + PR.AC-7 + FMT_MOF_EXT.1 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020023 + 4.4.3.1.3 + SV-230345r743984_rule + By limiting the number of failed logon attempts, the risk of unauthorized system access via +user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking +the account. + + CCE-80668-7 - name: Gather the package facts package_facts: manager: auto @@ -36076,56 +36081,9 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Lock Accounts Must Persist - This rule ensures that the system lock out accounts using pam_faillock.so persist -after system reboot. From "pam_faillock" man pages: -Note that the default directory that "pam_faillock" uses is usually cleared on system -boot so the access will be reenabled after system reboot. If that is undesirable, a different -tally directory must be set with the "dir" option. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - -The chosen profile expects the directory to be . - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - CCI-000044 - CCI-002238 - AC-7(b) - AC-7(a) - AC-7.1(ii) - SRG-OS-000021-GPOS-00005 - SRG-OS-000329-GPOS-00128 - RHEL-08-020016 - RHEL-08-020017 - SV-230338r627750_rule - SV-230339r743975_rule - Locking out user accounts after a number of incorrect attempts prevents direct password -guessing attacks. In combination with the silent option, user enumeration attacks -are also mitigated. - - CCE-86067-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_accounts_passwords_pam_faillock_dir='' - - if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -36157,12 +36115,10 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*dir\s*=" - line="dir = $var_accounts_passwords_pam_faillock_dir" + regex="^\s*even_deny_root" + line="even_deny_root" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(dir\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_dir"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -36200,8 +36156,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdir\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdir\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\beven_deny_root\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\beven_deny_root\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -36214,34 +36170,61 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*dir' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*even_deny_root' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ even_deny_root/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ even_deny_root/' "$pam_file" fi done fi -if ! rpm -q --quiet "python3-libselinux" ; then - yum install -y "python3-libselinux" -fi -if ! rpm -q --quiet "python3-policycoreutils" ; then - yum install -y "python3-policycoreutils" -fi -if ! rpm -q --quiet "policycoreutils-python-utils" ; then - yum install -y "policycoreutils-python-utils" -fi - -mkdir -p "$var_accounts_passwords_pam_faillock_dir" -semanage fcontext -a -t faillog_t "$var_accounts_passwords_pam_faillock_dir(/.*)?" -restorecon -R -v "$var_accounts_passwords_pam_faillock_dir" - else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Lock Accounts Must Persist + This rule ensures that the system lock out accounts using pam_faillock.so persist +after system reboot. From "pam_faillock" man pages: +Note that the default directory that "pam_faillock" uses is usually cleared on system +boot so the access will be reenabled after system reboot. If that is undesirable, a different +tally directory must be set with the "dir" option. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + +The chosen profile expects the directory to be . + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + CCI-000044 + CCI-002238 + AC-7(b) + AC-7(a) + AC-7.1(ii) + SRG-OS-000021-GPOS-00005 + SRG-OS-000329-GPOS-00128 + RHEL-08-020016 + RHEL-08-020017 + SV-230338r627750_rule + SV-230339r743975_rule + Locking out user accounts after a number of incorrect attempts prevents direct password +guessing attacks. In combination with the silent option, user enumeration attacks +are also mitigated. + + CCE-86067-6 - name: Gather the package facts package_facts: manager: auto @@ -36978,39 +36961,12 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Enforce pam_faillock for Local Accounts Only - The pam_faillock module's local_users_only parameter controls requirements for -enforcing failed lockout attempts only for local user accounts and ignoring centralized user -account management failed attempt configurations. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - Using this rule bypasses pam_faillock's functionality and should be used in cases -where centralized management such as LDAP or Active Directory is in use. - CCI-000015 - AC-2(1) - SRG-OS-000001-GPOS-00001 - The operating system must provide automated mechanisms for supporting account management -functions. Enterprise environments make application account management challenging and -complex. A manual process for account management functions adds the risk of a potential -oversight or other error. Locking out remote accounts may cause unintentional DoS. - - CCE-83401-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_dir='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -37042,10 +36998,12 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*local_users_only" - line="local_users_only" + regex="^\s*dir\s*=" + line="dir = $var_accounts_passwords_pam_faillock_dir" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(dir\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_dir"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -37083,8 +37041,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\blocal_users_only\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\blocal_users_only\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdir\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdir\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -37097,17 +37055,64 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*local_users_only' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ local_users_only/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ local_users_only/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*dir' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" fi done fi +if ! rpm -q --quiet "python3-libselinux" ; then + yum install -y "python3-libselinux" +fi +if ! rpm -q --quiet "python3-policycoreutils" ; then + yum install -y "python3-policycoreutils" +fi +if ! rpm -q --quiet "policycoreutils-python-utils" ; then + yum install -y "policycoreutils-python-utils" +fi + +mkdir -p "$var_accounts_passwords_pam_faillock_dir" +semanage fcontext -a -t faillog_t "$var_accounts_passwords_pam_faillock_dir(/.*)?" +restorecon -R -v "$var_accounts_passwords_pam_faillock_dir" + else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enforce pam_faillock for Local Accounts Only + The pam_faillock module's local_users_only parameter controls requirements for +enforcing failed lockout attempts only for local user accounts and ignoring centralized user +account management failed attempt configurations. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + Using this rule bypasses pam_faillock's functionality and should be used in cases +where centralized management such as LDAP or Active Directory is in use. + CCI-000015 + AC-2(1) + SRG-OS-000001-GPOS-00001 + The operating system must provide automated mechanisms for supporting account management +functions. Enterprise environments make application account management challenging and +complex. A manual process for account management functions adds the risk of a potential +oversight or other error. Locking out remote accounts may cause unintentional DoS. + + CCE-83401-0 - name: Gather the package facts package_facts: manager: auto @@ -37717,102 +37722,9 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Set Interval For Counting Failed Password Attempts - Utilizing pam_faillock.so, the fail_interval directive configures the system -to lock out an account after a number of incorrect login attempts within a specified time -period. - -Ensure that the file /etc/security/faillock.conf contains the following entry: -fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. - - -In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - BP28(R18) - 1 - 12 - 15 - 16 - DSS05.04 - DSS05.10 - DSS06.10 - CCI-000044 - CCI-002236 - CCI-002237 - CCI-002238 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - 0421 - 0422 - 0431 - 0974 - 1173 - 1401 - 1504 - 1505 - 1546 - 1557 - 1558 - 1559 - 1560 - 1561 - A.18.1.4 - A.9.2.1 - A.9.2.4 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(a) - PR.AC-7 - FIA_AFL.1 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020012 - RHEL-08-020013 - SV-230334r627750_rule - SV-230335r743969_rule - By limiting the number of failed logon attempts the risk of unauthorized system -access via user password guessing, otherwise known as brute-forcing, is reduced. -Limits are imposed by locking the account. - - CCE-80669-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_accounts_passwords_pam_faillock_fail_interval='' - - if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -37844,12 +37756,10 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*fail_interval\s*=" - line="fail_interval = $var_accounts_passwords_pam_faillock_fail_interval" + regex="^\s*local_users_only" + line="local_users_only" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(fail_interval\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_fail_interval"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -37887,8 +37797,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bfail_interval\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bfail_interval\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\blocal_users_only\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\blocal_users_only\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -37901,12 +37811,9 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*fail_interval' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*local_users_only' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ local_users_only/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ local_users_only/' "$pam_file" fi done fi @@ -37915,6 +37822,96 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set Interval For Counting Failed Password Attempts + Utilizing pam_faillock.so, the fail_interval directive configures the system +to lock out an account after a number of incorrect login attempts within a specified time +period. + +Ensure that the file /etc/security/faillock.conf contains the following entry: +fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. + + +In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + BP28(R18) + 1 + 12 + 15 + 16 + DSS05.04 + DSS05.10 + DSS06.10 + CCI-000044 + CCI-002236 + CCI-002237 + CCI-002238 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + 0421 + 0422 + 0431 + 0974 + 1173 + 1401 + 1504 + 1505 + 1546 + 1557 + 1558 + 1559 + 1560 + 1561 + A.18.1.4 + A.9.2.1 + A.9.2.4 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(a) + PR.AC-7 + FIA_AFL.1 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020012 + RHEL-08-020013 + SV-230334r627750_rule + SV-230335r743969_rule + By limiting the number of failed logon attempts the risk of unauthorized system +access via user password guessing, otherwise known as brute-forcing, is reduced. +Limits are imposed by locking the account. + + CCE-80669-5 - name: Gather the package facts package_facts: manager: auto @@ -38584,48 +38581,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Do Not Show System Messages When Unsuccessful Logon Attempts Occur - This rule ensures the system prevents informative messages from being presented to the user -pertaining to logon information after a number of incorrect login attempts using -pam_faillock.so. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - CCI-002238 - CCI-000044 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020018 - RHEL-08-020019 - SV-230340r627750_rule - SV-230341r743978_rule - The pam_faillock module without the silent option will leak information about the existence or -non-existence of a user account in the system because the failures are not recorded for unknown -users. The message about the user account being locked is never displayed for non-existing user -accounts allowing the adversary to infer that a particular account exists or not on the system. - - CCE-87096-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_fail_interval='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -38653,20 +38614,73 @@ done fi - AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*silent" - line="silent" + regex="^\s*fail_interval\s*=" + line="fail_interval = $var_accounts_passwords_pam_faillock_fail_interval" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(fail_interval\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_fail_interval"'|g' $FAILLOCK_CONF fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bfail_interval\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bfail_interval\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so\s*preauth.*silent' "$pam_file"; then - sed -i --follow-symlinks '/^\s*auth.*pam_faillock\.so.*preauth/ s/$/ silent/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*fail_interval' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" fi done fi @@ -38675,6 +38689,45 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Do Not Show System Messages When Unsuccessful Logon Attempts Occur + This rule ensures the system prevents informative messages from being presented to the user +pertaining to logon information after a number of incorrect login attempts using +pam_faillock.so. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + CCI-002238 + CCI-000044 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020018 + RHEL-08-020019 + SV-230340r627750_rule + SV-230341r743978_rule + The pam_faillock module without the silent option will leak information about the existence or +non-existence of a user account in the system because the failures are not recorded for unknown +users. The message about the user account being locked is never displayed for non-existing user +accounts allowing the adversary to infer that a particular account exists or not on the system. + + CCE-87096-4 - name: Gather the package facts package_facts: manager: auto @@ -38905,6 +38958,58 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*silent" + line="silent" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so\s*preauth.*silent' "$pam_file"; then + sed -i --follow-symlinks '/^\s*auth.*pam_faillock\.so.*preauth/ s/$/ silent/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -39004,7 +39109,7 @@ parameters should be defined in faillock.conf file.SRG-OS-000021-GPOS-00005 RHEL-08-020014 RHEL-08-020015 - 5.5.2 + 4.4.3.1.2 SV-230336r627750_rule SV-230337r743972_rule By limiting the number of failed logon attempts the risk of unauthorized system @@ -39012,114 +39117,6 @@ access via user password guessing, otherwise known as brute-forcing, is reduced. Limits are imposed by locking the account. CCE-80670-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_passwords_pam_faillock_unlock_time='' - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*unlock_time\s*=" - line="unlock_time = $var_accounts_passwords_pam_faillock_unlock_time" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(unlock_time\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_unlock_time"'|g' $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bunlock_time\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bunlock_time\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*unlock_time' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" - fi - done -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -39819,6 +39816,114 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_accounts_passwords_pam_faillock_unlock_time='' + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*unlock_time\s*=" + line="unlock_time = $var_accounts_passwords_pam_faillock_unlock_time" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(unlock_time\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_unlock_time"'|g' $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bunlock_time\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bunlock_time\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*unlock_time' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40065,6 +40170,7 @@ length credit for each digit. Modify the dcredit setting 8.3.6 SRG-OS-000071-GPOS-00039 RHEL-08-020130 + 4.4.3.2.3 SV-230359r858775_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -40078,42 +40184,6 @@ Requiring digits makes password guessing attacks more difficult by ensuring a la search space. CCE-80653-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_dcredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dcredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dcredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^dcredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^dcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80653-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40161,6 +40231,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_dcredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dcredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dcredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^dcredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^dcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80653-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40181,6 +40287,7 @@ fi IA-5(4) SRG-OS-000480-GPOS-00225 RHEL-08-020300 + 4.4.3.2.6 SV-230377r858789_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at @@ -40193,42 +40300,6 @@ password is compromised. Passwords with dictionary words may be more vulnerable to password-guessing attacks. CCE-86233-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_dictcheck='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dictcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dictcheck" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^dictcheck\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^dictcheck\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-86233-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40272,6 +40343,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_dictcheck='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dictcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dictcheck" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^dictcheck\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^dictcheck\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-86233-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40345,6 +40452,7 @@ when changing passwords. PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020170 + 4.4.3.2.1 SV-230363r858783_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, @@ -40361,42 +40469,6 @@ newly changed passwords should not resemble previously compromised ones. Note that passwords which are changed on compromised systems will still be compromised, however. CCE-80654-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_difok='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^difok") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_difok" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^difok\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^difok\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80654-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40442,6 +40514,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_difok='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^difok") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_difok" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^difok\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^difok\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80654-7" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40469,28 +40577,6 @@ complex. A manual process for account management functions adds the risk of a po oversight or other error. CCE-83364-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/security/pwquality.conf" ] ; then - - LC_ALL=C sed -i "/^\s*local_users_only/Id" "/etc/security/pwquality.conf" -else - touch "/etc/security/pwquality.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/security/pwquality.conf" - -cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" -# Insert at the end of the file -printf '%s\n' "local_users_only" >> "/etc/security/pwquality.conf" -# Clean up after ourselves. -rm "/etc/security/pwquality.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40520,6 +40606,28 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/security/pwquality.conf" ] ; then + + LC_ALL=C sed -i "/^\s*local_users_only/Id" "/etc/security/pwquality.conf" +else + touch "/etc/security/pwquality.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/security/pwquality.conf" + +cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" +# Insert at the end of the file +printf '%s\n' "local_users_only" >> "/etc/security/pwquality.conf" +# Clean up after ourselves. +rm "/etc/security/pwquality.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40552,6 +40660,7 @@ to use complex passwords. SRG-OS-000078-GPOS-00046 SRG-OS-000480-GPOS-00225 SRG-OS-000069-GPOS-00037 + 4.4.3.2.7 Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. @@ -40561,28 +40670,6 @@ password. The more complex the password, the greater the number of possible comb that need to be tested before the password is compromised. CCE-83377-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/security/pwquality.conf" ] ; then - - LC_ALL=C sed -i "/^\s*enforce_for_root/Id" "/etc/security/pwquality.conf" -else - touch "/etc/security/pwquality.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/security/pwquality.conf" - -cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" -# Insert at the end of the file -printf '%s\n' "enforce_for_root" >> "/etc/security/pwquality.conf" -# Clean up after ourselves. -rm "/etc/security/pwquality.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40618,6 +40705,28 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/security/pwquality.conf" ] ; then + + LC_ALL=C sed -i "/^\s*enforce_for_root/Id" "/etc/security/pwquality.conf" +else + touch "/etc/security/pwquality.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/security/pwquality.conf" + +cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" +# Insert at the end of the file +printf '%s\n' "enforce_for_root" >> "/etc/security/pwquality.conf" +# Clean up after ourselves. +rm "/etc/security/pwquality.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40706,6 +40815,7 @@ length credit for each lowercase character. Modify the lcredit8.3.6 SRG-OS-000070-GPOS-00038 RHEL-08-020120 + 4.4.3.2.3 SV-230358r858773_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -40719,42 +40829,6 @@ Requiring a minimum number of lowercase characters makes password guessing attac more difficult by ensuring a larger search space. CCE-80655-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_lcredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^lcredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_lcredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^lcredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^lcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80655-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40802,6 +40876,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_lcredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^lcredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_lcredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^lcredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^lcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80655-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40883,42 +40993,6 @@ more complex a password, the greater the number of possible combinations that ne password is compromised. CCE-81034-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_maxclassrepeat='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxclassrepeat") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxclassrepeat" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^maxclassrepeat\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^maxclassrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-81034-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40963,6 +41037,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_maxclassrepeat='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxclassrepeat") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxclassrepeat" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^maxclassrepeat\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^maxclassrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-81034-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41033,6 +41143,7 @@ run of (PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020150 + 4.4.3.2.4 SV-230361r858779_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at @@ -41045,42 +41156,6 @@ password is compromised. Passwords with excessive repeating characters may be more vulnerable to password-guessing attacks. CCE-82066-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_maxrepeat='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxrepeat") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxrepeat" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^maxrepeat\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^maxrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-82066-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41122,6 +41197,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_maxrepeat='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxrepeat") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxrepeat" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^maxrepeat\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^maxrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-82066-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41218,7 +41329,7 @@ differing categories of characters when changing passwords.PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020160 - 5.5.1 + 4.4.3.2.3 SV-230362r858781_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts @@ -41232,42 +41343,6 @@ Requiring a minimum number of character categories makes password guessing attac by ensuring a larger search space. CCE-82046-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_minclass='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minclass") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minclass" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^minclass\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^minclass\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-82046-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41311,6 +41386,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_minclass='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minclass") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minclass" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^minclass\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^minclass\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-82046-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41399,7 +41510,7 @@ after pam_pwquality to set minimum password length requirements.8.3.6 SRG-OS-000078-GPOS-00046 RHEL-08-020230 - 5.5.1 + 4.4.3.2.2 SV-230369r858785_rule The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. @@ -41412,42 +41523,6 @@ helps to exponentially increase the time and/or resources required to compromise the password. CCE-80656-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_minlen='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minlen") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minlen" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^minlen\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^minlen\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80656-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41497,6 +41572,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_minlen='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minlen") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minlen" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^minlen\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^minlen\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80656-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41586,6 +41697,7 @@ to require use of a special character in passwords. FMT_SMF_EXT.1 SRG-OS-000266-GPOS-00101 RHEL-08-020280 + 4.4.3.2.3 SV-230375r858787_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -41599,6 +41711,50 @@ Requiring a minimum number of special characters makes password guessing attacks more difficult by ensuring a larger search space. CCE-80663-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80663-8 + - DISA-STIG-RHEL-08-020280 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-5(1)(a) + - NIST-800-53-IA-5(4) + - NIST-800-53-IA-5(c) + - accounts_password_pam_ocredit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_password_pam_ocredit # promote to variable + set_fact: + var_password_pam_ocredit: !!str + tags: + - always + +- name: Ensure PAM Enforces Password Requirements - Minimum Special Characters - Ensure + PAM variable ocredit is set accordingly + ansible.builtin.lineinfile: + create: true + dest: /etc/security/pwquality.conf + regexp: ^#?\s*ocredit + line: ocredit = {{ var_password_pam_ocredit }} + when: '"pam" in ansible_facts.packages' + tags: + - CCE-80663-8 + - DISA-STIG-RHEL-08-020280 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-5(1)(a) + - NIST-800-53-IA-5(4) + - NIST-800-53-IA-5(c) + - accounts_password_pam_ocredit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then @@ -41634,50 +41790,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80663-8 - - DISA-STIG-RHEL-08-020280 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-5(1)(a) - - NIST-800-53-IA-5(4) - - NIST-800-53-IA-5(c) - - accounts_password_pam_ocredit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_password_pam_ocredit # promote to variable - set_fact: - var_password_pam_ocredit: !!str - tags: - - always - -- name: Ensure PAM Enforces Password Requirements - Minimum Special Characters - Ensure - PAM variable ocredit is set accordingly - ansible.builtin.lineinfile: - create: true - dest: /etc/security/pwquality.conf - regexp: ^#?\s*ocredit - line: ocredit = {{ var_password_pam_ocredit }} - when: '"pam" in ansible_facts.packages' - tags: - - CCE-80663-8 - - DISA-STIG-RHEL-08-020280 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-5(1)(a) - - NIST-800-53-IA-5(4) - - NIST-800-53-IA-5(c) - - accounts_password_pam_ocredit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -41703,68 +41815,6 @@ Edit the password section in makes the system less prone to dictionary attacks. CCE-85877-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwquality.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwquality.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwquality.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^account.*required.*pam_permit\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwquality.so' "$PAM_FILE_PATH" - else - echo 'password '"requisite"' pam_pwquality.so' >> "$PAM_FILE_PATH" - fi - fi -fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -42024,32 +42074,11 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure PAM password complexity module is enabled in system-auth - To enable PAM password complexity in system-auth file: -Edit the password section in -/etc/pam.d/system-auth to show -password requisite pam_pwquality.so. - CCI-000366 - SRG-OS-000480-GPOS-00227 - RHEL-08-020101 - SV-251713r902740_rule - Enabling PAM password complexity permits to enforce strong passwords and consequently -makes the system less prone to dictionary attacks. - - CCE-85872-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -42076,7 +42105,7 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -42100,13 +42129,34 @@ fi authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure PAM password complexity module is enabled in system-auth + To enable PAM password complexity in system-auth file: +Edit the password section in +/etc/pam.d/system-auth to show +password requisite pam_pwquality.so. + CCI-000366 + SRG-OS-000480-GPOS-00227 + RHEL-08-020101 + SV-251713r902740_rule + Enabling PAM password complexity permits to enforce strong passwords and consequently +makes the system less prone to dictionary attacks. + + CCE-85872-0 - name: Gather the package facts package_facts: manager: auto @@ -42366,135 +42416,11 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session - To configure the number of retry prompts that are permitted per-session: - -Edit the /etc/security/pwquality.conf to include - -retry=, or a lower value if site -policy is more restrictive. The DoD requirement is a maximum of 3 prompts -per session. - 1 - 11 - 12 - 15 - 16 - 3 - 5 - 9 - 5.5.3 - BAI10.01 - BAI10.02 - BAI10.03 - BAI10.05 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - CCI-000192 - CCI-000366 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - 4.3.4.3.2 - 4.3.4.3.3 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - SR 7.6 - A.12.1.2 - A.12.5.1 - A.12.6.2 - A.14.2.2 - A.14.2.3 - A.14.2.4 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(a) - IA-5(4) - PR.AC-1 - PR.AC-6 - PR.AC-7 - PR.IP-1 - FMT_MOF_EXT.1 - SRG-OS-000069-GPOS-00037 - SRG-OS-000480-GPOS-00227 - RHEL-08-020104 - 5.5.1 - SV-251716r858737_rule - Setting the password retry prompts that are permitted on a per-session basis to a low value -requires some software, such as SSH, to re-connect. This can slow down and -draw additional attention to some types of password-guessing attacks. Note that this -is different from account lockout, which is provided by the pam_faillock module. - - CCE-80664-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_password_pam_retry='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^retry") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_retry" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^retry\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^retry\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80664-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - - if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -42521,59 +42447,24 @@ fi authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b fi - -if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" -fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - - if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwquality.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwquality.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwquality.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^account.*required.*pam_permit\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwquality.so' "$PAM_FILE_PATH" + else + echo 'password '"requisite"' pam_pwquality.so' >> "$PAM_FILE_PATH" fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b fi - -if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -42587,6 +42478,105 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session + To configure the number of retry prompts that are permitted per-session: + +Edit the /etc/security/pwquality.conf to include + +retry=, or a lower value if site +policy is more restrictive. The DoD requirement is a maximum of 3 prompts +per session. + 1 + 11 + 12 + 15 + 16 + 3 + 5 + 9 + 5.5.3 + BAI10.01 + BAI10.02 + BAI10.03 + BAI10.05 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + CCI-000192 + CCI-000366 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + 4.3.4.3.2 + 4.3.4.3.3 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + SR 7.6 + A.12.1.2 + A.12.5.1 + A.12.6.2 + A.14.2.2 + A.14.2.3 + A.14.2.4 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(a) + IA-5(4) + PR.AC-1 + PR.AC-6 + PR.AC-7 + PR.IP-1 + FMT_MOF_EXT.1 + SRG-OS-000069-GPOS-00037 + SRG-OS-000480-GPOS-00227 + RHEL-08-020104 + 4.4.3.3.1 + SV-251716r858737_rule + Setting the password retry prompts that are permitted on a per-session basis to a low value +requires some software, such as SSH, to re-connect. This can slow down and +draw additional attention to some types of password-guessing attacks. Note that this +is different from account lockout, which is provided by the pam_faillock module. + + CCE-80664-6 - name: Gather the package facts package_facts: manager: auto @@ -43045,6 +43035,128 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_retry='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^retry") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_retry" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^retry\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^retry\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80664-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + + if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + +if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" +fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/password-auth was not found" >&2 +fi + + if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + +if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" +fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43135,6 +43247,7 @@ length credit for each uppercase character. Modify the ucreditSRG-OS-000069-GPOS-00037 SRG-OS-000070-GPOS-00038 RHEL-08-020110 + 4.4.3.2.3 SV-230357r858771_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts @@ -43145,42 +43258,6 @@ complex the password, the greater the number of possible combinations that need the password is compromised. CCE-80665-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_ucredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ucredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_ucredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^ucredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^ucredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80665-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43226,6 +43303,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_ucredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ucredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_ucredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^ucredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^ucredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80665-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43308,6 +43421,7 @@ algorithm for password hashing: Req-8.2.1 8.3.2 SRG-OS-000073-GPOS-00041 + 4.5.1.1 Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords that @@ -43321,26 +43435,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-80891-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q libuser; then - -LIBUSER_CONF="/etc/libuser.conf" -CRYPT_STYLE_REGEX='[[:space:]]*\[defaults](.*(\n)+)+?[[:space:]]*crypt_style[[:space:]]*' - -# Try find crypt_style in [defaults] section. If it is here, then change algorithm to sha512. -# If it isn't here, then add it to [defaults] section. -if grep -qzosP $CRYPT_STYLE_REGEX $LIBUSER_CONF ; then - sed -i "s/\(crypt_style[[:space:]]*=[[:space:]]*\).*/\1sha512/g" $LIBUSER_CONF -elif grep -qs "\[defaults]" $LIBUSER_CONF ; then - sed -i "/[[:space:]]*\[defaults]/a crypt_style = sha512" $LIBUSER_CONF -else - echo -e "[defaults]\ncrypt_style = sha512" >> $LIBUSER_CONF -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43384,6 +43478,26 @@ fi - no_reboot_needed - restrict_strategy - set_password_hashing_algorithm_libuserconf + + # Remediation is applicable only in certain platforms +if rpm --quiet -q libuser; then + +LIBUSER_CONF="/etc/libuser.conf" +CRYPT_STYLE_REGEX='[[:space:]]*\[defaults](.*(\n)+)+?[[:space:]]*crypt_style[[:space:]]*' + +# Try find crypt_style in [defaults] section. If it is here, then change algorithm to sha512. +# If it isn't here, then add it to [defaults] section. +if grep -qzosP $CRYPT_STYLE_REGEX $LIBUSER_CONF ; then + sed -i "s/\(crypt_style[[:space:]]*=[[:space:]]*\).*/\1sha512/g" $LIBUSER_CONF +elif grep -qs "\[defaults]" $LIBUSER_CONF ; then + sed -i "/[[:space:]]*\[defaults]/a crypt_style = sha512" $LIBUSER_CONF +else + echo -e "[defaults]\ncrypt_style = sha512" >> $LIBUSER_CONF +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43459,7 +43573,7 @@ the system will use 8.3.2 SRG-OS-000073-GPOS-00041 RHEL-08-010110 - 5.5.4 + 4.5.1.1 SV-230231r877397_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords @@ -43468,37 +43582,6 @@ that are encrypted with a weak algorithm are no more protected than if they are Using a stronger hashing algorithm makes password cracking attacks more difficult. CCE-80892-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_password_hashing_algorithm='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ENCRYPT_METHOD") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_password_hashing_algorithm" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^ENCRYPT_METHOD\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^ENCRYPT_METHOD\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80892-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43548,6 +43631,37 @@ fi - no_reboot_needed - restrict_strategy - set_password_hashing_algorithm_logindefs + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_password_hashing_algorithm='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ENCRYPT_METHOD") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_password_hashing_algorithm" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^ENCRYPT_METHOD\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^ENCRYPT_METHOD\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80892-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43636,7 +43750,7 @@ the default. SRG-OS-000073-GPOS-00041 SRG-OS-000120-GPOS-00061 RHEL-08-010160 - 5.5.4 + 4.4.3.4.3 SV-230237r809276_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can @@ -43651,67 +43765,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-85945-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -44008,6 +44061,67 @@ fi - medium_severity - no_reboot_needed - set_password_hashing_algorithm_passwordauth + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/password-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44096,7 +44210,7 @@ the default. SRG-OS-000073-GPOS-00041 SRG-OS-000120-GPOS-00061 RHEL-08-010159 - 5.5.4 + 4.4.3.4.3 SV-244524r809331_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can @@ -44111,67 +44225,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-80893-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/system-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -44466,6 +44519,67 @@ fi - medium_severity - no_reboot_needed - set_password_hashing_algorithm_systemauth + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44498,23 +44612,6 @@ they are kept in plain text. Using more hashing rounds makes password cracking attacks more difficult. CCE-89707-4 - -if [ -e "/etc/login.defs" ] ; then - - LC_ALL=C sed -i "/^\s*SHA_CRYPT_MIN_ROUNDS\s*/Id" "/etc/login.defs" -else - printf '%s\n' "Path '/etc/login.defs' wasn't found on this system. Refusing to continue." >&2 - return 1 -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/login.defs" - -cp "/etc/login.defs" "/etc/login.defs.bak" -# Insert at the end of the file -printf '%s\n' "SHA_CRYPT_MIN_ROUNDS 5000" >> "/etc/login.defs" -# Clean up after ourselves. -rm "/etc/login.defs.bak" - - name: Set Password Hashing Rounds in /etc/login.defs - Ensure SHA_CRYPT_MIN_ROUNDS has Minimum Value of 5000 ansible.builtin.replace: @@ -44548,6 +44645,23 @@ rm "/etc/login.defs.bak" - no_reboot_needed - restrict_strategy - set_password_hashing_min_rounds_logindefs + + +if [ -e "/etc/login.defs" ] ; then + + LC_ALL=C sed -i "/^\s*SHA_CRYPT_MIN_ROUNDS\s*/Id" "/etc/login.defs" +else + printf '%s\n' "Path '/etc/login.defs' wasn't found on this system. Refusing to continue." >&2 + return 1 +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/login.defs" + +cp "/etc/login.defs" "/etc/login.defs.bak" +# Insert at the end of the file +printf '%s\n' "SHA_CRYPT_MIN_ROUNDS 5000" >> "/etc/login.defs" +# Clean up after ourselves. +rm "/etc/login.defs.bak" @@ -44615,52 +44729,6 @@ The debug-shell service can be disabled with the followin on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. CCE-80876-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - enabled: false - name: debug-shell.service - - include disable_debug-shell - -class disable_debug-shell { - service {'debug-shell': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'debug-shell.service' -"$SYSTEMCTL_EXEC" disable 'debug-shell.service' -"$SYSTEMCTL_EXEC" mask 'debug-shell.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files debug-shell.socket; then - "$SYSTEMCTL_EXEC" stop 'debug-shell.socket' - "$SYSTEMCTL_EXEC" mask 'debug-shell.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'debug-shell.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["debug-shell"] - - name: Block Disable service debug-shell block: @@ -44730,6 +44798,52 @@ disabled = ["debug-shell"] - medium_severity - no_reboot_needed - service_debug-shell_disabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - enabled: false + name: debug-shell.service + + +[customizations.services] +disabled = ["debug-shell"] + + include disable_debug-shell + +class disable_debug-shell { + service {'debug-shell': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'debug-shell.service' +"$SYSTEMCTL_EXEC" disable 'debug-shell.service' +"$SYSTEMCTL_EXEC" mask 'debug-shell.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files debug-shell.socket; then + "$SYSTEMCTL_EXEC" stop 'debug-shell.socket' + "$SYSTEMCTL_EXEC" mask 'debug-shell.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'debug-shell.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44828,6 +44942,47 @@ the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-80784-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80784-2 + - DISA-STIG-RHEL-08-040172 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_burstaction + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + +- name: Disable Ctrl-Alt-Del Burst Action + lineinfile: + dest: /etc/systemd/system.conf + state: present + regexp: ^CtrlAltDelBurstAction + line: CtrlAltDelBurstAction=none + create: true + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"systemd" in ansible_facts.packages' + tags: + - CCE-80784-2 + - DISA-STIG-RHEL-08-040172 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_burstaction + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -44871,47 +45026,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80784-2 - - DISA-STIG-RHEL-08-040172 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_burstaction - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - -- name: Disable Ctrl-Alt-Del Burst Action - lineinfile: - dest: /etc/systemd/system.conf - state: present - regexp: ^CtrlAltDelBurstAction - line: CtrlAltDelBurstAction=none - create: true - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"systemd" in ansible_facts.packages' - tags: - - CCE-80784-2 - - DISA-STIG-RHEL-08-040172 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_burstaction - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed @@ -45008,6 +45122,26 @@ can reboot the system. If accidentally pressed, as could happen in the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-80785-9 + - name: Disable Ctrl-Alt-Del Reboot Activation + systemd: + name: ctrl-alt-del.target + force: true + masked: true + state: stopped + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80785-9 + - DISA-STIG-RHEL-08-040170 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_reboot + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -45029,26 +45163,6 @@ systemctl mask --now ctrl-alt-del.target else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable Ctrl-Alt-Del Reboot Activation - systemd: - name: ctrl-alt-del.target - force: true - masked: true - state: stopped - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80785-9 - - DISA-STIG-RHEL-08-040170 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_reboot - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed @@ -45162,40 +45276,6 @@ It is also required to change the runtime configuration, run: or other services, weakening system security. CCE-80826-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -# Verify that Interactive Boot is Disabled in /etc/default/grub -CONFIRM_SPAWN_YES="systemd.confirm_spawn\(=\(1\|yes\|true\|on\)\|\b\)" -CONFIRM_SPAWN_NO="systemd.confirm_spawn=no" - -if grep -q "\(GRUB_CMDLINE_LINUX\|GRUB_CMDLINE_LINUX_DEFAULT\)" /etc/default/grub -then - sed -i "s/${CONFIRM_SPAWN_YES}/${CONFIRM_SPAWN_NO}/" /etc/default/grub -fi - -# make sure GRUB_DISABLE_RECOVERY=true -if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then - # modify the GRUB command-line if an GRUB_DISABLE_RECOVERY= arg already exists - sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' /etc/default/grub -else - # no GRUB_DISABLE_RECOVERY=arg is present, append it to file - echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' -fi - - - -# Remove 'systemd.confirm_spawn' kernel argument also from runtime settings -/sbin/grubby --update-kernel=ALL --remove-args="systemd.confirm_spawn" - - -#Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn -grub2-mkconfig -o /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -45290,6 +45370,40 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +# Verify that Interactive Boot is Disabled in /etc/default/grub +CONFIRM_SPAWN_YES="systemd.confirm_spawn\(=\(1\|yes\|true\|on\)\|\b\)" +CONFIRM_SPAWN_NO="systemd.confirm_spawn=no" + +if grep -q "\(GRUB_CMDLINE_LINUX\|GRUB_CMDLINE_LINUX_DEFAULT\)" /etc/default/grub +then + sed -i "s/${CONFIRM_SPAWN_YES}/${CONFIRM_SPAWN_NO}/" /etc/default/grub +fi + +# make sure GRUB_DISABLE_RECOVERY=true +if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then + # modify the GRUB command-line if an GRUB_DISABLE_RECOVERY= arg already exists + sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' /etc/default/grub +else + # no GRUB_DISABLE_RECOVERY=arg is present, append it to file + echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' +fi + + + +# Remove 'systemd.confirm_spawn' kernel argument also from runtime settings +/sbin/grubby --update-kernel=ALL --remove-args="systemd.confirm_spawn" + + +#Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn +grub2-mkconfig -o /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45403,39 +45517,13 @@ after Req-8.1.8 SRG-OS-000163-GPOS-00072 RHEL-08-020035 - SV-257258r917891_rule + SV-257258r942953_rule Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been let unattended. CCE-90784-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; [[ "$real" != "$expected" ]]; } ) || grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; }; then - -var_logind_session_timeout='' - - - -# Try find '[Login]' and 'StopIdleSessionSec' in '/etc/systemd/logind.conf', if it exists, set -# to '$var_logind_session_timeout', if it isn't here, add it, if '[Login]' doesn't exist, add it there -if grep -qzosP '[[:space:]]*\[Login]([^\n\[]*\n+)+?[[:space:]]*StopIdleSessionSec' '/etc/systemd/logind.conf'; then - - sed -i "s/StopIdleSessionSec[^(\n)]*/StopIdleSessionSec=$var_logind_session_timeout/" '/etc/systemd/logind.conf' -elif grep -qs '[[:space:]]*\[Login]' '/etc/systemd/logind.conf'; then - sed -i "/[[:space:]]*\[Login]/a StopIdleSessionSec=$var_logind_session_timeout" '/etc/systemd/logind.conf' -else - if test -d "/etc/systemd"; then - printf '%s\n' '[Login]' "StopIdleSessionSec=$var_logind_session_timeout" >> '/etc/systemd/logind.conf' - else - echo "Config file directory '/etc/systemd' doesnt exist, not remediating, assuming non-applicability." >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_logind_session_timeout # promote to variable set_fact: var_logind_session_timeout: !!str @@ -45476,6 +45564,32 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; [[ "$real" != "$expected" ]]; } ) || grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; }; then + +var_logind_session_timeout='' + + + +# Try find '[Login]' and 'StopIdleSessionSec' in '/etc/systemd/logind.conf', if it exists, set +# to '$var_logind_session_timeout', if it isn't here, add it, if '[Login]' doesn't exist, add it there +if grep -qzosP '[[:space:]]*\[Login]([^\n\[]*\n+)+?[[:space:]]*StopIdleSessionSec' '/etc/systemd/logind.conf'; then + + sed -i "s/StopIdleSessionSec[^(\n)]*/StopIdleSessionSec=$var_logind_session_timeout/" '/etc/systemd/logind.conf' +elif grep -qs '[[:space:]]*\[Login]' '/etc/systemd/logind.conf'; then + sed -i "/[[:space:]]*\[Login]/a StopIdleSessionSec=$var_logind_session_timeout" '/etc/systemd/logind.conf' +else + if test -d "/etc/systemd"; then + printf '%s\n' '[Login]' "StopIdleSessionSec=$var_logind_session_timeout" >> '/etc/systemd/logind.conf' + else + echo "Config file directory '/etc/systemd' doesnt exist, not remediating, assuming non-applicability." >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45611,25 +45725,6 @@ in /usr/lib/systemd/system/emergency.service. CCE-82186-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -service_file="/usr/lib/systemd/system/emergency.service" - - -sulogin="/usr/lib/systemd/systemd-sulogin-shell emergency" - - -if grep "^ExecStart=.*" "$service_file" ; then - sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" -else - echo "ExecStart=-$sulogin" >> "$service_file" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Require emergency mode password lineinfile: create: true @@ -45651,6 +45746,25 @@ fi - no_reboot_needed - require_emergency_target_auth - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +service_file="/usr/lib/systemd/system/emergency.service" + + +sulogin="/usr/lib/systemd/systemd-sulogin-shell emergency" + + +if grep "^ExecStart=.*" "$service_file" ; then + sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" +else + echo "ExecStart=-$sulogin" >> "$service_file" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45795,23 +45909,6 @@ in /usr/lib/systemd/system/rescue.service. CCE-80855-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -service_file="/usr/lib/systemd/system/rescue.service" - -sulogin="/usr/lib/systemd/systemd-sulogin-shell rescue" - -if grep "^ExecStart=.*" "$service_file" ; then - sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" -else - echo "ExecStart=-$sulogin" >> "$service_file" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Require single user mode password lineinfile: create: true @@ -45833,6 +45930,23 @@ fi - no_reboot_needed - require_singleuser_auth - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +service_file="/usr/lib/systemd/system/rescue.service" + +sulogin="/usr/lib/systemd/systemd-sulogin-shell rescue" + +if grep "^ExecStart=.*" "$service_file" ; then + sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" +else + echo "ExecStart=-$sulogin" >> "$service_file" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45919,8 +46033,27 @@ session lock. The tmux package allows for a session lock to be implemented and configured. CCE-80644-8 - -package --add=tmux + - name: Ensure tmux is installed + package: + name: tmux + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80644-8 + - DISA-STIG-RHEL-08-020039 + - NIST-800-171-3.1.10 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tmux_installed + + +[[packages]] +name = "tmux" +version = "*" include install_tmux @@ -45929,6 +46062,9 @@ class install_tmux { ensure => 'installed', } } + + +package --add=tmux # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -45940,28 +46076,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "tmux" -version = "*" - - - name: Ensure tmux is installed - package: - name: tmux - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80644-8 - - DISA-STIG-RHEL-08-020039 - - NIST-800-171-3.1.10 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tmux_installed @@ -45990,24 +46104,6 @@ immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. CCE-82266-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then - cat >> /etc/profile.d/tmux.sh <<'EOF' -if [ "$PS1" ]; then - parent=$(ps -o ppid= -p $$) - name=$(ps -o comm= -p $parent) - case "$name" in sshd|login) exec tmux ;; esac -fi -EOF - chmod 0644 /etc/profile.d/tmux.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46081,6 +46177,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then + cat >> /etc/profile.d/tmux.sh <<'EOF' +if [ "$PS1" ]; then + parent=$(ps -o ppid= -p $$) + name=$(ps -o comm= -p $parent) + case "$name" in sshd|login) exec tmux ;; esac +fi +EOF + chmod 0644 /etc/profile.d/tmux.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46110,24 +46224,6 @@ immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. CCE-90782-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -if ! grep -x ' case "$name" in (sshd|login) tmux ;; esac' /etc/bashrc /etc/profile.d/*.sh; then - cat >> /etc/profile.d/tmux.sh <<'EOF' -if [ "$PS1" ]; then - parent=$(ps -o ppid= -p $$) - name=$(ps -o comm= -p $parent) - case "$name" in (sshd|login) tmux ;; esac -fi -EOF - chmod 0644 /etc/profile.d/tmux.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46206,6 +46302,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +if ! grep -x ' case "$name" in (sshd|login) tmux ;; esac' /etc/bashrc /etc/profile.d/*.sh; then + cat >> /etc/profile.d/tmux.sh <<'EOF' +if [ "$PS1" ]; then + parent=$(ps -o ppid= -p $$) + name=$(ps -o comm= -p $parent) + case "$name" in (sshd|login) tmux ;; esac +fi +EOF + chmod 0644 /etc/profile.d/tmux.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46233,22 +46347,6 @@ or equal to 900 in /etc/tmux.conf. CCE-82199-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if grep -qP '^\s*set\s+-g\s+lock-after-time' "$tmux_conf" ; then - sed -i 's/^\s*set\s\+-g\s\+lock-after-time.*$/set -g lock-after-time 900/' "$tmux_conf" -else - echo "set -g lock-after-time 900" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46305,6 +46403,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if grep -qP '^\s*set\s+-g\s+lock-after-time' "$tmux_conf" ; then + sed -i 's/^\s*set\s\+-g\s\+lock-after-time.*$/set -g lock-after-time 900/' "$tmux_conf" +else + echo "set -g lock-after-time 900" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46339,22 +46453,6 @@ However, the session lock is implemented by an external command. The default configuration does not contain an effective session lock. CCE-80940-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if grep -qP '^\s*set\s+-g\s+lock-command' "$tmux_conf" ; then - sed -i 's/^\s*set\s\+-g\s\+lock-command.*$/set -g lock-command vlock/' "$tmux_conf" -else - echo "set -g lock-command vlock" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46417,6 +46515,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if grep -qP '^\s*set\s+-g\s+lock-command' "$tmux_conf" ; then + sed -i 's/^\s*set\s\+-g\s\+lock-command.*$/set -g lock-command vlock/' "$tmux_conf" +else + echo "set -g lock-command vlock" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46443,20 +46557,6 @@ However, the session lock is implemented by an external command. The default configuration does not contain an effective session lock. CCE-86135-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if ! grep -qP '^\s*bind\s+\w\s+lock-session' "$tmux_conf" ; then - echo "bind X lock-session" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46534,6 +46634,20 @@ fi - low_disruption - low_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if ! grep -qP '^\s*bind\s+\w\s+lock-session' "$tmux_conf" ; then + echo "bind X lock-session" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46678,8 +46792,26 @@ providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80846-9 - -package --add=opensc + - name: Ensure opensc is installed + package: + name: opensc + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80846-9 + - DISA-STIG-RHEL-08-010410 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_opensc_installed + + +[[packages]] +name = "opensc" +version = "*" include install_opensc @@ -46688,6 +46820,9 @@ class install_opensc { ensure => 'installed', } } + + +package --add=opensc # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -46699,27 +46834,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "opensc" -version = "*" - - - name: Ensure opensc is installed - package: - name: opensc - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80846-9 - - DISA-STIG-RHEL-08-010410 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_opensc_installed @@ -46742,8 +46856,25 @@ $ sudo yum install pcsc-lite The pcsc-lite package must be installed if it is to be available for multifactor authentication using smartcards. CCE-80993-9 - -package --add=pcsc-lite + - name: Ensure pcsc-lite is installed + package: + name: pcsc-lite + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80993-9 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_pcsc-lite_installed + + +[[packages]] +name = "pcsc-lite" +version = "*" include install_pcsc-lite @@ -46752,6 +46883,9 @@ class install_pcsc-lite { ensure => 'installed', } } + + +package --add=pcsc-lite # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -46763,26 +46897,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "pcsc-lite" -version = "*" - - - name: Ensure pcsc-lite is installed - package: - name: pcsc-lite - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80993-9 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_pcsc-lite_installed @@ -46823,8 +46937,29 @@ as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-84029-8 - -package --add=openssl-pkcs11 + - name: Ensure openssl-pkcs11 is installed + package: + name: openssl-pkcs11 + state: present + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture != "s390x" + tags: + - CCE-84029-8 + - DISA-STIG-RHEL-08-010390 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-8.3 + - enable_strategy + - install_smartcard_packages + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + + +[[packages]] +name = "openssl-pkcs11" +version = "*" include install_openssl-pkcs11 @@ -46833,6 +46968,9 @@ class install_openssl-pkcs11 { ensure => 'installed', } } + + +package --add=openssl-pkcs11 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ! grep -q s390x /proc/sys/kernel/osrelease; }; then @@ -46844,30 +46982,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssl-pkcs11" -version = "*" - - - name: Ensure openssl-pkcs11 is installed - package: - name: openssl-pkcs11 - state: present - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture != "s390x" - tags: - - CCE-84029-8 - - DISA-STIG-RHEL-08-010390 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-8.3 - - enable_strategy - - install_smartcard_packages - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed @@ -46906,31 +47020,6 @@ providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80881-6 - include enable_pcscd - -class enable_pcscd { - service {'pcscd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'pcscd.service' -"$SYSTEMCTL_EXEC" start 'pcscd.service' -"$SYSTEMCTL_EXEC" enable 'pcscd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["pcscd"] - - name: Enable service pcscd block: @@ -46969,6 +47058,31 @@ enabled = ["pcscd"] - medium_severity - no_reboot_needed - service_pcscd_enabled + + +[customizations.services] +enabled = ["pcscd"] + + include enable_pcscd + +class enable_pcscd { + service {'pcscd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'pcscd.service' +"$SYSTEMCTL_EXEC" start 'pcscd.service' +"$SYSTEMCTL_EXEC" enable 'pcscd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47073,22 +47187,6 @@ that provided by a username and password combination. Smart cards leverage PKI Configuring the smart card driver in use by your organization helps to prevent users from using unauthorized smart cards. CCE-80766-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_smartcard_drivers='' - - -OPENSC_TOOL="/usr/bin/opensc-tool" - -if [ -f "${OPENSC_TOOL}" ]; then - ${OPENSC_TOOL} -S app:default:card_drivers:$var_smartcard_drivers -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_smartcard_drivers # promote to variable set_fact: var_smartcard_drivers: !!str @@ -47151,6 +47249,22 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_smartcard_drivers='' + + +OPENSC_TOOL="/usr/bin/opensc-tool" + +if [ -f "${OPENSC_TOOL}" ]; then + ${OPENSC_TOOL} -S app:default:card_drivers:$var_smartcard_drivers +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47252,22 +47366,6 @@ that provided by a username and password combination. Smart cards leverage PKI Forcing the smart card driver in use by your organization helps to prevent users from using unauthorized smart cards. CCE-80821-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_smartcard_drivers='' - - -OPENSC_TOOL="/usr/bin/opensc-tool" - -if [ -f "${OPENSC_TOOL}" ]; then - ${OPENSC_TOOL} -S app:default:force_card_driver:$var_smartcard_drivers -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_smartcard_drivers # promote to variable set_fact: var_smartcard_drivers: !!str @@ -47330,6 +47428,22 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_smartcard_drivers='' + + +OPENSC_TOOL="/usr/bin/opensc-tool" + +if [ -f "${OPENSC_TOOL}" ]; then + ${OPENSC_TOOL} -S app:default:force_card_driver:$var_smartcard_drivers +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47606,13 +47720,62 @@ elapse until the account would be automatically disabled. See the 8.2.6 SRG-OS-000118-GPOS-00060 RHEL-08-020260 - 5.6.1.4 + 4.5.1.4 SV-230373r627750_rule Inactive identifiers pose a risk to systems and applications because attackers may exploit an inactive identifier and potentially obtain undetected access to the system. Disabling inactive accounts ensures that accounts which may not have been responsibly removed are not available to attackers who may have compromised their credentials. Owners of inactive accounts will not notice if unauthorized access to their user account has been obtained. CCE-80954-1 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80954-1 + - CJIS-5.6.2.1.1 + - DISA-STIG-RHEL-08-020260 + - NIST-800-171-3.5.6 + - NIST-800-53-AC-2(3) + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-4(e) + - PCI-DSS-Req-8.1.4 + - PCI-DSSv4-8.2.6 + - account_disable_post_pw_expiration + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable + set_fact: + var_account_disable_post_pw_expiration: !!str + tags: + - always + +- name: Set Account Expiration Following Inactivity + lineinfile: + create: true + dest: /etc/default/useradd + regexp: ^INACTIVE + line: INACTIVE={{ var_account_disable_post_pw_expiration }} + when: '"shadow-utils" in ansible_facts.packages' + tags: + - CCE-80954-1 + - CJIS-5.6.2.1.1 + - DISA-STIG-RHEL-08-020260 + - NIST-800-171-3.5.6 + - NIST-800-53-AC-2(3) + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-4(e) + - PCI-DSS-Req-8.1.4 + - PCI-DSSv4-8.2.6 + - account_disable_post_pw_expiration + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q shadow-utils; then @@ -47644,55 +47807,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80954-1 - - CJIS-5.6.2.1.1 - - DISA-STIG-RHEL-08-020260 - - NIST-800-171-3.5.6 - - NIST-800-53-AC-2(3) - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-4(e) - - PCI-DSS-Req-8.1.4 - - PCI-DSSv4-8.2.6 - - account_disable_post_pw_expiration - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable - set_fact: - var_account_disable_post_pw_expiration: !!str - tags: - - always - -- name: Set Account Expiration Following Inactivity - lineinfile: - create: true - dest: /etc/default/useradd - regexp: ^INACTIVE - line: INACTIVE={{ var_account_disable_post_pw_expiration }} - when: '"shadow-utils" in ansible_facts.packages' - tags: - - CCE-80954-1 - - CJIS-5.6.2.1.1 - - DISA-STIG-RHEL-08-020260 - - NIST-800-171-3.5.6 - - NIST-800-53-AC-2(3) - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-4(e) - - PCI-DSS-Req-8.1.4 - - PCI-DSSv4-8.2.6 - - account_disable_post_pw_expiration - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -48067,7 +48181,7 @@ The profile requirement is 8.3.9 SRG-OS-000076-GPOS-00044 RHEL-08-020200 - 5.6.1.1 + 4.5.1.2 SV-230366r646878_rule Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime @@ -48080,37 +48194,6 @@ increases the risk of users writing down the password in a convenient location subject to physical compromise. CCE-80647-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_maximum_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MAX_DAYS") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_maximum_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MAX_DAYS\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MAX_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80647-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48159,6 +48242,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_maximum_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MAX_DAYS") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_maximum_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MAX_DAYS\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MAX_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80647-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48236,7 +48350,6 @@ The profile requirement is PR.AC-7 SRG-OS-000075-GPOS-00043 RHEL-08-020190 - 5.6.1.2 SV-230365r858727_rule Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If @@ -48248,37 +48361,6 @@ Setting the minimum password age protects against users cycling back to a favorite password after satisfying the password reuse requirement. CCE-80648-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_minimum_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_DAYS") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_minimum_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_DAYS\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80648-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48323,6 +48405,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_minimum_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_DAYS") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_minimum_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_DAYS\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80648-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48425,37 +48538,6 @@ must be carefully weighed against usability problems, support costs, or counterp behavior that may result. CCE-80652-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_password_minlen_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_LEN") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_minlen_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_LEN\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_LEN\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80652-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48501,6 +48583,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_password_minlen_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_LEN") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_minlen_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_LEN\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_LEN\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80652-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48522,7 +48635,7 @@ restriction by running the following command: 8.3.9 SRG-OS-000076-GPOS-00044 RHEL-08-020210 - 5.6.1.1 + 4.5.1.2 SV-230367r627750_rule Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does @@ -48530,16 +48643,6 @@ not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised. CCE-82473-0 - -var_accounts_maximum_age_login_defs='' - - -while IFS= read -r i; do - - chage -M $var_accounts_maximum_age_login_defs $i - -done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($5 > var || $5 == "")) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_maximum_age_login_defs # promote to variable set_fact: var_accounts_maximum_age_login_defs: !!str @@ -48584,6 +48687,16 @@ done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+ - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_maximum_age_login_defs='' + + +while IFS= read -r i; do + + chage -M $var_accounts_maximum_age_login_defs $i + +done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($5 > var || $5 == "")) {print $1}' /etc/shadow) @@ -48605,7 +48718,6 @@ lifetime by running the following command: CM-6(a) SRG-OS-000075-GPOS-00043 RHEL-08-020180 - 5.6.1.2 SV-230364r627750_rule Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If @@ -48613,16 +48725,6 @@ users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse. CCE-82472-2 - -var_accounts_minimum_age_login_defs='' - - -while IFS= read -r i; do - - chage -m $var_accounts_minimum_age_login_defs $i - -done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($4 < var || $4 == "")) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_minimum_age_login_defs # promote to variable set_fact: var_accounts_minimum_age_login_defs: !!str @@ -48663,6 +48765,16 @@ done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+ - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_minimum_age_login_defs='' + + +while IFS= read -r i; do + + chage -m $var_accounts_minimum_age_login_defs $i + +done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($4 < var || $4 == "")) {print $1}' /etc/shadow) @@ -48685,19 +48797,11 @@ This profile requirement is IA-5(1)(d) CM-6(a) 8.3.9 - 5.6.1.3 + 4.5.1.3 Providing an advance warning that a password will be expiring gives users time to think of a secure password. Users caught unaware may choose a simple password or write it down where it may be discovered. CCE-86914-9 - -var_accounts_password_warn_age_login_defs='' - - -while IFS= read -r i; do - chage --warndays $var_accounts_password_warn_age_login_defs $i -done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(($6 < var || $6 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_password_warn_age_login_defs # promote to variable set_fact: var_accounts_password_warn_age_login_defs: !!str @@ -48744,6 +48848,14 @@ done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(( - low_disruption - medium_severity - no_reboot_needed + + +var_accounts_password_warn_age_login_defs='' + + +while IFS= read -r i; do + chage --warndays $var_accounts_password_warn_age_login_defs $i +done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(($6 < var || $6 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) @@ -48839,42 +48951,11 @@ The profile requirement is PR.AC-7 Req-8.2.4 8.3.9 - 5.6.1.3 + 4.5.1.3 Setting the password warning age enables users to make the change at a practical time. CCE-80671-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_password_warn_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_WARN_AGE") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_warn_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_WARN_AGE\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_WARN_AGE\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80671-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48920,6 +49001,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_password_warn_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_WARN_AGE") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_warn_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_WARN_AGE\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_WARN_AGE\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80671-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -49008,18 +49120,10 @@ to be automatically disabled by running the following command: Req-8.1.4 8.2.6 SRG-OS-000118-GPOS-00060 - 5.6.1.4 + 4.5.1.4 Inactive accounts pose a threat to system security since the users are not logging in to notice failed login attempts or other anomalies. CCE-86758-0 - -var_account_disable_post_pw_expiration='' - - -while IFS= read -r i; do - chage --inactive $var_account_disable_post_pw_expiration $i -done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 > var || $7 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) - - name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable set_fact: var_account_disable_post_pw_expiration: !!str @@ -49066,6 +49170,14 @@ done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 - medium_severity - no_reboot_needed - restrict_strategy + + +var_account_disable_post_pw_expiration='' + + +while IFS= read -r i; do + chage --inactive $var_account_disable_post_pw_expiration $i +done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 > var || $7 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) @@ -49212,7 +49324,7 @@ protecting passwords. If passwords are not encrypted, they can be plainly read All users should have a password change date in the past. Automatic remediation is not available, in order to avoid any system disruption. 8.3.5 - 5.6.1.5 + 4.5.1.5 If a user recorded password change date is in the future then they could bypass any set password expiration. @@ -49241,73 +49353,6 @@ but requires more CPU resources to authenticate users. Using a higher number of rounds makes password cracking attacks more difficult. CCE-83403-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_unix_rounds='' - - - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\srounds\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ rounds='"$var_password_pam_unix_rounds"'/' "$PAM_FILE_PATH" - else - sed -i -E --follow-symlinks 's/(\s*password\s+'"sufficient"'\s+pam_unix.so\s+.*)('"rounds"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_rounds"' \3/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -49600,39 +49645,15 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - Set number of Password Hashing Rounds - system-auth - Configure the number or rounds for the password hashing algorithm. This can be -accomplished by using the rounds option for the pam_unix PAM module. - -In file /etc/pam.d/system-auth append rounds= -to the pam_unix.so entry, as shown below: -password sufficient pam_unix.so ...existing_options... rounds= -The system's default number of rounds is 5000. - Setting a high number of hashing rounds makes it more difficult to brute force the password, -but requires more CPU resources to authenticate users. - BP28(R68) - CCI-000196 - SRG-OS-000073-GPOS-00041 - Using a higher number of rounds makes password cracking attacks more difficult. - - CCE-83386-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then var_password_pam_unix_rounds='' -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" + +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -49659,7 +49680,7 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -49684,13 +49705,38 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Set number of Password Hashing Rounds - system-auth + Configure the number or rounds for the password hashing algorithm. This can be +accomplished by using the rounds option for the pam_unix PAM module. + +In file /etc/pam.d/system-auth append rounds= +to the pam_unix.so entry, as shown below: +password sufficient pam_unix.so ...existing_options... rounds= +The system's default number of rounds is 5000. + Setting a high number of hashing rounds makes it more difficult to brute force the password, +but requires more CPU resources to authenticate users. + BP28(R68) + CCI-000196 + SRG-OS-000073-GPOS-00041 + Using a higher number of rounds makes password cracking attacks more difficult. + + CCE-83386-3 - name: Gather the package facts package_facts: manager: auto @@ -49982,6 +50028,72 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_unix_rounds='' + + +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\srounds\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ rounds='"$var_password_pam_unix_rounds"'/' "$PAM_FILE_PATH" + else + sed -i -E --follow-symlinks 's/(\s*password\s+'"sufficient"'\s+pam_unix.so\s+.*)('"rounds"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_rounds"' \3/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50194,7 +50306,9 @@ a container anyway. SRG-OS-000480-GPOS-00227 RHEL-08-020331 RHEL-08-020332 - 5.4.1 + 4.4.2.1 + 4.4.2.5 + 4.4.3.4.1 SV-244540r743869_rule SV-244541r743872_rule If an account has an empty password, anyone could log in and @@ -50202,64 +50316,6 @@ run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments. CCE-80841-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A - mode: 0644 - path: /etc/pam.d/password-auth - overwrite: true - - contents: - source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A - mode: 0644 - path: /etc/pam.d/system-auth - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature without-nullok - -authselect apply-changes -b -else - -if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" -fi - -if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" -fi - -if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then - sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" -fi - -if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then - sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" -fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Prevent Login to Accounts With Empty Password - Check if system relies on authselect ansible.builtin.stat: @@ -50387,6 +50443,64 @@ fi - medium_disruption - no_empty_passwords - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A + mode: 0644 + path: /etc/pam.d/password-auth + overwrite: true + - contents: + source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A + mode: 0644 + path: /etc/pam.d/system-auth + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature without-nullok + +authselect apply-changes -b +else + +if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" +fi + +if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" +fi + +if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then + sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" +fi + +if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then + sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" +fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50421,20 +50535,6 @@ run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments. CCE-85953-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -readarray -t users_with_empty_pass < <(sudo awk -F: '!$2 {print $1}' /etc/shadow) - -for user_with_empty_pass in "${users_with_empty_pass[@]}" -do - passwd -l $user_with_empty_pass -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Collect users with no password command: | awk -F: '!$2 {print $1}' /etc/shadow @@ -50472,6 +50572,20 @@ fi - no_empty_passwords_etc_shadow - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +readarray -t users_with_empty_pass < <(sudo awk -F: '!$2 {print $1}' /etc/shadow) + +for user_with_empty_pass in "${users_with_empty_pass[@]}" +do + passwd -l $user_with_empty_pass +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50504,13 +50618,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-83389-7 - -if grep -q '^\+' /etc/group; then -# backup old file to /etc/group- - cp /etc/group /etc/group- - sed -i '/^\+.*$/d' /etc/group -fi - - name: Ensure there are no legacy + NIS entries in /etc/group - Backup the Old /etc/group File ansible.builtin.copy: @@ -50540,6 +50647,13 @@ fi - no_legacy_plus_entries_etc_group - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/group; then +# backup old file to /etc/group- + cp /etc/group /etc/group- + sed -i '/^\+.*$/d' /etc/group +fi @@ -50556,13 +50670,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-82890-5 - -if grep -q '^\+' /etc/passwd; then -# backup old file to /etc/passwd- - cp /etc/passwd /etc/passwd- - sed -i '/^\+.*$/d' /etc/passwd -fi - - name: Ensure there are no legacy + NIS entries in /etc/passwd - Backup the Old /etc/passwd File ansible.builtin.copy: @@ -50592,6 +50699,13 @@ fi - no_legacy_plus_entries_etc_passwd - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/passwd; then +# backup old file to /etc/passwd- + cp /etc/passwd /etc/passwd- + sed -i '/^\+.*$/d' /etc/passwd +fi @@ -50608,13 +50722,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-84290-6 - -if grep -q '^\+' /etc/shadow; then -# backup old file to /etc/shadow- - cp /etc/shadow /etc/shadow- - sed -i '/^\+.*$/d' /etc/shadow -fi - - name: Ensure there are no legacy + NIS entries in /etc/shadow - Backup the Old /etc/shadow File ansible.builtin.copy: @@ -50644,6 +50751,13 @@ fi - no_legacy_plus_entries_etc_shadow - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/shadow; then +# backup old file to /etc/shadow- + cp /etc/shadow /etc/shadow- + sed -i '/^\+.*$/d' /etc/shadow +fi @@ -50917,8 +51031,6 @@ guess a password for a privileged account. Proper configuration of sudo is recommended to afford multiple system administrators access to root privileges in an accountable manner. CCE-80649-7 - awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs --no-run-if-empty --max-lines=1 passwd -l - - name: Get all /etc/passwd file entries getent: database: passwd @@ -50961,6 +51073,8 @@ access to root privileges in an accountable manner. - low_disruption - no_reboot_needed - restrict_strategy + + awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs --no-run-if-empty --max-lines=1 passwd -l @@ -50974,7 +51088,7 @@ access to root privileges in an accountable manner. The root user should have a primary group of 0. Req-8.1.1 8.2.1 - 5.6.4 + 4.5.2.1 To help ensure that root-owned files are not inadvertently exposed to other users. CCE-86297-9 @@ -50995,29 +51109,12 @@ altered privileges through the su command.pam_wheel.so module. The pam_wheel.so module configuration is accomplished by use_pam_wheel_group_for_su rule. 2.2.6 - 5.3.7 + 4.3.7 The su program allows to run commands with a substitute user and group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-86071-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_pam_wheel_group_for_su='' - - -if ! grep -q "^${var_pam_wheel_group_for_su}:[^:]*:[^:]*:[^:]*" /etc/group; then - groupadd ${var_pam_wheel_group_for_su} -fi - -# group must be empty -gpasswd -M '' ${var_pam_wheel_group_for_su} - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51069,6 +51166,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_pam_wheel_group_for_su='' + + +if ! grep -q "^${var_pam_wheel_group_for_su}:[^:]*:[^:]*:[^:]*" /etc/group; then + groupadd ${var_pam_wheel_group_for_su} +fi + +# group must be empty +gpasswd -M '' ${var_pam_wheel_group_for_su} + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51078,6 +51192,24 @@ fi + + Ensure Authentication Required for Single User Mode + Single user mode is used for recovery when the system detects an +issue during boot or by manual selection from the bootloader. + 2.2.2 + 4.5.2.4 + Requiring authentication in single user mode prevents an unauthorized +user from rebooting the system into single user to gain root privileges +without credentials. + + CCE-86517-0 + + + + + + + Direct root Logins Not Allowed To further limit access to the root account, administrators @@ -51178,6 +51310,25 @@ to privileged (root) access via su / sudo. This is required for FISMA Low and FISMA Moderate systems. CCE-80840-2 + - name: Direct root Logins Not Allowed + copy: + dest: /etc/securetty + content: '' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80840-2 + - NIST-800-171-3.1.1 + - NIST-800-171-3.1.6 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-2 + - PCI-DSSv4-8.6.1 + - low_complexity + - low_disruption + - medium_severity + - no_direct_root_logins + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -51201,25 +51352,6 @@ echo > /etc/securetty else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Direct root Logins Not Allowed - copy: - dest: /etc/securetty - content: '' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80840-2 - - NIST-800-171-3.1.1 - - NIST-800-171-3.1.6 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-2 - - PCI-DSSv4-8.6.1 - - low_complexity - - low_disruption - - medium_severity - - no_direct_root_logins - - no_reboot_needed - - restrict_strategy @@ -51249,19 +51381,10 @@ and nfsnobody has an unlocked password, disable it with t AC-6 CM-6(a) 8.2.2 - 5.6.2 + 4.5.2.3 Disabling authentication for default system accounts makes it more difficult for attackers to make use of them to compromise a system. CCE-86112-0 - -readarray -t systemaccounts < <(awk -F: \ - '($3 < 1000 && $3 != root && $3 != halt && $3 != sync && $3 != shutdown \ - && $3 != nfsnobody) { print $1 }' /etc/passwd) - -for systemaccount in "${systemaccounts[@]}"; do - usermod -L "$systemaccount" -done - - name: Ensure that System Accounts Are Locked - Get All Local Users From /etc/passwd ansible.builtin.getent: database: passwd @@ -51313,6 +51436,15 @@ done - no_password_auth_for_systemaccounts - no_reboot_needed - restrict_strategy + + +readarray -t systemaccounts < <(awk -F: \ + '($3 < 1000 && $3 != root && $3 != halt && $3 != sync && $3 != shutdown \ + && $3 != nfsnobody) { print $1 }' /etc/passwd) + +for systemaccount in "${systemaccounts[@]}"; do + usermod -L "$systemaccount" +done @@ -51407,19 +51539,10 @@ system to become inaccessible. PR.AC-6 8.2.2 SRG-OS-000480-GPOS-00227 - 5.6.2 + 4.5.2.3 Ensuring shells are not given to system accounts upon login makes it more difficult for attackers to make use of system accounts. CCE-80843-6 - -readarray -t systemaccounts < <(awk -F: '($3 < 1000 && $3 != root \ - && $7 != "\/sbin\/shutdown" && $7 != "\/sbin\/halt" && $7 != "\/bin\/sync") \ - { print $1 }' /etc/passwd) - -for systemaccount in "${systemaccounts[@]}"; do - usermod -s /sbin/nologin "$systemaccount" -done - - name: Ensure that System Accounts Do Not Run a Shell Upon Login - Get All Local Users From /etc/passwd ansible.builtin.getent: @@ -51480,6 +51603,15 @@ done - no_reboot_needed - no_shelllogin_for_systemaccounts - restrict_strategy + + +readarray -t systemaccounts < <(awk -F: '($3 < 1000 && $3 != root \ + && $7 != "\/sbin\/shutdown" && $7 != "\/sbin\/halt" && $7 != "\/bin\/sync") \ + { print $1 }' /etc/passwd) + +for systemaccount in "${systemaccounts[@]}"; do + usermod -s /sbin/nologin "$systemaccount" +done @@ -51563,8 +51695,6 @@ ttyS1 helps ensure accountability for actions taken on the systems using the root account. CCE-80856-8 - sed -i '/ttyS/d' /etc/securetty - - name: Restrict Serial Port Root Logins lineinfile: dest: /etc/securetty @@ -51582,6 +51712,8 @@ using the root account. - no_reboot_needed - restrict_serial_port_logins - restrict_strategy + + sed -i '/ttyS/d' /etc/securetty @@ -51694,8 +51826,6 @@ vc/4 helps ensure accountability for actions taken on the system using the root account. CCE-80864-2 - sed -i '/^vc\//d' /etc/securetty - - name: Restrict Virtual Console Root Logins lineinfile: dest: /etc/securetty @@ -51714,6 +51844,8 @@ using the root account. - no_reboot_needed - restrict_strategy - securetty_root_login_console_only + + sed -i '/^vc\//d' /etc/securetty @@ -51739,16 +51871,6 @@ group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-83318-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -# uncomment the option if commented -sed '/^[[:space:]]*#[[:space:]]*auth[[:space:]]\+required[[:space:]]\+pam_wheel\.so[[:space:]]\+use_uid$/s/^[[:space:]]*#//' -i /etc/pam.d/su - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51775,6 +51897,16 @@ fi - no_reboot_needed - restrict_strategy - use_pam_wheel_for_su + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +# uncomment the option if commented +sed '/^[[:space:]]*#[[:space:]]*auth[[:space:]]\+required[[:space:]]\+pam_wheel\.so[[:space:]]\+use_uid$/s/^[[:space:]]*#//' -i /etc/pam.d/su + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51792,35 +51924,12 @@ command, make sure that the following line exists in the file /etc/pa Note that ensure_pam_wheel_group_empty rule complements this requirement by ensuring the referenced group exists and has no members. 2.2.6 - 5.3.7 + 4.3.7 The su program allows to run commands with a substitute user and group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-86064-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_pam_wheel_group_for_su='' - - -PAM_CONF=/etc/pam.d/su - -pamstr=$(grep -P '^auth\s+required\s+pam_wheel\.so\s+(?=[^#]*\buse_uid\b)(?=[^#]*\bgroup=)' ${PAM_CONF}) -if [ -z "$pamstr" ]; then - sed -Ei '/^auth\b.*\brequired\b.*\bpam_wheel\.so/d' ${PAM_CONF} # remove any remaining uncommented pam_wheel.so line - sed -Ei "/^auth\s+sufficient\s+pam_rootok\.so.*$/a auth required pam_wheel.so use_uid group=${var_pam_wheel_group_for_su}" ${PAM_CONF} -else - group_val=$(echo -n "$pamstr" | grep -Eo '\bgroup=[_a-z][-0-9_a-z]*' | cut -d '=' -f 2) - if [ -z "${group_val}" ] || [ ${group_val} != ${var_pam_wheel_group_for_su} ]; then - sed -Ei "s/(^auth\s+required\s+pam_wheel.so\s+[^#]*group=)[_a-z][-0-9_a-z]*/\1${var_pam_wheel_group_for_su}/" ${PAM_CONF} - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51857,6 +51966,29 @@ fi - no_reboot_needed - restrict_strategy - use_pam_wheel_group_for_su + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_pam_wheel_group_for_su='' + + +PAM_CONF=/etc/pam.d/su + +pamstr=$(grep -P '^auth\s+required\s+pam_wheel\.so\s+(?=[^#]*\buse_uid\b)(?=[^#]*\bgroup=)' ${PAM_CONF}) +if [ -z "$pamstr" ]; then + sed -Ei '/^auth\b.*\brequired\b.*\bpam_wheel\.so/d' ${PAM_CONF} # remove any remaining uncommented pam_wheel.so line + sed -Ei "/^auth\s+sufficient\s+pam_rootok\.so.*$/a auth required pam_wheel.so use_uid group=${var_pam_wheel_group_for_su}" ${PAM_CONF} +else + group_val=$(echo -n "$pamstr" | grep -Eo '\bgroup=[_a-z][-0-9_a-z]*' | cut -d '=' -f 2) + if [ -z "${group_val}" ] || [ ${group_val} != ${var_pam_wheel_group_for_su} ]; then + sed -Ei "s/(^auth\s+required\s+pam_wheel.so\s+[^#]*group=)[_a-z][-0-9_a-z]*/\1${var_pam_wheel_group_for_su}/" ${PAM_CONF} + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51936,37 +52068,6 @@ parameter in /etc/login.defs to yes CCE-83789-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -if [ -e "/etc/login.defs" ] ; then - - LC_ALL=C sed -i "/^\s*CREATE_HOME\s\+/Id" "/etc/login.defs" -else - touch "/etc/login.defs" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/login.defs" - -cp "/etc/login.defs" "/etc/login.defs.bak" -# Insert before the line matching the regex '^\s*CREATE_HOME'. -line_number="$(LC_ALL=C grep -n "^\s*CREATE_HOME" "/etc/login.defs.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^\s*CREATE_HOME', insert at - # the end of the file. - printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" -else - head -n "$(( line_number - 1 ))" "/etc/login.defs.bak" > "/etc/login.defs" - printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" - tail -n "+$(( line_number ))" "/etc/login.defs.bak" >> "/etc/login.defs" -fi -# Clean up after ourselves. -rm "/etc/login.defs.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52018,6 +52119,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +if [ -e "/etc/login.defs" ] ; then + + LC_ALL=C sed -i "/^\s*CREATE_HOME\s\+/Id" "/etc/login.defs" +else + touch "/etc/login.defs" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/login.defs" + +cp "/etc/login.defs" "/etc/login.defs.bak" +# Insert before the line matching the regex '^\s*CREATE_HOME'. +line_number="$(LC_ALL=C grep -n "^\s*CREATE_HOME" "/etc/login.defs.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^\s*CREATE_HOME', insert at + # the end of the file. + printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" +else + head -n "$(( line_number - 1 ))" "/etc/login.defs.bak" > "/etc/login.defs" + printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" + tail -n "+$(( line_number ))" "/etc/login.defs.bak" >> "/etc/login.defs" +fi +# Clean up after ourselves. +rm "/etc/login.defs.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52058,38 +52190,6 @@ add or correct the FAIL_DELAY setting in /etc/ enter credentials helps to slow a single-threaded brute force attack. CCE-84037-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_fail_delay='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^FAIL_DELAY") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_fail_delay" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^FAIL_DELAY\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^FAIL_DELAY\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-84037-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52128,6 +52228,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_fail_delay='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^FAIL_DELAY") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_fail_delay" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^FAIL_DELAY\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^FAIL_DELAY\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-84037-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52174,24 +52306,6 @@ problems caused by excessive logins. Automated login processes operating imprope maliciously may result in an exceptional number of simultaneous login sessions. CCE-80955-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_max_concurrent_login_sessions='' - - -if grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.d/*.conf; then - sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.d/*.conf -elif grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.conf; then - sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.conf -else - echo "* hard maxlogins $var_accounts_max_concurrent_login_sessions" >> /etc/security/limits.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52280,6 +52394,24 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_accounts_max_concurrent_login_sessions='' + + +if grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.d/*.conf; then + sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.d/*.conf +elif grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.conf; then + sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.conf +else + echo "* hard maxlogins $var_accounts_max_concurrent_login_sessions" >> /etc/security/limits.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52301,19 +52433,6 @@ Then, add the following entry to /etc/security/namespace.conf CCE-83732-8 - -# shellcheck disable=SC2174 -mkdir -p --mode 000 /tmp/tmp-inst -chmod 000 /tmp/tmp-inst -chcon --reference=/tmp /tmp/tmp-inst - -if ! grep -Eq '^\s*/tmp\s+/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then - if grep -Eq '^\s*/tmp\s+' /etc/security/namespace.conf ; then - sed -i '/^\s*\/tmp/d' /etc/security/namespace.conf - fi - echo "/tmp /tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf -fi - - name: Create /tmp/tmp-inst directory file: path: /tmp/tmp-inst @@ -52346,6 +52465,19 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + +# shellcheck disable=SC2174 +mkdir -p --mode 000 /tmp/tmp-inst +chmod 000 /tmp/tmp-inst +chcon --reference=/tmp /tmp/tmp-inst + +if ! grep -Eq '^\s*/tmp\s+/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then + if grep -Eq '^\s*/tmp\s+' /etc/security/namespace.conf ; then + sed -i '/^\s*\/tmp/d' /etc/security/namespace.conf + fi + echo "/tmp /tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf +fi @@ -52366,19 +52498,6 @@ Then, add the following entry to /etc/security/namespace.conf CCE-83778-1 - -# shellcheck disable=SC2174 -mkdir -p --mode 000 /var/tmp/tmp-inst -chmod 000 /var/tmp/tmp-inst -chcon --reference=/var/tmp /var/tmp/tmp-inst - -if ! grep -Eq '^\s*/var/tmp\s+/var/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then - if grep -Eq '^\s*/var/tmp\s+' /etc/security/namespace.conf ; then - sed -i '/^\s*\/var\/tmp/d' /etc/security/namespace.conf - fi - echo "/var/tmp /var/tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf -fi - - name: Create /var/tmp/tmp-inst directory file: path: /var/tmp/tmp-inst @@ -52411,6 +52530,19 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + +# shellcheck disable=SC2174 +mkdir -p --mode 000 /var/tmp/tmp-inst +chmod 000 /var/tmp/tmp-inst +chcon --reference=/var/tmp /var/tmp/tmp-inst + +if ! grep -Eq '^\s*/var/tmp\s+/var/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then + if grep -Eq '^\s*/var/tmp\s+' /etc/security/namespace.conf ; then + sed -i '/^\s*\/var\/tmp/d' /etc/security/namespace.conf + fi + echo "/var/tmp /var/tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf +fi @@ -52481,40 +52613,13 @@ Using the typeset keyword is preferred for wider compatib 8.6.1 SRG-OS-000163-GPOS-00072 SRG-OS-000029-GPOS-00010 - 5.6.3 + 4.5.3.2 Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. CCE-80673-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_accounts_tmout='' - - -# if 0, no occurence of tmout found, if 1, occurence found -tmout_found=0 - - -for f in /etc/profile /etc/profile.d/*.sh; do - - if grep --silent '^[^#].*TMOUT' $f; then - sed -i -E "s/^(.*)TMOUT\s*=\s*(\w|\$)*(.*)$/typeset -xr TMOUT=$var_accounts_tmout\3/g" $f - tmout_found=1 - fi -done - -if [ $tmout_found -eq 0 ]; then - echo -e "\n# Set TMOUT to $var_accounts_tmout per security requirements" >> /etc/profile.d/tmout.sh - echo "typeset -xr TMOUT=$var_accounts_tmout" >> /etc/profile.d/tmout.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_accounts_tmout # promote to variable set_fact: var_accounts_tmout: !!str @@ -52565,6 +52670,33 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_accounts_tmout='' + + +# if 0, no occurence of tmout found, if 1, occurence found +tmout_found=0 + + +for f in /etc/profile /etc/profile.d/*.sh; do + + if grep --silent '^[^#].*TMOUT' $f; then + sed -i -E "s/^(.*)TMOUT\s*=\s*(\w|\$)*(.*)$/typeset -xr TMOUT=$var_accounts_tmout\3/g" $f + tmout_found=1 + fi +done + +if [ $tmout_found -eq 0 ]; then + echo -e "\n# Set TMOUT to $var_accounts_tmout per security requirements" >> /etc/profile.d/tmout.sh + echo "typeset -xr TMOUT=$var_accounts_tmout" >> /etc/profile.d/tmout.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52593,9 +52725,6 @@ of their respective initialization files. user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-86314-2 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6"/.[^\.]?*") }' /etc/passwd - - name: Ensure interactive local users are the group-owners of their respective initialization files ansible.builtin.command: @@ -52609,6 +52738,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6"/.[^\.]?*") }' /etc/passwd @@ -52672,9 +52804,6 @@ their respective initialization files. upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-86316-7 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd - - name: Ensure interactive local users are the owners of their respective initialization files ansible.builtin.command: @@ -52688,6 +52817,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd @@ -52735,14 +52867,6 @@ Therefore, this rule will report a finding for home directories like If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own. CCE-84036-3 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - # This follows the same logic of evaluation of home directories as used in OVAL. - if ! grep -q $user /etc/passwd | cut -d: -f6 | grep '^\/\w*\/\w\{1,\}'; then - sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd; - fi -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52789,6 +52913,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + # This follows the same logic of evaluation of home directories as used in OVAL. + if ! grep -q $user /etc/passwd | cut -d: -f6 | grep '^\/\w*\/\w\{1,\}'; then + sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd; + fi +done @@ -52814,11 +52946,6 @@ upon logon. This could create a Denial of Service because the user would not be able to access their logon configuration files, and it may give them visibility to system files they normally would not be able to access. CCE-83424-2 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd); do - mkhomedir_helper $user 0077; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52863,6 +52990,11 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd); do + mkhomedir_helper $user 0077; +done @@ -52890,16 +53022,6 @@ of folders or files in their respective home directories. If a local interactive users files are group-owned by a group of which the user is not a member, unintended users may be able to access them. CCE-86534-5 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd $user | cut -d: -f6) - group=$(getent passwd $user | cut -d: -f4) - # Only update the group-ownership when necessary. This will avoid changing the inode timestamp - # when the group is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find $home_dir -not -group $group -exec chgrp -f $group {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52962,6 +53084,16 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd $user | cut -d: -f6) + group=$(getent passwd $user | cut -d: -f4) + # Only update the group-ownership when necessary. This will avoid changing the inode timestamp + # when the group is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find $home_dir -not -group $group -exec chgrp -f $group {} \; +done @@ -52989,15 +53121,6 @@ folders or files in their respective home directories. If local interactive users do not own the files in their directories, unauthorized users may be able to access them. Additionally, if files are not owned by the user, this could be an indication of system compromise. - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd $user | cut -d: -f6) - # Only update the ownership when necessary. This will avoid changing the inode timestamp - # when the owner is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find $home_dir -not -user $user -exec chown -f $user {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53052,6 +53175,15 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd $user | cut -d: -f6) + # Only update the ownership when necessary. This will avoid changing the inode timestamp + # when the owner is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find $home_dir -not -user $user -exec chown -f $user {} \; +done @@ -53073,14 +53205,6 @@ Files that begin with a "." are excluded from this requirement.If a local interactive user files have excessive permissions, unintended users may be able to access or modify them. CCE-85888-6 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53144,6 +53268,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53164,12 +53296,6 @@ to an interactive user is not group or world accessible Note: While the complete removal of .netrc files is recommended, if any are required on the system, secure permissions must be applied. CCE-87369-5 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd "$user" | cut -d: -f6) - find "${home_dir}/.netrc" -exec chmod 0600 {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53228,6 +53354,12 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd "$user" | cut -d: -f6) + find "${home_dir}/.netrc" -exec chmod 0600 {} \; +done @@ -53259,9 +53391,6 @@ not the same as the primary GID of the user, this would allow unauthorized access to the users files, and users that share the same group may not be able to access files that they legitimately should. CCE-83434-1 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53324,6 +53453,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd @@ -53352,9 +53484,6 @@ their respective home directories. users could access or modify the user's files, and the users may not be able to access their own files. CCE-86131-0 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53412,6 +53541,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd @@ -53434,28 +53566,6 @@ following command: upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-84043-9 - -var_user_initialization_files_regex='' - - -readarray -t interactive_users < <(awk -F: '$3>=1000 {print $1}' /etc/passwd) -readarray -t interactive_users_home < <(awk -F: '$3>=1000 {print $6}' /etc/passwd) -readarray -t interactive_users_shell < <(awk -F: '$3>=1000 {print $7}' /etc/passwd) - -USERS_IGNORED_REGEX='nobody|nfsnobody' - -for (( i=0; i<"${#interactive_users[@]}"; i++ )); do - if ! grep -qP "$USERS_IGNORED_REGEX" <<< "${interactive_users[$i]}" && \ - [ "${interactive_users_shell[$i]}" != "/sbin/nologin" ]; then - - readarray -t init_files < <(find "${interactive_users_home[$i]}" -maxdepth 1 \ - -exec basename {} \; | grep -P "$var_user_initialization_files_regex") - for file in "${init_files[@]}"; do - chmod u-s,g-wxs,o= "${interactive_users_home[$i]}/$file" - done - fi -done - - name: XCCDF Value var_user_initialization_files_regex # promote to variable set_fact: var_user_initialization_files_regex: !!str @@ -53515,6 +53625,28 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +var_user_initialization_files_regex='' + + +readarray -t interactive_users < <(awk -F: '$3>=1000 {print $1}' /etc/passwd) +readarray -t interactive_users_home < <(awk -F: '$3>=1000 {print $6}' /etc/passwd) +readarray -t interactive_users_shell < <(awk -F: '$3>=1000 {print $7}' /etc/passwd) + +USERS_IGNORED_REGEX='nobody|nfsnobody' + +for (( i=0; i<"${#interactive_users[@]}"; i++ )); do + if ! grep -qP "$USERS_IGNORED_REGEX" <<< "${interactive_users[$i]}" && \ + [ "${interactive_users_shell[$i]}" != "/sbin/nologin" ]; then + + readarray -t init_files < <(find "${interactive_users_home[$i]}" -maxdepth 1 \ + -exec basename {} \; | grep -P "$var_user_initialization_files_regex") + for file in "${init_files[@]}"; do + chmod u-s,g-wxs,o= "${interactive_users_home[$i]}/$file" + done + fi +done @@ -53538,14 +53670,6 @@ following command: Excessive permissions on local interactive user home directories may allow unauthorized access to user files by other users. CCE-84038-9 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53609,6 +53733,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53694,14 +53826,6 @@ to other users. If a subset of users need read access to one another's home directories, this can be provided using groups or ACLs. CCE-84274-0 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53773,6 +53897,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53977,33 +54109,13 @@ as follows: SRG-OS-000480-GPOS-00228 SRG-OS-000480-GPOS-00227 RHEL-08-020353 - 5.6.5 + 4.5.3.3 SV-230385r792902_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81036-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q bash; then - -var_accounts_user_umask='' - - - - - - -grep -q "^\s*umask" /etc/bashrc && \ - sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/bashrc -if ! [ $? -eq 0 ]; then - echo "umask $var_accounts_user_umask" >> /etc/bashrc -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -54084,6 +54196,26 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q bash; then + +var_accounts_user_umask='' + + + + + + +grep -q "^\s*umask" /etc/bashrc && \ + sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/bashrc +if ! [ $? -eq 0 ]; then + echo "umask $var_accounts_user_umask" >> /etc/bashrc +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -54129,16 +54261,6 @@ add or correct the umask setting in /etc/csh.c A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81037-4 - -var_accounts_user_umask='' - - -grep -q "^\s*umask" /etc/csh.cshrc && \ - sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/csh.cshrc -if ! [ $? -eq 0 ]; then - echo "umask $var_accounts_user_umask" >> /etc/csh.cshrc -fi - - name: XCCDF Value var_accounts_user_umask # promote to variable set_fact: var_accounts_user_umask: !!str @@ -54200,6 +54322,16 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_user_umask='' + + +grep -q "^\s*umask" /etc/csh.cshrc && \ + sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/csh.cshrc +if ! [ $? -eq 0 ]; then + echo "umask $var_accounts_user_umask" >> /etc/csh.cshrc +fi @@ -54256,45 +54388,13 @@ add or correct the UMASK setting in /etc/login PR.IP-2 SRG-OS-000480-GPOS-00228 RHEL-08-020351 - 5.6.5 + 4.5.3.3 SV-230383r627750_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read and written to by unauthorized users. CCE-82888-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_user_umask='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^UMASK") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_user_umask" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^UMASK\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^UMASK\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-82888-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -54375,6 +54475,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_user_umask='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^UMASK") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_user_umask" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^UMASK\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^UMASK\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-82888-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -54420,26 +54552,12 @@ considered during the check and properly remediated, if necessary.SRG-OS-000480-GPOS-00228 SRG-OS-000480-GPOS-00227 RHEL-08-020353 - 5.6.5 + 4.5.3.3 SV-230385r792902_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81035-8 - -var_accounts_user_umask='' - - -readarray -t profile_files < <(find /etc/profile.d/ -type f -name '*.sh' -or -name 'sh.local') - -for file in "${profile_files[@]}" /etc/profile; do - grep -qE '^[^#]*umask' "$file" && sed -i -E "s/^(\s*umask\s*)[0-7]+/\1$var_accounts_user_umask/g" "$file" -done - -if ! grep -qrE '^[^#]*umask' /etc/profile*; then - echo "umask $var_accounts_user_umask" >> /etc/profile -fi - - name: XCCDF Value var_accounts_user_umask # promote to variable set_fact: var_accounts_user_umask: !!str @@ -54527,6 +54645,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_user_umask='' + + +readarray -t profile_files < <(find /etc/profile.d/ -type f -name '*.sh' -or -name 'sh.local') + +for file in "${profile_files[@]}" /etc/profile; do + grep -qE '^[^#]*umask' "$file" && sed -i -E "s/^(\s*umask\s*)[0-7]+/\1$var_accounts_user_umask/g" "$file" +done + +if ! grep -qrE '^[^#]*umask' /etc/profile*; then + echo "umask $var_accounts_user_umask" >> /etc/profile +fi @@ -54544,6 +54676,7 @@ fi SRG-OS-000480-GPOS-00227 SRG-OS-000480-GPOS-00228 RHEL-08-020352 + 4.5.3.3 SV-230384r858732_rule The umask controls the default access mode assigned to newly created files. A umask of 077 limits new files to mode 700 or less permissive. Although umask can @@ -54552,15 +54685,6 @@ access modes is typically ignored or required to be 0. This requirement applies to the globally configured system defaults and the local interactive user defaults for each account on the system. CCE-84044-7 - -while IFS= read -r dir; do - while IFS= read -r -d '' file; do - if [ "$(basename $file)" != ".bash_history" ]; then - sed -i 's/^\(\s*umask\s*\)/#\1/g' "$file" - fi - done < <(find $dir -maxdepth 1 -type f -name ".*" -print0) -done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6}' /etc/passwd) - - name: Ensure interactive local users are the owners of their respective initialization files ansible.builtin.shell: @@ -54581,6 +54705,15 @@ done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 - medium_severity - no_reboot_needed - restrict_strategy + + +while IFS= read -r dir; do + while IFS= read -r -d '' file; do + if [ "$(basename $file)" != ".bash_history" ]; then + sed -i 's/^\(\s*umask\s*\)/#\1/g' "$file" + fi + done < <(find $dir -maxdepth 1 -type f -name ".*" -print0) +done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6}' /etc/passwd) @@ -54684,8 +54817,25 @@ $ sudo yum install audispd-plugins audit subsystem, audispd. These plugins can do things like relay events to remote machines or analyze events for suspicious behavior. CCE-82953-1 - -package --add=audispd-plugins + - name: Ensure audispd-plugins is installed + package: + name: audispd-plugins + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82953-1 + - PCI-DSSv4-10.3.3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_audispd-plugins_installed + + +[[packages]] +name = "audispd-plugins" +version = "*" include install_audispd-plugins @@ -54694,6 +54844,9 @@ class install_audispd-plugins { ensure => 'installed', } } + + +package --add=audispd-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -54705,26 +54858,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "audispd-plugins" -version = "*" - - - name: Ensure audispd-plugins is installed - package: - name: audispd-plugins - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82953-1 - - PCI-DSSv4-10.3.3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_audispd-plugins_installed @@ -54741,8 +54874,25 @@ version = "*" 10.3.3 SRG-OS-000342-GPOS-00133 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. - -package --add=audit-audispd-plugins + - name: Ensure audit-audispd-plugins is installed + package: + name: audit-audispd-plugins + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - PCI-DSS-Req-10.5.3 + - PCI-DSSv4-10.3.3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_audit-audispd-plugins_installed + + +[[packages]] +name = "audit-audispd-plugins" +version = "*" include install_audit-audispd-plugins @@ -54751,6 +54901,9 @@ class install_audit-audispd-plugins { ensure => 'installed', } } + + +package --add=audit-audispd-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -54762,26 +54915,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "audit-audispd-plugins" -version = "*" - - - name: Ensure audit-audispd-plugins is installed - package: - name: audit-audispd-plugins - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - PCI-DSS-Req-10.5.3 - - PCI-DSSv4-10.3.3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_audit-audispd-plugins_installed @@ -54856,37 +54989,10 @@ version = "*" SRG-OS-000392-GPOS-00172 SRG-OS-000475-GPOS-00220 RHEL-08-030180 - 4.1.1.1 + 5.2.1.1 SV-230411r744000_rule The auditd service is an access monitoring and accounting daemon, watching system calls to audit any access, in comparison with potential local access control policy such as SELinux policy. CCE-81043-2 - -package --add=audit - - include install_audit - -class install_audit { - package { 'audit': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "audit" ; then - yum install -y "audit" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "audit" -version = "*" - - name: Ensure audit is installed package: name: audit @@ -54910,6 +55016,33 @@ version = "*" - medium_severity - no_reboot_needed - package_audit_installed + + +[[packages]] +name = "audit" +version = "*" + + include install_audit + +class install_audit { + package { 'audit': + ensure => 'installed', + } +} + + +package --add=audit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "audit" ; then + yum install -y "audit" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55108,7 +55241,7 @@ The auditd service can be enabled with the following comm SRG-APP-000508-CTR-001300 SRG-APP-000510-CTR-001310 RHEL-08-030181 - 4.1.1.2 + 5.2.1.4 SV-244542r818838_rule Without establishing what type of events occurred, it would be difficult to establish, correlate, and investigate the events leading up to an outage or attack. @@ -55121,43 +55254,6 @@ can be held accountable for their actions. CCE-80872-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: auditd.service - enabled: true - - include enable_auditd - -class enable_auditd { - service {'auditd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q audit; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'auditd.service' -"$SYSTEMCTL_EXEC" start 'auditd.service' -"$SYSTEMCTL_EXEC" enable 'auditd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["auditd"] - - name: Gather the package facts package_facts: manager: auto @@ -55228,6 +55324,43 @@ enabled = ["auditd"] - medium_severity - no_reboot_needed - service_auditd_enabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: auditd.service + enabled: true + + +[customizations.services] +enabled = ["auditd"] + + include enable_auditd + +class enable_auditd { + service {'auditd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q audit; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'auditd.service' +"$SYSTEMCTL_EXEC" start 'auditd.service' +"$SYSTEMCTL_EXEC" enable 'auditd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55369,7 +55502,7 @@ Run the following command to update command line for already installed kernels:< SRG-OS-000473-GPOS-00218 SRG-OS-000254-GPOS-00095 RHEL-08-030601 - 4.1.1.3 + 5.2.1.2 SV-230468r792904_rule Each process on the system carries an "auditable" flag which indicates whether its activities can be audited. Although auditd takes care of enabling @@ -55377,18 +55510,6 @@ this for all processes which launch after it does, adding the kernel argument ensures it is set for every process during boot. CCE-80825-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=audit=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "audit=1" - - name: Gather the package facts package_facts: manager: auto @@ -55434,6 +55555,18 @@ append = "audit=1" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "audit=1" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=audit=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55472,7 +55605,7 @@ Run the following command to update command line for already installed kernels:< SRG-OS-000462-GPOS-00206 SRG-OS-000471-GPOS-00215 RHEL-08-030602 - 4.1.1.4 + 5.2.1.3 SV-230469r877391_rule audit_backlog_limit sets the queue length for audit events awaiting transfer to the audit daemon. Until the audit daemon is up and running, all log messages @@ -55480,18 +55613,6 @@ are stored in this queue. If the queue is overrun during boot process, the acti defined by audit failure flag is taken. CCE-80943-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=audit_backlog_limit=8192 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "audit_backlog_limit=8192" - - name: Gather the package facts package_facts: manager: auto @@ -55523,6 +55644,18 @@ append = "audit_backlog_limit=8192" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "audit_backlog_limit=8192" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=audit_backlog_limit=8192 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55614,6 +55747,323 @@ to the same event is more efficient. See the following example: Auditing these events could serve as evidence of potential system compromise. CCE-80927-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit open tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for open for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules + set_fact: audit_file="/etc/audit/rules.d/modify.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for open for 64bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules + set_fact: audit_file="/etc/audit/rules.d/modify.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + - audit_arch == "b64" + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -55941,60 +56391,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group + The audit system should collect write events to /etc/group file for all group and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80929-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56039,7 +56531,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56049,7 +56541,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56059,14 +56551,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56085,7 +56577,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56095,7 +56587,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56104,35 +56596,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56177,7 +56668,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56187,7 +56678,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56197,14 +56688,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56223,7 +56714,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56233,7 +56724,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56242,65 +56733,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group - The audit system should collect write events to /etc/group file for all group and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80929-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -56628,24 +57075,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/group + The audit system should collect write events to /etc/group file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80928-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -56654,29 +57144,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56745,10 +57235,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56791,29 +57281,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56882,10 +57372,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56929,62 +57419,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/group - The audit system should collect write events to /etc/group file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80928-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -57312,59 +57759,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80959-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57409,7 +57901,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57419,7 +57911,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57429,14 +57921,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57455,7 +57947,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57465,7 +57957,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57474,34 +57966,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57546,7 +58039,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57556,7 +58049,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57566,14 +58059,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57592,7 +58085,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57602,7 +58095,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57611,65 +58104,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80959-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -57997,60 +58447,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80960-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58095,7 +58587,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58105,7 +58597,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58115,14 +58607,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58141,7 +58633,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58151,7 +58643,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58160,35 +58652,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58233,7 +58724,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58243,7 +58734,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58253,14 +58744,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58279,7 +58770,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58289,7 +58780,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58298,65 +58789,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80960-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -58684,24 +59131,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80961-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -58710,29 +59200,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58801,10 +59291,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58847,29 +59337,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58938,10 +59428,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58985,62 +59475,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80961-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -59368,59 +59815,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80930-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59465,7 +59957,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59475,7 +59967,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59485,14 +59977,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59511,7 +60003,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59521,7 +60013,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59530,34 +60022,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59602,7 +60095,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59612,7 +60105,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59622,14 +60115,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59648,7 +60141,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59658,7 +60151,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59667,65 +60160,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80930-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -60053,60 +60503,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80932-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60151,7 +60643,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60161,7 +60653,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60171,14 +60663,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60197,7 +60689,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60207,7 +60699,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60216,35 +60708,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60289,7 +60780,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60299,7 +60790,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60309,14 +60800,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60335,7 +60826,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60345,7 +60836,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60354,65 +60845,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80932-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -60740,24 +61187,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80931-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -60766,29 +61256,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60857,10 +61347,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60903,29 +61393,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60994,10 +61484,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -61041,62 +61531,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80931-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -61424,59 +61871,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80956-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61521,7 +62013,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61531,7 +62023,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61541,14 +62033,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61567,7 +62059,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61577,7 +62069,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61586,34 +62078,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61658,7 +62151,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61668,7 +62161,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61678,14 +62171,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61704,7 +62197,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61714,7 +62207,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61723,65 +62216,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80956-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -62109,60 +62559,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80957-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62207,7 +62699,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62217,7 +62709,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62227,14 +62719,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62253,7 +62745,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62263,7 +62755,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62272,35 +62764,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62345,7 +62836,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62355,7 +62846,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62365,14 +62856,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62391,7 +62882,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62401,7 +62892,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62410,65 +62901,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80957-4 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -62796,24 +63243,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80958-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -62822,29 +63312,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -62913,10 +63403,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -62959,29 +63449,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -63050,10 +63540,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -63097,62 +63587,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80958-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -63479,320 +63926,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Set architecture for audit openat tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for openat for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules - set_fact: audit_file="/etc/audit/rules.d/modify.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for openat for 64bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules - set_fact: audit_file="/etc/audit/rules.d/modify.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - audit_arch == "b64" - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy @@ -63939,58 +64072,13 @@ With this setting, a reboot will be required to change any audit rules.SRG-APP-000119-CTR-000245 SRG-APP-000120-CTR-000250 RHEL-08-030121 - 4.1.3.20 + 5.2.3.20 SV-230402r627750_rule Making the audit configuration immutable prevents accidental as well as malicious modification of the audit rules, although it may be problematic if legitimate changes are needed during system operation. CCE-80708-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,-e%202%0A - mode: 0600 - path: /etc/audit/rules.d/90-immutable.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Traverse all of: -# -# /etc/audit/audit.rules, (for auditctl case) -# /etc/audit/rules.d/*.rules (for augenrules case) -# -# files to check if '-e .*' setting is present in that '*.rules' file already. -# If found, delete such occurrence since auditctl(8) manual page instructs the -# '-e 2' rule should be placed as the last rule in the configuration -find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-e[[:space:]]\+.*/d' {} ';' - -# Append '-e 2' requirement at the end of both: -# * /etc/audit/audit.rules file (for auditctl case) -# * /etc/audit/rules.d/immutable.rules (for augenrules case) - -for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" -do - echo '' >> $AUDIT_FILE - echo '# Set the audit.rules configuration immutable per security requirements' >> $AUDIT_FILE - echo '# Reboot is required to change audit rules once this setting is applied' >> $AUDIT_FILE - echo '-e 2' >> $AUDIT_FILE - chmod o-rwx $AUDIT_FILE -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64091,6 +64179,51 @@ fi - medium_severity - reboot_required - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,-e%202%0A + mode: 0600 + path: /etc/audit/rules.d/90-immutable.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Traverse all of: +# +# /etc/audit/audit.rules, (for auditctl case) +# /etc/audit/rules.d/*.rules (for augenrules case) +# +# files to check if '-e .*' setting is present in that '*.rules' file already. +# If found, delete such occurrence since auditctl(8) manual page instructs the +# '-e 2' rule should be placed as the last rule in the configuration +find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-e[[:space:]]\+.*/d' {} ';' + +# Append '-e 2' requirement at the end of both: +# * /etc/audit/audit.rules file (for auditctl case) +# * /etc/audit/rules.d/immutable.rules (for augenrules case) + +for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" +do + echo '' >> $AUDIT_FILE + echo '# Set the audit.rules configuration immutable per security requirements' >> $AUDIT_FILE + echo '# Reboot is required to change audit rules once this setting is applied' >> $AUDIT_FILE + echo '-e 2' >> $AUDIT_FILE + chmod o-rwx $AUDIT_FILE +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -64128,30 +64261,6 @@ immutable: If modification of login UIDs is not prevented, they can be changed by unprivileged users and make auditing complicated or impossible. CCE-90783-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# in case auditctl is used -if grep -q '^\s*ExecStartPost=-/sbin/auditctl' /usr/lib/systemd/system/auditd.service; then - if ! grep -q '^\s*--loginuid-immutable\s*$' /etc/audit/audit.rules; then - echo "--loginuid-immutable" >> /etc/audit/audit.rules - fi -else - immutable_found=0 - while IFS= read -r -d '' f; do - if grep -q '^\s*--loginuid-immutable\s*$' "$f"; then - immutable_found=1 - fi - done < <(find /etc/audit/rules.d -maxdepth 1 -name '*.rules' -print0) - if [ $immutable_found -eq 0 ]; then - echo "--loginuid-immutable" >> /etc/audit/rules.d/immutable.rules - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64236,6 +64345,30 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# in case auditctl is used +if grep -q '^\s*ExecStartPost=-/sbin/auditctl' /usr/lib/systemd/system/auditd.service; then + if ! grep -q '^\s*--loginuid-immutable\s*$' /etc/audit/audit.rules; then + echo "--loginuid-immutable" >> /etc/audit/audit.rules + fi +else + immutable_found=0 + while IFS= read -r -d '' f; do + if grep -q '^\s*--loginuid-immutable\s*$' "$f"; then + immutable_found=1 + fi + done < <(find /etc/audit/rules.d -maxdepth 1 -name '*.rules' -print0) + if [ $immutable_found -eq 0 ]; then + echo "--loginuid-immutable" >> /etc/audit/rules.d/immutable.rules + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -64373,168 +64506,11 @@ utility to read audit rules during daemon startup, add the following line to FAU_GEN.1.1.c Req-10.5.5 10.3.4 - 4.1.3.14 + 5.2.3.14 The system's mandatory access policy (SELinux) should not be arbitrarily changed by anything other than administrator action. All changes to MAC policy should be audited. CCE-80721-4 - --- - -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/selinux/%20-p%20wa%20-k%20MAC-policy%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-etcselinux-wa-MAC-policy.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/selinux/" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/MAC-policy.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/MAC-policy.rules" - # If the MAC-policy.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64736,129 +64712,23 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Mandatory Access Controls in usr/share - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --w /usr/share/selinux/ -p wa -k MAC-policy -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /usr/share/selinux/ -p wa -k MAC-policy - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.8 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 4.1.3.14 - The system's mandatory access policy (SELinux) should not be -arbitrarily changed by anything other than administrator action. All changes to -MAC policy should be audited. - CCE-86342-3 - # Remediation is applicable only in certain platforms + --- + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/selinux/%20-p%20wa%20-k%20MAC-policy%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-etcselinux-wa-MAC-policy.rules + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -64885,7 +64755,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -64893,7 +64763,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -64909,12 +64779,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -64933,7 +64803,7 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. # If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/usr/share/selinux/" /etc/audit/rules.d/*.rules) +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/selinux/" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -64962,7 +64832,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -64970,7 +64840,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -64986,12 +64856,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" fi done @@ -64999,6 +64869,128 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Mandatory Access Controls in usr/share + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-w /usr/share/selinux/ -p wa -k MAC-policy +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /usr/share/selinux/ -p wa -k MAC-policy + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.8 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 5.2.3.14 + The system's mandatory access policy (SELinux) should not be +arbitrarily changed by anything other than administrator action. All changes to +MAC policy should be audited. + CCE-86342-3 - name: Gather the package facts package_facts: manager: auto @@ -65183,6 +65175,147 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/usr/share/selinux/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/MAC-policy.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/MAC-policy.rules" + # If the MAC-policy.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -65336,341 +65469,13 @@ appropriate for your system: SRG-OS-000471-GPOS-00215 SRG-APP-000495-CTR-001235 RHEL-08-030302 - 4.1.3.10 + 5.2.3.10 SV-230425r627750_rule The unauthorized exportation of data to external media could result in an information leak where classified information, Privacy Act information, and intellectual property could be lost. An audit trail should be created each time a filesystem is mounted to help identify and guard against information loss. CCE-80722-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="mount" - KEY="perm_mod" - SYSCALL_GROUPING="" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -66001,158 +65806,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Network Environment - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following lines to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification --w /etc/issue -p wa -k audit_rules_networkconfig_modification --w /etc/issue.net -p wa -k audit_rules_networkconfig_modification --w /etc/hosts -p wa -k audit_rules_networkconfig_modification --w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification --w /etc/issue -p wa -k audit_rules_networkconfig_modification --w /etc/issue.net -p wa -k audit_rules_networkconfig_modification --w /etc/hosts -p wa -k audit_rules_networkconfig_modification --w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.5.5 - 10.3.4 - 4.1.3.5 - The network environment should not be modified by anything other -than administrator action. Any change to network parameters should be -audited. - CCE-80723-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -66163,10 +65817,11 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" - AUID_FILTERS="" - SYSCALL="sethostname setdomainname" - KEY="audit_rules_networkconfig_modification" - SYSCALL_GROUPING="sethostname setdomainname" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="mount" + KEY="perm_mod" + SYSCALL_GROUPING="" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -66475,541 +66130,161 @@ if [ "$skip" -ne 0 ]; then fi done -# Then perform the remediations for the watch rules -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue.net" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/hosts" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sysconfig/network" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done - else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Network Environment + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following lines to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification +-w /etc/issue -p wa -k audit_rules_networkconfig_modification +-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification +-w /etc/hosts -p wa -k audit_rules_networkconfig_modification +-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification +-w /etc/issue -p wa -k audit_rules_networkconfig_modification +-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification +-w /etc/hosts -p wa -k audit_rules_networkconfig_modification +-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.5.5 + 10.3.4 + 5.2.3.5 + The network environment should not be modified by anything other +than administrator action. Any change to network parameters should be +audited. + CCE-80723-0 - name: Gather the package facts package_facts: manager: auto @@ -68100,180 +67375,330 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Attempts to Alter Process and Session Initiation Information - The audit system already collects process information for all -users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following lines to a file with suffix .rules in the -directory /etc/audit/rules.d in order to watch for attempted manual -edits of files involved in storing such process information: --w /var/run/utmp -p wa -k session --w /var/log/btmp -p wa -k session --w /var/log/wtmp -p wa -k session -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file in order to watch for attempted manual -edits of files involved in storing such process information: --w /var/run/utmp -p wa -k session --w /var/log/btmp -p wa -k session --w /var/log/wtmp -p wa -k session - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - 0582 - 0584 - 05885 - 0586 - 0846 - 0957 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.3 - 10.2.1.3 - SRG-APP-000505-CTR-001285 - 4.1.3.11 - Manual editing of these files may indicate nefarious activity, such -as an attacker attempting to remove evidence of an intrusion. - CCE-80742-0 - --- + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %0A-w%20/var/run/utmp%20-p%20wa%20-k%20session%0A-w%20/var/log/btmp%20-p%20wa%20-k%20session%0A-w%20/var/log/wtmp%20-p%20wa%20-k%20session%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-audit-session-events.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="" + SYSCALL="sethostname setdomainname" + KEY="audit_rules_networkconfig_modification" + SYSCALL_GROUPING="sethostname setdomainname" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done +# Then perform the remediations for the watch rules # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: @@ -68298,7 +67723,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68306,7 +67731,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68322,12 +67747,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68345,8 +67770,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/run/utmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68359,9 +67784,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68375,7 +67800,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68383,7 +67808,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68399,12 +67824,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68430,7 +67855,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68438,7 +67863,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68454,12 +67879,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68477,8 +67902,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/btmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue.net" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68491,9 +67916,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68507,7 +67932,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68515,7 +67940,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68531,12 +67956,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68562,7 +67987,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68570,7 +67995,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68586,12 +68011,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68609,8 +68034,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/wtmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/hosts" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68623,9 +68048,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68639,7 +68064,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68647,7 +68072,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68663,12 +68088,144 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sysconfig/network" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done @@ -68676,6 +68233,160 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Attempts to Alter Process and Session Initiation Information + The audit system already collects process information for all +users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following lines to a file with suffix .rules in the +directory /etc/audit/rules.d in order to watch for attempted manual +edits of files involved in storing such process information: +-w /var/run/utmp -p wa -k session +-w /var/log/btmp -p wa -k session +-w /var/log/wtmp -p wa -k session +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file in order to watch for attempted manual +edits of files involved in storing such process information: +-w /var/run/utmp -p wa -k session +-w /var/log/btmp -p wa -k session +-w /var/log/wtmp -p wa -k session + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + 0582 + 0584 + 05885 + 0586 + 0846 + 0957 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.3 + 10.2.1.3 + SRG-APP-000505-CTR-001285 + 5.2.3.11 + Manual editing of these files may indicate nefarious activity, such +as an attacker attempting to remove evidence of an intrusion. + CCE-80742-0 - name: Gather the package facts package_facts: manager: auto @@ -69241,59 +68952,24 @@ fi - reboot_required - restrict_strategy - - - - - - Ensure auditd Collects System Administrator Actions - /etc/sudoers - At a minimum, the audit system should collect administrator actions -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the default), -add the following line to a file with suffix .rules in the directory -/etc/audit/rules.d: --w /etc/sudoers -p wa -k actions -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /etc/sudoers -p wa -k actions - CCI-000018 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-001403 - CCI-001404 - CCI-002130 - CCI-002132 - CCI-002884 - SRG-OS-000004-GPOS-00004 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000304-GPOS-00121 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000470-GPOS-00214 - SRG-OS-000471-GPOS-00215 - SRG-OS-000239-GPOS-00089 - SRG-OS-000240-GPOS-00090 - SRG-OS-000241-GPOS-00091 - SRG-OS-000303-GPOS-00120 - SRG-OS-000466-GPOS-00210 - SRG-OS-000476-GPOS-00221 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000503-CTR-001275 - RHEL-08-030171 - SV-230409r627750_rule - The actions taken by system administrators should be audited to keep a record -of what was executed on the system, as well as, for accountability purposes. -Editing the sudoers file may be sign of an attacker trying to -establish persistent methods to a system, auditing the editing of the sudoers -files mitigates this risk. - CCE-90175-1 - # Remediation is applicable only in certain platforms + --- + + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %0A-w%20/var/run/utmp%20-p%20wa%20-k%20session%0A-w%20/var/log/btmp%20-p%20wa%20-k%20session%0A-w%20/var/log/wtmp%20-p%20wa%20-k%20session%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-audit-session-events.rules + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -69320,7 +68996,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69328,7 +69004,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69344,12 +69020,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -69367,8 +69043,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/run/utmp" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -69381,9 +69057,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -69397,7 +69073,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69405,7 +69081,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69421,75 +69097,391 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" fi done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Check if watch rule for /etc/sudoers already exists in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: ^\s*-w\s+/etc/sudoers\s+-p\s+wa(\s|$)+ - patterns: '*.rules' - register: find_existing_watch_rules_d - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: Search /etc/audit/rules.d for other rules with specified key actions - find: - paths: /etc/audit/rules.d - contains: ^.*(?:-F key=|-k\s+)actions$ - patterns: '*.rules' - register: find_watch_key - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - find_existing_watch_rules_d.matched is defined and find_existing_watch_rules_d.matched - == 0 - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') -- name: Use /etc/audit/rules.d/actions.rules as the recipient for the rule - set_fact: - all_files: +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/btmp" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/wtmp" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + Ensure auditd Collects System Administrator Actions - /etc/sudoers + At a minimum, the audit system should collect administrator actions +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the default), +add the following line to a file with suffix .rules in the directory +/etc/audit/rules.d: +-w /etc/sudoers -p wa -k actions +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /etc/sudoers -p wa -k actions + CCI-000018 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-001403 + CCI-001404 + CCI-002130 + CCI-002132 + CCI-002884 + SRG-OS-000004-GPOS-00004 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000304-GPOS-00121 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000470-GPOS-00214 + SRG-OS-000471-GPOS-00215 + SRG-OS-000239-GPOS-00089 + SRG-OS-000240-GPOS-00090 + SRG-OS-000241-GPOS-00091 + SRG-OS-000303-GPOS-00120 + SRG-OS-000466-GPOS-00210 + SRG-OS-000476-GPOS-00221 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000503-CTR-001275 + RHEL-08-030171 + SV-230409r627750_rule + The actions taken by system administrators should be audited to keep a record +of what was executed on the system, as well as, for accountability purposes. +Editing the sudoers file may be sign of an attacker trying to +establish persistent methods to a system, auditing the editing of the sudoers +files mitigates this risk. + CCE-90175-1 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Check if watch rule for /etc/sudoers already exists in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: ^\s*-w\s+/etc/sudoers\s+-p\s+wa(\s|$)+ + patterns: '*.rules' + register: find_existing_watch_rules_d + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Search /etc/audit/rules.d for other rules with specified key actions + find: + paths: /etc/audit/rules.d + contains: ^.*(?:-F key=|-k\s+)actions$ + patterns: '*.rules' + register: find_watch_key + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - find_existing_watch_rules_d.matched is defined and find_existing_watch_rules_d.matched + == 0 + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Use /etc/audit/rules.d/actions.rules as the recipient for the rule + set_fact: + all_files: - /etc/audit/rules.d/actions.rules when: - '"audit" in ansible_facts.packages' @@ -69587,62 +69579,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ - At a minimum, the audit system should collect administrator actions -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the default), -add the following line to a file with suffix .rules in the directory -/etc/audit/rules.d: --w /etc/sudoers.d/ -p wa -k actions -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /etc/sudoers.d/ -p wa -k actions - CCI-000018 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-001403 - CCI-001404 - CCI-002130 - CCI-002132 - CCI-002884 - SRG-OS-000004-GPOS-00004 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000304-GPOS-00121 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000470-GPOS-00214 - SRG-OS-000471-GPOS-00215 - SRG-OS-000239-GPOS-00089 - SRG-OS-000240-GPOS-00090 - SRG-OS-000241-GPOS-00091 - SRG-OS-000303-GPOS-00120 - SRG-OS-000466-GPOS-00210 - SRG-OS-000476-GPOS-00221 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000503-CTR-001275 - RHEL-08-030172 - SV-230410r627750_rule - The actions taken by system administrators should be audited to keep a record -of what was executed on the system, as well as, for accountability purposes. -Editing the sudoers file may be sign of an attacker trying to -establish persistent methods to a system, auditing the editing of the sudoers -files mitigates this risk. - CCE-89497-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -69669,7 +69606,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69677,7 +69614,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69693,12 +69630,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -69717,7 +69654,7 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. # If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -69746,7 +69683,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69754,7 +69691,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69770,12 +69707,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" fi done @@ -69783,6 +69720,61 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ + At a minimum, the audit system should collect administrator actions +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the default), +add the following line to a file with suffix .rules in the directory +/etc/audit/rules.d: +-w /etc/sudoers.d/ -p wa -k actions +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /etc/sudoers.d/ -p wa -k actions + CCI-000018 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-001403 + CCI-001404 + CCI-002130 + CCI-002132 + CCI-002884 + SRG-OS-000004-GPOS-00004 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000304-GPOS-00121 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000470-GPOS-00214 + SRG-OS-000471-GPOS-00215 + SRG-OS-000239-GPOS-00089 + SRG-OS-000240-GPOS-00090 + SRG-OS-000241-GPOS-00091 + SRG-OS-000303-GPOS-00120 + SRG-OS-000466-GPOS-00210 + SRG-OS-000476-GPOS-00221 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000503-CTR-001275 + RHEL-08-030172 + SV-230410r627750_rule + The actions taken by system administrators should be audited to keep a record +of what was executed on the system, as well as, for accountability purposes. +Editing the sudoers file may be sign of an attacker trying to +establish persistent methods to a system, auditing the editing of the sudoers +files mitigates this risk. + CCE-89497-2 - name: Gather the package facts package_facts: manager: auto @@ -69935,6 +69927,147 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -69961,7 +70094,7 @@ If audit is using the "augenrules" tool to load the rules, run the following com If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. Note that these rules can be configured in a number of ways while still achieving the desired effect. - 4.1.3.2 + 5.2.3.2 Creating an audit log of users with temporary elevated privileges and the operation(s) they performed is essential to reporting. Administrators will want to correlate the events written to the audit trail with the records @@ -69975,6 +70108,128 @@ of privileged functions is one way to detect such misuse and identify the risk from insider threats and the advanced persistent threat. CCE-90209-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Service facts + ansible.builtin.service_facts: null + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Check the rules script being used + ansible.builtin.command: grep '^ExecStartPost' /usr/lib/systemd/system/auditd.service + register: check_rules_scripts_result + changed_when: false + failed_when: false + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set suid_audit_rules fact + ansible.builtin.set_fact: + suid_audit_rules: + - rule: -a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset -k user_emulation + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Update /etc/audit/rules.d/user_emulation.rules to audit privileged functions + ansible.builtin.lineinfile: + path: /etc/audit/rules.d/user_emulation.rules + line: '{{ item.rule }}' + regexp: '{{ item.regex }}' + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"auditd.service" in ansible_facts.services' + - '"augenrules" in check_rules_scripts_result.stdout' + register: augenrules_audit_rules_privilege_function_update_result + with_items: '{{ suid_audit_rules }}' + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Update Update /etc/audit/audit.rules to audit privileged functions + ansible.builtin.lineinfile: + path: /etc/audit/audit.rules + line: '{{ item.rule }}' + regexp: '{{ item.regex }}' + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"auditd.service" in ansible_facts.services' + - '"auditctl" in check_rules_scripts_result.stdout' + register: auditctl_audit_rules_privilege_function_update_result + with_items: '{{ suid_audit_rules }}' + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Restart Auditd + ansible.builtin.command: /usr/sbin/service auditd restart + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) + - ansible_facts.services["auditd.service"].state == "running" + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -70302,12 +70557,83 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events When Privileged Executables Are Run + Verify the system generates an audit record when privileged functions are executed. + +If audit is using the "auditctl" tool to load the rules, run the following command: + +$ sudo grep execve /etc/audit/audit.rules + +If audit is using the "augenrules" tool to load the rules, run the following command: + +$ sudo grep -r execve /etc/audit/rules.d + + +-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid +-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + + +If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. +If both the "b32" and "b64" audit rules for "SGID" files are not defined, this is a finding. + Note that these rules can be configured in a +number of ways while still achieving the desired effect. + CCI-001814 + CCI-001882 + CCI-001889 + CCI-001880 + CCI-001881 + CCI-001878 + CCI-001879 + CCI-001875 + CCI-001877 + CCI-001914 + CCI-002233 + CCI-002234 + CM-5(1) + AU-7(a) + AU-7(b) + AU-8(b) + AU-12(3) + AC-6(9) + 10.2.1.2 + SRG-OS-000326-GPOS-00126 + SRG-OS-000327-GPOS-00127 + SRG-APP-000343-CTR-000780 + SRG-APP-000381-CTR-000905 + RHEL-08-030000 + SV-230386r854037_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have +compromised information system accounts, is a serious and ongoing concern +and can have significant adverse impacts on organizations. Auditing the use +of privileged functions is one way to detect such misuse and identify the +risk from insider threats and the advanced persistent threat. + + CCE-83556-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70320,25 +70646,16 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Check the rules script being used - ansible.builtin.command: grep '^ExecStartPost' /usr/lib/systemd/system/auditd.service - register: check_rules_scripts_result - changed_when: false - failed_when: false - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70348,38 +70665,57 @@ fi - name: Set suid_audit_rules fact ansible.builtin.set_fact: suid_audit_rules: - - rule: -a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset -k user_emulation - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Update /etc/audit/rules.d/user_emulation.rules to audit privileged functions +- name: Update /etc/audit/rules.d/privileged.rules to audit privileged functions ansible.builtin.lineinfile: - path: /etc/audit/rules.d/user_emulation.rules + path: /etc/audit/rules.d/privileged.rules line: '{{ item.rule }}' regexp: '{{ item.regex }}' create: true when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"auditd.service" in ansible_facts.services' - - '"augenrules" in check_rules_scripts_result.stdout' + - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') register: augenrules_audit_rules_privilege_function_update_result with_items: '{{ suid_audit_rules }}' tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70395,13 +70731,20 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"auditd.service" in ansible_facts.services' - - '"auditctl" in check_rules_scripts_result.stdout' + - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') register: auditctl_audit_rules_privilege_function_update_result with_items: '{{ suid_audit_rules }}' tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70416,77 +70759,22 @@ fi - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) - ansible_facts.services["auditd.service"].state == "running" tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Events When Privileged Executables Are Run - Verify the system generates an audit record when privileged functions are executed. - -If audit is using the "auditctl" tool to load the rules, run the following command: - -$ sudo grep execve /etc/audit/audit.rules - -If audit is using the "augenrules" tool to load the rules, run the following command: - -$ sudo grep -r execve /etc/audit/rules.d - - --a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid --a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - - -If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. -If both the "b32" and "b64" audit rules for "SGID" files are not defined, this is a finding. - Note that these rules can be configured in a -number of ways while still achieving the desired effect. - CCI-001814 - CCI-001882 - CCI-001889 - CCI-001880 - CCI-001881 - CCI-001878 - CCI-001879 - CCI-001875 - CCI-001877 - CCI-001914 - CCI-002233 - CCI-002234 - CM-5(1) - AU-7(a) - AU-7(b) - AU-8(b) - AU-12(3) - AC-6(9) - 10.2.1.2 - SRG-OS-000326-GPOS-00126 - SRG-OS-000327-GPOS-00127 - SRG-APP-000343-CTR-000780 - SRG-APP-000381-CTR-000905 - RHEL-08-030000 - SV-230386r854037_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have -compromised information system accounts, is a serious and ongoing concern -and can have significant adverse impacts on organizations. Auditing the use -of privileged functions is one way to detect such misuse and identify the -risk from insider threats and the advanced persistent threat. - - CCE-83556-1 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -71148,161 +71436,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Service facts - ansible.builtin.service_facts: null - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set suid_audit_rules fact - ansible.builtin.set_fact: - suid_audit_rules: - - rule: -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Update /etc/audit/rules.d/privileged.rules to audit privileged functions - ansible.builtin.lineinfile: - path: /etc/audit/rules.d/privileged.rules - line: '{{ item.rule }}' - regexp: '{{ item.regex }}' - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') - register: augenrules_audit_rules_privilege_function_update_result - with_items: '{{ suid_audit_rules }}' - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Update Update /etc/audit/audit.rules to audit privileged functions - ansible.builtin.lineinfile: - path: /etc/audit/audit.rules - line: '{{ item.rule }}' - regexp: '{{ item.regex }}' - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') - register: auditctl_audit_rules_privilege_function_update_result - with_items: '{{ suid_audit_rules }}' - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Restart Auditd - ansible.builtin.command: /usr/sbin/service auditd restart - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) - - ansible_facts.services["auditd.service"].state == "running" - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -71512,299 +71645,10 @@ utility to read audit rules during daemon startup, add the following line to SRG-APP-000319-CTR-000745 SRG-APP-000320-CTR-000750 SRG-APP-000509-CTR-001305 - 4.1.3.1 + 5.2.3.1 The actions taken by system administrators should be audited to keep a record of what was executed on the system, as well as, for accountability purposes. CCE-80743-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/sudoers.d/%20-p%20wa%20-k%20actions%0A-w%20/etc/sudoers%20-p%20wa%20-k%20actions%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-audit-sysadmin-actions.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -72232,6 +72076,295 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/sudoers.d/%20-p%20wa%20-k%20actions%0A-w%20/etc/sudoers%20-p%20wa%20-k%20actions%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-audit-sysadmin-actions.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -72305,29 +72438,6 @@ Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. CCE-80744-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audit_failure_mode='' - - -# Traverse all of: -# -# /etc/audit/audit.rules, (for auditctl case) -# /etc/audit/rules.d/*.rules (for augenrules case) -find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-f[[:space:]]\+.*/d' {} ';' - -for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" -do - echo '' >> $AUDIT_FILE - echo '# Set the audit.rules configuration to halt system upon audit failure per security requirements' >> $AUDIT_FILE - echo "-f $var_audit_failure_mode" >> $AUDIT_FILE -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -72420,6 +72530,29 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audit_failure_mode='' + + +# Traverse all of: +# +# /etc/audit/audit.rules, (for auditctl case) +# /etc/audit/rules.d/*.rules (for augenrules case) +find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-f[[:space:]]\+.*/d' {} ';' + +for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" +do + echo '' >> $AUDIT_FILE + echo '# Set the audit.rules configuration to halt system upon audit failure per security requirements' >> $AUDIT_FILE + echo "-f $var_audit_failure_mode" >> $AUDIT_FILE +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -73525,154 +73658,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030170 - 4.1.3.8 + 5.2.3.8 SV-230408r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80758-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/group" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -73898,6 +73889,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/group" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -74118,154 +74251,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030160 - 4.1.3.8 + 5.2.3.8 SV-230407r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80759-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/gshadow" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -74491,6 +74482,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/gshadow" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -74713,154 +74846,12 @@ account changes: SRG-APP-000498-CTR-001250 SRG-APP-000503-CTR-001275 RHEL-08-030140 - 4.1.3.8 + 5.2.3.8 SV-230405r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80760-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/security/opasswd" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -75086,6 +75077,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/security/opasswd" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -75311,154 +75444,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030150 - 4.1.3.8 + 5.2.3.8 SV-230406r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80761-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/passwd" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -75684,6 +75675,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/passwd" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -75904,154 +76037,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030130 - 4.1.3.8 + 5.2.3.8 SV-230404r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80762-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/shadow" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -76278,58 +76269,11 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Attempts to perform maintenance activities - The Red Hat Enterprise Linux 8 operating system must generate audit records for -privileged activities, nonlocal maintenance, diagnostic sessions and -other system-level access. - -Verify the operating system audits activities performed during nonlocal -maintenance and diagnostic sessions. Run the following command: -$ sudo auditctl -l | grep sudo.log --w /var/log/sudo.log -p wa -k maintenance - BP28(R73) - CCI-000172 - CCI-002884 - Req-10.2.2 - Req-10.2.5.b - 10.2.1.4 - SRG-OS-000392-GPOS-00172 - SRG-OS-000471-GPOS-00215 - 4.1.3.3 - If events associated with nonlocal administrative access or diagnostic -sessions are not logged, a major tool for assessing and investigating -attacks would not be available. -This requirement addresses auditing-related issues associated with -maintenance tools used specifically for diagnostic and repair actions -on organizational information systems. -Nonlocal maintenance and diagnostic activities are those activities -conducted by individuals communicating through a network, either an -external network (e.g., the internet) or an internal network. Local -maintenance and diagnostic activities are those activities carried -out by individuals physically present at the information system or -information system component and not communicating across a network -connection. -This requirement applies to hardware/software diagnostic test -equipment or tools. This requirement does not cover hardware/software -components that may support information system maintenance, yet are a -part of the system, for example, the software implementing "ping," -"ls," "ipconfig," or the hardware and software implementing the -monitoring port of an Ethernet switch. - CCE-86432-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: # @@ -76353,7 +76297,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -76361,7 +76305,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -76377,12 +76321,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -76400,8 +76344,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/sudo.log" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/shadow" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -76414,9 +76358,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -76430,7 +76374,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -76438,7 +76382,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -76454,12 +76398,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" fi done @@ -76467,6 +76411,52 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Attempts to perform maintenance activities + The Red Hat Enterprise Linux 8 operating system must generate audit records for +privileged activities, nonlocal maintenance, diagnostic sessions and +other system-level access. + +Verify the operating system audits activities performed during nonlocal +maintenance and diagnostic sessions. Run the following command: +$ sudo auditctl -l | grep sudo.log +-w /var/log/sudo.log -p wa -k maintenance + BP28(R73) + CCI-000172 + CCI-002884 + Req-10.2.2 + Req-10.2.5.b + 10.2.1.4 + SRG-OS-000392-GPOS-00172 + SRG-OS-000471-GPOS-00215 + 5.2.3.3 + If events associated with nonlocal administrative access or diagnostic +sessions are not logged, a major tool for assessing and investigating +attacks would not be available. +This requirement addresses auditing-related issues associated with +maintenance tools used specifically for diagnostic and repair actions +on organizational information systems. +Nonlocal maintenance and diagnostic activities are those activities +conducted by individuals communicating through a network, either an +external network (e.g., the internet) or an internal network. Local +maintenance and diagnostic activities are those activities carried +out by individuals physically present at the information system or +information system component and not communicating across a network +connection. +This requirement applies to hardware/software diagnostic test +equipment or tools. This requirement does not cover hardware/software +components that may support information system maintenance, yet are a +part of the system, for example, the software implementing "ping," +"ls," "ipconfig," or the hardware and software implementing the +monitoring port of an Ethernet switch. + CCE-86432-2 - name: Gather the package facts package_facts: manager: auto @@ -76635,6 +76625,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/sudo.log" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -76666,6 +76799,158 @@ utility to read audit rules during daemon startup, add the rule to Auditing these events could serve as evidence of potential system compromise.' CCE-80941-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80941-8 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSSv4-10.3.1 + - directory_access_var_log_audit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /var/log/audit + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/access-audit-trail.rules + set_fact: audit_file="/etc/audit/rules.d/access-audit-trail.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r + -F auid>=1000 -F auid!=unset -F key=access-audit-trail + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r + -F auid>=1000 -F auid!=unset -F key=access-audit-trail + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80941-8 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSSv4-10.3.1 + - directory_access_var_log_audit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -76985,158 +77270,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80941-8 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSSv4-10.3.1 - - directory_access_var_log_audit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /var/log/audit - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/access-audit-trail.rules - set_fact: audit_file="/etc/audit/rules.d/access-audit-trail.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r - -F auid>=1000 -F auid!=unset -F key=access-audit-trail - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r - -F auid>=1000 -F auid!=unset -F key=access-audit-trail - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80941-8 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSSv4-10.3.1 - - directory_access_var_log_audit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -77258,27 +77391,6 @@ group account, change the group ownership of the audit directories to this speci Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. CCE-88225-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -m 1 -q ^log_group /etc/audit/auditd.conf; then - GROUP=$(awk -F "=" '/log_group/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') -else - GROUP=root -fi -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - DIR=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ' | rev | cut -d"/" -f2- | rev) -else - DIR="/var/log/audit" -fi - - -find ${DIR} -type d -exec chgrp ${GROUP} {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -77349,6 +77461,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -m 1 -q ^log_group /etc/audit/auditd.conf; then + GROUP=$(awk -F "=" '/log_group/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') +else + GROUP=root +fi +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + DIR=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ' | rev | cut -d"/" -f2- | rev) +else + DIR="/var/log/audit" +fi + + +find ${DIR} -type d -exec chgrp ${GROUP} {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77467,21 +77600,6 @@ To properly set the owner of /var/log/audit, run the comm Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. CCE-88226-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') - LOGPATH="$(dirname "$FILE")" - chown root $LOGPATH -else - chown root /var/log/audit -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -77549,6 +77667,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') + LOGPATH="$(dirname "$FILE")" + chown root $LOGPATH +else + chown root /var/log/audit +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77676,6 +77809,7 @@ By default, audit_log_directory is "/var SRG-OS-000058-GPOS-00028 SRG-OS-000059-GPOS-00029 RHEL-08-030120 + 5.2.4.1 SV-230401r627750_rule If users can write to audit logs, audit trails can be modified or destroyed. CCE-84048-8 @@ -77815,6 +77949,7 @@ to this specific group. SRG-OS-000059-GPOS-00029 SRG-OS-000206-GPOS-00084 RHEL-08-030090 + 5.2.4.4 SV-230398r627750_rule Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. @@ -77857,6 +77992,7 @@ fi chown :root /etc/audit/audit*.{rules,conf} /etc/audit/rules.d/* CCI-000171 SRG-OS-000063-GPOS-00032 + 5.2.4.7 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -77864,21 +78000,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find /etc/audit/ -maxdepth 1 -type f ! -group 0 -regex '^audit(\.rules|d\.conf)$' -exec chgrp 0 {} \; - -find /etc/audit/rules.d/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.rules$' -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86405-8 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77896,6 +78023,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77914,6 +78042,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77931,6 +78060,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77949,12 +78079,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find /etc/audit/ -maxdepth 1 -type f ! -group 0 -regex '^audit(\.rules|d\.conf)$' -exec chgrp 0 {} \; + +find /etc/audit/rules.d/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.rules$' -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77974,6 +78116,7 @@ To properly set the owner of /etc/audit/rules.d/, run the $ sudo chown root /etc/audit/rules.d/ CCI-000171 SRG-OS-000063-GPOS-00032 + 5.2.4.6 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -77981,21 +78124,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find /etc/audit/ -maxdepth 1 -type f ! -uid 0 -regex '^audit(\.rules|d\.conf)$' -exec chown 0 {} \; - -find /etc/audit/rules.d/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.rules$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86406-6 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78013,6 +78147,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78031,6 +78166,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78048,6 +78184,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78066,12 +78203,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find /etc/audit/ -maxdepth 1 -type f ! -uid 0 -regex '^audit(\.rules|d\.conf)$' -exec chown 0 {} \; + +find /etc/audit/rules.d/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.rules$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78337,6 +78486,7 @@ To properly set the owner of /var/log/audit/*, run the co SRG-OS-000059-GPOS-00029 SRG-OS-000206-GPOS-00084 RHEL-08-030080 + 5.2.4.3 SV-230397r627750_rule Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. @@ -78366,6 +78516,7 @@ fi Audit Configuration Files Permissions are 640 or More Restrictive All audit configuration files permissions must be 640 or more restrictive. chmod 0640 /etc/audit/audit*.{rules,conf} /etc/audit/rules.d/* + 5.2.4.5 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -78373,21 +78524,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find -H /etc/audit/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*audit\(\.rules\|d\.conf\)$' -exec chmod u-xs,g-xws,o-xwrt {} \; - -find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*\.rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86407-4 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78406,6 +78548,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78424,6 +78567,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78442,6 +78586,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78460,12 +78605,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find -H /etc/audit/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*audit\(\.rules\|d\.conf\)$' -exec chmod u-xs,g-xws,o-xwrt {} \; + +find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*\.rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78595,25 +78752,10 @@ By default, audit_log_file is "/var/log/audit/audit.log".SRG-OS-000206-GPOS-00084 SRG-APP-000118-CTR-000240 RHEL-08-030070 + 5.2.4.2 SV-230396r902733_rule If users can write to audit logs, audit trails can be modified or destroyed. CCE-80819-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') -else - FILE="/var/log/audit/audit.log" -fi - - -chmod 0600 $FILE - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -78756,6 +78898,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') +else + FILE="/var/log/audit/audit.log" +fi + + +chmod 0600 $FILE + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78944,7 +79102,7 @@ calls with others as identifying earlier in this guide is more efficient.SRG-APP-000495-CTR-001235 SRG-APP-000499-CTR-001255 RHEL-08-030490 - 4.1.3.9 + 5.2.3.9 SV-230456r810462_rule The changing of file permissions could indicate that a user is attempting to gain access to information that would otherwise be disallowed. Auditing DAC modifications @@ -78952,334 +79110,6 @@ can facilitate the identification of patterns of abuse among both authorized and unauthorized users. CCE-80685-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="chmod" - KEY="perm_mod" - SYSCALL_GROUPING="chmod fchmod fchmodat" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -79621,185 +79451,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - chown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - CCE-80686-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -79811,9 +79463,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="chown" + SYSCALL="chmod" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="chmod fchmod fchmodat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -80127,6 +79779,184 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - chown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + + CCE-80686-9 - name: Gather the package facts package_facts: manager: auto @@ -80472,184 +80302,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchmod - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030490 - 4.1.3.9 - SV-230456r810462_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80687-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -80660,9 +80314,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchmod" + SYSCALL="chown" KEY="perm_mod" - SYSCALL_GROUPING="chmod fchmod fchmodat" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -80976,6 +80630,182 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchmod + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030490 + 5.2.3.9 + SV-230456r810462_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80687-7 - name: Gather the package facts package_facts: manager: auto @@ -81314,183 +81144,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchmodat - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030490 - 4.1.3.9 - SV-230456r810462_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80688-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -81502,7 +81156,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchmodat" + SYSCALL="fchmod" KEY="perm_mod" SYSCALL_GROUPING="chmod fchmod fchmodat" @@ -81818,6 +81472,182 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchmodat + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030490 + 5.2.3.9 + SV-230456r810462_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80688-5 - name: Gather the package facts package_facts: manager: auto @@ -82156,187 +81986,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80689-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -82348,9 +81998,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchown" + SYSCALL="fchmodat" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="chmod fchmod fchmodat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -82664,6 +82314,186 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80689-3 - name: Gather the package facts package_facts: manager: auto @@ -83006,184 +82836,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchownat - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80690-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -83195,7 +82848,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchownat" + SYSCALL="fchown" KEY="perm_mod" SYSCALL_GROUPING="chown fchown fchownat lchown" @@ -83511,6 +83164,183 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchownat + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80690-1 - name: Gather the package facts package_facts: manager: auto @@ -83853,197 +83683,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fremovexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80691-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -84055,328 +83695,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fremovexattr" - KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - - - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid=0" - SYSCALL="fremovexattr" + SYSCALL="fchownat" KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -84690,6 +84011,196 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fremovexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80691-9 - name: Gather the package facts package_facts: manager: auto @@ -85296,194 +84807,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fsetxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80692-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -85495,7 +84819,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fsetxattr" + SYSCALL="fremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -85814,7 +85138,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="fsetxattr" + SYSCALL="fremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -86130,135 +85454,322 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80692-7 - - CJIS-5.4.1.1 - - DISA-STIG-RHEL-08-030200 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.5.5 - - PCI-DSSv4-10.3.4 - - audit_rules_dac_modification_fsetxattr - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Set architecture for audit fsetxattr tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80692-7 - - CJIS-5.4.1.1 - - DISA-STIG-RHEL-08-030200 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.5.5 - - PCI-DSSv4-10.3.4 - - audit_rules_dac_modification_fsetxattr - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for fsetxattr for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - fsetxattr - syscall_grouping: - - fremovexattr - - lremovexattr - - removexattr - - fsetxattr - - lsetxattr - - setxattr - - - name: Check existence of fsetxattr in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/perm_mod.rules - set_fact: audit_file="/etc/audit/rules.d/perm_mod.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F auid>=1000 - -F auid!=unset -F key=perm_mod - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fsetxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80692-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80692-7 + - CJIS-5.4.1.1 + - DISA-STIG-RHEL-08-030200 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.5.5 + - PCI-DSSv4-10.3.4 + - audit_rules_dac_modification_fsetxattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit fsetxattr tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80692-7 + - CJIS-5.4.1.1 + - DISA-STIG-RHEL-08-030200 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.5.5 + - PCI-DSSv4-10.3.4 + - audit_rules_dac_modification_fsetxattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for fsetxattr for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - fsetxattr + syscall_grouping: + - fremovexattr + - lremovexattr + - removexattr + - fsetxattr + - lsetxattr + - setxattr + + - name: Check existence of fsetxattr in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/perm_mod.rules + set_fact: audit_file="/etc/audit/rules.d/perm_mod.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F auid>=1000 + -F auid!=unset -F key=perm_mod + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: - fsetxattr syscall_grouping: - fremovexattr @@ -86736,186 +86247,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lchown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - CCE-80693-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -86926,9 +86259,328 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lchown" + SYSCALL="fsetxattr" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + + + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid=0" + SYSCALL="fsetxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -87242,6 +86894,184 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lchown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + + CCE-80693-5 - name: Gather the package facts package_facts: manager: auto @@ -87587,200 +87417,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lremovexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80694-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -87791,328 +87429,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lremovexattr" - KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - - - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid=0" - SYSCALL="lremovexattr" + SYSCALL="lchown" KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -88426,6 +87745,198 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lremovexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80694-3 - name: Gather the package facts package_facts: manager: auto @@ -89032,194 +88543,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lsetxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80695-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -89231,7 +88555,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lsetxattr" + SYSCALL="lremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -89550,7 +88874,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="lsetxattr" + SYSCALL="lremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -89866,6 +89190,193 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lsetxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80695-0 - name: Gather the package facts package_facts: manager: auto @@ -90472,198 +89983,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - removexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -following line to a file with suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80696-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -90675,7 +89995,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="removexattr" + SYSCALL="lsetxattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -90994,7 +90314,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="removexattr" + SYSCALL="lsetxattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -91310,6 +90630,197 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - removexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +following line to a file with suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80696-8 - name: Gather the package facts package_facts: manager: auto @@ -91916,186 +91427,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - setxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000466-GPOS-00210 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80697-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -92107,7 +91439,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="setxattr" + SYSCALL="removexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -92426,7 +91758,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="setxattr" + SYSCALL="removexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -92742,6 +92074,185 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - setxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000466-GPOS-00210 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80697-6 - name: Gather the package facts package_facts: manager: auto @@ -93348,215 +92859,502 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - umount - At a minimum, the audit system should collect file system umount -changes. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - CCI-000130 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -ACTION_ARCH_FILTERS="-a always,exit -F arch=b32" -OTHER_FILTERS="" -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="umount" -KEY="perm_mod" -SYSCALL_GROUPING="" - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -for audit_file in "${files_to_inspect[@]}" +for ARCH in "${RULE_ARCHS[@]}" do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="setxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -unset syscall_a + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + + + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid=0" + SYSCALL="setxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -93702,11 +93500,50 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi +done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - umount + At a minimum, the audit system should collect file system umount +changes. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + CCI-000130 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + - name: Gather the package facts package_facts: manager: auto @@ -93850,67 +93687,18 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - umount2 - At a minimum, the audit system should collect file system umount2 -changes. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - CCI-000130 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-90776-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="umount2" - KEY="perm_mod" - SYSCALL_GROUPING="" +ACTION_ARCH_FILTERS="-a always,exit -F arch=b32" +OTHER_FILTERS="" +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="umount" +KEY="perm_mod" +SYSCALL_GROUPING="" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94069,7 +93857,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94215,12 +94003,54 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - umount2 + At a minimum, the audit system should collect file system umount2 +changes. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + CCI-000130 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-90776-6 - name: Gather the package facts package_facts: manager: auto @@ -94515,65 +94345,24 @@ fi - reboot_required - restrict_strategy - - - - - - - - - - Record Execution Attempts to Run ACL Privileged Commands - At a minimum, the audit system should collect the execution of -ACL privileged commands for all users and root. - - Record Any Attempts to Run chacl - At a minimum, the audit system should collect any execution attempt -of the chacl command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030570 - 4.1.3.17 - SV-230464r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-89446-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/chacl -F perm=x" -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="" -KEY="privileged" -SYSCALL_GROUPING="" -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -unset syscall_a +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="umount2" + KEY="perm_mod" + SYSCALL_GROUPING="" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94732,7 +94521,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -unset syscall_a + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94878,11 +94667,60 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi +done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Execution Attempts to Run ACL Privileged Commands + At a minimum, the audit system should collect the execution of +ACL privileged commands for all users and root. + + Record Any Attempts to Run chacl + At a minimum, the audit system should collect any execution attempt +of the chacl command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030570 + 5.2.3.17 + SV-230464r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-89446-9 - name: Gather the package facts package_facts: manager: auto @@ -95027,52 +94865,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setfacl - At a minimum, the audit system should collect any execution attempt -of the setfacl command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030330 - 4.1.3.16 - SV-230435r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-88437-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/setfacl -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/chacl -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -95388,6 +95185,47 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setfacl + At a minimum, the audit system should collect any execution attempt +of the setfacl command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030330 + 5.2.3.16 + SV-230435r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-88437-9 - name: Gather the package facts package_facts: manager: auto @@ -95532,140 +95370,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Record Execution Attempts to Run SELinux Privileged Commands - At a minimum, the audit system should collect the execution of -SELinux privileged commands for all users and root. - - Record Any Attempts to Run chcon - At a minimum, the audit system should collect any execution attempt -of the chcon command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030260 - 4.1.3.15 - SV-230419r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80698-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/chcon -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/setfacl -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -95981,6 +95690,135 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Execution Attempts to Run SELinux Privileged Commands + At a minimum, the audit system should collect the execution of +SELinux privileged commands for all users and root. + + Record Any Attempts to Run chcon + At a minimum, the audit system should collect any execution attempt +of the chcon command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030260 + 5.2.3.15 + SV-230419r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80698-4 - name: Gather the package facts package_facts: manager: auto @@ -96135,117 +95973,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run restorecon - At a minimum, the audit system should collect any execution attempt -of the restorecon command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000392-GPOS-00172 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80699-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/restorecon -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/chcon -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -96561,6 +96293,112 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run restorecon + At a minimum, the audit system should collect any execution attempt +of the restorecon command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000392-GPOS-00172 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80699-2 - name: Gather the package facts package_facts: manager: auto @@ -96713,138 +96551,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run semanage - At a minimum, the audit system should collect any execution attempt -of the semanage command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030313 - SV-230429r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80700-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/semanage -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/restorecon -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -97160,6 +96871,133 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run semanage + At a minimum, the audit system should collect any execution attempt +of the semanage command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030313 + SV-230429r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80700-8 - name: Gather the package facts package_facts: manager: auto @@ -97316,62 +97154,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setfiles - At a minimum, the audit system should collect any execution attempt -of the setfiles command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000169 - CCI-000172 - CCI-002884 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030314 - SV-230430r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-82280-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/setfiles -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/semanage -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -97687,6 +97474,57 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setfiles + At a minimum, the audit system should collect any execution attempt +of the setfiles command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000169 + CCI-000172 + CCI-002884 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030314 + SV-230430r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-82280-9 - name: Gather the package facts package_facts: manager: auto @@ -97839,131 +97677,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setsebool - At a minimum, the audit system should collect any execution attempt -of the setsebool command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030316 - SV-230432r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80701-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/setsebool -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/setfiles -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -98279,6 +97997,126 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setsebool + At a minimum, the audit system should collect any execution attempt +of the setsebool command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030316 + SV-230432r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80701-6 - name: Gather the package facts package_facts: manager: auto @@ -98433,47 +98271,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run seunshare - At a minimum, the audit system should collect any execution attempt -of the seunshare command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80933-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/seunshare -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/setsebool -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -98789,6 +98591,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run seunshare + At a minimum, the audit system should collect any execution attempt +of the seunshare command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80933-5 - name: Gather the package facts package_facts: manager: auto @@ -98939,180 +98777,17 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Record File Deletion Events by User - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete - - Ensure auditd Collects File Deletion Events by User - At a minimum the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename -S renameat -F auid>=1000 -F auid!=unset -F key=delete - This rule checks for multiple syscalls related to file deletion; -it was written with DISA STIG in mind. Other policies should use a -separate rule for each syscall that needs to be checked. For example: -audit_rules_file_deletion_events_rmdiraudit_rules_file_deletion_events_unlinkaudit_rules_file_deletion_events_unlinkat - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000366 - CCI-000172 - CCI-002884 - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 4.1.14 - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80702-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# Perform the remediation for the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rmdir unlink unlinkat rename renameat" - KEY="delete" - SYSCALL_GROUPING="rmdir unlink unlinkat rename renameat" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a +ACTION_ARCH_FILTERS="-a always,exit" +OTHER_FILTERS="-F path=/usr/sbin/seunshare -F perm=x" +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="" +KEY="privileged" +SYSCALL_GROUPING="" +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -99271,7 +98946,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -99417,34 +99092,51 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -done else >&2 echo 'Remediation is not applicable, nothing was done' fi - + - + - - Ensure auditd Collects File Deletion Events by User - rename - At a minimum, the audit system should collect file deletion events + + + Record File Deletion Events by User + At a minimum, the audit system should collect file deletion events for all users and root. If the auditd daemon is configured to use the augenrules program to read audit rules during daemon startup (the default), add the following line to a file with suffix .rules in the directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete If the auditd daemon is configured to use the auditctl utility to read audit rules during daemon startup, add the following line to /etc/audit/audit.rules file, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete + + Ensure auditd Collects File Deletion Events by User + At a minimum the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename -S renameat -F auid>=1000 -F auid!=unset -F key=delete + This rule checks for multiple syscalls related to file deletion; +it was written with DISA STIG in mind. Other policies should use a +separate rule for each syscall that needs to be checked. For example: +audit_rules_file_deletion_events_rmdiraudit_rules_file_deletion_events_unlinkaudit_rules_file_deletion_events_unlinkat 1 11 12 @@ -99461,6 +99153,7 @@ appropriate for your system: 7 8 9 + 5.4.1.1 APO10.01 APO10.03 APO10.04 @@ -99489,27 +99182,14 @@ appropriate for your system: MEA01.05 MEA02.01 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 CCI-000366 + CCI-000172 CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) 4.2.3.10 4.3.2.6.7 4.3.3.3.9 4.3.3.5.8 - 4.3.3.6.5 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 4.3.4.4.7 4.3.4.5.6 4.3.4.5.7 @@ -99536,7 +99216,6 @@ appropriate for your system: SR 6.2 SR 7.1 SR 7.6 - A.11.2.4 A.11.2.6 A.12.4.1 A.12.4.2 @@ -99547,7 +99226,6 @@ appropriate for your system: A.13.2.1 A.14.1.3 A.14.2.7 - A.15.1.1 A.15.2.1 A.15.2.2 A.16.1.4 @@ -99565,39 +99243,21 @@ appropriate for your system: DE.CM-7 ID.SC-4 PR.AC-3 - PR.MA-2 PR.PT-1 PR.PT-4 RS.AN-1 RS.AN-4 FAU_GEN.1.1.c Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule + 4.1.14 Auditing file deletions will create an audit trail for files that are removed from the system. The audit trail could aid in system troubleshooting, as well as, detecting malicious processes that attempt to delete log files to conceal their presence. - - CCE-80703-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + CCE-80702-4 + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# First perform the remediation of the syscall rule +# Perform the remediation for the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") @@ -99606,9 +99266,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rename" + SYSCALL="rmdir unlink unlinkat rename renameat" KEY="delete" - SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" + SYSCALL_GROUPING="rmdir unlink unlinkat rename renameat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -99921,6 +99581,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - rename + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80703-2 - name: Gather the package facts package_facts: manager: auto @@ -100266,178 +100097,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - renameat - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80704-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -100448,7 +100109,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="renameat" + SYSCALL="rename" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -100763,6 +100424,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - renameat + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + CCE-80704-0 - name: Gather the package facts package_facts: manager: auto @@ -101105,179 +100936,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - rmdir - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.14 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - - CCE-80705-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -101288,7 +100948,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rmdir" + SYSCALL="renameat" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -101603,6 +101263,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - rmdir + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 4.1.14 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80705-7 - name: Gather the package facts package_facts: manager: auto @@ -101948,178 +101779,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - unlink - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - - CCE-80706-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -102131,7 +101791,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="unlink" + SYSCALL="rmdir" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -102446,6 +102106,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - unlink + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80706-5 - name: Gather the package facts package_facts: manager: auto @@ -102791,178 +102622,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - unlinkat - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80707-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -102973,7 +102634,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="unlinkat" + SYSCALL="unlink" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -103288,6 +102949,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - unlinkat + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + CCE-80707-3 - name: Gather the package facts package_facts: manager: auto @@ -103629,6 +103460,333 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="unlinkat" + KEY="delete" + SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -105427,646 +105585,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80975-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="chmod" -KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EPERM" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -106697,43 +106215,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - chown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80984-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -106741,9 +106223,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="chown" +SYSCALL="chmod" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -107373,6 +106855,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - chown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80984-8 - name: Gather the package facts package_facts: manager: auto @@ -107987,179 +107505,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - creat - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80751-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -108167,9 +107513,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="creat" +SYSCALL="chown" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -108799,6 +108145,178 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - creat + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80751-1 - name: Gather the package facts package_facts: manager: auto @@ -109453,52 +108971,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fchmod - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80977-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchmod" +SYSCALL="creat" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -110128,6 +109611,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fchmod + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80977-2 - name: Gather the package facts package_facts: manager: auto @@ -110753,42 +110271,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fchmodat - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80976-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -110796,7 +110279,7 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchmodat" +SYSCALL="fchmod" KEY="access" SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" @@ -111428,6 +110911,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fchmodat + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80976-4 - name: Gather the package facts package_facts: manager: auto @@ -112053,42 +111571,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - fchown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80986-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -112096,9 +111579,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchown" +SYSCALL="fchmodat" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -112728,6 +112211,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - fchown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80986-3 - name: Gather the package facts package_facts: manager: auto @@ -113337,42 +112855,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - fchownat - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80985-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -113380,7 +112863,7 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchownat" +SYSCALL="fchown" KEY="access" SYSCALL_GROUPING="chown fchown fchownat lchown" @@ -114012,6 +113495,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - fchownat + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80985-5 - name: Gather the package facts package_facts: manager: auto @@ -114621,42 +114139,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fremovexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80978-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -114664,9 +114147,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fremovexattr" +SYSCALL="fchownat" KEY="access" -SYSCALL_GROUPING="" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -115296,6 +114779,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fremovexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80978-0 - name: Gather the package facts package_facts: manager: auto @@ -115873,42 +115391,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fsetxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80979-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -115916,9 +115399,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fsetxattr" +SYSCALL="fremovexattr" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -116548,6 +116031,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fsetxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80979-8 - name: Gather the package facts package_facts: manager: auto @@ -117173,181 +116691,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - ftruncate - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80752-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -117355,9 +116699,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="ftruncate" +SYSCALL="fsetxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -117987,6 +117331,180 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - ftruncate + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80752-9 - name: Gather the package facts package_facts: manager: auto @@ -118636,57 +118154,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - lchown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80987-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lchown" +SYSCALL="ftruncate" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -119316,6 +118794,46 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - lchown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80987-1 - name: Gather the package facts package_facts: manager: auto @@ -119930,52 +119448,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - lremovexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80980-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lremovexattr" +SYSCALL="lchown" KEY="access" -SYSCALL_GROUPING="" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -120605,6 +120088,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - lremovexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80980-6 - name: Gather the package facts package_facts: manager: auto @@ -121182,42 +120700,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - lsetxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80981-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -121225,9 +120708,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lsetxattr" +SYSCALL="lremovexattr" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -121857,6 +121340,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - lsetxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80981-4 - name: Gather the package facts package_facts: manager: auto @@ -122482,192 +122000,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - open - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80753-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="open" +SYSCALL="lsetxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -123297,6 +122640,181 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - open + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80753-7 - name: Gather the package facts package_facts: manager: auto @@ -123951,185 +123469,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - open_by_handle_at - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.10 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80755-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="open_by_handle_at" +SYSCALL="open" KEY="access" SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" @@ -124761,6 +124109,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - open_by_handle_at + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 4.1.10 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80755-2 - name: Gather the package facts package_facts: manager: auto @@ -125411,6 +124929,646 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="open_by_handle_at" +KEY="access" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EPERM" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -125576,57 +125734,6 @@ to the same event is more efficient. See the following example: Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80965-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -125707,6 +125814,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -125872,57 +126030,6 @@ to the same event is more efficient. See the following example: Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80966-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126003,6 +126110,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -126387,57 +126545,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80968-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126519,6 +126626,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -126681,57 +126839,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80969-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126813,6 +126920,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -127202,651 +127360,11 @@ calls with others as identifying earlier in this guide is more efficient.SRG-OS-000461-GPOS-00205 SRG-APP-000495-CTR-001235 RHEL-08-030420 - 4.1.3.7 + 5.2.3.7 SV-230449r810455_rule Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80754-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="openat" -KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EPERM" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -128496,882 +128014,37 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Creation Attempts to Files - openat O_CREAT - The audit system should collect unauthorized file accesses for -all users and root. The openat syscall can be used to create new files -when O_CREAT flag is specified. + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -The following auidt rules will asure that unsuccessful attempts to create a -file via openat syscall are collected. +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -rules below to a file with suffix .rules in the directory -/etc/audit/rules.d. +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="openat" +KEY="access" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the rules below to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80962-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80962-4 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_creat - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Add unsuccessful file operations audit rules - blockinfile: - path: /etc/audit/rules.d/30-ospp-v42-remediation.rules - create: true - block: |- - ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. - ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - ## The purpose of these rules is to meet the requirements for Operating - ## System Protection Profile (OSPP)v4.2. These rules depends on having - ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - ## Unsuccessful file creation (open with O_CREAT) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - ## Unsuccessful file modifications (open for write or truncate) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - ## Unsuccessful file access (any other opens) This has to go last. - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80962-4 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_creat - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - - - - - - - - - Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE - The audit system should collect detailed unauthorized file accesses for -all users and root. The openat syscall can be used to modify files -if called for write operation of with O_TRUNC_WRITE flag. - -The following auidt rules will asure that unsuccessful attempts to modify a -file via openat syscall are collected. - -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -rules below to a file with suffix .rules in the directory -/etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the rules below to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80963-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80963-2 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_trunc_write - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Add unsuccessful file operations audit rules - blockinfile: - path: /etc/audit/rules.d/30-ospp-v42-remediation.rules - create: true - block: |- - ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. - ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - ## The purpose of these rules is to meet the requirements for Operating - ## System Protection Profile (OSPP)v4.2. These rules depends on having - ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - ## Unsuccessful file creation (open with O_CREAT) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - ## Unsuccessful file modifications (open for write or truncate) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - ## Unsuccessful file access (any other opens) This has to go last. - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80963-2 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_trunc_write - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - - - - - - - - - Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly - The audit system should collect detailed unauthorized file -accesses for all users and root. -To correctly identify unsuccessful creation, unsuccessful modification and unsuccessful access -of files via openat syscall the audit rules collecting these events need to be in certain order. -The more specific rules need to come before the less specific rules. The reason for that is that more -specific rules cover a subset of events covered in the less specific rules, thus, they need to come -before to not be overshadowed by less specific rules, which match a bigger set of events. -Make sure that rules for unsuccessful calls of openat syscall are in the order shown below. -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), check the order of -rules below in a file with suffix .rules in the directory -/etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, check the order of rules below in -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - The more specific rules cover a subset of events covered by the less specific rules. -By ordering them from more specific to less specific, it is assured that the less specific -rule will not catch events better recorded by the more specific rule. - CCE-80964-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - - - - - - - - Record Unsuccessful Permission Changes to Files - removexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80982-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="removexattr" -KEY="access" -SYSCALL_GROUPING="" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: @@ -129981,85 +128654,930 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Unsuccessful Creation Attempts to Files - openat O_CREAT + The audit system should collect unauthorized file accesses for +all users and root. The openat syscall can be used to create new files +when O_CREAT flag is specified. + +The following auidt rules will asure that unsuccessful attempts to create a +file via openat syscall are collected. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +rules below to a file with suffix .rules in the directory +/etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the rules below to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80962-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80982-2 + - CCE-80962-4 + - NIST-800-171-3.1.7 - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_unsuccessful_file_modification_removexattr + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_creat - low_complexity - low_disruption - medium_severity - - reboot_required + - no_reboot_needed - restrict_strategy -- name: Set architecture for audit removexattr tasks - set_fact: - audit_arch: b64 +- name: Add unsuccessful file operations audit rules + blockinfile: + path: /etc/audit/rules.d/30-ospp-v42-remediation.rules + create: true + block: |- + ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. + ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + + ## The purpose of these rules is to meet the requirements for Operating + ## System Protection Profile (OSPP)v4.2. These rules depends on having + ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + + ## Unsuccessful file creation (open with O_CREAT) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + ## Unsuccessful file modifications (open for write or truncate) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + ## Unsuccessful file access (any other opens) This has to go last. + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80982-2 + - CCE-80962-4 + - NIST-800-171-3.1.7 - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_unsuccessful_file_modification_removexattr + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_creat - low_complexity - low_disruption - medium_severity - - reboot_required + - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -- name: Perform remediation of Audit rules for removexattr EACCES for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - removexattr - syscall_grouping: [] - - - name: Check existence of removexattr in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F exit=-EACCES -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF - - name: No file with syscall found, set path to /etc/audit/rules.d/access.rules +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE + The audit system should collect detailed unauthorized file accesses for +all users and root. The openat syscall can be used to modify files +if called for write operation of with O_TRUNC_WRITE flag. + +The following auidt rules will asure that unsuccessful attempts to modify a +file via openat syscall are collected. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +rules below to a file with suffix .rules in the directory +/etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the rules below to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80963-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80963-2 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_trunc_write + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Add unsuccessful file operations audit rules + blockinfile: + path: /etc/audit/rules.d/30-ospp-v42-remediation.rules + create: true + block: |- + ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. + ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + + ## The purpose of these rules is to meet the requirements for Operating + ## System Protection Profile (OSPP)v4.2. These rules depends on having + ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + + ## Unsuccessful file creation (open with O_CREAT) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + ## Unsuccessful file modifications (open for write or truncate) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + ## Unsuccessful file access (any other opens) This has to go last. + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80963-2 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_trunc_write + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly + The audit system should collect detailed unauthorized file +accesses for all users and root. +To correctly identify unsuccessful creation, unsuccessful modification and unsuccessful access +of files via openat syscall the audit rules collecting these events need to be in certain order. +The more specific rules need to come before the less specific rules. The reason for that is that more +specific rules cover a subset of events covered in the less specific rules, thus, they need to come +before to not be overshadowed by less specific rules, which match a bigger set of events. +Make sure that rules for unsuccessful calls of openat syscall are in the order shown below. +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), check the order of +rules below in a file with suffix .rules in the directory +/etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, check the order of rules below in +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + The more specific rules cover a subset of events covered by the less specific rules. +By ordering them from more specific to less specific, it is assured that the less specific +rule will not catch events better recorded by the more specific rule. + CCE-80964-0 + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Record Unsuccessful Permission Changes to Files - removexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80982-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80982-2 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_unsuccessful_file_modification_removexattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit removexattr tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80982-2 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_unsuccessful_file_modification_removexattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for removexattr EACCES for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - removexattr + syscall_grouping: [] + + - name: Check existence of removexattr in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F exit=-EACCES -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/access.rules set_fact: audit_file="/etc/audit/rules.d/access.rules" when: found_paths | length == 0 @@ -130558,172 +130076,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - rename - The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80973-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="rename" +SYSCALL="removexattr" KEY="access" -SYSCALL_GROUPING="rename renameat unlink unlinkat" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -131353,6 +130716,161 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - rename + The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80973-1 - name: Gather the package facts package_facts: manager: auto @@ -131985,171 +131503,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - renameat - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80974-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="renameat" +SYSCALL="rename" KEY="access" SYSCALL_GROUPING="rename renameat unlink unlinkat" @@ -132781,6 +132143,162 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - renameat + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80974-9 - name: Gather the package facts package_facts: manager: auto @@ -133408,42 +132926,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - setxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80983-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -133451,9 +132934,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="setxattr" +SYSCALL="renameat" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="rename renameat unlink unlinkat" for ARCH in "${RULE_ARCHS[@]}" do @@ -134083,6 +133566,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - setxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80983-0 - name: Gather the package facts package_facts: manager: auto @@ -134708,181 +134226,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - truncate - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80756-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -134890,9 +134234,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="truncate" +SYSCALL="setxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -135522,6 +134866,180 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - truncate + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80756-0 - name: Gather the package facts package_facts: manager: auto @@ -136171,176 +135689,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - unlink - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80971-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="unlink" +SYSCALL="truncate" KEY="access" -SYSCALL_GROUPING="rename renameat unlink unlinkat" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -136970,6 +136329,165 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - unlink + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80971-5 - name: Gather the package facts package_facts: manager: auto @@ -137602,173 +137120,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - unlinkat - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80972-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="unlinkat" +SYSCALL="unlink" KEY="access" SYSCALL_GROUPING="rename renameat unlink unlinkat" @@ -138400,6 +137760,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - unlinkat + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80972-3 - name: Gather the package facts package_facts: manager: auto @@ -139027,180 +138545,24 @@ fi - reboot_required - restrict_strategy - - - - - - - - - - Record Information on Kernel Modules Loading and Unloading - To capture kernel module loading and unloading events, use following lines, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module,delete_module -F key=modules - - -Place to add the lines depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the lines to file /etc/audit/audit.rules. - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - To capture kernel module loading and unloading events, use following lines, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module,finit_module,delete_module -F auid>=1000 -F auid!=unset -F key=modules - - -The place to add the lines depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the lines to file /etc/audit/audit.rules. - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.2.7 - 4.1.15 - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80709-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system -# Note: 32-bit and 64-bit kernel syscall numbers not always line up => -# it's required on a 64-bit system to check also for the presence -# of 32-bit's equivalent of the corresponding rule. -# (See `man 7 audit.rules` for details ) [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="unlinkat" +KEY="access" +SYSCALL_GROUPING="rename renameat unlink unlinkat" + for ARCH in "${RULE_ARCHS[@]}" do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - - SYSCALL="init_module finit_module delete_module" - KEY="modules" - SYSCALL_GROUPING="init_module finit_module delete_module" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -139359,7 +138721,319 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EPERM" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -139511,6 +139185,157 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Information on Kernel Modules Loading and Unloading + To capture kernel module loading and unloading events, use following lines, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module,delete_module -F key=modules + + +Place to add the lines depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the lines to file /etc/audit/audit.rules. + + Ensure auditd Collects Information on Kernel Module Loading and Unloading + To capture kernel module loading and unloading events, use following lines, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module,finit_module,delete_module -F auid>=1000 -F auid!=unset -F key=modules + + +The place to add the lines depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the lines to file /etc/audit/audit.rules. + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.2.7 + 4.1.15 + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80709-9 - name: Gather the package facts package_facts: manager: auto @@ -139853,51 +139678,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on Kernel Module Unloading - create_module - To capture kernel module unloading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: --a always,exit -F arch=ARCH -S create_module -F key=module-change - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - CCI-000172 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - 4.1.3.19 - The removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - - CCE-88435-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20create_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20create_module%20-k%20module-change%0A - mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-create.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -139909,15 +139691,16 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- for ARCH in "${RULE_ARCHS[@]}" do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="" - SYSCALL="create_module" - KEY="module-change" - SYSCALL_GROUPING="" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + + SYSCALL="init_module finit_module delete_module" + KEY="modules" + SYSCALL_GROUPING="init_module finit_module delete_module" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -140076,7 +139859,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -140228,6 +140011,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Unloading - create_module + To capture kernel module unloading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: +-a always,exit -F arch=ARCH -S create_module -F key=module-change + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + CCI-000172 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + 5.2.3.19 + The removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + + CCE-88435-3 - name: Gather the package facts package_facts: manager: auto @@ -140517,167 +140328,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Unloading - delete_module - To capture kernel module unloading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S delete_module -F auid>=1000 -F auid!=unset -F key=modules - - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030390 - 4.1.3.19 - SV-230446r627750_rule - The removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80711-5 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -140687,13 +140338,13 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20create_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20create_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-delete.rules + path: /etc/audit/rules.d/75-kernel-module-loading-create.rules overwrite: true - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -140707,12 +140358,11 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" - - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - - SYSCALL="delete_module" - KEY="modules" - SYSCALL_GROUPING="delete_module" + AUID_FILTERS="" + SYSCALL="create_module" + KEY="module-change" + SYSCALL_GROUPING="" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -141025,6 +140675,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Unloading - delete_module + To capture kernel module unloading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S delete_module -F auid>=1000 -F auid!=unset -F key=modules + + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030390 + 5.2.3.19 + SV-230446r627750_rule + The removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80711-5 - name: Gather the package facts package_facts: manager: auto @@ -141347,167 +141157,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - finit_module - If the auditd daemon is configured to use the augenrules program -to read audit rules during daemon startup (the default), add the following lines to a file -with suffix .rules in the directory /etc/audit/rules.d to capture kernel module -loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: - --a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules - If the auditd daemon is configured to use the auditctl utility to read audit -rules during daemon startup, add the following lines to /etc/audit/audit.rules file -in order to capture kernel module loading and unloading events, setting ARCH to either b32 or -b64 as appropriate for your system: - --a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030360 - 4.1.3.19 - SV-230438r810464_rule - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80712-3 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -141517,12 +141167,12 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20finit_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20finit_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-finit.rules + path: /etc/audit/rules.d/75-kernel-module-loading-delete.rules overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -141540,9 +141190,9 @@ do AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="finit_module" + SYSCALL="delete_module" KEY="modules" - SYSCALL_GROUPING="init_module finit_module" + SYSCALL_GROUPING="delete_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -141855,6 +141505,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - finit_module + If the auditd daemon is configured to use the augenrules program +to read audit rules during daemon startup (the default), add the following lines to a file +with suffix .rules in the directory /etc/audit/rules.d to capture kernel module +loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: + +-a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules + If the auditd daemon is configured to use the auditctl utility to read audit +rules during daemon startup, add the following lines to /etc/audit/audit.rules file +in order to capture kernel module loading and unloading events, setting ARCH to either b32 or +b64 as appropriate for your system: + +-a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030360 + 5.2.3.19 + SV-230438r810464_rule + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80712-3 - name: Gather the package facts package_facts: manager: auto @@ -142185,167 +141995,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading - init_module - To capture kernel module loading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module -F auid>=1000 -F auid!=unset -F key=modules - - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030360 - 4.1.3.19 - SV-230438r810464_rule - The addition of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80713-1 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -142355,12 +142005,12 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20finit_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20finit_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-init.rules + path: /etc/audit/rules.d/75-kernel-module-loading-finit.rules overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -142378,7 +142028,7 @@ do AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="init_module" + SYSCALL="finit_module" KEY="modules" SYSCALL_GROUPING="init_module finit_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -142693,6 +142343,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading - init_module + To capture kernel module loading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module -F auid>=1000 -F auid!=unset -F key=modules + + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030360 + 5.2.3.19 + SV-230438r810464_rule + The addition of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80713-1 - name: Gather the package facts package_facts: manager: auto @@ -143023,33 +142833,23 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module - If the auditd daemon is configured to use the augenrules program -to read audit rules during daemon startup (the default), add the following lines to a file -with suffix .rules in the directory /etc/audit/rules.d to capture kernel module -loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules -If the auditd daemon is configured to use the auditctl utility to read audit -rules during daemon startup, add the following lines to /etc/audit/audit.rules file -in order to capture kernel module loading and unloading events, setting ARCH to either b32 or -b64 as appropriate for your system: --a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules - 4.1.3.19 - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - - CCE-88748-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%20-k%20module-change%0A + mode: 0600 + path: /etc/audit/rules.d/75-kernel-module-loading-init.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -143063,10 +142863,12 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="query_module" + + SYSCALL="init_module" KEY="modules" - SYSCALL_GROUPING="init_module query_module" + SYSCALL_GROUPING="init_module finit_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -143379,6 +143181,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module + If the auditd daemon is configured to use the augenrules program +to read audit rules during daemon startup (the default), add the following lines to a file +with suffix .rules in the directory /etc/audit/rules.d to capture kernel module +loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: +-a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules +If the auditd daemon is configured to use the auditctl utility to read audit +rules during daemon startup, add the following lines to /etc/audit/audit.rules file +in order to capture kernel module loading and unloading events, setting ARCH to either b32 or +b64 as appropriate for your system: +-a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules + 5.2.3.19 + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + + CCE-88748-9 - name: Gather the package facts package_facts: manager: auto @@ -143683,6 +143510,337 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +# Note: 32-bit and 64-bit kernel syscall numbers not always line up => +# it's required on a 64-bit system to check also for the presence +# of 32-bit's equivalent of the corresponding rule. +# (See `man 7 audit.rules` for details ) +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="query_module" + KEY="modules" + SYSCALL_GROUPING="init_module query_module" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -144403,156 +144561,11 @@ edits of files involved in storing logon events: SRG-APP-000503-CTR-001275 SRG-APP-000506-CTR-001290 RHEL-08-030590 - 4.1.3.12 + 5.2.3.12 SV-230466r627750_rule Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80718-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -var_accounts_passwords_pam_faillock_dir='' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -144768,6 +144781,151 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +var_accounts_passwords_pam_faillock_dir='' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -144927,154 +145085,11 @@ edits of files involved in storing logon events: SRG-APP-000503-CTR-001275 SRG-APP-000506-CTR-001290 RHEL-08-030600 - 4.1.3.12 + 5.2.3.12 SV-230467r627750_rule Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80719-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/lastlog" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -145283,6 +145298,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/lastlog" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -145432,149 +145590,6 @@ edits of files involved in storing logon events: Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80720-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/tallylog" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -145775,6 +145790,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/tallylog" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -145804,6 +145962,148 @@ form to /etc/audit/audit.rules: AU-12(c) SRG-OS-000477-GPOS-00222 Misuse of the init command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_init + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/init + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_init + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -146124,31 +146424,54 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_init - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/init - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - poweroff + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-12(c) + SRG-OS-000477-GPOS-00222 + Misuse of the poweroff command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_poweroff + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/poweroff + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + - name: Check existence of in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146193,8 +146516,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -146203,8 +146526,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146219,7 +146542,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146238,7 +146561,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146248,8 +146571,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146259,36 +146582,13 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_init + - audit_privileged_commands_poweroff - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - poweroff - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-12(c) - SRG-OS-000477-GPOS-00222 - Misuse of the poweroff command may cause availability issues for the system. # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -146609,19 +146909,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - reboot + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-12(c) + SRG-OS-000477-GPOS-00222 + Misuse of the reboot command may cause availability issues for the system. + - name: Gather the package facts package_facts: manager: auto tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_poweroff + - audit_privileged_commands_reboot - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/poweroff +- name: Perform remediation of Audit rules for /usr/sbin/reboot block: - name: Declare list of syscalls @@ -146633,7 +146956,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146678,7 +147001,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146688,8 +147011,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146704,7 +147027,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146723,7 +147046,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146733,8 +147056,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146744,36 +147067,13 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_poweroff + - audit_privileged_commands_reboot - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - reboot - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-12(c) - SRG-OS-000477-GPOS-00222 - Misuse of the reboot command may cause availability issues for the system. # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -147093,148 +147393,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_reboot - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/reboot - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_reboot - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -147259,6 +147417,148 @@ form to /etc/audit/audit.rules: AU-12(c) SRG-OS-000477-GPOS-00222 Misuse of the shutdown command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_shutdown + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/shutdown + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_shutdown + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -147578,148 +147878,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_shutdown - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/shutdown - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_shutdown - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -147899,7 +148057,7 @@ file system during check or remediation caused undesirable errors.RS.CO-2 Req-10.2.2 SRG-OS-000327-GPOS-00127 - 4.1.3.6 + 5.2.3.6 Misuse of privileged functions, either intentionally or unintentionally by authorized users, or by unauthorized external entities that have compromised system accounts, is a serious and ongoing concern that can have significant adverse impacts on organizations. @@ -147910,6 +148068,176 @@ Privileged programs are subject to escalation-of-privilege attacks, which attemp their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80724-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set + List of Mount Points Which Permits Execution of Privileged Commands + ansible.builtin.set_fact: + privileged_mount_points: '{{(ansible_facts.mounts | rejectattr(''options'', ''search'', + ''noexec|nosuid'') | rejectattr(''mount'', ''match'', ''/proc($|/.*$)'') | map(attribute=''mount'') + | list ) }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Search + for Privileged Commands in Eligible Mount Points + ansible.builtin.shell: + cmd: find {{ item }} -xdev -perm /6000 -type f 2>/dev/null + register: result_privileged_commands_search + changed_when: false + failed_when: false + with_items: '{{ privileged_mount_points }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set + List of Privileged Commands Found in Eligible Mount Points + ansible.builtin.set_fact: + privileged_commands: '{{ privileged_commands | default([]) + item.stdout_lines + }}' + loop: '{{ result_privileged_commands_search.results }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - item is not skipped + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Privileged + Commands are Present in the System + block: + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for All Privileged Commands in augenrules Format + ansible.builtin.lineinfile: + path: /etc/audit/rules.d/privileged.rules + line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset + -F key=privileged + regexp: ^.*path={{ item | regex_escape() }} .*$ + create: true + with_items: + - '{{ privileged_commands }}' + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for All Privileged Commands in auditctl Format + ansible.builtin.lineinfile: + path: /etc/audit/audit.rules + line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset + -F key=privileged + regexp: ^.*path={{ item | regex_escape() }} .*$ + create: true + with_items: + - '{{ privileged_commands }}' + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Search + for Duplicated Rules in Other Files + ansible.builtin.find: + paths: /etc/audit/rules.d + recurse: false + contains: ^-a always,exit -F path={{ item }} .*$ + patterns: '*.rules' + with_items: + - '{{ privileged_commands }}' + register: result_augenrules_files + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for Privileged Commands are Defined Only in One File + ansible.builtin.lineinfile: + path: '{{ item.1.path }}' + regexp: ^-a always,exit -F path={{ item.0.item }} .*$ + state: absent + with_subelements: + - '{{ result_augenrules_files.results }}' + - files + when: + - item.1.path != '/etc/audit/rules.d/privileged.rules' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - privileged_commands is defined + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -148237,176 +148565,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set - List of Mount Points Which Permits Execution of Privileged Commands - ansible.builtin.set_fact: - privileged_mount_points: '{{(ansible_facts.mounts | rejectattr(''options'', ''search'', - ''noexec|nosuid'') | rejectattr(''mount'', ''match'', ''/proc($|/.*$)'') | map(attribute=''mount'') - | list ) }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Search - for Privileged Commands in Eligible Mount Points - ansible.builtin.shell: - cmd: find {{ item }} -xdev -perm /6000 -type f 2>/dev/null - register: result_privileged_commands_search - changed_when: false - failed_when: false - with_items: '{{ privileged_mount_points }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set - List of Privileged Commands Found in Eligible Mount Points - ansible.builtin.set_fact: - privileged_commands: '{{ privileged_commands | default([]) + item.stdout_lines - }}' - loop: '{{ result_privileged_commands_search.results }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - item is not skipped - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Privileged - Commands are Present in the System - block: - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for All Privileged Commands in augenrules Format - ansible.builtin.lineinfile: - path: /etc/audit/rules.d/privileged.rules - line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset - -F key=privileged - regexp: ^.*path={{ item | regex_escape() }} .*$ - create: true - with_items: - - '{{ privileged_commands }}' - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for All Privileged Commands in auditctl Format - ansible.builtin.lineinfile: - path: /etc/audit/audit.rules - line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset - -F key=privileged - regexp: ^.*path={{ item | regex_escape() }} .*$ - create: true - with_items: - - '{{ privileged_commands }}' - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Search - for Duplicated Rules in Other Files - ansible.builtin.find: - paths: /etc/audit/rules.d - recurse: false - contains: ^-a always,exit -F path={{ item }} .*$ - patterns: '*.rules' - with_items: - - '{{ privileged_commands }}' - register: result_augenrules_files - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for Privileged Commands are Defined Only in One File - ansible.builtin.lineinfile: - path: '{{ item.1.path }}' - regexp: ^-a always,exit -F path={{ item.0.item }} .*$ - state: absent - with_subelements: - - '{{ result_augenrules_files.results }}' - - files - when: - - item.1.path != '/etc/audit/rules.d/privileged.rules' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - privileged_commands is defined - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed @@ -148444,6 +148602,156 @@ which attempt to subvert their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80988-9 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80988-9 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_at + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/bin/at + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80988-9 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_at + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -148764,23 +149072,153 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - chage + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030250 + SV-230418r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80725-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80988-9 + - CCE-80725-5 + - DISA-STIG-RHEL-08-030250 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_at + - audit_rules_privileged_commands_chage - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/at +- name: Perform remediation of Audit rules for /usr/bin/chage block: - name: Declare list of syscalls @@ -148792,7 +149230,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -148837,8 +149275,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -148847,7 +149285,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -148863,7 +149301,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -148882,8 +149320,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -148892,7 +149330,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -148902,145 +149340,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80988-9 + - CCE-80725-5 + - DISA-STIG-RHEL-08-030250 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_at + - audit_rules_privileged_commands_chage - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - chage - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030250 - SV-230418r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80725-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -149361,26 +149675,149 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - chsh + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030410 + SV-230448r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80726-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80725-5 - - DISA-STIG-RHEL-08-030250 + - CCE-80726-3 + - DISA-STIG-RHEL-08-030410 - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chage + - audit_rules_privileged_commands_chsh - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/chage +- name: Perform remediation of Audit rules for /usr/bin/chsh block: - name: Declare list of syscalls @@ -149392,7 +149829,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -149437,7 +149874,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -149447,7 +149884,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -149463,7 +149900,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -149482,7 +149919,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -149492,7 +149929,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -149502,144 +149939,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80725-5 - - DISA-STIG-RHEL-08-030250 + - CCE-80726-3 + - DISA-STIG-RHEL-08-030410 - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chage + - audit_rules_privileged_commands_chsh - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - chsh - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030410 - SV-230448r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80726-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -149960,26 +150274,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - crontab + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030400 + SV-230447r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80727-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80726-3 - - DISA-STIG-RHEL-08-030410 + - CCE-80727-1 + - DISA-STIG-RHEL-08-030400 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chsh + - audit_rules_privileged_commands_crontab - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/chsh +- name: Perform remediation of Audit rules for /usr/bin/crontab block: - name: Declare list of syscalls @@ -149991,7 +150418,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150036,8 +150463,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -150046,7 +150473,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150062,7 +150489,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150081,7 +150508,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150091,7 +150518,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150101,135 +150528,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80726-3 - - DISA-STIG-RHEL-08-030410 + - CCE-80727-1 + - DISA-STIG-RHEL-08-030400 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chsh + - audit_rules_privileged_commands_crontab - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - crontab - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030400 - SV-230447r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80727-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -150550,25 +150862,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030370 + SV-230444r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80728-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80727-1 - - DISA-STIG-RHEL-08-030400 + - CCE-80728-9 + - DISA-STIG-RHEL-08-030370 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_crontab + - audit_rules_privileged_commands_gpasswd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/crontab +- name: Perform remediation of Audit rules for /usr/bin/gpasswd block: - name: Declare list of syscalls @@ -150580,7 +151018,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150625,7 +151063,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150635,7 +151073,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150651,7 +151089,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150670,7 +151108,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150680,7 +151118,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150690,145 +151128,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80727-1 - - DISA-STIG-RHEL-08-030400 + - CCE-80728-9 + - DISA-STIG-RHEL-08-030370 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_crontab + - audit_rules_privileged_commands_gpasswd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030370 - SV-230444r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80728-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -151149,26 +151463,79 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - kmod + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + BP28(R73) + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + AU-3 + AU-3.1 + AU-12(a) + AU-12.1(ii) + AU-12.1(iv)AU-12(c) + MA-4(1)(a) + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030580 + 5.2.3.19 + SV-230465r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. + +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + + CCE-89455-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80728-9 - - DISA-STIG-RHEL-08-030370 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_gpasswd + - CCE-89455-0 + - DISA-STIG-RHEL-08-030580 + - NIST-800-53-AU-12(a) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv)AU-12(c) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_kmod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/gpasswd +- name: Perform remediation of Audit rules for /usr/bin/kmod block: - name: Declare list of syscalls @@ -151180,7 +151547,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151225,8 +151592,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -151235,7 +151602,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151251,7 +151618,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151270,7 +151637,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151280,7 +151647,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151290,74 +151657,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80728-9 - - DISA-STIG-RHEL-08-030370 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_gpasswd + - CCE-89455-0 + - DISA-STIG-RHEL-08-030580 + - NIST-800-53-AU-12(a) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv)AU-12(c) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_kmod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - kmod - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - BP28(R73) - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - AU-3 - AU-3.1 - AU-12(a) - AU-12.1(ii) - AU-12.1(iv)AU-12(c) - MA-4(1)(a) - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030580 - 4.1.3.19 - SV-230465r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. - -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - - CCE-89455-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -151678,26 +151992,73 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - mount + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + RHEL-08-030300 + SV-230423r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80989-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-89455-0 - - DISA-STIG-RHEL-08-030580 - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv)AU-12(c) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_kmod + - CCE-80989-7 + - DISA-STIG-RHEL-08-030300 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_mount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/kmod +- name: Perform remediation of Audit rules for /usr/bin/mount block: - name: Declare list of syscalls @@ -151709,7 +152070,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151754,7 +152115,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151764,7 +152125,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151780,7 +152141,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151799,7 +152160,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151809,7 +152170,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151819,70 +152180,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-89455-0 - - DISA-STIG-RHEL-08-030580 - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv)AU-12(c) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_kmod + - CCE-80989-7 + - DISA-STIG-RHEL-08-030300 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_mount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - mount - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - RHEL-08-030300 - SV-230423r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80989-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -152203,24 +152513,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80991-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80989-7 - - DISA-STIG-RHEL-08-030300 + - CCE-80991-3 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_mount + - audit_rules_privileged_commands_newgidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/mount +- name: Perform remediation of Audit rules for /usr/bin/newgidmap block: - name: Declare list of syscalls @@ -152232,7 +152587,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152277,8 +152632,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -152287,8 +152642,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152303,7 +152658,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152322,7 +152677,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -152332,8 +152687,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152342,64 +152697,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80989-7 - - DISA-STIG-RHEL-08-030300 + - CCE-80991-3 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_mount + - audit_rules_privileged_commands_newgidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80991-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -152720,24 +153030,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newgrp + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000169 + CCI-000135 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030350 + SV-230437r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80729-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80991-3 + - CCE-80729-7 + - DISA-STIG-RHEL-08-030350 + - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgidmap + - audit_rules_privileged_commands_newgrp - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newgidmap +- name: Perform remediation of Audit rules for /usr/bin/newgrp block: - name: Declare list of syscalls @@ -152749,7 +153186,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152794,8 +153231,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -152804,8 +153241,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152820,7 +153257,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152839,7 +153276,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -152849,8 +153286,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152859,144 +153296,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80991-3 + - CCE-80729-7 + - DISA-STIG-RHEL-08-030350 + - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgidmap + - audit_rules_privileged_commands_newgrp - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newgrp - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000169 - CCI-000135 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030350 - SV-230437r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80729-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -153317,26 +153631,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80992-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80729-7 - - DISA-STIG-RHEL-08-030350 - - NIST-800-171-3.1.7 + - CCE-80992-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgrp + - audit_rules_privileged_commands_newuidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newgrp +- name: Perform remediation of Audit rules for /usr/bin/newuidmap block: - name: Declare list of syscalls @@ -153348,7 +153705,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153393,8 +153750,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153403,8 +153760,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153419,7 +153776,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153438,7 +153795,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -153448,8 +153805,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153458,66 +153815,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80729-7 - - DISA-STIG-RHEL-08-030350 - - NIST-800-171-3.1.7 + - CCE-80992-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgrp + - audit_rules_privileged_commands_newuidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80992-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -153838,24 +154148,142 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/pam_timestamp_check +-F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/pam_timestamp_check +-F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030340 + SV-230436r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80730-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80992-1 - - NIST-800-53-AC-2(4) + - CCE-80730-5 + - DISA-STIG-RHEL-08-030340 + - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newuidmap + - audit_rules_privileged_commands_pam_timestamp_check - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newuidmap +- name: Perform remediation of Audit rules for /usr/sbin/pam_timestamp_check block: - name: Declare list of syscalls @@ -153867,7 +154295,8 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153912,8 +154341,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153922,8 +154351,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153938,7 +154367,8 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153957,8 +154387,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153967,8 +154397,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153977,136 +154407,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80992-1 - - NIST-800-53-AC-2(4) + - CCE-80730-5 + - DISA-STIG-RHEL-08-030340 + - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newuidmap + - audit_rules_privileged_commands_pam_timestamp_check - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/pam_timestamp_check --F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/pam_timestamp_check --F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030340 - SV-230436r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80730-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -154427,25 +154741,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - passwd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030290 + SV-230422r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80731-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80730-5 - - DISA-STIG-RHEL-08-030340 + - CCE-80731-3 + - DISA-STIG-RHEL-08-030290 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pam_timestamp_check + - audit_rules_privileged_commands_passwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/pam_timestamp_check +- name: Perform remediation of Audit rules for /usr/bin/passwd block: - name: Declare list of syscalls @@ -154457,8 +154897,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -154503,8 +154942,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -154513,8 +154952,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -154529,8 +154968,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -154549,8 +154987,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -154559,8 +154997,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -154569,145 +155007,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80730-5 - - DISA-STIG-RHEL-08-030340 + - CCE-80731-3 + - DISA-STIG-RHEL-08-030290 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pam_timestamp_check + - audit_rules_privileged_commands_passwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - passwd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030290 - SV-230422r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80731-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -155028,26 +155342,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - postdrop + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030311 + SV-230427r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80732-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80731-3 - - DISA-STIG-RHEL-08-030290 + - CCE-80732-1 + - DISA-STIG-RHEL-08-030311 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_passwd + - audit_rules_privileged_commands_postdrop - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/passwd +- name: Perform remediation of Audit rules for /usr/sbin/postdrop block: - name: Declare list of syscalls @@ -155059,7 +155486,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155104,8 +155531,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -155114,8 +155541,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -155130,7 +155557,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155149,7 +155576,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155159,8 +155586,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -155169,135 +155596,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80731-3 - - DISA-STIG-RHEL-08-030290 + - CCE-80732-1 + - DISA-STIG-RHEL-08-030311 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_passwd + - audit_rules_privileged_commands_postdrop - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - postdrop - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030311 - SV-230427r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80732-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -155618,25 +155930,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - postqueue + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030312 + SV-230428r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80733-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80732-1 - - DISA-STIG-RHEL-08-030311 + - CCE-80733-9 + - DISA-STIG-RHEL-08-030312 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postdrop + - audit_rules_privileged_commands_postqueue - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/postdrop +- name: Perform remediation of Audit rules for /usr/sbin/postqueue block: - name: Declare list of syscalls @@ -155648,7 +156074,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155693,7 +156119,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155703,7 +156129,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -155719,7 +156145,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155738,7 +156164,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155748,7 +156174,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -155758,134 +156184,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80732-1 - - DISA-STIG-RHEL-08-030311 + - CCE-80733-9 + - DISA-STIG-RHEL-08-030312 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postdrop + - audit_rules_privileged_commands_postqueue - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - postqueue - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030312 - SV-230428r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80733-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -156206,25 +156518,123 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000135 + CCI-000172 + CCI-002884 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000042-GPOS-00020 + SRG-OS-000392-GPOS-00172 + SRG-OS-000471-GPOS-00215 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80734-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80733-9 - - DISA-STIG-RHEL-08-030312 + - CCE-80734-7 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postqueue + - audit_rules_privileged_commands_pt_chown - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/postqueue +- name: Perform remediation of Audit rules for /usr/libexec/pt_chown block: - name: Declare list of syscalls @@ -156236,7 +156646,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156281,7 +156691,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156291,8 +156701,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156307,7 +156717,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156326,7 +156736,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156336,8 +156746,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156346,119 +156756,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80733-9 - - DISA-STIG-RHEL-08-030312 + - CCE-80734-7 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postqueue + - audit_rules_privileged_commands_pt_chown - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000135 - CCI-000172 - CCI-002884 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000042-GPOS-00020 - SRG-OS-000392-GPOS-00172 - SRG-OS-000471-GPOS-00215 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80734-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -156779,24 +157089,61 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Any Attempts to Run ssh-agent + At a minimum, the audit system should collect any execution attempt +of the ssh-agent command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030280 + SV-230421r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. + +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-85944-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80734-7 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pt_chown + - CCE-85944-7 + - DISA-STIG-RHEL-08-030280 + - audit_rules_privileged_commands_ssh_agent - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/libexec/pt_chown +- name: Perform remediation of Audit rules for /usr/bin/ssh-agent block: - name: Declare list of syscalls @@ -156808,7 +157155,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156853,7 +157200,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156863,8 +157210,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156879,7 +157226,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156898,7 +157245,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156908,8 +157255,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156918,60 +157265,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80734-7 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pt_chown + - CCE-85944-7 + - DISA-STIG-RHEL-08-030280 + - audit_rules_privileged_commands_ssh_agent - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run ssh-agent - At a minimum, the audit system should collect any execution attempt -of the ssh-agent command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030280 - SV-230421r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. - -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-85944-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -157291,150 +157593,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-85944-7 - - DISA-STIG-RHEL-08-030280 - - audit_rules_privileged_commands_ssh_agent - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/bin/ssh-agent - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85944-7 - - DISA-STIG-RHEL-08-030280 - - audit_rules_privileged_commands_ssh_agent - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -157552,6 +157710,162 @@ which attempt to subvert their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80735-4 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80735-4 + - DISA-STIG-RHEL-08-030320 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_ssh_keysign + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/libexec/openssh/ssh-keysign + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80735-4 + - DISA-STIG-RHEL-08-030320 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_ssh_keysign + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -157872,25 +158186,144 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - su + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000064-GPOS-0003 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030190 + SV-230412r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80736-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80735-4 - - DISA-STIG-RHEL-08-030320 + - CCE-80736-2 + - DISA-STIG-RHEL-08-030190 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_ssh_keysign + - audit_rules_privileged_commands_su - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/libexec/openssh/ssh-keysign +- name: Perform remediation of Audit rules for /usr/bin/su block: - name: Declare list of syscalls @@ -157902,8 +158335,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -157948,8 +158380,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -157958,8 +158390,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -157974,8 +158406,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -157994,8 +158425,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158004,8 +158435,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -158014,139 +158445,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80735-4 - - DISA-STIG-RHEL-08-030320 + - CCE-80736-2 + - DISA-STIG-RHEL-08-030190 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_ssh_keysign + - audit_rules_privileged_commands_su - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - su - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000064-GPOS-0003 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030190 - SV-230412r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80736-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -158467,25 +158779,144 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - sudo + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + BP28(R19) + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030550 + SV-230462r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80737-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80736-2 - - DISA-STIG-RHEL-08-030190 + - CCE-80737-0 + - DISA-STIG-RHEL-08-030550 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_su + - audit_rules_privileged_commands_sudo - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/su +- name: Perform remediation of Audit rules for /usr/bin/sudo block: - name: Declare list of syscalls @@ -158497,7 +158928,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -158542,8 +158973,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158552,7 +158983,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -158568,7 +158999,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -158587,8 +159018,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158597,7 +159028,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -158607,139 +159038,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80736-2 - - DISA-STIG-RHEL-08-030190 + - CCE-80737-0 + - DISA-STIG-RHEL-08-030550 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_su + - audit_rules_privileged_commands_sudo - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - sudo - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - BP28(R19) - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030550 - SV-230462r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80737-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -159060,25 +159372,137 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80738-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80737-0 - - DISA-STIG-RHEL-08-030550 + - CCE-80738-8 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudo + - audit_rules_privileged_commands_sudoedit - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/sudo +- name: Perform remediation of Audit rules for /usr/bin/sudoedit block: - name: Declare list of syscalls @@ -159090,7 +159514,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159135,8 +159559,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -159145,8 +159569,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159161,7 +159585,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159180,7 +159604,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -159190,8 +159614,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159200,133 +159624,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80737-0 - - DISA-STIG-RHEL-08-030550 + - CCE-80738-8 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudo + - audit_rules_privileged_commands_sudoedit - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80738-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -159647,24 +159957,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - umount + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000169 + CCI-000135 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + RHEL-08-030301 + SV-230424r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80739-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80738-8 + - CCE-80739-6 + - DISA-STIG-RHEL-08-030301 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudoedit + - audit_rules_privileged_commands_umount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/sudoedit +- name: Perform remediation of Audit rules for /usr/bin/umount block: - name: Declare list of syscalls @@ -159676,7 +160101,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159721,8 +160146,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -159731,8 +160156,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159747,7 +160172,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159766,7 +160191,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -159776,8 +160201,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159786,133 +160211,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80738-8 + - CCE-80739-6 + - DISA-STIG-RHEL-08-030301 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudoedit + - audit_rules_privileged_commands_umount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - umount - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000169 - CCI-000135 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - RHEL-08-030301 - SV-230424r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80739-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -160233,25 +160545,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + CIP-007-3 R6.5 + AC-2(4) + AU-2(d) + AU-3 + AU-3.1 + AU-12(a) + AU-12(c) + AU-12.1(ii) + AU-12.1(iv) + AC-6(9) + CM-6(a) + MA-4(1)(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030317 + SV-230433r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80740-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80739-6 - - DISA-STIG-RHEL-08-030301 + - CCE-80740-4 + - DISA-STIG-RHEL-08-030317 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(a) - NIST-800-53-AU-12(c) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv) - NIST-800-53-AU-2(d) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_umount + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_unix_chkpwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/umount +- name: Perform remediation of Audit rules for /usr/sbin/unix_chkpwd block: - name: Declare list of syscalls @@ -160263,7 +160714,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160308,8 +160759,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -160318,8 +160769,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -160334,7 +160785,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160353,7 +160804,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160363,8 +160814,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -160373,152 +160824,27 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80739-6 - - DISA-STIG-RHEL-08-030301 + - CCE-80740-4 + - DISA-STIG-RHEL-08-030317 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(a) - NIST-800-53-AU-12(c) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv) - NIST-800-53-AU-2(d) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_umount + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_unix_chkpwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - CIP-007-3 R6.5 - AC-2(4) - AU-2(d) - AU-3 - AU-3.1 - AU-12(a) - AU-12(c) - AU-12.1(ii) - AU-12.1(iv) - AC-6(9) - CM-6(a) - MA-4(1)(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030317 - SV-230433r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80740-4 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -160839,32 +161165,65 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_update + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030310 + SV-230426r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-89480-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80740-4 - - DISA-STIG-RHEL-08-030317 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv) - - NIST-800-53-AU-2(d) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-CM-6(a) - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_unix_chkpwd + - CCE-89480-8 + - DISA-STIG-RHEL-08-030310 + - audit_rules_privileged_commands_unix_update - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/unix_chkpwd +- name: Perform remediation of Audit rules for /usr/sbin/unix_update block: - name: Declare list of syscalls @@ -160876,7 +161235,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160921,7 +161280,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160931,7 +161290,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -160947,7 +161306,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160966,7 +161325,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160976,7 +161335,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -160986,72 +161345,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80740-4 - - DISA-STIG-RHEL-08-030317 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv) - - NIST-800-53-AU-2(d) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-CM-6(a) - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_unix_chkpwd + - CCE-89480-8 + - DISA-STIG-RHEL-08-030310 + - audit_rules_privileged_commands_unix_update - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_update - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030310 - SV-230426r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-89480-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -161372,20 +161674,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - userhelper + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030315 + SV-230431r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80741-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-89480-8 - - DISA-STIG-RHEL-08-030310 - - audit_rules_privileged_commands_unix_update + - CCE-80741-2 + - DISA-STIG-RHEL-08-030315 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_userhelper - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/unix_update +- name: Perform remediation of Audit rules for /usr/sbin/userhelper block: - name: Declare list of syscalls @@ -161397,7 +161818,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -161442,7 +161863,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -161452,7 +161873,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -161468,7 +161889,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -161487,7 +161908,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -161497,7 +161918,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -161507,129 +161928,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-89480-8 - - DISA-STIG-RHEL-08-030310 - - audit_rules_privileged_commands_unix_update + - CCE-80741-2 + - DISA-STIG-RHEL-08-030315 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_userhelper - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - userhelper - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030315 - SV-230431r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80741-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -161950,25 +162262,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - usermod + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030560 + 5.2.3.18 + SV-230463r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-86027-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80741-2 - - DISA-STIG-RHEL-08-030315 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_userhelper + - CCE-86027-0 + - DISA-STIG-RHEL-08-030560 + - audit_rules_privileged_commands_usermod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/userhelper +- name: Perform remediation of Audit rules for /usr/sbin/usermod block: - name: Declare list of syscalls @@ -161980,7 +162334,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162025,7 +162379,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162035,8 +162389,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162051,7 +162405,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162070,7 +162424,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162080,8 +162434,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162090,67 +162444,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80741-2 - - DISA-STIG-RHEL-08-030315 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_userhelper + - CCE-86027-0 + - DISA-STIG-RHEL-08-030560 + - audit_rules_privileged_commands_usermod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - usermod - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030560 - 4.1.3.18 - SV-230463r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-86027-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -162471,20 +162773,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80990-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-86027-0 - - DISA-STIG-RHEL-08-030560 - - audit_rules_privileged_commands_usermod + - CCE-80990-5 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_usernetctl - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/usermod +- name: Perform remediation of Audit rules for /usr/sbin/usernetctl block: - name: Declare list of syscalls @@ -162496,7 +162847,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162541,7 +162892,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162551,8 +162902,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162567,7 +162918,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162586,7 +162937,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162596,8 +162947,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162606,60 +162957,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-86027-0 - - DISA-STIG-RHEL-08-030560 - - audit_rules_privileged_commands_usermod + - CCE-80990-5 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_usernetctl - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80990-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -162979,158 +163289,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80990-5 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_usernetctl - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/usernetctl - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80990-5 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_usernetctl - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -163286,12 +163444,341 @@ not required. See an example of multiple combined syscalls: RS.AN-4 Req-10.4.2.b 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80745-3 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set architecture for audit tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for adjtimex for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for adjtimex for 64bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + + - name: Check existence of adjtimex in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - audit_arch == "b64" + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -163646,11 +164133,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Attempts to Alter Time Through clock_settime + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change +The -k option allows for the specification of a key in string form that can +be used for better reporting capability through ausearch and aureport. +Multiple system calls can be defined on the same line to save space if +desired, but is not required. See an example of multiple combined syscalls: +-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-001487 + CCI-000169 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.4.2.b + 10.6.3 + 5.2.3.4 + Arbitrary changes to the system time can be used to obfuscate +nefarious activities in log files, as well as to confuse network services that +are highly dependent upon an accurate system time (such as sshd). All changes +to the system time should be audited. + CCE-80746-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163659,7 +164299,7 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity @@ -163675,7 +164315,7 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163684,30 +164324,27 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for adjtimex for 32bit platform +- name: Perform remediation of Audit rules for clock_settime for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/rules.d/ + - name: Check existence of clock_settime in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163737,8 +164374,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules + set_fact: audit_file="/etc/audit/rules.d/time-change.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -163752,7 +164389,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163761,7 +164398,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163770,17 +164408,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/audit.rules + - name: Check existence of clock_settime in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163799,7 +164434,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163808,7 +164443,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163817,7 +164453,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163826,29 +164462,27 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for adjtimex for 64bit platform +- name: Perform remediation of Audit rules for clock_settime for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/rules.d/ + - name: Check existence of clock_settime in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163878,8 +164512,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules + set_fact: audit_file="/etc/audit/rules.d/time-change.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -163893,7 +164527,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163902,7 +164536,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163911,17 +164546,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/audit.rules + - name: Check existence of clock_settime in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163940,7 +164572,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163949,7 +164581,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163959,7 +164592,7 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163968,166 +164601,13 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Attempts to Alter Time Through clock_settime - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change -The -k option allows for the specification of a key in string form that can -be used for better reporting capability through ausearch and aureport. -Multiple system calls can be defined on the same line to save space if -desired, but is not required. See an example of multiple combined syscalls: --a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-001487 - CCI-000169 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.4.2.b - 10.6.3 - 4.1.3.4 - Arbitrary changes to the system time can be used to obfuscate -nefarious activities in log files, as well as to confuse network services that -are highly dependent upon an accurate system time (such as sshd). All changes -to the system time should be audited. - CCE-80746-1 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -164470,155 +164950,312 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80746-1 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set architecture for audit tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80746-1 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for clock_settime for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - clock_settime - syscall_grouping: [] - - - name: Check existence of clock_settime in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules - set_fact: audit_file="/etc/audit/rules.d/time-change.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - clock_settime - syscall_grouping: [] - - - name: Check existence of clock_settime in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: + + + + + + + + + Record attempts to alter time through settimeofday + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules +The -k option allows for the specification of a key in string form that can be +used for better reporting capability through ausearch and aureport. Multiple +system calls can be defined on the same line to save space if desired, but is +not required. See an example of multiple combined syscalls: +-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-001487 + CCI-000169 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.4.2.b + 10.6.3 + 5.2.3.4 + Arbitrary changes to the system time can be used to obfuscate +nefarious activities in log files, as well as to confuse network services that +are highly dependent upon an accurate system time (such as sshd). All changes +to the system time should be audited. + CCE-80747-9 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80747-9 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_settimeofday + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set architecture for audit tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80747-9 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_settimeofday + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for settimeofday for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of settimeofday in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of settimeofday in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164627,8 +165264,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164637,7 +165273,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80746-1 + - CCE-80747-9 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -164646,27 +165282,30 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime + - audit_rules_time_settimeofday - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for clock_settime for 64bit platform +- name: Perform remediation of Audit rules for settimeofday for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - clock_settime - syscall_grouping: [] + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime - - name: Check existence of clock_settime in /etc/audit/rules.d/ + - name: Check existence of settimeofday in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -164696,8 +165335,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules - set_fact: audit_file="/etc/audit/rules.d/time-change.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -164711,7 +165350,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164720,8 +165359,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164730,14 +165368,17 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - clock_settime - syscall_grouping: [] + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime - - name: Check existence of clock_settime in /etc/audit/audit.rules + - name: Check existence of settimeofday in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -164756,7 +165397,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164765,8 +165406,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164776,7 +165416,7 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80746-1 + - CCE-80747-9 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -164785,165 +165425,13 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime + - audit_rules_time_settimeofday - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record attempts to alter time through settimeofday - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules -The -k option allows for the specification of a key in string form that can be -used for better reporting capability through ausearch and aureport. Multiple -system calls can be defined on the same line to save space if desired, but is -not required. See an example of multiple combined syscalls: --a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-001487 - CCI-000169 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.4.2.b - 10.6.3 - 4.1.3.4 - Arbitrary changes to the system time can be used to obfuscate -nefarious activities in log files, as well as to confuse network services that -are highly dependent upon an accurate system time (such as sshd). All changes -to the system time should be audited. - CCE-80747-9 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -165297,336 +165785,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set architecture for audit tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for settimeofday for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for settimeofday for 64bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - audit_arch == "b64" - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -165779,13 +165937,177 @@ required. See an example of multiple combined system calls: RS.AN-4 Req-10.4.2.b 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80748-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80748-7 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_stime + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for stime syscall for x86 platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - stime + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of stime in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - stime + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of stime in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ( not ( ansible_architecture == "aarch64" ) and not ( ansible_architecture == + "s390x" ) ) + tags: + - CCE-80748-7 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_stime + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -166139,170 +166461,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80748-7 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_stime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for stime syscall for x86 platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - stime - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of stime in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - stime - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of stime in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ( not ( ansible_architecture == "aarch64" ) and not ( ansible_architecture == - "s390x" ) ) - tags: - - CCE-80748-7 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_stime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -166446,168 +166604,12 @@ should always be used. Req-10.4.2.b 10.6.3 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80749-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/localtime%20-p%20wa%20-k%20audit_time_rules%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-etclocaltime-wa-audit_time_rules.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_time_rules.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/localtime" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_time_rules.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_time_rules.rules" - # If the audit_time_rules.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -166824,6 +166826,162 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/localtime%20-p%20wa%20-k%20audit_time_rules%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-etclocaltime-wa-audit_time_rules.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_time_rules.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/localtime" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_time_rules.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_time_rules.rules" + # If the audit_time_rules.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167080,42 +167238,6 @@ send audit records to. For example deletion or alteration.Off-loading is a common process in information systems with limited audit storage capacity. CCE-80925-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_remote_server='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^remote_server") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_remote_server" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^remote_server\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^remote_server\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80925-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167151,6 +167273,42 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_remote_server='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^remote_server") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_remote_server" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^remote_server\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^remote_server\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80925-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167218,38 +167376,6 @@ determined. SRG-OS-000479-GPOS-00224 Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_disk_full_action='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^disk_full_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_disk_full_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^disk_full_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^disk_full_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167293,6 +167419,38 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_disk_full_action='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^disk_full_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_disk_full_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^disk_full_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^disk_full_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167383,38 +167541,6 @@ This profile configures the action to be SRG-OS-000479-GPOS-00224 Taking appropriate action when there is an error sending audit records to a remote system will minimize the possibility of losing audit records. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_network_failure_action='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^network_failure_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_network_failure_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^network_failure_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^network_failure_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167458,6 +167584,38 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_network_failure_action='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^network_failure_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_network_failure_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^network_failure_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^network_failure_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167552,39 +167710,6 @@ records to a centralized server for management directly. It does, however, include a plug-in for audit event multiplexor (audispd) to pass audit records to the local syslog server. CCE-80677-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_syslog_active="yes" - -AUDISP_SYSLOGCONFIG=/etc/audit/plugins.d/syslog.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^active") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_syslog_active" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^active\\>" "$AUDISP_SYSLOGCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^active\\>.*/$escaped_formatted_output/gi" "$AUDISP_SYSLOGCONFIG" -else - if [[ -s "$AUDISP_SYSLOGCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDISP_SYSLOGCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDISP_SYSLOGCONFIG" - fi - cce="CCE-80677-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDISP_SYSLOGCONFIG" >> "$AUDISP_SYSLOGCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDISP_SYSLOGCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167626,6 +167751,39 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_syslog_active="yes" + +AUDISP_SYSLOGCONFIG=/etc/audit/plugins.d/syslog.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^active") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_syslog_active" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^active\\>" "$AUDISP_SYSLOGCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^active\\>.*/$escaped_formatted_output/gi" "$AUDISP_SYSLOGCONFIG" +else + if [[ -s "$AUDISP_SYSLOGCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDISP_SYSLOGCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDISP_SYSLOGCONFIG" + fi + cce="CCE-80677-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDISP_SYSLOGCONFIG" >> "$AUDISP_SYSLOGCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDISP_SYSLOGCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167724,10 +167882,59 @@ determined. Details regarding all possible values for ACTION ar SRG-APP-000290-CTR-000670 SRG-APP-000357-CTR-000800 RHEL-08-030040 + 5.2.2.3 SV-230390r627750_rule Taking appropriate action in case of disk errors will minimize the possibility of losing audit records. CCE-84046-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-84046-2 + - DISA-STIG-RHEL-08-030040 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_error_action # promote to variable + set_fact: + var_auditd_disk_error_action: !!str + tags: + - always + +- name: Configure auditd Disk Error Action on Disk Error + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_error_action = {{ var_auditd_disk_error_action.split('|')[0] }} + regexp: ^\s*disk_error_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84046-2 + - DISA-STIG-RHEL-08-030040 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -167781,54 +167988,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-84046-2 - - DISA-STIG-RHEL-08-030040 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_error_action # promote to variable - set_fact: - var_auditd_disk_error_action: !!str - tags: - - always - -- name: Configure auditd Disk Error Action on Disk Error - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_error_action = {{ var_auditd_disk_error_action.split('|')[0] }} - regexp: ^\s*disk_error_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84046-2 - - DISA-STIG-RHEL-08-030040 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -167922,6 +168081,50 @@ determined. Details regarding all possible values for ACTION ar SRG-OS-000047-GPOS-00023 Taking appropriate action in case of disk errors will minimize the possibility of losing audit records. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_error_action # promote to variable + set_fact: + var_auditd_disk_error_action: !!str + tags: + - always + +- name: Configure auditd Disk Error Action on Disk Error + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_error_action = {{ var_auditd_disk_error_action }} + regexp: ^\s*disk_error_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -167966,50 +168169,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_error_action # promote to variable - set_fact: - var_auditd_disk_error_action: !!str - tags: - - always - -- name: Configure auditd Disk Error Action on Disk Error - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_error_action = {{ var_auditd_disk_error_action }} - regexp: ^\s*disk_error_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168104,10 +168263,59 @@ determined. Details regarding all possible values for ACTION ar RS.AN-4 SRG-OS-000047-GPOS-00023 RHEL-08-030060 + 5.2.2.3 SV-230392r627750_rule Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. CCE-84045-4 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-84045-4 + - DISA-STIG-RHEL-08-030060 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_full_action # promote to variable + set_fact: + var_auditd_disk_full_action: !!str + tags: + - always + +- name: Configure auditd Disk Full Action when Disk Space Is Full + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_full_action = {{ var_auditd_disk_full_action.split('|')[0] }} + regexp: ^\s*disk_full_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84045-4 + - DISA-STIG-RHEL-08-030060 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -168156,54 +168364,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-84045-4 - - DISA-STIG-RHEL-08-030060 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_full_action # promote to variable - set_fact: - var_auditd_disk_full_action: !!str - tags: - - always - -- name: Configure auditd Disk Full Action when Disk Space Is Full - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_full_action = {{ var_auditd_disk_full_action.split('|')[0] }} - regexp: ^\s*disk_full_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84045-4 - - DISA-STIG-RHEL-08-030060 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168297,6 +168457,50 @@ determined. Details regarding all possible values for ACTION ar SRG-OS-000047-GPOS-00023 Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_full_action # promote to variable + set_fact: + var_auditd_disk_full_action: !!str + tags: + - always + +- name: Configure auditd Disk Full Action when Disk Space Is Full + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_full_action = {{ var_auditd_disk_full_action }} + regexp: ^\s*disk_full_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -168341,50 +168545,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_full_action # promote to variable - set_fact: - var_auditd_disk_full_action: !!str - tags: - - always - -- name: Configure auditd Disk Full Action when Disk Space Is Full - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_full_action = {{ var_auditd_disk_full_action }} - regexp: ^\s*disk_full_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168490,45 +168650,11 @@ via email for those situations: SRG-OS-000046-GPOS-00022 SRG-OS-000343-GPOS-00134 RHEL-08-030020 - 4.1.2.3 + 5.2.2.4 SV-230388r627750_rule Email sent to the root account is typically aliased to the administrators of the system, who can take appropriate action. CCE-80678-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_action_mail_acct='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^action_mail_acct") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_action_mail_acct" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^action_mail_acct\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^action_mail_acct\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80678-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168579,6 +168705,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_action_mail_acct='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^action_mail_acct") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_action_mail_acct" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^action_mail_acct\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^action_mail_acct\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80678-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -168677,60 +168837,11 @@ determined. Details regarding all possible values for ACTION ar Req-10.7 10.5.1 SRG-OS-000343-GPOS-00134 - 4.1.2.3 + 5.2.2.4 Administrators should be made aware of an inability to record audit records. If a separate partition or logical volume of adequate size is used, running low on space for audit records should never occur. CCE-80679-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_admin_space_left_action='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^admin_space_left_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_admin_space_left_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^admin_space_left_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^admin_space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80679-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168784,6 +168895,55 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_admin_space_left_action='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^admin_space_left_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_admin_space_left_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^admin_space_left_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^admin_space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80679-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -168874,20 +169034,6 @@ to cause the system to perform an action. SRG-OS-000343-GPOS-00134 Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_admin_space_left_percentage='' - - -grep -q "^admin_space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^admin_space_left[[:space:]]*=.*$/admin_space_left = $var_auditd_admin_space_left_percentage%/g" /etc/audit/auditd.conf || \ - echo "admin_space_left = $var_auditd_admin_space_left_percentage%" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168933,6 +169079,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_admin_space_left_percentage='' + + +grep -q "^admin_space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^admin_space_left[[:space:]]*=.*$/admin_space_left = $var_auditd_admin_space_left_percentage%/g" /etc/audit/auditd.conf || \ + echo "admin_space_left = $var_auditd_admin_space_left_percentage%" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169030,6 +169190,48 @@ fully synchronized with the log files on the disk: log integrity. These parameters assure that all audit event data is fully synchronized with the log files on the disk. CCE-80680-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80680-2 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - auditd_data_retention_flush + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_flush # promote to variable + set_fact: + var_auditd_flush: !!str + tags: + - always + +- name: Configure auditd Flush Priority + lineinfile: + dest: /etc/audit/auditd.conf + regexp: ^\s*flush\s*=\s*.*$ + line: flush = {{ var_auditd_flush }} + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80680-2 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - auditd_data_retention_flush + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169081,48 +169283,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80680-2 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - auditd_data_retention_flush - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_flush # promote to variable - set_fact: - var_auditd_flush: !!str - tags: - - always - -- name: Configure auditd Flush Priority - lineinfile: - dest: /etc/audit/auditd.conf - regexp: ^\s*flush\s*=\s*.*$ - line: flush = {{ var_auditd_flush }} - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80680-2 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - auditd_data_retention_flush - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169207,11 +169367,55 @@ support retention of even more audit data. RS.AN-1 RS.AN-4 Req-10.7 - 4.1.2.1 + 5.2.2.1 The total storage for audit log files must be large enough to retain log information over the period required. This is a function of the maximum log file size and the number of logs retained. CCE-80681-0 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80681-0 + - CJIS-5.4.1.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_max_log_file + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_max_log_file # promote to variable + set_fact: + var_auditd_max_log_file: !!str + tags: + - always + +- name: Configure auditd Max Log File Size + lineinfile: + dest: /etc/audit/auditd.conf + regexp: ^\s*max_log_file\s*=\s*.*$ + line: max_log_file = {{ var_auditd_max_log_file }} + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80681-0 + - CJIS-5.4.1.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_max_log_file + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169260,50 +169464,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80681-0 - - CJIS-5.4.1.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_max_log_file - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_max_log_file # promote to variable - set_fact: - var_auditd_max_log_file: !!str - tags: - - always - -- name: Configure auditd Max Log File Size - lineinfile: - dest: /etc/audit/auditd.conf - regexp: ^\s*max_log_file\s*=\s*.*$ - line: max_log_file = {{ var_auditd_max_log_file }} - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80681-0 - - CJIS-5.4.1.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_max_log_file - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169396,62 +169556,13 @@ occurs. This is the default. The setting is case-insensitive.RS.AN-4 Req-10.7 SRG-OS-000047-GPOS-00023 - 4.1.2.2 + 5.2.2.2 Automatically rotating logs (by setting this to rotate) minimizes the chances of the system unexpectedly running out of disk space by being overwhelmed with log data. However, for systems that must never discard log data, or which use external processes to transfer it and reclaim space, keep_logs can be employed. CCE-80682-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_max_log_file_action='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80682-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -169501,6 +169612,55 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_max_log_file_action='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80682-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169604,51 +169764,6 @@ minimizes the chances of the system unexpectedly running out of disk space by being overwhelmed with log data. However, for systems that must never discard log data, or which use external processes to transfer it and reclaim space, keep_logs can be employed. - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_max_log_file_action='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "/etc/audit/auditd.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "/etc/audit/auditd.conf" -else - if [[ -s "/etc/audit/auditd.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/audit/auditd.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/audit/auditd.conf" - fi - printf '%s\n' "$formatted_output" >> "/etc/audit/auditd.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -169694,6 +169809,51 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_max_log_file_action='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "/etc/audit/auditd.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "/etc/audit/auditd.conf" +else + if [[ -s "/etc/audit/auditd.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/audit/auditd.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/audit/auditd.conf" + fi + printf '%s\n' "$formatted_output" >> "/etc/audit/auditd.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169781,6 +169941,52 @@ Note that values less than 2 result in no log rotation. log information over the period required. This is a function of the maximum log file size and the number of logs retained. CCE-80683-6 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80683-6 + - CJIS-5.4.1.1 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_num_logs + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_num_logs # promote to variable + set_fact: + var_auditd_num_logs: !!str + tags: + - always + +- name: Configure auditd Number of Logs Retained + lineinfile: + dest: /etc/audit/auditd.conf + line: num_logs = {{ var_auditd_num_logs }} + regexp: ^\s*num_logs\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80683-6 + - CJIS-5.4.1.1 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_num_logs + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169829,52 +170035,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80683-6 - - CJIS-5.4.1.1 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_num_logs - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_num_logs # promote to variable - set_fact: - var_auditd_num_logs: !!str - tags: - - always - -- name: Configure auditd Number of Logs Retained - lineinfile: - dest: /etc/audit/auditd.conf - line: num_logs = {{ var_auditd_num_logs }} - regexp: ^\s*num_logs\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80683-6 - - CJIS-5.4.1.1 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_num_logs - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169967,35 +170127,6 @@ notify the user of an issue. Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-83619-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left='' - - -grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left/g" /etc/audit/auditd.conf || \ - echo "space_left = $var_auditd_space_left" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170045,6 +170176,35 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left='' + + +grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left/g" /etc/audit/auditd.conf || \ + echo "space_left = $var_auditd_space_left" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170142,67 +170302,11 @@ also include suspend, single, and 10.5.1 SRG-OS-000343-GPOS-00134 RHEL-08-030731 - 4.1.2.3 + 5.2.2.4 SV-244543r877389_rule Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-80684-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left_action='' - - -var_auditd_space_left_action="$(echo $var_auditd_space_left_action | cut -d \| -f 1)" -# -# If space_left_action present in /etc/audit/auditd.conf, change value -# to var_auditd_space_left_action, else -# add "space_left_action = $var_auditd_space_left_action" to /etc/audit/auditd.conf -# - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^space_left_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_space_left_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^space_left_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80684-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170258,6 +170362,62 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left_action='' + + +var_auditd_space_left_action="$(echo $var_auditd_space_left_action | cut -d \| -f 1)" +# +# If space_left_action present in /etc/audit/auditd.conf, change value +# to var_auditd_space_left_action, else +# add "space_left_action = $var_auditd_space_left_action" to /etc/audit/auditd.conf +# + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^space_left_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_space_left_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^space_left_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80684-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170351,20 +170511,6 @@ notify the user of an issue. Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-86055-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left_percentage='' - - -grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left_percentage%/g" /etc/audit/auditd.conf || \ - echo "space_left = $var_auditd_space_left_percentage%" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170414,6 +170560,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left_percentage='' + + +grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left_percentage%/g" /etc/audit/auditd.conf || \ + echo "space_left = $var_auditd_space_left_percentage%" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170435,43 +170595,6 @@ in /etc/audit/auditd.conf. may happen after higher number of records, increasing the danger of audit loss. CCE-82258-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if [ -e "/etc/audit/auditd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*freq\s*=\s*/Id" "/etc/audit/auditd.conf" -else - touch "/etc/audit/auditd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/audit/auditd.conf" - -cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" -# Insert at the end of the file -printf '%s\n' "freq = 50" >> "/etc/audit/auditd.conf" -# Clean up after ourselves. -rm "/etc/audit/auditd.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170526,29 +170649,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Include Local Events in Audit Logs - To configure Audit daemon to include local events in Audit logs, set -local_events to yes in /etc/audit/auditd.conf. -This is the default setting. - CCI-000366 - CM-6 - FAU_GEN.1 - SRG-OS-000062-GPOS-00031 - SRG-OS-000480-GPOS-00227 - RHEL-08-030061 - SV-230393r627750_rule - If option local_events isn't set to yes only events from -network will be aggregated. - CCE-82233-8 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170563,12 +170664,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*local_events\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*freq\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170577,7 +170678,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "local_events = yes" >> "/etc/audit/auditd.conf" +printf '%s\n' "freq = 50" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170585,6 +170686,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Include Local Events in Audit Logs + To configure Audit daemon to include local events in Audit logs, set +local_events to yes in /etc/audit/auditd.conf. +This is the default setting. + CCI-000366 + CM-6 + FAU_GEN.1 + SRG-OS-000062-GPOS-00031 + SRG-OS-000480-GPOS-00227 + RHEL-08-030061 + SV-230393r627750_rule + If option local_events isn't set to yes only events from +network will be aggregated. + CCE-82233-8 - name: Gather the package facts package_facts: manager: auto @@ -170641,40 +170764,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Resolve information before writing to audit logs - To configure Audit daemon to resolve all uid, gid, syscall, -architecture, and socket address information before writing the -events to disk, set log_format to ENRICHED -in /etc/audit/auditd.conf. - CCI-000366 - CM-6 - AU-3 - FAU_GEN.1.2 - SRG-OS-000255-GPOS-00096 - SRG-OS-000480-GPOS-00227 - SRG-APP-000096-CTR-000175 - SRG-APP-000097-CTR-000180 - SRG-APP-000098-CTR-000185 - SRG-APP-000099-CTR-000190 - SRG-APP-000100-CTR-000195 - SRG-APP-000100-CTR-000200 - SRG-APP-000109-CTR-000215 - SRG-APP-000290-CTR-000670 - SRG-APP-000357-CTR-000800 - RHEL-08-030063 - SV-230395r627750_rule - If option log_format isn't set to ENRICHED, the -audit records will be stored in a format exactly as the kernel sends them. - CCE-82201-5 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170689,12 +170779,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*log_format\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*local_events\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170703,7 +170793,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "log_format = ENRICHED" >> "/etc/audit/auditd.conf" +printf '%s\n' "local_events = yes" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170711,6 +170801,39 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Resolve information before writing to audit logs + To configure Audit daemon to resolve all uid, gid, syscall, +architecture, and socket address information before writing the +events to disk, set log_format to ENRICHED +in /etc/audit/auditd.conf. + CCI-000366 + CM-6 + AU-3 + FAU_GEN.1.2 + SRG-OS-000255-GPOS-00096 + SRG-OS-000480-GPOS-00227 + SRG-APP-000096-CTR-000175 + SRG-APP-000097-CTR-000180 + SRG-APP-000098-CTR-000185 + SRG-APP-000099-CTR-000190 + SRG-APP-000100-CTR-000195 + SRG-APP-000100-CTR-000200 + SRG-APP-000109-CTR-000215 + SRG-APP-000290-CTR-000670 + SRG-APP-000357-CTR-000800 + RHEL-08-030063 + SV-230395r627750_rule + If option log_format isn't set to ENRICHED, the +audit records will be stored in a format exactly as the kernel sends them. + CCE-82201-5 - name: Gather the package facts package_facts: manager: auto @@ -170769,35 +170892,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Set type of computer node name logging in audit logs - To configure Audit daemon to use a unique identifier -as computer node name in the audit events, -set name_format to -in /etc/audit/auditd.conf. - Whenever the variable var_auditd_name_format uses a multiple value option, for example -A|B|C, the first value will be used when remediating this rule. - CCI-001851 - CM-6 - AU-3 - FAU_GEN.1.2 - SRG-OS-000039-GPOS-00017 - SRG-OS-000342-GPOS-00133 - SRG-OS-000479-GPOS-00224 - RHEL-08-030062 - SV-230394r877390_rule - If option name_format is left at its default value of -none, audit events from different computers may be hard -to distinguish. - CCE-82897-0 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170812,17 +170907,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -var_auditd_name_format='' - - -var_auditd_name_format="$(echo $var_auditd_name_format | cut -d \| -f 1)" - if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*name_format\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*log_format\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170831,7 +170921,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "name_format = $var_auditd_name_format" >> "/etc/audit/auditd.conf" +printf '%s\n' "log_format = ENRICHED" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170839,6 +170929,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set type of computer node name logging in audit logs + To configure Audit daemon to use a unique identifier +as computer node name in the audit events, +set name_format to +in /etc/audit/auditd.conf. + Whenever the variable var_auditd_name_format uses a multiple value option, for example +A|B|C, the first value will be used when remediating this rule. + CCI-001851 + CM-6 + AU-3 + FAU_GEN.1.2 + SRG-OS-000039-GPOS-00017 + SRG-OS-000342-GPOS-00133 + SRG-OS-000479-GPOS-00224 + RHEL-08-030062 + SV-230394r877390_rule + If option name_format is left at its default value of +none, audit events from different computers may be hard +to distinguish. + CCE-82897-0 - name: Gather the package facts package_facts: manager: auto @@ -170920,6 +171038,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_name_format='' + + +var_auditd_name_format="$(echo $var_auditd_name_format | cut -d \| -f 1)" + +if [ -e "/etc/audit/auditd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*name_format\s*=\s*/Id" "/etc/audit/auditd.conf" +else + touch "/etc/audit/auditd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/audit/auditd.conf" + +cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" +# Insert at the end of the file +printf '%s\n' "name_format = $var_auditd_name_format" >> "/etc/audit/auditd.conf" +# Clean up after ourselves. +rm "/etc/audit/auditd.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170943,28 +171103,6 @@ to one of the following values: syslog, single The audit system should have an action setup in the event the internal event queue becomes full so that no data is lost. CCE-85889-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if [ -e "/etc/audit/auditd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*overflow_action\s*=\s*/Id" "/etc/audit/auditd.conf" -else - touch "/etc/audit/auditd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/audit/auditd.conf" - -cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" -# Insert at the end of the file -printf '%s\n' "overflow_action = syslog" >> "/etc/audit/auditd.conf" -# Clean up after ourselves. -rm "/etc/audit/auditd.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -171021,45 +171159,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Write Audit Logs to the Disk - To configure Audit daemon to write Audit logs to the disk, set -write_logs to yes in /etc/audit/auditd.conf. -This is the default setting. - CM-6 - FAU_STG.1 - SRG-OS-000480-GPOS-00227 - If write_logs isn't set to yes, the Audit logs will -not be written to the disk. - CCE-82366-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*write_logs\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*overflow_action\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -171068,7 +171173,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "write_logs = yes" >> "/etc/audit/auditd.conf" +printf '%s\n' "overflow_action = syslog" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -171076,6 +171181,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Write Audit Logs to the Disk + To configure Audit daemon to write Audit logs to the disk, set +write_logs to yes in /etc/audit/auditd.conf. +This is the default setting. + CM-6 + FAU_STG.1 + SRG-OS-000480-GPOS-00227 + If write_logs isn't set to yes, the Audit logs will +not be written to the disk. + CCE-82366-6 - name: Gather the package facts package_facts: manager: auto @@ -171129,6 +171252,43 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if [ -e "/etc/audit/auditd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*write_logs\s*=\s*/Id" "/etc/audit/auditd.conf" +else + touch "/etc/audit/auditd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/audit/auditd.conf" + +cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" +# Insert at the end of the file +printf '%s\n' "write_logs = yes" >> "/etc/audit/auditd.conf" +# Clean up after ourselves. +rm "/etc/audit/auditd.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171182,25 +171342,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful attempts to access a file might be signs of malicious activity happening within the system. Auditing of such activities helps in their monitoring and investigation. CCE-82833-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules according to policy copy: @@ -171237,6 +171378,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171275,39 +171435,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to access a file helps in investigation of activities performed on the system. CCE-82834-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Successful%20file%20access%20%28any%20other%20opens%29%20This%20has%20to%20go%20last.%0A%23%23%20These%20next%20two%20are%20likely%20to%20result%20in%20a%20whole%20lot%20of%20events%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-3-access-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-success.rules -## Successful file access (any other opens) This has to go last. -## These next two are likely to result in a whole lot of events --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-3-access-success.rules according to policy copy: @@ -171343,6 +171470,39 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Successful%20file%20access%20%28any%20other%20opens%29%20This%20has%20to%20go%20last.%0A%23%23%20These%20next%20two%20are%20likely%20to%20result%20in%20a%20whole%20lot%20of%20events%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-3-access-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-success.rules +## Successful file access (any other opens) This has to go last. +## These next two are likely to result in a whole lot of events +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171379,48 +171539,6 @@ Load new Audit rules into kernel by running: SRG-OS-000475-GPOS-00220 Without basic configurations, audit may not perform as expected. It may not be able to correctly handle events under stressful conditions, or log events in case of failure. CCE-82827-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20First%20rule%20-%20delete%20all%0A-D%0A%0A%23%23%20Increase%20the%20buffers%20to%20survive%20stress%20events.%0A%23%23%20Make%20this%20bigger%20for%20busy%20systems%0A-b%208192%0A%0A%23%23%20This%20determine%20how%20long%20to%20wait%20in%20burst%20of%20events%0A--backlog_wait_time%2060000%0A%0A%23%23%20Set%20failure%20mode%20to%20syslog%0A-f%201%0A - mode: 0600 - path: /etc/audit/rules.d/10-base-config.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/10-base-config.rules -## First rule - delete all --D - -## Increase the buffers to survive stress events. -## Make this bigger for busy systems --b 8192 - -## This determine how long to wait in burst of events ---backlog_wait_time 60000 - -## Set failure mode to syslog --f 1 - -EOF - -chmod o-rwx /etc/audit/rules.d/10-base-config.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/10-base-config.rules according to policy copy: dest: /etc/audit/rules.d/10-base-config.rules @@ -171464,6 +171582,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20First%20rule%20-%20delete%20all%0A-D%0A%0A%23%23%20Increase%20the%20buffers%20to%20survive%20stress%20events.%0A%23%23%20Make%20this%20bigger%20for%20busy%20systems%0A-b%208192%0A%0A%23%23%20This%20determine%20how%20long%20to%20wait%20in%20burst%20of%20events%0A--backlog_wait_time%2060000%0A%0A%23%23%20Set%20failure%20mode%20to%20syslog%0A-f%201%0A + mode: 0600 + path: /etc/audit/rules.d/10-base-config.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/10-base-config.rules +## First rule - delete all +-D + +## Increase the buffers to survive stress events. +## Make this bigger for busy systems +-b 8192 + +## This determine how long to wait in burst of events +--backlog_wait_time 60000 + +## Set failure mode to syslog +-f 1 + +EOF + +chmod o-rwx /etc/audit/rules.d/10-base-config.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171511,33 +171671,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful file creations might be a sign of a malicious action being performed on the system. Keeping log of such events helps in monitoring and investigation of such actions. CCE-82374-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules according to policy copy: @@ -171582,6 +171715,33 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171617,27 +171777,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to create a file helps in investigation of actions which happened on the system. CCE-82829-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-success.rules -## Successful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-1-create-success.rules according to policy copy: @@ -171676,6 +171815,27 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-success.rules +## Successful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171710,40 +171870,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000468-GPOS-00212 Unsuccessful attempts to delete a file might be signs of malicious activities. Auditing of such events help in monitoring and investigating of such activities. CCE-82835-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Unsuccessful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules -## Unsuccessful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules according to policy copy: @@ -171780,6 +171906,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Unsuccessful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules +## Unsuccessful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171812,39 +171972,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000468-GPOS-00212 Auditing of successful attempts to delete a file may help in monitoring and investigation of activities performed on the system. CCE-82836-8 - --- - -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%23%20Successful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete }} - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules -## Successful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules according to policy copy: @@ -171879,6 +172006,39 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%23%20Successful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete }} + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules +## Successful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171914,38 +172074,6 @@ Load new Audit rules into kernel by running: If modification of login UIDs is not prevented, they can be changed by unprivileged users and make auditing complicated or impossible. CCE-82828-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Make%20the%20loginuid%20immutable.%20This%20prevents%20tampering%20with%20the%20auid.%0A--loginuid-immutable%0A%0A - mode: 0600 - path: /etc/audit/rules.d/11-loginuid.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/11-loginuid.rules -## Make the loginuid immutable. This prevents tampering with the auid. ---loginuid-immutable - -EOF - -chmod o-rwx /etc/audit/rules.d/11-loginuid.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/11-loginuid.rules according to policy copy: dest: /etc/audit/rules.d/11-loginuid.rules @@ -171979,6 +172107,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Make%20the%20loginuid%20immutable.%20This%20prevents%20tampering%20with%20the%20auid.%0A--loginuid-immutable%0A%0A + mode: 0600 + path: /etc/audit/rules.d/11-loginuid.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/11-loginuid.rules +## Make the loginuid immutable. This prevents tampering with the auid. +--loginuid-immutable + +EOF + +chmod o-rwx /etc/audit/rules.d/11-loginuid.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172026,48 +172186,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful file modifications might be a sign of a malicious action being performed on the system. Auditing of such events helps in detection and investigation of such actions. CCE-82830-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Unsuccessful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules according to policy copy: @@ -172112,6 +172230,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Unsuccessful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172147,42 +172307,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to modify a file helps in investigation of actions which happened on the system. CCE-82832-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Successful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules -## Successful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules according to policy copy: @@ -172221,6 +172345,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Successful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules +## Successful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172250,41 +172410,6 @@ Load new Audit rules into kernel by running: SRG-OS-000475-GPOS-00220 Loading of a malicious kernel module introduces a risk to the system, as the module has access to sensitive data and perform actions at the operating system kernel level. Having such events audited helps in monitoring and investigating of malicious activities. CCE-82838-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20These%20rules%20watch%20for%20kernel%20module%20insertion.%20By%20monitoring%0A%23%23%20the%20syscall%2C%20we%20do%20not%20need%20any%20watches%20on%20programs.%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A - mode: 0600 - path: /etc/audit/rules.d/43-module-load.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/43-module-load.rules -## These rules watch for kernel module insertion. By monitoring -## the syscall, we do not need any watches on programs. --a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b32 -S delete_module -F key=module-unload --a always,exit -F arch=b64 -S delete_module -F key=module-unload -EOF - -chmod o-rwx /etc/audit/rules.d/43-module-load.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/43-module-load.rules according to policy copy: dest: /etc/audit/rules.d/43-module-load.rules @@ -172321,6 +172446,41 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20These%20rules%20watch%20for%20kernel%20module%20insertion.%20By%20monitoring%0A%23%23%20the%20syscall%2C%20we%20do%20not%20need%20any%20watches%20on%20programs.%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A + mode: 0600 + path: /etc/audit/rules.d/43-module-load.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/43-module-load.rules +## These rules watch for kernel module insertion. By monitoring +## the syscall, we do not need any watches on programs. +-a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b32 -S delete_module -F key=module-unload +-a always,exit -F arch=b64 -S delete_module -F key=module-unload +EOF + +chmod o-rwx /etc/audit/rules.d/43-module-load.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172438,119 +172598,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000304-GPOS-00121 Auditing of events listed in the description provides data for monitoring and investigation of potentially malicious events e.g. tampering with Audit logs, malicious access to files storing information about system users and groups etc. CCE-82373-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20The%20purpose%20of%20these%20rules%20is%20to%20meet%20the%20requirements%20for%20Operating%0A%23%23%20System%20Protection%20Profile%20%28OSPP%29v4.2.%20These%20rules%20depends%20on%20having%0A%23%23%20the%20following%20rule%20files%20copied%20to%20%2Fetc%2Faudit%2Frules.d%3A%0A%23%23%0A%23%23%2010-base-config.rules%2C%2011-loginuid.rules%2C%0A%23%23%2030-ospp-v42-1-create-failed.rules%2C%2030-ospp-v42-1-create-success.rules%2C%0A%23%23%2030-ospp-v42-2-modify-failed.rules%2C%2030-ospp-v42-2-modify-success.rules%2C%0A%23%23%2030-ospp-v42-3-access-failed.rules%2C%2030-ospp-v42-3-access-success.rules%2C%0A%23%23%2030-ospp-v42-4-delete-failed.rules%2C%2030-ospp-v42-4-delete-success.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-failed.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-success.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-failed.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-success.rules%0A%23%23%0A%23%23%20original%20copies%20may%20be%20found%20in%20%2Fusr%2Fshare%2Faudit%2Fsample-rules%2F%0A%0A%0A%23%23%20User%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20passwd%20and%0A%23%23%20shadow%20for%20writes%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A%0A%23%23%20User%20enable%20and%20disable.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Group%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20group%20and%0A%23%23%20gshadow%20for%20writes%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgroup%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A%0A%0A%23%23%20Use%20of%20special%20rights%20for%20config%20changes.%20This%20would%20be%20use%20of%20setuid%0A%23%23%20programs%20that%20relate%20to%20user%20accts.%20This%20is%20not%20all%20setuid%20apps%20because%0A%23%23%20requirements%20are%20only%20for%20ones%20that%20affect%20system%20configuration.%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Funix_chkpwd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fusernetctl%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fuserhelper%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fseunshare%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fmount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgrp%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewuidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fgpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fumount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fcrontab%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fat%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Privilege%20escalation%20via%20su%20or%20sudo.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Watch%20for%20configuration%20changes%20to%20privilege%20escalation.%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fsudoers%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fsudoers.d%2F%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Audit%20log%20access%0A-a%20always%2Cexit%20-F%20dir%3D%2Fvar%2Flog%2Faudit%2F%20-F%20perm%3Dr%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Daccess-audit-trail%0A%23%23%20Attempts%20to%20Alter%20Process%20and%20Session%20Initiation%20Information%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Frun%2Futmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fbtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fwtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A%0A%23%23%20Attempts%20to%20modify%20MAC%20controls%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fselinux%2F%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3DMAC-policy%0A%0A%23%23%20Software%20updates.%20This%20is%20entirely%20handled%20by%20rpm.%0A%0A%23%23%20System%20start%20and%20shutdown.%20This%20is%20entirely%20handled%20by%20systemd%0A%0A%23%23%20Kernel%20Module%20loading.%20This%20is%20handled%20in%2043-module-load.rules%0A%0A%23%23%20Application%20invocation.%20The%20requirements%20list%20an%20optional%20requirement%0A%23%23%20FPT_SRP_EXT.1%20Software%20Restriction%20Policies.%20This%20event%20is%20intended%20to%0A%23%23%20state%20results%20from%20that%20policy.%20This%20would%20be%20handled%20entirely%20by%0A%23%23%20that%20daemon.%0A%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42.rules -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## the following rule files copied to /etc/audit/rules.d: -## -## 10-base-config.rules, 11-loginuid.rules, -## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, -## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, -## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, -## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, -## 30-ospp-v42-5-perm-change-failed.rules, -## 30-ospp-v42-5-perm-change-success.rules, -## 30-ospp-v42-6-owner-change-failed.rules, -## 30-ospp-v42-6-owner-change-success.rules -## -## original copies may be found in /usr/share/audit/sample-rules/ - - -## User add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch passwd and -## shadow for writes --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - -## User enable and disable. This is entirely handled by pam. - -## Group add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch group and -## gshadow for writes --a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify --a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify - - -## Use of special rights for config changes. This would be use of setuid -## programs that relate to user accts. This is not all setuid apps because -## requirements are only for ones that affect system configuration. --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes - -## Privilege escalation via su or sudo. This is entirely handled by pam. - -## Watch for configuration changes to privilege escalation. --a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes --a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes - -## Audit log access --a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail -## Attempts to Alter Process and Session Initiation Information --a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session - -## Attempts to modify MAC controls --a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy - -## Software updates. This is entirely handled by rpm. - -## System start and shutdown. This is entirely handled by systemd - -## Kernel Module loading. This is handled in 43-module-load.rules - -## Application invocation. The requirements list an optional requirement -## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to -## state results from that policy. This would be handled entirely by -## that daemon. - -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42.rules according to policy copy: dest: /etc/audit/rules.d/30-ospp-v42.rules @@ -172665,6 +172712,119 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20The%20purpose%20of%20these%20rules%20is%20to%20meet%20the%20requirements%20for%20Operating%0A%23%23%20System%20Protection%20Profile%20%28OSPP%29v4.2.%20These%20rules%20depends%20on%20having%0A%23%23%20the%20following%20rule%20files%20copied%20to%20%2Fetc%2Faudit%2Frules.d%3A%0A%23%23%0A%23%23%2010-base-config.rules%2C%2011-loginuid.rules%2C%0A%23%23%2030-ospp-v42-1-create-failed.rules%2C%2030-ospp-v42-1-create-success.rules%2C%0A%23%23%2030-ospp-v42-2-modify-failed.rules%2C%2030-ospp-v42-2-modify-success.rules%2C%0A%23%23%2030-ospp-v42-3-access-failed.rules%2C%2030-ospp-v42-3-access-success.rules%2C%0A%23%23%2030-ospp-v42-4-delete-failed.rules%2C%2030-ospp-v42-4-delete-success.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-failed.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-success.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-failed.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-success.rules%0A%23%23%0A%23%23%20original%20copies%20may%20be%20found%20in%20%2Fusr%2Fshare%2Faudit%2Fsample-rules%2F%0A%0A%0A%23%23%20User%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20passwd%20and%0A%23%23%20shadow%20for%20writes%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A%0A%23%23%20User%20enable%20and%20disable.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Group%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20group%20and%0A%23%23%20gshadow%20for%20writes%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgroup%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A%0A%0A%23%23%20Use%20of%20special%20rights%20for%20config%20changes.%20This%20would%20be%20use%20of%20setuid%0A%23%23%20programs%20that%20relate%20to%20user%20accts.%20This%20is%20not%20all%20setuid%20apps%20because%0A%23%23%20requirements%20are%20only%20for%20ones%20that%20affect%20system%20configuration.%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Funix_chkpwd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fusernetctl%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fuserhelper%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fseunshare%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fmount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgrp%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewuidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fgpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fumount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fcrontab%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fat%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Privilege%20escalation%20via%20su%20or%20sudo.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Watch%20for%20configuration%20changes%20to%20privilege%20escalation.%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fsudoers%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fsudoers.d%2F%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Audit%20log%20access%0A-a%20always%2Cexit%20-F%20dir%3D%2Fvar%2Flog%2Faudit%2F%20-F%20perm%3Dr%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Daccess-audit-trail%0A%23%23%20Attempts%20to%20Alter%20Process%20and%20Session%20Initiation%20Information%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Frun%2Futmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fbtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fwtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A%0A%23%23%20Attempts%20to%20modify%20MAC%20controls%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fselinux%2F%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3DMAC-policy%0A%0A%23%23%20Software%20updates.%20This%20is%20entirely%20handled%20by%20rpm.%0A%0A%23%23%20System%20start%20and%20shutdown.%20This%20is%20entirely%20handled%20by%20systemd%0A%0A%23%23%20Kernel%20Module%20loading.%20This%20is%20handled%20in%2043-module-load.rules%0A%0A%23%23%20Application%20invocation.%20The%20requirements%20list%20an%20optional%20requirement%0A%23%23%20FPT_SRP_EXT.1%20Software%20Restriction%20Policies.%20This%20event%20is%20intended%20to%0A%23%23%20state%20results%20from%20that%20policy.%20This%20would%20be%20handled%20entirely%20by%0A%23%23%20that%20daemon.%0A%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42.rules +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## the following rule files copied to /etc/audit/rules.d: +## +## 10-base-config.rules, 11-loginuid.rules, +## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, +## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, +## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, +## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, +## 30-ospp-v42-5-perm-change-failed.rules, +## 30-ospp-v42-5-perm-change-success.rules, +## 30-ospp-v42-6-owner-change-failed.rules, +## 30-ospp-v42-6-owner-change-success.rules +## +## original copies may be found in /usr/share/audit/sample-rules/ + + +## User add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch passwd and +## shadow for writes +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + +## User enable and disable. This is entirely handled by pam. + +## Group add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch group and +## gshadow for writes +-a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify +-a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify + + +## Use of special rights for config changes. This would be use of setuid +## programs that relate to user accts. This is not all setuid apps because +## requirements are only for ones that affect system configuration. +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes + +## Privilege escalation via su or sudo. This is entirely handled by pam. + +## Watch for configuration changes to privilege escalation. +-a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes +-a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes + +## Audit log access +-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail +## Attempts to Alter Process and Session Initiation Information +-a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session + +## Attempts to modify MAC controls +-a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy + +## Software updates. This is entirely handled by rpm. + +## System start and shutdown. This is entirely handled by systemd + +## Kernel Module loading. This is handled in 43-module-load.rules + +## Application invocation. The requirements list an optional requirement +## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to +## state results from that policy. This would be handled entirely by +## that daemon. + +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172699,25 +172859,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Unsuccessful attempts to change an ownership of files or directories might be signs of a malicious activity. Having such events audited helps in monitoring and investigation of such activities. CCE-82384-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules -## Unsuccessful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules according to policy copy: @@ -172754,6 +172895,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +## Unsuccessful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172786,23 +172946,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Auditing of successful ownership changes of files or directories helps in monitoring or investingating of activities performed on the system. CCE-82385-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules -## Successful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules according to policy copy: @@ -172837,6 +172980,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules +## Successful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172871,25 +173031,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Unsuccessful attempts to change permissions of files or directories might be signs of malicious activity. Having such events audited helps in monitoring and investigation of such activities. CCE-82837-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules -## Unsuccessful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules according to policy copy: @@ -172926,6 +173067,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules +## Unsuccessful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172958,23 +173118,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Auditing successful file or directory permission changes helps in monitoring and investigating of activities performed on the system. CCE-82383-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules -## Successful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules according to policy copy: @@ -173009,6 +173152,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules +## Successful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173167,21 +173327,6 @@ also required to change the runtime configuration, run: or other services, weakening system security. CCE-86006-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common; then - -if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then - sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' "/etc/default/grub" -else - echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' -fi - -grubby --update-kernel=ALL --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173221,6 +173366,21 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common; then + +if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then + sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' "/etc/default/grub" +else + echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' +fi + +grubby --update-kernel=ALL --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173245,18 +173405,6 @@ Run the following command to update command line for already installed kernels:< hardware devices. CCE-83920-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=iommu=force --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "iommu=force" - - name: Gather the package facts package_facts: manager: auto @@ -173282,6 +173430,18 @@ append = "iommu=force" - reboot_required - restrict_strategy - unknown_severity + + [customizations.kernel] +append = "iommu=force" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=iommu=force --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173314,18 +173474,6 @@ be useful during boot time when other means of getting random data can be slow because there is not yet enough entropy in the system. CCE-83314-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=random.trust_cpu=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "random.trust_cpu=on" - - name: Gather the package facts package_facts: manager: auto @@ -173351,6 +173499,18 @@ append = "random.trust_cpu=on" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "random.trust_cpu=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=random.trust_cpu=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173385,22 +173545,6 @@ by the system or hypervisor. The L1TF vulnerability allows read access to any ph location that is cached in the L1 Data Cache. CCE-88123-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_l1tf_options='' - - - -grubby --update-kernel=ALL --args=l1tf=$var_l1tf_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "l1tf=" - - name: Gather the package facts package_facts: manager: auto @@ -173431,6 +173575,22 @@ append = "l1tf=[customizations.kernel] +append = "l1tf=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_l1tf_options='' + + + +grubby --update-kernel=ALL --args=l1tf=$var_l1tf_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173461,18 +173621,6 @@ Run the following command to update command line for already installed kernels:< trying to exploit a vulnerability such as Rowhammer. CCE-87098-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=mce=0 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "mce=0" - - name: Gather the package facts package_facts: manager: auto @@ -173498,6 +173646,18 @@ append = "mce=0" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "mce=0" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=mce=0 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173524,15 +173684,6 @@ Run the following command to update command line for already installed kernels: manipulation of data in the user space. CCE-87345-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=nosmap --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173558,6 +173709,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=nosmap --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173584,15 +173744,6 @@ Run the following command to update command line for already installed kernels: the kernel to unintentionally execute code in less privileged memory space. CCE-85989-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=nosmep --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173618,6 +173769,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=nosmep --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173650,18 +173810,6 @@ against attempts to bypass kernel address space layout randomization (KASLR). CCE-82194-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=pti=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "pti=on" - - name: Gather the package facts package_facts: manager: auto @@ -173691,6 +173839,18 @@ append = "pti=on" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "pti=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=pti=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173728,22 +173888,6 @@ Run the following command to update command line for already installed kernels:< from the hardware number generators available in the system helps fill up the entropy pool. CCE-89567-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_rng_core_default_quality='' - - - -grubby --update-kernel=ALL --args=rng_core.default_quality=$var_rng_core_default_quality --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "rng_core.default_quality=" - - name: Gather the package facts package_facts: manager: auto @@ -173775,6 +173919,22 @@ append = "rng_core.default_quality=[customizations.kernel] +append = "rng_core.default_quality=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_rng_core_default_quality='' + + + +grubby --update-kernel=ALL --args=rng_core.default_quality=$var_rng_core_default_quality --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173808,18 +173968,6 @@ with unmerged caches the heap overflow would only affect the objects in the same Overall, this reduces the kernel attack surface area by isolating slabs from each other. CCE-86777-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=slab_nomerge=yes --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "slab_nomerge=yes" - - name: Gather the package facts package_facts: manager: auto @@ -173845,6 +173993,18 @@ append = "slab_nomerge=yes" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "slab_nomerge=yes" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=slab_nomerge=yes --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173882,22 +174042,6 @@ attack. An example of this is reading memory to which the attacker does not dire for example inside the sandboxed code. CCE-89234-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_spec_store_bypass_disable_options='' - - - -grubby --update-kernel=ALL --args=spec_store_bypass_disable=$var_spec_store_bypass_disable_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "spec_store_bypass_disable=" - - name: Gather the package facts package_facts: manager: auto @@ -173929,6 +174073,22 @@ append = "spec_store_bypass_disable=[customizations.kernel] +append = "spec_store_bypass_disable=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_spec_store_bypass_disable_options='' + + + +grubby --update-kernel=ALL --args=spec_store_bypass_disable=$var_spec_store_bypass_disable_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173962,18 +174122,6 @@ Run the following command to update command line for already installed kernels:< access to. CCE-89345-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=spectre_v2=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "spectre_v2=on" - - name: Gather the package facts package_facts: manager: auto @@ -173999,6 +174147,18 @@ append = "spectre_v2=on" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "spectre_v2=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=spectre_v2=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174030,15 +174190,6 @@ Run the following command to update command line for already installed kernels: on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=systemd.debug-shell --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174062,6 +174213,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=systemd.debug-shell --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174092,18 +174252,6 @@ Run the following command to update command line for already installed kernels:< of the return instruction pointer. CCE-80946-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=vsyscall=none --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "vsyscall=none" - - name: Gather the package facts package_facts: manager: auto @@ -174133,6 +174281,18 @@ append = "vsyscall=none" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "vsyscall=none" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=vsyscall=none --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174217,15 +174377,6 @@ To properly set the group owner of /boot/grub2/grub.cfg, file should not have any access privileges anyway. CCE-80800-6 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174290,6 +174441,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174370,15 +174530,6 @@ file should not have any access privileges anyway. Non-root users who read the b may be able to identify weaknesses in security upon boot and be able to exploit them. CCE-86009-8 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174443,6 +174594,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174522,15 +174682,6 @@ To properly set the owner of /boot/grub2/grub.cfg, run th Only root should be able to modify important boot parameters. CCE-80805-5 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174595,6 +174746,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174674,15 +174834,6 @@ the boot parameters may be able to identify weaknesses in security upon boot and exploit them. CCE-86015-5 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174747,6 +174898,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174822,15 +174982,6 @@ To properly set the permissions of /boot/grub2/grub.cfg, parameters. CCE-80814-7 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-xs,g-xwrs,o-xwrt /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174889,6 +175040,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-xs,g-xwrs,o-xwrt /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174964,15 +175124,6 @@ To properly set the permissions of /boot/grub2/user.cfg, parameters. CCE-86024-7 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-xs,g-xwrs,o-xwrt /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175031,6 +175182,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-xs,g-xwrs,o-xwrt /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175387,15 +175547,6 @@ To properly set the group owner of /boot/efi/EFI/redhat/grub.cfg CCE-85915-7 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175457,6 +175608,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175524,15 +175684,6 @@ file should not have any access privileges anyway. Non-root users who read the b may be able to identify weaknesses in security upon boot and be able to exploit them. CCE-86012-2 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175594,6 +175745,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175660,15 +175820,6 @@ To properly set the owner of /boot/efi/EFI/redhat/grub.cfgOnly root should be able to modify important boot parameters. CCE-85913-2 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175730,6 +175881,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175797,15 +175957,6 @@ the boot parameters may be able to identify weaknesses in security upon boot and exploit them. CCE-86021-3 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175867,6 +176018,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175930,15 +176090,6 @@ To properly set the permissions of /boot/efi/EFI/redhat/grub.cfg CCE-85912-4 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175994,6 +176145,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176057,15 +176217,6 @@ To properly set the permissions of /boot/efi/EFI/redhat/user.cfg CCE-86028-8 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -176121,6 +176272,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176409,24 +176569,6 @@ this for all processes which launch after it does, adding the kernel argument ensures it is set for every process during boot. CCE-83321-0 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="audit=1" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "audit=1" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?audit=1(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 audit=1/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain audit=1 block: @@ -176486,6 +176628,24 @@ fi - medium_severity - reboot_required - zipl_audit_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="audit=1" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "audit=1" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?audit=1(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 audit=1/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176509,24 +176669,6 @@ are stored in this queue. If the queue is overrun during boot process, the acti defined by audit failure flag is taken. CCE-83341-8 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="audit_backlog_limit=8192" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "audit_backlog_limit=8192" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?audit_backlog_limit=8192(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 audit_backlog_limit=8192/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain audit_backlog_limit=8192 block: @@ -176586,6 +176728,24 @@ fi - medium_severity - reboot_required - zipl_audit_backlog_limit_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="audit_backlog_limit=8192" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "audit_backlog_limit=8192" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?audit_backlog_limit=8192(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 audit_backlog_limit=8192/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176621,15 +176781,6 @@ Run zipl command to generate an updated /boot/ boot correct kernel and options. CCE-83486-1 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -/usr/sbin/zipl - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure zIPL bootmap is up to date block: @@ -176659,6 +176810,15 @@ fi - medium_severity - no_reboot_needed - zipl_bootmap_is_up_to_date + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +/usr/sbin/zipl + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176694,24 +176854,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-83351-7 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="page_poison=1" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "page_poison=1" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?page_poison=1(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 page_poison=1/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain page_poison=1 block: @@ -176771,6 +176913,24 @@ fi - medium_severity - reboot_required - zipl_page_poison_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="page_poison=1" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "page_poison=1" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?page_poison=1(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 page_poison=1/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176793,24 +176953,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-83371-5 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="slub_debug=P" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "slub_debug=P" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?slub_debug=P(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 slub_debug=P/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain slub_debug=P block: @@ -176870,6 +177012,24 @@ fi - medium_severity - reboot_required - zipl_slub_debug_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="slub_debug=P" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "slub_debug=P" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?slub_debug=P(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 slub_debug=P/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176901,21 +177061,6 @@ that systemd.debug-shell=1 is not present in / on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --remove-args="systemd.debug-shell" - -# Ensure new kernels and boot entries retain the boot option -if grep -q '\bsystemd.debug-shell\b' /etc/kernel/cmdline; then - sed -Ei 's/^(.*)\s*systemd.debug-shell\b\S*(.*)/\1\2/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain systemd.debug-shell block: @@ -176960,6 +177105,21 @@ fi - medium_severity - reboot_required - zipl_systemd_debug-shell_argument_absent + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --remove-args="systemd.debug-shell" + +# Ensure new kernels and boot entries retain the boot option +if grep -q '\bsystemd.debug-shell\b' /etc/kernel/cmdline; then + sed -Ei 's/^(.*)\s*systemd.debug-shell\b\S*(.*)/\1\2/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176980,24 +177140,6 @@ add vsyscall=none to /etc/kernel/cmdline CCE-83381-4 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="vsyscall=none" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "vsyscall=none" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?vsyscall=none(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 vsyscall=none/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain vsyscall=none block: @@ -177057,6 +177199,24 @@ fi - medium_severity - reboot_required - zipl_vsyscall_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="vsyscall=none" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "vsyscall=none" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?vsyscall=none(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 vsyscall=none/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -178701,8 +178861,25 @@ $ sudo yum install rsyslog-gnutls The rsyslog-gnutls package provides Transport Layer Security (TLS) support for the rsyslog daemon, which enables secure remote logging. CCE-82859-0 - -package --add=rsyslog-gnutls + - name: Ensure rsyslog-gnutls is installed + package: + name: rsyslog-gnutls + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82859-0 + - DISA-STIG-RHEL-08-030680 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsyslog-gnutls_installed + + +[[packages]] +name = "rsyslog-gnutls" +version = "*" include install_rsyslog-gnutls @@ -178711,6 +178888,9 @@ class install_rsyslog-gnutls { ensure => 'installed', } } + + +package --add=rsyslog-gnutls # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -178722,26 +178902,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rsyslog-gnutls" -version = "*" - - - name: Ensure rsyslog-gnutls is installed - package: - name: rsyslog-gnutls - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82859-0 - - DISA-STIG-RHEL-08-030680 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsyslog-gnutls_installed @@ -178792,13 +178952,31 @@ version = "*" SRG-OS-000051-GPOS-00024 SRG-OS-000480-GPOS-00227 RHEL-08-030670 - 4.2.1.1 + 5.1.1.1 SV-230477r627750_rule The rsyslog package provides the rsyslog daemon, which provides system logging services. CCE-80847-7 - -package --add=rsyslog + - name: Ensure rsyslog is installed + package: + name: rsyslog + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80847-7 + - DISA-STIG-RHEL-08-030670 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsyslog_installed + + +[[packages]] +name = "rsyslog" +version = "*" include install_rsyslog @@ -178807,6 +178985,9 @@ class install_rsyslog { ensure => 'installed', } } + + +package --add=rsyslog # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -178818,27 +178999,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rsyslog" -version = "*" - - - name: Ensure rsyslog is installed - package: - name: rsyslog - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80847-7 - - DISA-STIG-RHEL-08-030670 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsyslog_installed @@ -178928,36 +179088,11 @@ The rsyslog service can be enabled with the following com PR.PT-1 SRG-OS-000480-GPOS-00227 RHEL-08-010561 - 4.2.1.2 + 5.1.1.2 SV-230298r627750_rule The rsyslog service must be running in order to provide logging services, which are essential to system administration. CCE-80886-5 - include enable_rsyslog - -class enable_rsyslog { - service {'rsyslog': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'rsyslog.service' -"$SYSTEMCTL_EXEC" start 'rsyslog.service' -"$SYSTEMCTL_EXEC" enable 'rsyslog.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["rsyslog"] - - name: Enable service rsyslog block: @@ -178985,6 +179120,31 @@ enabled = ["rsyslog"] - medium_severity - no_reboot_needed - service_rsyslog_enabled + + +[customizations.services] +enabled = ["rsyslog"] + + include enable_rsyslog + +class enable_rsyslog { + service {'rsyslog': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'rsyslog.service' +"$SYSTEMCTL_EXEC" start 'rsyslog.service' +"$SYSTEMCTL_EXEC" enable 'rsyslog.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179009,42 +179169,10 @@ easier and less time-intensive for administrators. rsyslog will create logfiles that do not already exist on the system. This settings controls what permissions will be applied to these newly created files. - 4.2.1.4 + 5.1.1.4 It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. CCE-88321-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -readarray -t targets < <(grep -H '^\s*$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*) - -# if $FileCreateMode set in multiple places -if [ ${#targets[@]} -gt 1 ]; then - # delete all and create new entry with expected value - sed -i '/^\s*$FileCreateMode/d' /etc/rsyslog.conf /etc/rsyslog.d/* - echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf -# if $FileCreateMode set in only one place -elif [ "${#targets[@]}" -eq 1 ]; then - filename=$(echo "${targets[0]}" | cut -d':' -f1) - value=$(echo "${targets[0]}" | cut -d' ' -f2) - #convert to decimal and bitwise or operation - result=$((8#$value | 416)) - # if more permissive than expected, then set it to 0640 - if [ $result -ne 416 ]; then - # if value is wrong remove it - sed -i '/^\s*$FileCreateMode/d' $filename - echo '$FileCreateMode 0640' > $filename - fi -else - echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf -fi - -systemctl restart rsyslog.service - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure rsyslog Default File Permissions Configured - Search for $FileCreateMode Parameter in rsyslog Main Config File ansible.builtin.find: @@ -179153,6 +179281,38 @@ fi - medium_severity - no_reboot_needed - rsyslog_filecreatemode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +readarray -t targets < <(grep -H '^\s*$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*) + +# if $FileCreateMode set in multiple places +if [ ${#targets[@]} -gt 1 ]; then + # delete all and create new entry with expected value + sed -i '/^\s*$FileCreateMode/d' /etc/rsyslog.conf /etc/rsyslog.d/* + echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf +# if $FileCreateMode set in only one place +elif [ "${#targets[@]}" -eq 1 ]; then + filename=$(echo "${targets[0]}" | cut -d':' -f1) + value=$(echo "${targets[0]}" | cut -d' ' -f2) + #convert to decimal and bitwise or operation + result=$((8#$value | 416)) + # if more permissive than expected, then set it to 0640 + if [ $result -ne 416 ]; then + # if value is wrong remove it + sed -i '/^\s*$FileCreateMode/d' $filename + echo '$FileCreateMode 0640' > $filename + fi +else + echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf +fi + +systemctl restart rsyslog.service + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179321,30 +179481,6 @@ When using rsyslogd to off-load logs the remote system mu configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-86339-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -sed -i '/^.*\$ActionSendStreamDriverAuthMode.*/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2> /dev/null - -if [ -e "/etc/rsyslog.d/stream_driver_auth.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverAuthMode /Id" "/etc/rsyslog.d/stream_driver_auth.conf" -else - touch "/etc/rsyslog.d/stream_driver_auth.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/stream_driver_auth.conf" - -cp "/etc/rsyslog.d/stream_driver_auth.conf" "/etc/rsyslog.d/stream_driver_auth.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$ActionSendStreamDriverAuthMode x509/name" >> "/etc/rsyslog.d/stream_driver_auth.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/stream_driver_auth.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Authenticates Off-Loaded Audit Records block: @@ -179396,6 +179532,30 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_actionsendstreamdriverauthmode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sed -i '/^.*\$ActionSendStreamDriverAuthMode.*/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2> /dev/null + +if [ -e "/etc/rsyslog.d/stream_driver_auth.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverAuthMode /Id" "/etc/rsyslog.d/stream_driver_auth.conf" +else + touch "/etc/rsyslog.d/stream_driver_auth.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/stream_driver_auth.conf" + +cp "/etc/rsyslog.d/stream_driver_auth.conf" "/etc/rsyslog.d/stream_driver_auth.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$ActionSendStreamDriverAuthMode x509/name" >> "/etc/rsyslog.d/stream_driver_auth.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/stream_driver_auth.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179423,28 +179583,6 @@ When using rsyslogd to off-load logs off a encrpytion sys configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-86098-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverMode /Id" "/etc/rsyslog.d/encrypt.conf" -else - touch "/etc/rsyslog.d/encrypt.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" - -cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$ActionSendStreamDriverMode 1" >> "/etc/rsyslog.d/encrypt.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/encrypt.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Encrypts Off-Loaded Audit Records block: @@ -179496,6 +179634,28 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_actionsendstreamdrivermode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverMode /Id" "/etc/rsyslog.d/encrypt.conf" +else + touch "/etc/rsyslog.d/encrypt.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" + +cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$ActionSendStreamDriverMode 1" >> "/etc/rsyslog.d/encrypt.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/encrypt.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179523,28 +179683,6 @@ When using rsyslogd to off-load logs off an encryption sy configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-85992-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$DefaultNetstreamDriver /Id" "/etc/rsyslog.d/encrypt.conf" -else - touch "/etc/rsyslog.d/encrypt.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" - -cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$DefaultNetstreamDriver gtls" >> "/etc/rsyslog.d/encrypt.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/encrypt.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Encrypts Off-Loaded Audit Records block: @@ -179596,6 +179734,28 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_defaultnetstreamdriver + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$DefaultNetstreamDriver /Id" "/etc/rsyslog.d/encrypt.conf" +else + touch "/etc/rsyslog.d/encrypt.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" + +cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$DefaultNetstreamDriver gtls" >> "/etc/rsyslog.d/encrypt.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/encrypt.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179676,113 +179836,11 @@ correct this: Req-10.5.1 Req-10.5.2 10.3.2 + 5.1.4 The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access. CCE-80860-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# List of log file paths to be inspected for correct permissions -# * Primarily inspect log file paths listed in /etc/rsyslog.conf -RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" -# * And also the log file paths listed after rsyslog's $IncludeConfig directive -# (store the result into array for the case there's shell glob used as value of IncludeConfig) -readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) -readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) -readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') -readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) - -# Declare an array to hold the final list of different log file paths -declare -a LOG_FILE_PATHS - -# Array to hold all rsyslog config entries -RSYSLOG_CONFIGS=() -RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") - -# Get full list of files to be checked -# RSYSLOG_CONFIGS may contain globs such as -# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule -# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. -RSYSLOG_CONFIG_FILES=() -for ENTRY in "${RSYSLOG_CONFIGS[@]}" -do - # If directory, rsyslog will search for config files in recursively. - # However, files in hidden sub-directories or hidden files will be ignored. - if [ -d "${ENTRY}" ] - then - readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) - RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") - elif [ -f "${ENTRY}" ] - then - RSYSLOG_CONFIG_FILES+=("${ENTRY}") - else - echo "Invalid include object: ${ENTRY}" - fi -done - -# Browse each file selected above as containing paths of log files -# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - # From each of these files extract just particular log file path(s), thus: - # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, - # * Ignore empty lines, - # * Strip quotes and closing brackets from paths. - # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files - # * From the remaining valid rows select only fields constituting a log file path - # Text file column is understood to represent a log file path if and only if all of the - # following are met: - # * it contains at least one slash '/' character, - # * it is preceded by space - # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters - # Search log file for path(s) only in case it exists! - if [[ -f "${LOG_FILE}" ]] - then - NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") - LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") - FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") - CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") - MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") - # Since above sed command might return more than one item (delimited by newline), split - # the particular matches entries into new array specific for this log file - readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" - # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with - # items from newly created array for this log file - LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") - # Delete the temporary array - unset ARRAY_FOR_LOG_FILE - fi -done - -# Check for RainerScript action log format which might be also multiline so grep regex is a bit -# curly: -# extract possibly multiline action omfile expressions -# extract File="logfile" expression -# match only "logfile" expression -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") - OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") - LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") -done - -# Ensure the correct attribute if file exists -FILE_CMD="chgrp" -for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" -do - # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing - if [ -z "$LOG_FILE_PATH" ] - then - continue - fi - $FILE_CMD "root" "$LOG_FILE_PATH" -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Log Files Are Owned By Appropriate Group - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -179986,6 +180044,109 @@ fi - medium_severity - no_reboot_needed - rsyslog_files_groupownership + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# List of log file paths to be inspected for correct permissions +# * Primarily inspect log file paths listed in /etc/rsyslog.conf +RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" +# * And also the log file paths listed after rsyslog's $IncludeConfig directive +# (store the result into array for the case there's shell glob used as value of IncludeConfig) +readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) +readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) +readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') +readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) + +# Declare an array to hold the final list of different log file paths +declare -a LOG_FILE_PATHS + +# Array to hold all rsyslog config entries +RSYSLOG_CONFIGS=() +RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") + +# Get full list of files to be checked +# RSYSLOG_CONFIGS may contain globs such as +# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule +# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. +RSYSLOG_CONFIG_FILES=() +for ENTRY in "${RSYSLOG_CONFIGS[@]}" +do + # If directory, rsyslog will search for config files in recursively. + # However, files in hidden sub-directories or hidden files will be ignored. + if [ -d "${ENTRY}" ] + then + readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) + RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") + elif [ -f "${ENTRY}" ] + then + RSYSLOG_CONFIG_FILES+=("${ENTRY}") + else + echo "Invalid include object: ${ENTRY}" + fi +done + +# Browse each file selected above as containing paths of log files +# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + # From each of these files extract just particular log file path(s), thus: + # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, + # * Ignore empty lines, + # * Strip quotes and closing brackets from paths. + # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files + # * From the remaining valid rows select only fields constituting a log file path + # Text file column is understood to represent a log file path if and only if all of the + # following are met: + # * it contains at least one slash '/' character, + # * it is preceded by space + # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters + # Search log file for path(s) only in case it exists! + if [[ -f "${LOG_FILE}" ]] + then + NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") + LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") + FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") + CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") + MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") + # Since above sed command might return more than one item (delimited by newline), split + # the particular matches entries into new array specific for this log file + readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" + # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with + # items from newly created array for this log file + LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") + # Delete the temporary array + unset ARRAY_FOR_LOG_FILE + fi +done + +# Check for RainerScript action log format which might be also multiline so grep regex is a bit +# curly: +# extract possibly multiline action omfile expressions +# extract File="logfile" expression +# match only "logfile" expression +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") + OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") + LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") +done + +# Ensure the correct attribute if file exists +FILE_CMD="chgrp" +for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" +do + # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing + if [ -z "$LOG_FILE_PATH" ] + then + continue + fi + $FILE_CMD "root" "$LOG_FILE_PATH" +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180073,113 +180234,11 @@ correct this: Req-10.5.1 Req-10.5.2 10.3.2 + 5.1.4 The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access. CCE-80861-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# List of log file paths to be inspected for correct permissions -# * Primarily inspect log file paths listed in /etc/rsyslog.conf -RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" -# * And also the log file paths listed after rsyslog's $IncludeConfig directive -# (store the result into array for the case there's shell glob used as value of IncludeConfig) -readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) -readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) -readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') -readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) - -# Declare an array to hold the final list of different log file paths -declare -a LOG_FILE_PATHS - -# Array to hold all rsyslog config entries -RSYSLOG_CONFIGS=() -RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") - -# Get full list of files to be checked -# RSYSLOG_CONFIGS may contain globs such as -# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule -# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. -RSYSLOG_CONFIG_FILES=() -for ENTRY in "${RSYSLOG_CONFIGS[@]}" -do - # If directory, rsyslog will search for config files in recursively. - # However, files in hidden sub-directories or hidden files will be ignored. - if [ -d "${ENTRY}" ] - then - readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) - RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") - elif [ -f "${ENTRY}" ] - then - RSYSLOG_CONFIG_FILES+=("${ENTRY}") - else - echo "Invalid include object: ${ENTRY}" - fi -done - -# Browse each file selected above as containing paths of log files -# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - # From each of these files extract just particular log file path(s), thus: - # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, - # * Ignore empty lines, - # * Strip quotes and closing brackets from paths. - # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files - # * From the remaining valid rows select only fields constituting a log file path - # Text file column is understood to represent a log file path if and only if all of the - # following are met: - # * it contains at least one slash '/' character, - # * it is preceded by space - # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters - # Search log file for path(s) only in case it exists! - if [[ -f "${LOG_FILE}" ]] - then - NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") - LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") - FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") - CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") - MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") - # Since above sed command might return more than one item (delimited by newline), split - # the particular matches entries into new array specific for this log file - readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" - # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with - # items from newly created array for this log file - LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") - # Delete the temporary array - unset ARRAY_FOR_LOG_FILE - fi -done - -# Check for RainerScript action log format which might be also multiline so grep regex is a bit -# curly: -# extract possibly multiline action omfile expressions -# extract File="logfile" expression -# match only "logfile" expression -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") - OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") - LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") -done - -# Ensure the correct attribute if file exists -FILE_CMD="chown" -for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" -do - # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing - if [ -z "$LOG_FILE_PATH" ] - then - continue - fi - $FILE_CMD "root" "$LOG_FILE_PATH" -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Log Files Are Owned By Appropriate User - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -180384,49 +180443,7 @@ fi - no_reboot_needed - rsyslog_files_ownership - - - - - - - - - Ensure System Log Files Have Correct Permissions - The file permissions for all log files written by rsyslog should -be set to 640, or more restrictive. These log files are determined by the -second part of each Rule line in /etc/rsyslog.conf and typically -all appear in /var/log. For each log file LOGFILE -referenced in /etc/rsyslog.conf, run the following command to -inspect the file's permissions: -$ ls -l LOGFILE -If the permissions are not 640 or more restrictive, run the following -command to correct this: -$ sudo chmod 640 LOGFILE" - BP28(R36) - CCI-001314 - 0988 - 1405 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-6(a) - AC-6(1) - Req-10.5.1 - Req-10.5.2 - 10.3.1 - 4.2.3 - Log files can contain valuable information regarding system -configuration. If the system log files are not protected unauthorized -users could change the logged data, eliminating their forensic value. - CCE-80862-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then # List of log file paths to be inspected for correct permissions @@ -180514,7 +180531,7 @@ do done # Ensure the correct attribute if file exists -FILE_CMD="chmod" +FILE_CMD="chown" for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" do # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing @@ -180522,13 +180539,55 @@ do then continue fi - $FILE_CMD "0640" "$LOG_FILE_PATH" + $FILE_CMD "root" "$LOG_FILE_PATH" done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure System Log Files Have Correct Permissions + The file permissions for all log files written by rsyslog should +be set to 640, or more restrictive. These log files are determined by the +second part of each Rule line in /etc/rsyslog.conf and typically +all appear in /var/log. For each log file LOGFILE +referenced in /etc/rsyslog.conf, run the following command to +inspect the file's permissions: +$ ls -l LOGFILE +If the permissions are not 640 or more restrictive, run the following +command to correct this: +$ sudo chmod 640 LOGFILE" + BP28(R36) + CCI-001314 + 0988 + 1405 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-6(a) + AC-6(1) + Req-10.5.1 + Req-10.5.2 + 10.3.1 + 5.1.4 + Log files can contain valuable information regarding system +configuration. If the system log files are not protected unauthorized +users could change the logged data, eliminating their forensic value. + CCE-80862-6 - name: Ensure System Log Files Have Correct Permissions - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -180732,6 +180791,109 @@ fi - medium_severity - no_reboot_needed - rsyslog_files_permissions + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# List of log file paths to be inspected for correct permissions +# * Primarily inspect log file paths listed in /etc/rsyslog.conf +RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" +# * And also the log file paths listed after rsyslog's $IncludeConfig directive +# (store the result into array for the case there's shell glob used as value of IncludeConfig) +readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) +readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) +readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') +readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) + +# Declare an array to hold the final list of different log file paths +declare -a LOG_FILE_PATHS + +# Array to hold all rsyslog config entries +RSYSLOG_CONFIGS=() +RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") + +# Get full list of files to be checked +# RSYSLOG_CONFIGS may contain globs such as +# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule +# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. +RSYSLOG_CONFIG_FILES=() +for ENTRY in "${RSYSLOG_CONFIGS[@]}" +do + # If directory, rsyslog will search for config files in recursively. + # However, files in hidden sub-directories or hidden files will be ignored. + if [ -d "${ENTRY}" ] + then + readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) + RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") + elif [ -f "${ENTRY}" ] + then + RSYSLOG_CONFIG_FILES+=("${ENTRY}") + else + echo "Invalid include object: ${ENTRY}" + fi +done + +# Browse each file selected above as containing paths of log files +# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + # From each of these files extract just particular log file path(s), thus: + # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, + # * Ignore empty lines, + # * Strip quotes and closing brackets from paths. + # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files + # * From the remaining valid rows select only fields constituting a log file path + # Text file column is understood to represent a log file path if and only if all of the + # following are met: + # * it contains at least one slash '/' character, + # * it is preceded by space + # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters + # Search log file for path(s) only in case it exists! + if [[ -f "${LOG_FILE}" ]] + then + NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") + LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") + FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") + CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") + MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") + # Since above sed command might return more than one item (delimited by newline), split + # the particular matches entries into new array specific for this log file + readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" + # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with + # items from newly created array for this log file + LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") + # Delete the temporary array + unset ARRAY_FOR_LOG_FILE + fi +done + +# Check for RainerScript action log format which might be also multiline so grep regex is a bit +# curly: +# extract possibly multiline action omfile expressions +# extract File="logfile" expression +# match only "logfile" expression +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") + OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") + LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") +done + +# Ensure the correct attribute if file exists +FILE_CMD="chmod" +for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" +do + # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing + if [ -z "$LOG_FILE_PATH" ] + then + continue + fi + $FILE_CMD "0640" "$LOG_FILE_PATH" +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180781,37 +180943,6 @@ associated with remote user access management. It can also be used to spot cyber attacks and ensure ongoing compliance with organizational policies surrounding the use of remote access methods. CCE-83426-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -declare -A REMOTE_METHODS=( ['auth.*']='^[^#]*auth\.\*.*$' ['authpriv.*']='^[^#]*authpriv\.\*.*$' ['daemon.*']='^[^#]*daemon\.\*.*$' ) - -if [[ ! -f /etc/rsyslog.conf ]]; then - # Something is not right, create the file - touch /etc/rsyslog.conf -fi - -APPEND_LINE=$(sed -rn '/^\S+\s+\/var\/log\/secure$/p' /etc/rsyslog.conf) - -# Loop through the remote methods associative array -for K in "${!REMOTE_METHODS[@]}" -do - # Check to see if selector/value exists - if ! grep -rq "${REMOTE_METHODS[$K]}" /etc/rsyslog.*; then - # Make sure we have a line to insert after, otherwise append to end - if [[ ! -z ${APPEND_LINE} ]]; then - # Add selector to file - sed -r -i "0,/^(\S+\s+\/var\/log\/secure$)/s//\1\n${K} \/var\/log\/secure/" /etc/rsyslog.conf - else - echo "${K} /var/log/secure" >> /etc/rsyslog.conf - fi - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Ensure remote access methods are monitored in Rsyslog: Set facts' set_fact: conf_files: @@ -180931,6 +181062,37 @@ fi - medium_severity - no_reboot_needed - rsyslog_remote_access_monitoring + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +declare -A REMOTE_METHODS=( ['auth.*']='^[^#]*auth\.\*.*$' ['authpriv.*']='^[^#]*authpriv\.\*.*$' ['daemon.*']='^[^#]*daemon\.\*.*$' ) + +if [[ ! -f /etc/rsyslog.conf ]]; then + # Something is not right, create the file + touch /etc/rsyslog.conf +fi + +APPEND_LINE=$(sed -rn '/^\S+\s+\/var\/log\/secure$/p' /etc/rsyslog.conf) + +# Loop through the remote methods associative array +for K in "${!REMOTE_METHODS[@]}" +do + # Check to see if selector/value exists + if ! grep -rq "${REMOTE_METHODS[$K]}" /etc/rsyslog.*; then + # Make sure we have a line to insert after, otherwise append to end + if [[ ! -z ${APPEND_LINE} ]]; then + # Add selector to file + sed -r -i "0,/^(\S+\s+\/var\/log\/secure$)/s//\1\n${K} \/var\/log\/secure/" /etc/rsyslog.conf + else + echo "${K} /var/log/secure" >> /etc/rsyslog.conf + fi + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180954,13 +181116,29 @@ For more information on systemd-journald and additional Journald (via systemd-journal-remote ) supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralised log management. - 4.2.2.1.1 + 5.1.2.1.1 Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. CCE-86467-8 - -package --add=systemd-journal-remote + - name: Ensure systemd-journal-remote is installed + package: + name: systemd-journal-remote + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86467-8 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_systemd-journal-remote_installed + + +[[packages]] +name = "systemd-journal-remote" +version = "*" include install_systemd-journal-remote @@ -180969,6 +181147,9 @@ class install_systemd-journal-remote { ensure => 'installed', } } + + +package --add=systemd-journal-remote # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -180980,25 +181161,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "systemd-journal-remote" -version = "*" - - - name: Ensure systemd-journal-remote is installed - package: - name: systemd-journal-remote - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86467-8 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_systemd-journal-remote_installed @@ -181017,35 +181179,10 @@ The systemd-journald service can be enabled with the foll CCI-001665 SC-24 SRG-OS-000269-GPOS-00103 - 4.2.2.2 + 5.1.2.2 In the event of a system failure, Red Hat Enterprise Linux 8 must preserve any information necessary to determine cause of failure and any information necessary to return to operations with least disruption to system processes. CCE-85921-5 - include enable_systemd-journald - -class enable_systemd-journald { - service {'systemd-journald': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'systemd-journald.service' -"$SYSTEMCTL_EXEC" start 'systemd-journald.service' -"$SYSTEMCTL_EXEC" enable 'systemd-journald.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["systemd-journald"] - - name: Enable service systemd-journald block: @@ -181071,6 +181208,31 @@ enabled = ["systemd-journald"] - medium_severity - no_reboot_needed - service_systemd-journald_enabled + + +[customizations.services] +enabled = ["systemd-journald"] + + include enable_systemd-journald + +class enable_systemd-journald { + service {'systemd-journald': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'systemd-journald.service' +"$SYSTEMCTL_EXEC" start 'systemd-journald.service' +"$SYSTEMCTL_EXEC" enable 'systemd-journald.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181082,57 +181244,9 @@ enabled = ["systemd-journald"] Ensure journald is configured to compress large log files The journald system can compress large log files to avoid fill the system disk. - 4.2.2.3 + 5.1.2.3 Log files that are not properly compressed run the risk of growing so large that they fill up the log partition. Valuable logging information could be lost if the log partition becomes full. CCE-85930-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function remove_journald_Compress_configuration { - local COMPONENT_PARAM_CONFIG - mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) - COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") - - for f in "${COMPONENT_PARAM_CONFIG[@]}" - do - sed -i "/^\s*Compress\s*=\s*/d" "$f" - # make sure file has newline at the end - sed -i -e '$a\' "$f" - done - sed -i -e '$a\' "/etc/systemd/journald.conf" -} - -function journald_Compress_add_configuration { - local COMPONENT_PARAM_REMEDY_CFG - mkdir -p "/etc/systemd/journald.conf.d" - COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" - - if [ ! -f "${COMPONENT_PARAM_REMEDY_CFG}" ] ; then - touch "${COMPONENT_PARAM_REMEDY_CFG}" - fi - cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" - # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*Compress" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" - if [ -z "$line_number" ]; then - # There was no match of '^#\s*Compress', insert at - # the end of the file. - printf '%s\n' "Compress=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" - else - head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf" - tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" - fi - # Clean up after ourselves. - rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" -} - -remove_journald_Compress_configuration -journald_Compress_add_configuration - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Check for duplicate Compress values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181222,38 +181336,24 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure journald is configured to send logs to rsyslog - Data from journald may be stored in volatile memory or persisted locally. -Utilities exist to accept remote export of journald logs. - 4.2.1.3 - Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. - CCE-85995-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -function remove_journald_ForwardToSyslog_configuration { +function remove_journald_Compress_configuration { local COMPONENT_PARAM_CONFIG mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") for f in "${COMPONENT_PARAM_CONFIG[@]}" do - sed -i "/^\s*ForwardToSyslog\s*=\s*/d" "$f" + sed -i "/^\s*Compress\s*=\s*/d" "$f" # make sure file has newline at the end sed -i -e '$a\' "$f" done sed -i -e '$a\' "/etc/systemd/journald.conf" } -function journald_ForwardToSyslog_add_configuration { +function journald_Compress_add_configuration { local COMPONENT_PARAM_REMEDY_CFG mkdir -p "/etc/systemd/journald.conf.d" COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" @@ -181263,27 +181363,41 @@ function journald_ForwardToSyslog_add_configuration { fi cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*ForwardToSyslog" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + line_number="$(LC_ALL=C grep -n "^#\s*Compress" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" if [ -z "$line_number" ]; then - # There was no match of '^#\s*ForwardToSyslog', insert at + # There was no match of '^#\s*Compress', insert at # the end of the file. - printf '%s\n' "ForwardToSyslog=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "Compress=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" else head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf" + printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf" tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" fi # Clean up after ourselves. rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" } -remove_journald_ForwardToSyslog_configuration -journald_ForwardToSyslog_add_configuration +remove_journald_Compress_configuration +journald_Compress_add_configuration else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure journald is configured to send logs to rsyslog + Data from journald may be stored in volatile memory or persisted locally. +Utilities exist to accept remote export of journald logs. + 5.1.1.3 + Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. + CCE-85995-9 - name: Check for duplicate ForwardToSyslog values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181373,38 +181487,24 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure journald is configured to write log files to persistent disk - The journald system may store log files in volatile memory or locally on disk. -If the logs are only stored in volatile memory they will we lost upon reboot. - 4.2.2.4 - Log files contain valuable data and need to be persistent to aid in possible investigations. - CCE-86045-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -function remove_journald_Storage_configuration { +function remove_journald_ForwardToSyslog_configuration { local COMPONENT_PARAM_CONFIG mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") for f in "${COMPONENT_PARAM_CONFIG[@]}" do - sed -i "/^\s*Storage\s*=\s*/d" "$f" + sed -i "/^\s*ForwardToSyslog\s*=\s*/d" "$f" # make sure file has newline at the end sed -i -e '$a\' "$f" done sed -i -e '$a\' "/etc/systemd/journald.conf" } -function journald_Storage_add_configuration { +function journald_ForwardToSyslog_add_configuration { local COMPONENT_PARAM_REMEDY_CFG mkdir -p "/etc/systemd/journald.conf.d" COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" @@ -181414,27 +181514,41 @@ function journald_Storage_add_configuration { fi cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*Storage" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + line_number="$(LC_ALL=C grep -n "^#\s*ForwardToSyslog" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" if [ -z "$line_number" ]; then - # There was no match of '^#\s*Storage', insert at + # There was no match of '^#\s*ForwardToSyslog', insert at # the end of the file. - printf '%s\n' "Storage=persistent" >> "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "ForwardToSyslog=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" else head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf" + printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf" tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" fi # Clean up after ourselves. rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" } -remove_journald_Storage_configuration -journald_Storage_add_configuration +remove_journald_ForwardToSyslog_configuration +journald_ForwardToSyslog_add_configuration else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure journald is configured to write log files to persistent disk + The journald system may store log files in volatile memory or locally on disk. +If the logs are only stored in volatile memory they will we lost upon reboot. + 5.1.2.4 + Log files contain valuable data and need to be persistent to aid in possible investigations. + CCE-86045-2 - name: Check for duplicate Storage values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181523,6 +181637,54 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function remove_journald_Storage_configuration { + local COMPONENT_PARAM_CONFIG + mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) + COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") + + for f in "${COMPONENT_PARAM_CONFIG[@]}" + do + sed -i "/^\s*Storage\s*=\s*/d" "$f" + # make sure file has newline at the end + sed -i -e '$a\' "$f" + done + sed -i -e '$a\' "/etc/systemd/journald.conf" +} + +function journald_Storage_add_configuration { + local COMPONENT_PARAM_REMEDY_CFG + mkdir -p "/etc/systemd/journald.conf.d" + COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" + + if [ ! -f "${COMPONENT_PARAM_REMEDY_CFG}" ] ; then + touch "${COMPONENT_PARAM_REMEDY_CFG}" + fi + cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" + # Insert before the line matching the regex '^#\s*Compress'. + line_number="$(LC_ALL=C grep -n "^#\s*Storage" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + if [ -z "$line_number" ]; then + # There was no match of '^#\s*Storage', insert at + # the end of the file. + printf '%s\n' "Storage=persistent" >> "${COMPONENT_PARAM_REMEDY_CFG}" + else + head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf" + tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" + fi + # Clean up after ourselves. + rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" +} + +remove_journald_Storage_configuration +journald_Storage_add_configuration + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181541,25 +181703,10 @@ NOTE: logs to remote hosts and receiving incoming logs. With regards to receiving logs, there are two Systemd unit files; systemd-journal-remote.socket and systemd-journal-remote.service. - 4.2.2.1.4 + 5.1.2.1.4 If a client is configured to also receive data, thus turning it into a server, the client system is acting outside it's operational boundary. CCE-87605-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SOCKET_NAME="systemd-journal-remote.socket" -SYSTEMCTL_EXEC='/usr/bin/systemctl' - -if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then - "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" - "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable systemd-journal-remote Socket - Collect systemd Socket Units Present in the System ansible.builtin.command: @@ -181594,6 +181741,21 @@ fi - medium_severity - no_reboot_needed - socket_systemd-journal-remote_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SOCKET_NAME="systemd-journal-remote.socket" +SYSTEMCTL_EXEC='/usr/bin/systemctl' + +if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then + "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" + "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181665,11 +181827,30 @@ used. PR.PT-1 Req-10.7 10.5.1 - 4.3 + 5.1.3 The logrotate package provides the logrotate services. CCE-86154-2 - -package --add=logrotate + - name: Ensure logrotate is installed + package: + name: logrotate + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86154-2 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - PCI-DSSv4-10.5.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_logrotate_installed + + +[[packages]] +name = "logrotate" +version = "*" include install_logrotate @@ -181678,6 +181859,9 @@ class install_logrotate { ensure => 'installed', } } + + +package --add=logrotate # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -181689,28 +181873,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "logrotate" -version = "*" - - - name: Ensure logrotate is installed - package: - name: logrotate - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86154-2 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - PCI-DSSv4-10.5.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_logrotate_installed @@ -181761,52 +181923,12 @@ daily CM-6(a) PR.PT-1 Req-10.7 - 4.3 + 5.1.3 Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full. CCE-80794-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20see%20%22man%20logrotate%22%20for%20details%0A%23%20rotate%20log%20files%20daily%0Adaily%0A%0A%23%20keep%204%20weeks%20worth%20of%20backlogs%0Arotate%2030%0A%0A%23%20create%20new%20%28empty%29%20log%20files%20after%20rotating%20old%20ones%0Acreate%0A%0A%23%20use%20date%20as%20a%20suffix%20of%20the%20rotated%20file%0Adateext%0A%0A%23%20uncomment%20this%20if%20you%20want%20your%20log%20files%20compressed%0A%23compress%0A%0A%23%20RPM%20packages%20drop%20log%20rotation%20information%20into%20this%20directory%0Ainclude%20/etc/logrotate.d%0A%0A%23%20system-specific%20logs%20may%20be%20also%20be%20configured%20here. }} - mode: 0644 - path: /etc/logrotate.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q logrotate; }; then - -LOGROTATE_CONF_FILE="/etc/logrotate.conf" - -CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate" - - -# daily rotation is configured -grep -q "^daily$" $LOGROTATE_CONF_FILE|| echo "daily" >> $LOGROTATE_CONF_FILE - -# remove any line configuring weekly, monthly or yearly rotation -sed -i '/^\s*\(weekly\|monthly\|yearly\).*$/d' $LOGROTATE_CONF_FILE - - -# configure cron.daily if not already -if ! grep -q "^[[:space:]]*/usr/sbin/logrotate[[:alnum:][:blank:][:punct:]]*$LOGROTATE_CONF_FILE$" $CRON_DAILY_LOGROTATE_FILE; then - echo '#!/bin/sh' > $CRON_DAILY_LOGROTATE_FILE - echo "/usr/sbin/logrotate $LOGROTATE_CONF_FILE" >> $CRON_DAILY_LOGROTATE_FILE -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -181889,6 +182011,46 @@ fi - low_disruption - medium_severity - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20see%20%22man%20logrotate%22%20for%20details%0A%23%20rotate%20log%20files%20daily%0Adaily%0A%0A%23%20keep%204%20weeks%20worth%20of%20backlogs%0Arotate%2030%0A%0A%23%20create%20new%20%28empty%29%20log%20files%20after%20rotating%20old%20ones%0Acreate%0A%0A%23%20use%20date%20as%20a%20suffix%20of%20the%20rotated%20file%0Adateext%0A%0A%23%20uncomment%20this%20if%20you%20want%20your%20log%20files%20compressed%0A%23compress%0A%0A%23%20RPM%20packages%20drop%20log%20rotation%20information%20into%20this%20directory%0Ainclude%20/etc/logrotate.d%0A%0A%23%20system-specific%20logs%20may%20be%20also%20be%20configured%20here. }} + mode: 0644 + path: /etc/logrotate.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q logrotate; }; then + +LOGROTATE_CONF_FILE="/etc/logrotate.conf" + +CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate" + + +# daily rotation is configured +grep -q "^daily$" $LOGROTATE_CONF_FILE|| echo "daily" >> $LOGROTATE_CONF_FILE + +# remove any line configuring weekly, monthly or yearly rotation +sed -i '/^\s*\(weekly\|monthly\|yearly\).*$/d' $LOGROTATE_CONF_FILE + + +# configure cron.daily if not already +if ! grep -q "^[[:space:]]*/usr/sbin/logrotate[[:alnum:][:blank:][:punct:]]*$LOGROTATE_CONF_FILE$" $CRON_DAILY_LOGROTATE_FILE; then + echo '#!/bin/sh' > $CRON_DAILY_LOGROTATE_FILE + echo "/usr/sbin/logrotate $LOGROTATE_CONF_FILE" >> $CRON_DAILY_LOGROTATE_FILE +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181938,23 +182100,12 @@ The logrotate timer can be enabled with the following com PR.PT-1 Req-10.7 10.5.1 - 4.3 + 5.1.3 Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full. CCE-86157-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && rpm --quiet -q logrotate ); }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" start 'logrotate.timer' -"$SYSTEMCTL_EXEC" enable 'logrotate.timer' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -181999,6 +182150,17 @@ fi - medium_severity - no_reboot_needed - timer_logrotate_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && rpm --quiet -q logrotate ); }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" start 'logrotate.timer' +"$SYSTEMCTL_EXEC" enable 'logrotate.timer' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182059,8 +182221,24 @@ $ sudo yum install syslog-ng-core PR.PT-1 The syslog-ng-core package provides the syslog-ng daemon, which provides system logging services. - -package --add=syslog-ng + - name: Ensure syslog-ng is installed + package: + name: syslog-ng + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_syslogng_installed + + +[[packages]] +name = "syslog-ng" +version = "*" include install_syslog-ng @@ -182069,6 +182247,9 @@ class install_syslog-ng { ensure => 'installed', } } + + +package --add=syslog-ng # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -182080,25 +182261,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "syslog-ng" -version = "*" - - - name: Ensure syslog-ng is installed - package: - name: syslog-ng - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_syslogng_installed @@ -182188,31 +182350,6 @@ The syslog-ng service can be enabled with the following c PR.PT-1 The syslog-ng service must be running in order to provide logging services, which are essential to system administration. - include enable_syslog-ng - -class enable_syslog-ng { - service {'syslog-ng': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'syslog-ng.service' -"$SYSTEMCTL_EXEC" start 'syslog-ng.service' -"$SYSTEMCTL_EXEC" enable 'syslog-ng.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["syslog-ng"] - - name: Enable service syslog-ng block: @@ -182238,6 +182375,31 @@ enabled = ["syslog-ng"] - medium_severity - no_reboot_needed - service_syslogng_enabled + + +[customizations.services] +enabled = ["syslog-ng"] + + include enable_syslog-ng + +class enable_syslog-ng { + service {'syslog-ng': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'syslog-ng.service' +"$SYSTEMCTL_EXEC" start 'syslog-ng.service' +"$SYSTEMCTL_EXEC" enable 'syslog-ng.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182476,43 +182638,11 @@ input(type="imudp" port="514") PR.PT-1 PR.PT-4 SRG-OS-000480-GPOS-00227 - 4.2.1.7 + 5.1.1.7 Any process which receives messages from the network incurs some risk of receiving malicious messages. This risk can be eliminated for rsyslog by configuring it not to listen on the network. CCE-84275-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -legacy_regex='^\s*\$(((Input(TCP|RELP)|UDP)ServerRun)|ModLoad\s+(imtcp|imudp|imrelp))' -rainer_regex='^\s*(module|input)\((load|type)="(imtcp|imudp)".*$' - -readarray -t legacy_targets < <(grep -l -E -r "${legacy_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) -readarray -t rainer_targets < <(grep -l -E -r "${rainer_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) - -config_changed=false -if [ ${#legacy_targets[@]} -gt 0 ]; then - for target in "${legacy_targets[@]}"; do - sed -E -i "/$legacy_regex/ s/^/# /" "$target" - done - config_changed=true -fi - -if [ ${#rainer_targets[@]} -gt 0 ]; then - for target in "${rainer_targets[@]}"; do - sed -E -i "/$rainer_regex/ s/^/# /" "$target" - done - config_changed=true -fi - -if $config_changed; then - systemctl restart rsyslog.service -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server - Define Rsyslog Config Lines Regex in Legacy Syntax ansible.builtin.set_fact: @@ -182730,6 +182860,38 @@ fi - medium_severity - no_reboot_needed - rsyslog_nolisten + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +legacy_regex='^\s*\$(((Input(TCP|RELP)|UDP)ServerRun)|ModLoad\s+(imtcp|imudp|imrelp))' +rainer_regex='^\s*(module|input)\((load|type)="(imtcp|imudp)".*$' + +readarray -t legacy_targets < <(grep -l -E -r "${legacy_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) +readarray -t rainer_targets < <(grep -l -E -r "${rainer_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) + +config_changed=false +if [ ${#legacy_targets[@]} -gt 0 ]; then + for target in "${legacy_targets[@]}"; do + sed -E -i "/$legacy_regex/ s/^/# /" "$target" + done + config_changed=true +fi + +if [ ${#rainer_targets[@]} -gt 0 ]; then + for target in "${rainer_targets[@]}"; do + sed -E -i "/$rainer_regex/ s/^/# /" "$target" + done + config_changed=true +fi + +if $config_changed; then + systemctl restart rsyslog.service +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182869,7 +183031,7 @@ $ActionResumeRetryCount -1 SRG-OS-000480-GPOS-00227 SRG-OS-000342-GPOS-00133 RHEL-08-030690 - 4.2.1.6 + 5.1.1.6 SV-230479r917883_rule A log server (loghost) receives syslog messages from one or more systems. This data can be used as an additional log source in the event a @@ -182877,6 +183039,32 @@ system is compromised and its local logs are suspect. Forwarding log messages to a remote loghost also provides system administrators with a centralized place to view the status of multiple hosts within the enterprise. CCE-80863-4 + - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable + set_fact: + rsyslog_remote_loghost_address: !!str + tags: + - always + +- name: Set rsyslog remote loghost + lineinfile: + dest: /etc/rsyslog.conf + regexp: ^\*\.\* + line: '*.* @@{{ rsyslog_remote_loghost_address }}' + create: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80863-4 + - DISA-STIG-RHEL-08-030690 + - NIST-800-53-AU-4(1) + - NIST-800-53-AU-9(2) + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - rsyslog_remote_loghost + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -182908,32 +183096,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable - set_fact: - rsyslog_remote_loghost_address: !!str - tags: - - always - -- name: Set rsyslog remote loghost - lineinfile: - dest: /etc/rsyslog.conf - regexp: ^\*\.\* - line: '*.* @@{{ rsyslog_remote_loghost_address }}' - create: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80863-4 - - DISA-STIG-RHEL-08-030690 - - NIST-800-53-AU-4(1) - - NIST-800-53-AU-9(2) - - NIST-800-53-CM-6(a) - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - rsyslog_remote_loghost @@ -182966,36 +183128,6 @@ Replace the <remote system> in the above command wi For protection of data being logged, the connection to the remote logging server needs to be authenticated and encrypted. CCE-82457-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -rsyslog_remote_loghost_address='' - -params_to_add_if_missing=("protocol" "target" "port" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") -values_to_add_if_missing=("tcp" "$rsyslog_remote_loghost_address" "6514" "gtls" "1" "x509/name" "on") -params_to_replace_if_wrong_value=("protocol" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") -values_to_replace_if_wrong_value=("tcp" "gtls" "1" "x509/name" "on") - -files_containing_omfwd=("$(grep -ilE '^[^#]*\s*action\s*\(\s*type\s*=\s*"omfwd".*' /etc/rsyslog.conf /etc/rsyslog.d/*.conf)") -if [ -n "${files_containing_omfwd[*]}" ]; then - for file in "${files_containing_omfwd[@]}"; do - for ((i=0; i<${#params_to_replace_if_wrong_value[@]}; i++)); do - sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?)${params_to_replace_if_wrong_value[$i]}\s*=\s*[\"]\S*[\"](.*\))|\1${params_to_replace_if_wrong_value[$i]}=\"${values_to_replace_if_wrong_value[$i]}\"\2|gI" "$file" - done - for ((i=0; i<${#params_to_add_if_missing[@]}; i++)); do - if ! grep -qPzi "(?s)\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?${params_to_add_if_missing[$i]}.*?\).*" "$file"; then - sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"])|\1\n${params_to_add_if_missing[$i]}=\"${values_to_add_if_missing[$i]}\"|gI" "$file" - fi - done - done -else - echo "action(type=\"omfwd\" protocol=\"tcp\" Target=\"$rsyslog_remote_loghost_address\" port=\"6514\" StreamDriver=\"gtls\" StreamDriverMode=\"1\" StreamDriverAuthMode=\"x509/name\" streamdriver.CheckExtendedKeyPurpose=\"on\")" >> /etc/rsyslog.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable set_fact: rsyslog_remote_loghost_address: !!str @@ -183202,6 +183334,36 @@ fi - medium_severity - no_reboot_needed - rsyslog_remote_tls + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +rsyslog_remote_loghost_address='' + +params_to_add_if_missing=("protocol" "target" "port" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") +values_to_add_if_missing=("tcp" "$rsyslog_remote_loghost_address" "6514" "gtls" "1" "x509/name" "on") +params_to_replace_if_wrong_value=("protocol" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") +values_to_replace_if_wrong_value=("tcp" "gtls" "1" "x509/name" "on") + +files_containing_omfwd=("$(grep -ilE '^[^#]*\s*action\s*\(\s*type\s*=\s*"omfwd".*' /etc/rsyslog.conf /etc/rsyslog.d/*.conf)") +if [ -n "${files_containing_omfwd[*]}" ]; then + for file in "${files_containing_omfwd[@]}"; do + for ((i=0; i<${#params_to_replace_if_wrong_value[@]}; i++)); do + sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?)${params_to_replace_if_wrong_value[$i]}\s*=\s*[\"]\S*[\"](.*\))|\1${params_to_replace_if_wrong_value[$i]}=\"${values_to_replace_if_wrong_value[$i]}\"\2|gI" "$file" + done + for ((i=0; i<${#params_to_add_if_missing[@]}; i++)); do + if ! grep -qPzi "(?s)\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?${params_to_add_if_missing[$i]}.*?\).*" "$file"; then + sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"])|\1\n${params_to_add_if_missing[$i]}=\"${values_to_add_if_missing[$i]}\"|gI" "$file" + fi + done + done +else + echo "action(type=\"omfwd\" protocol=\"tcp\" Target=\"$rsyslog_remote_loghost_address\" port=\"6514\" StreamDriver=\"gtls\" StreamDriverMode=\"1\" StreamDriverAuthMode=\"x509/name\" streamdriver.CheckExtendedKeyPurpose=\"on\")" >> /etc/rsyslog.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183469,15 +183631,6 @@ untrusted access, prevent system availability, and/or can lead to a compromise o attack. CCE-82179-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q polkit; then - -printf "[Disable General User Access to NetworkManager]\nIdentity=default\nAction=org.freedesktop.NetworkManager.*\nResultAny=no\nResultInactive=no\nResultActive=auth_admin\n" > /etc/polkit-1/localauthority/20-org.d/10-nm-harden-access.pkla - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -183526,6 +183679,15 @@ fi - network_nmcli_permissions - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q polkit; then + +printf "[Disable General User Access to NetworkManager]\nIdentity=default\nAction=org.freedesktop.NetworkManager.*\nResultAny=no\nResultInactive=no\nResultActive=auth_admin\n" > /etc/polkit-1/localauthority/20-org.d/10-nm-harden-access.pkla + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183649,17 +183811,6 @@ tools must be documented with the Information Systems Security Manager (ISSM) an to only authorized personnel. CCE-82283-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -for interface in $(ip link show | grep -E '^[0-9]' | cut -d ":" -f 2); do - ip link set dev $interface multicast off promisc off -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure System is Not Acting as a Network Sniffer - Gather network interfaces ansible.builtin.command: cmd: ip link show @@ -183703,6 +183854,17 @@ fi - network_sniffer_disabled - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +for interface in $(ip link show | grep -E '^[0-9]' | cut -d ":" -f 2); do + ip link set dev $interface multicast off promisc off +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183743,37 +183905,6 @@ the firewall has to be reloaded. Utilizing the limit statement in "nftables" can help to mitigate DoS attacks. CCE-86506-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then - -if [ -e "/etc/firewalld/firewalld.conf" ] ; then - - LC_ALL=C sed -i "/^\s*FirewallBackend\s*=\s*/d" "/etc/firewalld/firewalld.conf" -else - touch "/etc/firewalld/firewalld.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/firewalld/firewalld.conf" - -cp "/etc/firewalld/firewalld.conf" "/etc/firewalld/firewalld.conf.bak" -# Insert before the line matching the regex '^#\s*FirewallBackend'. -line_number="$(LC_ALL=C grep -n "^#\s*FirewallBackend" "/etc/firewalld/firewalld.conf.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^#\s*FirewallBackend', insert at - # the end of the file. - printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" -else - head -n "$(( line_number - 1 ))" "/etc/firewalld/firewalld.conf.bak" > "/etc/firewalld/firewalld.conf" - printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" - tail -n "+$(( line_number ))" "/etc/firewalld/firewalld.conf.bak" >> "/etc/firewalld/firewalld.conf" -fi -# Clean up after ourselves. -rm "/etc/firewalld/firewalld.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -183832,6 +183963,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then + +if [ -e "/etc/firewalld/firewalld.conf" ] ; then + + LC_ALL=C sed -i "/^\s*FirewallBackend\s*=\s*/d" "/etc/firewalld/firewalld.conf" +else + touch "/etc/firewalld/firewalld.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/firewalld/firewalld.conf" + +cp "/etc/firewalld/firewalld.conf" "/etc/firewalld/firewalld.conf.bak" +# Insert before the line matching the regex '^#\s*FirewallBackend'. +line_number="$(LC_ALL=C grep -n "^#\s*FirewallBackend" "/etc/firewalld/firewalld.conf.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^#\s*FirewallBackend', insert at + # the end of the file. + printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" +else + head -n "$(( line_number - 1 ))" "/etc/firewalld/firewalld.conf.bak" > "/etc/firewalld/firewalld.conf" + printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" + tail -n "+$(( line_number ))" "/etc/firewalld/firewalld.conf.bak" >> "/etc/firewalld/firewalld.conf" +fi +# Clean up after ourselves. +rm "/etc/firewalld/firewalld.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183943,8 +184105,26 @@ Remote access is access to DoD nonpublic information systems by an authorized us Red Hat Enterprise Linux 8 functionality (e.g., SSH) must be capable of taking enforcement action if the audit reveals unauthorized activity. Automated control of remote access sessions allows organizations to ensure ongoing compliance with remote access policies by enforcing connection rules of remote access applications on a variety of information system components (e.g., servers, workstations, notebook computers, smartphones, and tablets)." CCE-82998-6 - -package --add=firewalld + - name: Ensure firewalld is installed + package: + name: firewalld + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82998-6 + - DISA-STIG-RHEL-08-040100 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_firewalld_installed + + +[[packages]] +name = "firewalld" +version = "*" include install_firewalld @@ -183953,6 +184133,9 @@ class install_firewalld { ensure => 'installed', } } + + +package --add=firewalld # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -183964,27 +184147,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "firewalld" -version = "*" - - - name: Ensure firewalld is installed - package: - name: firewalld - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82998-6 - - DISA-STIG-RHEL-08-040100 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_firewalld_installed @@ -184043,31 +184205,6 @@ by restricting services and known good IP addresses and address ranges. This prevents connections from unknown hosts and protocols. CCE-80877-4 - include enable_firewalld - -class enable_firewalld { - service {'firewalld': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'firewalld.service' -"$SYSTEMCTL_EXEC" start 'firewalld.service' -"$SYSTEMCTL_EXEC" enable 'firewalld.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["firewalld"] - - name: Gather the package facts package_facts: manager: auto @@ -184124,6 +184261,31 @@ enabled = ["firewalld"] - medium_severity - no_reboot_needed - service_firewalld_enabled + + +[customizations.services] +enabled = ["firewalld"] + + include enable_firewalld + +class enable_firewalld { + service {'firewalld': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'firewalld.service' +"$SYSTEMCTL_EXEC" start 'firewalld.service' +"$SYSTEMCTL_EXEC" enable 'firewalld.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -184289,7 +184451,7 @@ The default "drop" zone will drop all incoming network packets unless it is expl AC-17 (1) SRG-OS-000297-GPOS-00115 RHEL-08-040090 - SV-230504r854047_rule + SV-230504r942942_rule Failure to restrict network connectivity only to authorized systems permits inbound connections from malicious systems. It also permits outbound connections that may facilitate exfiltration of data. CCE-86266-4 @@ -184389,7 +184551,7 @@ above. SRG-OS-000480-GPOS-00227 RHEL-08-040090 3.4.1.5 - SV-230504r854047_rule + SV-230504r942942_rule In firewalld the default zone is applied only after all the applicable rules in the table are examined for a match. Setting the default zone to drop implements proper design for a firewall, i.e. @@ -184477,27 +184639,6 @@ $ sudo yum install libreswan to initiate a secure VPN connection protects information when it is transmitted over a wide area network. CCE-80845-1 - -package --add=libreswan - - include install_libreswan - -class install_libreswan { - package { 'libreswan': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "libreswan" ; then - yum install -y "libreswan" -fi - - -[[packages]] -name = "libreswan" -version = "*" - - name: Ensure libreswan is installed package: name: libreswan @@ -184512,6 +184653,27 @@ version = "*" - medium_severity - no_reboot_needed - package_libreswan_installed + + +[[packages]] +name = "libreswan" +version = "*" + + include install_libreswan + +class install_libreswan { + package { 'libreswan': + ensure => 'installed', + } +} + + +package --add=libreswan + + +if ! rpm -q --quiet "libreswan" ; then + yum install -y "libreswan" +fi @@ -184648,33 +184810,6 @@ These services load the iptables rules during the system startup and also allow the iptables rules during runtime. CCE-85982-7 - -package --add=iptables-services - - include install_iptables-services - -class install_iptables-services { - package { 'iptables-services': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q iptables; then - -if ! rpm -q --quiet "iptables-services" ; then - yum install -y "iptables-services" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "iptables-services" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -184702,6 +184837,33 @@ version = "*" - medium_severity - no_reboot_needed - package_iptables-services_installed + + +[[packages]] +name = "iptables-services" +version = "*" + + include install_iptables-services + +class install_iptables-services { + package { 'iptables-services': + ensure => 'installed', + } +} + + +package --add=iptables-services + + # Remediation is applicable only in certain platforms +if rpm --quiet -q iptables; then + +if ! rpm -q --quiet "iptables-services" ; then + yum install -y "iptables-services" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -184724,8 +184886,27 @@ code. iptables allows system operators to set up firewall masquerading, etc. CCE-82982-0 - -package --add=iptables + - name: Ensure iptables is installed + package: + name: iptables + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] ) + tags: + - CCE-82982-0 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-1.4.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables_installed + + +[[packages]] +name = "iptables" +version = "*" include install_iptables @@ -184734,6 +184915,9 @@ class install_iptables { ensure => 'installed', } } + + +package --add=iptables # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] ); then @@ -184745,28 +184929,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "iptables" -version = "*" - - - name: Ensure iptables is installed - package: - name: iptables - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] ) - tags: - - CCE-82982-0 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-1.4.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables_installed @@ -184789,8 +184951,31 @@ during runtime. Those iptables services conflicts with firewalld so they should firewalld is used. CCE-86679-8 - -package --remove=iptables-services + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-86679-8 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables-services_removed + +- name: Ensure iptables-services is removed + package: + name: iptables-services + state: absent + when: '"iptables" in ansible_facts.packages' + tags: + - CCE-86679-8 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables-services_removed include remove_iptables-services @@ -184799,6 +184984,9 @@ class remove_iptables-services { ensure => 'purged', } } + + +package --remove=iptables-services # Remediation is applicable only in certain platforms if rpm --quiet -q iptables; then @@ -184818,32 +185006,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-86679-8 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables-services_removed - -- name: Ensure iptables-services is removed - package: - name: iptables-services - state: absent - when: '"iptables" in ansible_facts.packages' - tags: - - CCE-86679-8 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables-services_removed @@ -185019,31 +185181,6 @@ The ip6tables service can be enabled with the following c capability for IPv6 and ICMPv6. CCE-85955-3 - include enable_ip6tables - -class enable_ip6tables { - service {'ip6tables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ip6tables.service' -"$SYSTEMCTL_EXEC" start 'ip6tables.service' -"$SYSTEMCTL_EXEC" enable 'ip6tables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ip6tables"] - - name: Enable service ip6tables block: @@ -185073,6 +185210,31 @@ enabled = ["ip6tables"] - medium_severity - no_reboot_needed - service_ip6tables_enabled + + +[customizations.services] +enabled = ["ip6tables"] + + include enable_ip6tables + +class enable_ip6tables { + service {'ip6tables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ip6tables.service' +"$SYSTEMCTL_EXEC" start 'ip6tables.service' +"$SYSTEMCTL_EXEC" enable 'ip6tables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185221,31 +185383,6 @@ The iptables service can be enabled with the following co capability for IPv4 and ICMP. CCE-85961-1 - include enable_iptables - -class enable_iptables { - service {'iptables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q iptables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'iptables.service' -"$SYSTEMCTL_EXEC" start 'iptables.service' -"$SYSTEMCTL_EXEC" enable 'iptables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["iptables"] - - name: Gather the package facts package_facts: manager: auto @@ -185293,6 +185430,31 @@ enabled = ["iptables"] - medium_severity - no_reboot_needed - service_iptables_enabled + + +[customizations.services] +enabled = ["iptables"] + + include enable_iptables + +class enable_iptables { + service {'iptables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q iptables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'iptables.service' +"$SYSTEMCTL_EXEC" start 'iptables.service' +"$SYSTEMCTL_EXEC" enable 'iptables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185797,18 +185959,6 @@ Run the following command to update command line for already installed kernels:< the vulnerability to exploitation. CCE-82887-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common; then - -grubby --update-kernel=ALL --args=ipv6.disable=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "ipv6.disable=1" - - name: Gather the package facts package_facts: manager: auto @@ -185836,6 +185986,18 @@ append = "ipv6.disable=1" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "ipv6.disable=1" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common; then + +grubby --update-kernel=ALL --args=ipv6.disable=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185925,39 +186087,6 @@ depend on it), while disabling support for the IPv6 protocol. CCE-82872-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Prevent the IPv6 kernel module (ipv6) from loading the IPv6 networking stack -echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf - -# Since according to: https://access.redhat.com/solutions/72733 -# "ipv6 disable=1" options doesn't always disable the IPv6 networking stack from -# loading, instruct also sysctl configuration to disable IPv6 according to: -# https://access.redhat.com/solutions/8709#rhel6disable - -declare -a IPV6_SETTINGS=("net.ipv6.conf.all.disable_ipv6" "net.ipv6.conf.default.disable_ipv6") - -for setting in "${IPV6_SETTINGS[@]}" -do - # Set runtime =1 for setting - /sbin/sysctl -q -n -w "$setting=1" - - # If setting is present in /etc/sysctl.conf, change value to "1" - # else, add "$setting = 1" to /etc/sysctl.conf - if grep -q ^"$setting" /etc/sysctl.conf ; then - sed -i "s/^$setting.*/$setting = 1/g" /etc/sysctl.conf - else - echo "" >> /etc/sysctl.conf - echo "# Set $setting = 1 per security requirements" >> /etc/sysctl.conf - echo "$setting = 1" >> /etc/sysctl.conf - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable IPv6 Networking kernel module lineinfile: create: true @@ -185998,6 +186127,39 @@ fi - medium_disruption - medium_severity - reboot_required + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Prevent the IPv6 kernel module (ipv6) from loading the IPv6 networking stack +echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf + +# Since according to: https://access.redhat.com/solutions/72733 +# "ipv6 disable=1" options doesn't always disable the IPv6 networking stack from +# loading, instruct also sysctl configuration to disable IPv6 according to: +# https://access.redhat.com/solutions/8709#rhel6disable + +declare -a IPV6_SETTINGS=("net.ipv6.conf.all.disable_ipv6" "net.ipv6.conf.default.disable_ipv6") + +for setting in "${IPV6_SETTINGS[@]}" +do + # Set runtime =1 for setting + /sbin/sysctl -q -n -w "$setting=1" + + # If setting is present in /etc/sysctl.conf, change value to "1" + # else, add "$setting = 1" to /etc/sysctl.conf + if grep -q ^"$setting" /etc/sysctl.conf ; then + sed -i "s/^$setting.*/$setting = 1/g" /etc/sysctl.conf + else + echo "" >> /etc/sysctl.conf + echo "# Set $setting = 1 per security requirements" >> /etc/sysctl.conf + echo "$setting = 1" >> /etc/sysctl.conf + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186186,66 +186348,6 @@ functionality require the IPv6 stack loaded to work. the vulnerability to exploitation. CCE-85904-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.disable_ipv6 from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.disable_ipv6.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.disable_ipv6" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv6.conf.all.disable_ipv6 -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.disable_ipv6="1" - -# -# If net.ipv6.conf.all.disable_ipv6 present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv6.conf.all.disable_ipv6 = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.disable_ipv6") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-85904-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186311,6 +186413,66 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_all_disable_ipv6 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.disable_ipv6 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.disable_ipv6.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.disable_ipv6" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv6.conf.all.disable_ipv6 +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.disable_ipv6="1" + +# +# If net.ipv6.conf.all.disable_ipv6 present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv6.conf.all.disable_ipv6 = 1" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.disable_ipv6") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-85904-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186400,66 +186562,6 @@ functionality require the IPv6 stack loaded to work. the vulnerability to exploitation. CCE-86004-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.disable_ipv6 from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.disable_ipv6.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.disable_ipv6" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv6.conf.default.disable_ipv6 -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.disable_ipv6="1" - -# -# If net.ipv6.conf.default.disable_ipv6 present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv6.conf.default.disable_ipv6 = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.disable_ipv6") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-86004-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186525,6 +186627,66 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_default_disable_ipv6 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.disable_ipv6 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.disable_ipv6.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.disable_ipv6" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv6.conf.default.disable_ipv6 +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.disable_ipv6="1" + +# +# If net.ipv6.conf.default.disable_ipv6 present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv6.conf.default.disable_ipv6 = 1" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.disable_ipv6") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-86004-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186828,83 +186990,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit router advertisement message could result in a man-in-the-middle attack. CCE-81006-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_ra%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_ra.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_ra from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_ra_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_ra -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra="$sysctl_net_ipv6_conf_all_accept_ra_value" - -# -# If net.ipv6.conf.all.accept_ra present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81006-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186978,34 +187063,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_ra - - - - - - - - - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_defrtr=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_defrtr = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84272-4 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_ra%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_ra.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_defrtr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_defrtr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_defrtr" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187017,37 +187101,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_defrtr_value='' +sysctl_net_ipv6_conf_all_accept_ra_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_defrtr +# Set runtime for net.ipv6.conf.all.accept_ra # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_defrtr="$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra="$sysctl_net_ipv6_conf_all_accept_ra_value" # -# If net.ipv6.conf.all.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_defrtr = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_defrtr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84272-4" + cce="CCE-81006-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187056,6 +187140,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_defrtr=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_defrtr = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84272-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187115,34 +187215,18 @@ fi - sysctl_net_ipv6_conf_all_accept_ra_defrtr - unknown_severity - - - - - - - - - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_pinfo=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_pinfo = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84280-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_pinfo from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_defrtr from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_pinfo.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_defrtr.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_pinfo" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra_defrtr" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187154,37 +187238,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_pinfo_value='' +sysctl_net_ipv6_conf_all_accept_ra_defrtr_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_pinfo +# Set runtime for net.ipv6.conf.all.accept_ra_defrtr # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_pinfo="$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_defrtr="$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" # -# If net.ipv6.conf.all.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_pinfo = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_defrtr = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_pinfo") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_defrtr") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84280-7" + cce="CCE-84272-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187193,6 +187277,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_pinfo=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_pinfo = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84280-7 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187252,34 +187352,18 @@ fi - sysctl_net_ipv6_conf_all_accept_ra_pinfo - unknown_severity - - - - - - - - - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_rtr_pref=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_rtr_pref = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84288-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_pinfo from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_rtr_pref.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_pinfo.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_rtr_pref" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra_pinfo" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187291,37 +187375,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value='' +sysctl_net_ipv6_conf_all_accept_ra_pinfo_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_rtr_pref +# Set runtime for net.ipv6.conf.all.accept_ra_pinfo # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_pinfo="$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" # -# If net.ipv6.conf.all.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_pinfo = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_rtr_pref") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_pinfo") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84288-0" + cce="CCE-84280-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187330,6 +187414,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_rtr_pref=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_rtr_pref = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84288-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187388,6 +187488,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_ra_rtr_pref - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_rtr_pref.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.accept_ra_rtr_pref" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value='' + + +# +# Set runtime for net.ipv6.conf.all.accept_ra_rtr_pref +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" + +# +# If net.ipv6.conf.all.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_rtr_pref") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84288-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -187481,83 +187643,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit ICMP redirect message could result in a man-in-the-middle attack. CCE-81009-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_redirects_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_redirects="$sysctl_net_ipv6_conf_all_accept_redirects_value" - -# -# If net.ipv6.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81009-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187637,6 +187722,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_all_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_accept_redirects_value='' + + +# +# Set runtime for net.ipv6.conf.all.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_redirects="$sysctl_net_ipv6_conf_all_accept_redirects_value" + +# +# If net.ipv6.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-81009-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -187734,83 +187896,6 @@ Accepting source-routed packets in the IPv6 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81013-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_source_route_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_source_route="$sysctl_net_ipv6_conf_all_accept_source_route_value" - -# -# If net.ipv6.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81013-5" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187885,34 +187970,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_source_route - - - - - - - - - - Configure Auto Configuration on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.autoconf=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.autoconf = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84266-6 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.autoconf from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.autoconf.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.autoconf" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187924,37 +188008,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_autoconf_value='' +sysctl_net_ipv6_conf_all_accept_source_route_value='' # -# Set runtime for net.ipv6.conf.all.autoconf +# Set runtime for net.ipv6.conf.all.accept_source_route # -/sbin/sysctl -q -n -w net.ipv6.conf.all.autoconf="$sysctl_net_ipv6_conf_all_autoconf_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_source_route="$sysctl_net_ipv6_conf_all_accept_source_route_value" # -# If net.ipv6.conf.all.autoconf present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.autoconf = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.autoconf") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_autoconf_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.autoconf\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84266-6" + cce="CCE-81013-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187963,6 +188047,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Auto Configuration on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.autoconf=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.autoconf = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84266-6 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188020,6 +188120,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_autoconf - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.autoconf from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.autoconf.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.autoconf" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_autoconf_value='' + + +# +# Set runtime for net.ipv6.conf.all.autoconf +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.autoconf="$sysctl_net_ipv6_conf_all_autoconf_value" + +# +# If net.ipv6.conf.all.autoconf present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.autoconf = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.autoconf") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_autoconf_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.autoconf\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84266-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -188132,68 +188294,6 @@ interface to another. The ability to forward packets between two networks is only appropriate for systems acting as routers. CCE-82863-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.forwarding from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.forwarding.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.forwarding" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_forwarding_value='' - - -# -# Set runtime for net.ipv6.conf.all.forwarding -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.forwarding="$sysctl_net_ipv6_conf_all_forwarding_value" - -# -# If net.ipv6.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.forwarding = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.forwarding") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_forwarding_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-82863-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188270,34 +188370,18 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_forwarding - - - - - - - - - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.max_addresses=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.max_addresses = 1 - BP28(R22) - The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. - - CCE-84259-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.max_addresses from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.forwarding from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.max_addresses.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.forwarding.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.max_addresses" matches to preserve user data + # comment out "net.ipv6.conf.all.forwarding" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188309,37 +188393,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_max_addresses_value='' +sysctl_net_ipv6_conf_all_forwarding_value='' # -# Set runtime for net.ipv6.conf.all.max_addresses +# Set runtime for net.ipv6.conf.all.forwarding # -/sbin/sysctl -q -n -w net.ipv6.conf.all.max_addresses="$sysctl_net_ipv6_conf_all_max_addresses_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.forwarding="$sysctl_net_ipv6_conf_all_forwarding_value" # -# If net.ipv6.conf.all.max_addresses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.max_addresses = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.forwarding = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.max_addresses") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.forwarding") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_max_addresses_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_forwarding_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.max_addresses\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84259-1" + cce="CCE-82863-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188348,6 +188432,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.max_addresses=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.max_addresses = 1 + BP28(R22) + The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. + + CCE-84259-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188407,34 +188507,18 @@ fi - sysctl_net_ipv6_conf_all_max_addresses - unknown_severity - - - - - - - - - - Configure Denying Router Solicitations on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.router_solicitations=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.router_solicitations = 0 - BP28(R22) - To prevent discovery of the system by other systems, router solicitation requests should be denied. - - CCE-84109-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.router_solicitations from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.max_addresses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.router_solicitations.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.max_addresses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.router_solicitations" matches to preserve user data + # comment out "net.ipv6.conf.all.max_addresses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188446,37 +188530,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_router_solicitations_value='' +sysctl_net_ipv6_conf_all_max_addresses_value='' # -# Set runtime for net.ipv6.conf.all.router_solicitations +# Set runtime for net.ipv6.conf.all.max_addresses # -/sbin/sysctl -q -n -w net.ipv6.conf.all.router_solicitations="$sysctl_net_ipv6_conf_all_router_solicitations_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.max_addresses="$sysctl_net_ipv6_conf_all_max_addresses_value" # -# If net.ipv6.conf.all.router_solicitations present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.router_solicitations = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.max_addresses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.max_addresses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.router_solicitations") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.max_addresses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_router_solicitations_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_max_addresses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.router_solicitations\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.max_addresses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84109-8" + cce="CCE-84259-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188485,6 +188569,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Denying Router Solicitations on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.router_solicitations=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.router_solicitations = 0 + BP28(R22) + To prevent discovery of the system by other systems, router solicitation requests should be denied. + + CCE-84109-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188543,6 +188643,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_router_solicitations - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.router_solicitations from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.router_solicitations.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.router_solicitations" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_router_solicitations_value='' + + +# +# Set runtime for net.ipv6.conf.all.router_solicitations +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.router_solicitations="$sysctl_net_ipv6_conf_all_router_solicitations_value" + +# +# If net.ipv6.conf.all.router_solicitations present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.router_solicitations = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.router_solicitations") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_router_solicitations_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.router_solicitations\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84109-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -188632,83 +188794,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit router advertisement message could result in a man-in-the-middle attack. CCE-81007-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.default.accept_ra%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_ra.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.accept_ra from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_default_accept_ra_value='' - - -# -# Set runtime for net.ipv6.conf.default.accept_ra -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra="$sysctl_net_ipv6_conf_default_accept_ra_value" - -# -# If net.ipv6.conf.default.accept_ra present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81007-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188783,34 +188868,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_ra - - - - - - - - - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_defrtr=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_defrtr = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84268-2 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.default.accept_ra%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_ra.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_defrtr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_defrtr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_defrtr" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188822,37 +188906,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_defrtr_value='' +sysctl_net_ipv6_conf_default_accept_ra_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_defrtr +# Set runtime for net.ipv6.conf.default.accept_ra # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_defrtr="$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra="$sysctl_net_ipv6_conf_default_accept_ra_value" # -# If net.ipv6.conf.default.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_defrtr = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_defrtr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84268-2" + cce="CCE-81007-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188861,6 +188945,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_defrtr=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_defrtr = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84268-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188920,34 +189020,18 @@ fi - sysctl_net_ipv6_conf_default_accept_ra_defrtr - unknown_severity - - - - - - - - - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_pinfo=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_pinfo = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84051-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_pinfo from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_defrtr from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_pinfo.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_defrtr.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_pinfo" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra_defrtr" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188959,37 +189043,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_pinfo_value='' +sysctl_net_ipv6_conf_default_accept_ra_defrtr_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_pinfo +# Set runtime for net.ipv6.conf.default.accept_ra_defrtr # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_pinfo="$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_defrtr="$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" # -# If net.ipv6.conf.default.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_pinfo = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_defrtr = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_pinfo") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_defrtr") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84051-2" + cce="CCE-84268-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188998,6 +189082,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_pinfo=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_pinfo = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84051-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189057,34 +189157,18 @@ fi - sysctl_net_ipv6_conf_default_accept_ra_pinfo - unknown_severity - - - - - - - - - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_rtr_pref=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_rtr_pref = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84291-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_pinfo from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_rtr_pref.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_pinfo.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_rtr_pref" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra_pinfo" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189096,37 +189180,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value='' +sysctl_net_ipv6_conf_default_accept_ra_pinfo_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_rtr_pref +# Set runtime for net.ipv6.conf.default.accept_ra_pinfo # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_pinfo="$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" # -# If net.ipv6.conf.default.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_pinfo = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_rtr_pref") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_pinfo") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84291-4" + cce="CCE-84051-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189135,6 +189219,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_rtr_pref=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_rtr_pref = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84291-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189193,6 +189293,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_ra_rtr_pref - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_rtr_pref.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.accept_ra_rtr_pref" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value='' + + +# +# Set runtime for net.ipv6.conf.default.accept_ra_rtr_pref +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" + +# +# If net.ipv6.conf.default.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_rtr_pref") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84291-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -189284,6 +189446,80 @@ To make sure that the setting is persistent, add the following line to a file in An illicit ICMP redirect message could result in a man-in-the-middle attack. CCE-81010-1 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv6.conf.default.accept_redirects.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects + +- name: Comment out any occurrences of net.ipv6.conf.default.accept_redirects from + config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv6.conf.default.accept_redirects + replace: '#net.ipv6.conf.default.accept_redirects' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects +- name: XCCDF Value sysctl_net_ipv6_conf_default_accept_redirects_value # promote to variable + set_fact: + sysctl_net_ipv6_conf_default_accept_redirects_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv6.conf.default.accept_redirects is set + sysctl: + name: net.ipv6.conf.default.accept_redirects + value: '{{ sysctl_net_ipv6_conf_default_accept_redirects_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -189360,80 +189596,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv6.conf.default.accept_redirects.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects - -- name: Comment out any occurrences of net.ipv6.conf.default.accept_redirects from - config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv6.conf.default.accept_redirects - replace: '#net.ipv6.conf.default.accept_redirects' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects -- name: XCCDF Value sysctl_net_ipv6_conf_default_accept_redirects_value # promote to variable - set_fact: - sysctl_net_ipv6_conf_default_accept_redirects_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv6.conf.default.accept_redirects is set - sysctl: - name: net.ipv6.conf.default.accept_redirects - value: '{{ sysctl_net_ipv6_conf_default_accept_redirects_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects @@ -189535,83 +189697,6 @@ Accepting source-routed packets in the IPv6 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81015-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.default.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_default_accept_source_route_value='' - - -# -# Set runtime for net.ipv6.conf.default.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_source_route="$sysctl_net_ipv6_conf_default_accept_source_route_value" - -# -# If net.ipv6.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81015-0" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189698,34 +189783,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_source_route - - - - - - - - - - Configure Auto Configuration on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.autoconf=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.autoconf = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84264-1 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.default.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.autoconf from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.autoconf.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.autoconf" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189737,37 +189821,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_autoconf_value='' +sysctl_net_ipv6_conf_default_accept_source_route_value='' # -# Set runtime for net.ipv6.conf.default.autoconf +# Set runtime for net.ipv6.conf.default.accept_source_route # -/sbin/sysctl -q -n -w net.ipv6.conf.default.autoconf="$sysctl_net_ipv6_conf_default_autoconf_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_source_route="$sysctl_net_ipv6_conf_default_accept_source_route_value" # -# If net.ipv6.conf.default.autoconf present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.autoconf = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.autoconf") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_autoconf_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.autoconf\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84264-1" + cce="CCE-81015-0" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189776,6 +189860,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Auto Configuration on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.autoconf=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.autoconf = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84264-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189835,34 +189935,18 @@ fi - sysctl_net_ipv6_conf_default_autoconf - unknown_severity - - - - - - - - - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.max_addresses=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.max_addresses = 1 - BP28(R22) - The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. - - CCE-84257-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.max_addresses from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.autoconf from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.max_addresses.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.autoconf.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.max_addresses" matches to preserve user data + # comment out "net.ipv6.conf.default.autoconf" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189874,37 +189958,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_max_addresses_value='' +sysctl_net_ipv6_conf_default_autoconf_value='' # -# Set runtime for net.ipv6.conf.default.max_addresses +# Set runtime for net.ipv6.conf.default.autoconf # -/sbin/sysctl -q -n -w net.ipv6.conf.default.max_addresses="$sysctl_net_ipv6_conf_default_max_addresses_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.autoconf="$sysctl_net_ipv6_conf_default_autoconf_value" # -# If net.ipv6.conf.default.max_addresses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.max_addresses = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.autoconf present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.autoconf = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.max_addresses") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.autoconf") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_max_addresses_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_autoconf_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.max_addresses\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.autoconf\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84257-5" + cce="CCE-84264-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189913,6 +189997,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.max_addresses=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.max_addresses = 1 + BP28(R22) + The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. + + CCE-84257-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189972,34 +190072,18 @@ fi - sysctl_net_ipv6_conf_default_max_addresses - unknown_severity - - - - - - - - - - Configure Denying Router Solicitations on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.router_solicitations=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.router_solicitations = 0 - BP28(R22) - To prevent discovery of the system by other systems, router solicitation requests should be denied. - - CCE-83477-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.router_solicitations from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.max_addresses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.router_solicitations.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.max_addresses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.router_solicitations" matches to preserve user data + # comment out "net.ipv6.conf.default.max_addresses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -190011,37 +190095,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_router_solicitations_value='' +sysctl_net_ipv6_conf_default_max_addresses_value='' # -# Set runtime for net.ipv6.conf.default.router_solicitations +# Set runtime for net.ipv6.conf.default.max_addresses # -/sbin/sysctl -q -n -w net.ipv6.conf.default.router_solicitations="$sysctl_net_ipv6_conf_default_router_solicitations_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.max_addresses="$sysctl_net_ipv6_conf_default_max_addresses_value" # -# If net.ipv6.conf.default.router_solicitations present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.router_solicitations = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.max_addresses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.max_addresses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.router_solicitations") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.max_addresses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_router_solicitations_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_max_addresses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.router_solicitations\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.max_addresses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83477-0" + cce="CCE-84257-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -190050,6 +190134,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Denying Router Solicitations on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.router_solicitations=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.router_solicitations = 0 + BP28(R22) + To prevent discovery of the system by other systems, router solicitation requests should be denied. + + CCE-83477-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -190108,6 +190208,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_router_solicitations - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.router_solicitations from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.router_solicitations.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.router_solicitations" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_default_router_solicitations_value='' + + +# +# Set runtime for net.ipv6.conf.default.router_solicitations +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.router_solicitations="$sysctl_net_ipv6_conf_default_router_solicitations_value" + +# +# If net.ipv6.conf.default.router_solicitations present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.router_solicitations = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.router_solicitations") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_router_solicitations_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.router_solicitations\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-83477-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -190355,6 +190517,60 @@ received from outside whose source is the 127.0.0.0/8 address block. In combination with suitable routing, this can be used to direct packets between two local interfaces over the wire and have them accepted properly. CCE-88789-3 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.all.accept_local.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + +- name: Comment out any occurrences of net.ipv4.conf.all.accept_local from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.all.accept_local + replace: '#net.ipv4.conf.all.accept_local' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + +- name: Ensure sysctl net.ipv4.conf.all.accept_local is set to 0 + sysctl: + name: net.ipv4.conf.all.accept_local + value: '0' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -190414,60 +190630,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.accept_local.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local - -- name: Comment out any occurrences of net.ipv4.conf.all.accept_local from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.accept_local - replace: '#net.ipv4.conf.all.accept_local' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local - -- name: Ensure sysctl net.ipv4.conf.all.accept_local is set to 0 - sysctl: - name: net.ipv4.conf.all.accept_local - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local @@ -190586,83 +190748,6 @@ message could result in a man-in-the-middle attack. This feature of the IPv4 protocol has few legitimate uses. It should be disabled unless absolutely required." CCE-80917-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_accept_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.all.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_redirects="$sysctl_net_ipv4_conf_all_accept_redirects_value" - -# -# If net.ipv4.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80917-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -190742,6 +190827,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_accept_redirects_value='' + + +# +# Set runtime for net.ipv4.conf.all.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_redirects="$sysctl_net_ipv4_conf_all_accept_redirects_value" + +# +# If net.ipv4.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80917-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -190913,83 +191075,6 @@ forwarding is enabled and the system is functioning as a router. Accepting source-routed packets in the IPv4 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81011-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_accept_source_route_value='' - - -# -# Set runtime for net.ipv4.conf.all.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_source_route="$sysctl_net_ipv4_conf_all_accept_source_route_value" - -# -# If net.ipv4.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81011-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191070,36 +191155,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_accept_source_route - - - - - - - - - - Configure ARP filtering for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.arp_filter kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_filter= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_filter = - This behaviour may cause problems to system on a high availability or load balancing configuration. - BP28(R12) - Prevents the Linux Kernel from handling the ARP table globally. -By default, the kernel may respond to an ARP request from a certain interface with information -from another interface. - CCE-88555-8 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.arp_filter from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_filter.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.arp_filter" matches to preserve user data + # comment out "net.ipv4.conf.all.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191111,37 +191193,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_arp_filter_value='' +sysctl_net_ipv4_conf_all_accept_source_route_value='' # -# Set runtime for net.ipv4.conf.all.arp_filter +# Set runtime for net.ipv4.conf.all.accept_source_route # -/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_filter="$sysctl_net_ipv4_conf_all_arp_filter_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_source_route="$sysctl_net_ipv4_conf_all_accept_source_route_value" # -# If net.ipv4.conf.all.arp_filter present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.arp_filter = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_filter") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_filter_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_filter\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88555-8" + cce="CCE-81011-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191150,6 +191232,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure ARP filtering for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.arp_filter kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_filter= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_filter = + This behaviour may cause problems to system on a high availability or load balancing configuration. + BP28(R12) + Prevents the Linux Kernel from handling the ARP table globally. +By default, the kernel may respond to an ARP request from a certain interface with information +from another interface. + CCE-88555-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191208,34 +191308,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_arp_filter - - - - - - - - - - Configure Response Mode of ARP Requests for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_ignore= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_ignore = - The ARP response mode may impact behaviour of workloads and firewalls on the system. - BP28(R12) - Avoids ARP Flux on system that have more than one interface on the same subnet. - CCE-88889-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.arp_ignore from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.arp_filter from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_ignore.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_filter.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.arp_ignore" matches to preserve user data + # comment out "net.ipv4.conf.all.arp_filter" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191247,37 +191331,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_arp_ignore_value='' +sysctl_net_ipv4_conf_all_arp_filter_value='' # -# Set runtime for net.ipv4.conf.all.arp_ignore +# Set runtime for net.ipv4.conf.all.arp_filter # -/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_ignore="$sysctl_net_ipv4_conf_all_arp_ignore_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_filter="$sysctl_net_ipv4_conf_all_arp_filter_value" # -# If net.ipv4.conf.all.arp_ignore present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.arp_ignore = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.arp_filter present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.arp_filter = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_ignore") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_filter") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_ignore_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_filter_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_ignore\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_filter\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_ignore\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88889-1" + cce="CCE-88555-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191286,6 +191370,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Response Mode of ARP Requests for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_ignore= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_ignore = + The ARP response mode may impact behaviour of workloads and firewalls on the system. + BP28(R12) + Avoids ARP Flux on system that have more than one interface on the same subnet. + CCE-88889-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191344,34 +191444,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_arp_ignore - - - - - - - - - - Drop Gratuitious ARP frames on All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.drop_gratuitous_arp=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.drop_gratuitous_arp = 1 - This can cause problems if ARP proxies are used in the network. - BP28(R12) - Drop Gratuitous ARP frames to prevent ARP poisoning. - CCE-88001-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.drop_gratuitous_arp from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.arp_ignore from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.drop_gratuitous_arp.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_ignore.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.drop_gratuitous_arp" matches to preserve user data + # comment out "net.ipv4.conf.all.arp_ignore" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191383,35 +191467,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" +sysctl_net_ipv4_conf_all_arp_ignore_value='' + # -# Set runtime for net.ipv4.conf.all.drop_gratuitous_arp +# Set runtime for net.ipv4.conf.all.arp_ignore # -/sbin/sysctl -q -n -w net.ipv4.conf.all.drop_gratuitous_arp="1" +/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_ignore="$sysctl_net_ipv4_conf_all_arp_ignore_value" # -# If net.ipv4.conf.all.drop_gratuitous_arp present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv4.conf.all.drop_gratuitous_arp = 1" to /etc/sysctl.conf +# If net.ipv4.conf.all.arp_ignore present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.arp_ignore = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.drop_gratuitous_arp") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_ignore") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_ignore_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.drop_gratuitous_arp\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_ignore\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.drop_gratuitous_arp\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_ignore\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88001-3" + cce="CCE-88889-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191420,6 +191506,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Drop Gratuitious ARP frames on All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.drop_gratuitous_arp=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.drop_gratuitous_arp = 1 + This can cause problems if ARP proxies are used in the network. + BP28(R12) + Drop Gratuitous ARP frames to prevent ARP poisoning. + CCE-88001-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191474,44 +191576,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_drop_gratuitous_arp - - - - - - - - - Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.forwarding kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.forwarding=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.forwarding = 0 - There might be cases when certain applications can systematically override this option. -One such case is Libvirt; a toolkit for managing of virtualization platforms. -By default, Libvirt requires IP forwarding to be enabled to facilitate -network communication between the virtualization host and guest -machines. It enables IP forwarding after every reboot. - CCI-000366 - CM-6(b) - SRG-OS-000480-GPOS-00227 - RHEL-08-040259 - SV-250317r858808_rule - IP forwarding permits the kernel to forward packets from one network -interface to another. The ability to forward packets between two networks is -only appropriate for systems acting as routers. - - CCE-86220-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.forwarding from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.drop_gratuitous_arp from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.forwarding.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.drop_gratuitous_arp.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.forwarding" matches to preserve user data + # comment out "net.ipv4.conf.all.drop_gratuitous_arp" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191523,37 +191599,35 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_forwarding_value='' - # -# Set runtime for net.ipv4.conf.all.forwarding +# Set runtime for net.ipv4.conf.all.drop_gratuitous_arp # -/sbin/sysctl -q -n -w net.ipv4.conf.all.forwarding="$sysctl_net_ipv4_conf_all_forwarding_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.drop_gratuitous_arp="1" # -# If net.ipv4.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.forwarding = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.drop_gratuitous_arp present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv4.conf.all.drop_gratuitous_arp = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.forwarding") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.drop_gratuitous_arp") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_forwarding_value" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.drop_gratuitous_arp\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.drop_gratuitous_arp\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-86220-1" + cce="CCE-88001-3" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191562,6 +191636,32 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.forwarding kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.forwarding=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.forwarding = 0 + There might be cases when certain applications can systematically override this option. +One such case is Libvirt; a toolkit for managing of virtualization platforms. +By default, Libvirt requires IP forwarding to be enabled to facilitate +network communication between the virtualization host and guest +machines. It enables IP forwarding after every reboot. + CCI-000366 + CM-6(b) + SRG-OS-000480-GPOS-00227 + RHEL-08-040259 + SV-250317r858808_rule + IP forwarding permits the kernel to forward packets from one network +interface to another. The ability to forward packets between two networks is +only appropriate for systems acting as routers. + + CCE-86220-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191625,6 +191725,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.forwarding from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.forwarding.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.forwarding" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_forwarding_value='' + + +# +# Set runtime for net.ipv4.conf.all.forwarding +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.forwarding="$sysctl_net_ipv4_conf_all_forwarding_value" + +# +# If net.ipv4.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.forwarding = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.forwarding") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_forwarding_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-86220-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -191752,6 +191914,77 @@ as well as spoofed packets, source-routed packets, and redirects could be a sign of nefarious network activity. Logging these packets enables this activity to be detected. CCE-81018-4 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.all.log_martians.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity + +- name: Comment out any occurrences of net.ipv4.conf.all.log_martians from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.all.log_martians + replace: '#net.ipv4.conf.all.log_martians' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity +- name: XCCDF Value sysctl_net_ipv4_conf_all_log_martians_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_all_log_martians_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.all.log_martians is set + sysctl: + name: net.ipv4.conf.all.log_martians + value: '{{ sysctl_net_ipv4_conf_all_log_martians_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -191829,94 +192062,77 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + + Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.route_localnet kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.route_localnet=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.route_localnet = 0 + BP28(R12) + Refuse the routing of packets whose source or destination address is the local loopback. +This prohibits the use of network 127/8 for local routing purposes. +Enabling route_localnet can expose applications listening on localhost to external traffic. + CCE-88023-7 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.log_martians.*$ + contains: ^[\s]*net.ipv4.conf.all.route_localnet.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity + - sysctl_net_ipv4_conf_all_route_localnet -- name: Comment out any occurrences of net.ipv4.conf.all.log_martians from config +- name: Comment out any occurrences of net.ipv4.conf.all.route_localnet from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.log_martians - replace: '#net.ipv4.conf.all.log_martians' + regexp: ^[\s]*net.ipv4.conf.all.route_localnet + replace: '#net.ipv4.conf.all.route_localnet' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity -- name: XCCDF Value sysctl_net_ipv4_conf_all_log_martians_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_all_log_martians_value: !!str - tags: - - always + - sysctl_net_ipv4_conf_all_route_localnet -- name: Ensure sysctl net.ipv4.conf.all.log_martians is set +- name: Ensure sysctl net.ipv4.conf.all.route_localnet is set to 0 sysctl: - name: net.ipv4.conf.all.log_martians - value: '{{ sysctl_net_ipv4_conf_all_log_martians_value }}' + name: net.ipv4.conf.all.route_localnet + value: '0' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity + - sysctl_net_ipv4_conf_all_route_localnet - - - - - - - - - - Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.route_localnet kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.route_localnet=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.route_localnet = 0 - BP28(R12) - Refuse the routing of packets whose source or destination address is the local loopback. -This prohibits the use of network 127/8 for local routing purposes. -Enabling route_localnet can expose applications listening on localhost to external traffic. - CCE-88023-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -191976,60 +192192,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.route_localnet.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet - -- name: Comment out any occurrences of net.ipv4.conf.all.route_localnet from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.route_localnet - replace: '#net.ipv4.conf.all.route_localnet' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet - -- name: Ensure sysctl net.ipv4.conf.all.route_localnet is set to 0 - sysctl: - name: net.ipv4.conf.all.route_localnet - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet @@ -192137,83 +192299,6 @@ received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks. CCE-81021-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.rp_filter%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_rp_filter.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.rp_filter from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.rp_filter.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.rp_filter" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_rp_filter_value='' - - -# -# Set runtime for net.ipv4.conf.all.rp_filter -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.rp_filter="$sysctl_net_ipv4_conf_all_rp_filter_value" - -# -# If net.ipv4.conf.all.rp_filter present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.rp_filter = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.rp_filter") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_rp_filter_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.rp_filter\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.rp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81021-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192295,6 +192380,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_rp_filter + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.rp_filter%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_rp_filter.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.rp_filter from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.rp_filter.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.rp_filter" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_rp_filter_value='' + + +# +# Set runtime for net.ipv4.conf.all.rp_filter +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.rp_filter="$sysctl_net_ipv4_conf_all_rp_filter_value" + +# +# If net.ipv4.conf.all.rp_filter present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.rp_filter = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.rp_filter") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_rp_filter_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.rp_filter\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.rp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-81021-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -192456,83 +192618,6 @@ To make sure that the setting is persistent, add the following line to a file in default gateways) has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81016-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.secure_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_secure_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.secure_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.secure_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.secure_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_secure_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.all.secure_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.secure_redirects="$sysctl_net_ipv4_conf_all_secure_redirects_value" - -# -# If net.ipv4.conf.all.secure_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.secure_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.secure_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_secure_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.secure_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81016-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192613,34 +192698,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_secure_redirects - - - - - - - - - - Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.shared_media= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.shared_media = - BP28(R12) - This setting should be aligned with net.ipv4.conf.all.secure_redirects because it overrides it. -If shared_media is enabled for an interface secure_redirects will be enabled too. - CCE-88333-0 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.secure_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_secure_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.shared_media from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.secure_redirects from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.shared_media.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.secure_redirects.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.shared_media" matches to preserve user data + # comment out "net.ipv4.conf.all.secure_redirects" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -192652,37 +192736,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_shared_media_value='' +sysctl_net_ipv4_conf_all_secure_redirects_value='' # -# Set runtime for net.ipv4.conf.all.shared_media +# Set runtime for net.ipv4.conf.all.secure_redirects # -/sbin/sysctl -q -n -w net.ipv4.conf.all.shared_media="$sysctl_net_ipv4_conf_all_shared_media_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.secure_redirects="$sysctl_net_ipv4_conf_all_secure_redirects_value" # -# If net.ipv4.conf.all.shared_media present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.shared_media = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.secure_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.secure_redirects = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.shared_media") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.secure_redirects") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_shared_media_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_secure_redirects_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.shared_media\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.secure_redirects\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88333-0" + cce="CCE-81016-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -192691,6 +192775,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.shared_media= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.shared_media = + BP28(R12) + This setting should be aligned with net.ipv4.conf.all.secure_redirects because it overrides it. +If shared_media is enabled for an interface secure_redirects will be enabled too. + CCE-88333-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192749,6 +192849,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_shared_media + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.shared_media from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.shared_media.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.shared_media" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_shared_media_value='' + + +# +# Set runtime for net.ipv4.conf.all.shared_media +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.shared_media="$sysctl_net_ipv4_conf_all_shared_media_value" + +# +# If net.ipv4.conf.all.shared_media present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.shared_media = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.shared_media") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_shared_media_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.shared_media\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-88333-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -192917,83 +193079,6 @@ message could result in a man-in-the-middle attack. This feature of the IPv4 protocol has few legitimate uses. It should be disabled unless absolutely required. CCE-80919-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_accept_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.default.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_redirects="$sysctl_net_ipv4_conf_default_accept_redirects_value" - -# -# If net.ipv4.conf.default.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80919-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -193079,6 +193164,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_accept_redirects_value='' + + +# +# Set runtime for net.ipv4.conf.default.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_redirects="$sysctl_net_ipv4_conf_default_accept_redirects_value" + +# +# If net.ipv4.conf.default.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80919-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -193251,83 +193413,6 @@ uses. It should be disabled unless it is absolutely required, such as when IPv4 forwarding is enabled and the system is legitimately functioning as a router. CCE-80920-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_accept_source_route_value='' - - -# -# Set runtime for net.ipv4.conf.default.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_source_route="$sysctl_net_ipv4_conf_default_accept_source_route_value" - -# -# If net.ipv4.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80920-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -193407,6 +193492,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_accept_source_route + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.accept_source_route from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_source_route.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.accept_source_route" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_accept_source_route_value='' + + +# +# Set runtime for net.ipv4.conf.default.accept_source_route +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_source_route="$sysctl_net_ipv4_conf_default_accept_source_route_value" + +# +# If net.ipv4.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.accept_source_route = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_source_route") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_source_route_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80920-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -193534,6 +193696,77 @@ as well as spoofed packets, source-routed packets, and redirects could be a sign of nefarious network activity. Logging these packets enables this activity to be detected. CCE-81020-0 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.default.log_martians.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity + +- name: Comment out any occurrences of net.ipv4.conf.default.log_martians from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.default.log_martians + replace: '#net.ipv4.conf.default.log_martians' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity +- name: XCCDF Value sysctl_net_ipv4_conf_default_log_martians_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_default_log_martians_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.default.log_martians is set + sysctl: + name: net.ipv4.conf.default.log_martians + value: '{{ sysctl_net_ipv4_conf_default_log_martians_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -193610,77 +193843,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.default.log_martians.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity - -- name: Comment out any occurrences of net.ipv4.conf.default.log_martians from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.default.log_martians - replace: '#net.ipv4.conf.default.log_martians' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity -- name: XCCDF Value sysctl_net_ipv4_conf_default_log_martians_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_default_log_martians_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv4.conf.default.log_martians is set - sysctl: - name: net.ipv4.conf.default.log_martians - value: '{{ sysctl_net_ipv4_conf_default_log_martians_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity @@ -193784,6 +193946,80 @@ received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks. CCE-81022-6 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.default.rp_filter.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter + +- name: Comment out any occurrences of net.ipv4.conf.default.rp_filter from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.default.rp_filter + replace: '#net.ipv4.conf.default.rp_filter' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter +- name: XCCDF Value sysctl_net_ipv4_conf_default_rp_filter_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_default_rp_filter_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.default.rp_filter is set + sysctl: + name: net.ipv4.conf.default.rp_filter + value: '{{ sysctl_net_ipv4_conf_default_rp_filter_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -193860,80 +194096,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.default.rp_filter.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter - -- name: Comment out any occurrences of net.ipv4.conf.default.rp_filter from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.default.rp_filter - replace: '#net.ipv4.conf.default.rp_filter' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter -- name: XCCDF Value sysctl_net_ipv4_conf_default_rp_filter_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_default_rp_filter_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv4.conf.default.rp_filter is set - sysctl: - name: net.ipv4.conf.default.rp_filter - value: '{{ sysctl_net_ipv4_conf_default_rp_filter_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter @@ -194097,83 +194259,6 @@ To make sure that the setting is persistent, add the following line to a file in default gateways) has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81017-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.secure_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_secure_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.secure_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.secure_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.secure_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_secure_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.default.secure_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.secure_redirects="$sysctl_net_ipv4_conf_default_secure_redirects_value" - -# -# If net.ipv4.conf.default.secure_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.secure_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.secure_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_secure_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.secure_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81017-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194248,34 +194333,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_default_secure_redirects - - - - - - - - - - Configure Sending and Accepting Shared Media Redirects by Default - To set the runtime status of the net.ipv4.conf.default.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.default.shared_media= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.default.shared_media = - BP28(R12) - This setting should be aligned with net.ipv4.conf.default.secure_redirects because it overrides it. -If shared_media is enabled for an interface secure_redirects will be enabled too. - CCE-88444-5 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.secure_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_secure_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.default.shared_media from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.default.secure_redirects from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.shared_media.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.secure_redirects.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.shared_media" matches to preserve user data + # comment out "net.ipv4.conf.default.secure_redirects" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -194287,37 +194371,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_default_shared_media_value='' +sysctl_net_ipv4_conf_default_secure_redirects_value='' # -# Set runtime for net.ipv4.conf.default.shared_media +# Set runtime for net.ipv4.conf.default.secure_redirects # -/sbin/sysctl -q -n -w net.ipv4.conf.default.shared_media="$sysctl_net_ipv4_conf_default_shared_media_value" +/sbin/sysctl -q -n -w net.ipv4.conf.default.secure_redirects="$sysctl_net_ipv4_conf_default_secure_redirects_value" # -# If net.ipv4.conf.default.shared_media present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.shared_media = value" to /etc/sysctl.conf +# If net.ipv4.conf.default.secure_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.secure_redirects = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.shared_media") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.secure_redirects") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_shared_media_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_secure_redirects_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.shared_media\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.secure_redirects\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88444-5" + cce="CCE-81017-6" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -194326,6 +194410,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Sending and Accepting Shared Media Redirects by Default + To set the runtime status of the net.ipv4.conf.default.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.default.shared_media= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.default.shared_media = + BP28(R12) + This setting should be aligned with net.ipv4.conf.default.secure_redirects because it overrides it. +If shared_media is enabled for an interface secure_redirects will be enabled too. + CCE-88444-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194384,6 +194484,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_shared_media + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.shared_media from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.shared_media.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.shared_media" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_shared_media_value='' + + +# +# Set runtime for net.ipv4.conf.default.shared_media +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.shared_media="$sysctl_net_ipv4_conf_default_shared_media_value" + +# +# If net.ipv4.conf.default.shared_media present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.shared_media = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.shared_media") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_shared_media_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.shared_media\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-88444-5" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -194552,83 +194714,6 @@ and provides a vector for amplification attacks. Ignoring ICMP echo requests (pings) sent to broadcast or multicast addresses makes the system slightly more difficult to enumerate on the network. CCE-80922-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.icmp_echo_ignore_broadcasts%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_echo_ignore_broadcasts.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.icmp_echo_ignore_broadcasts from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_echo_ignore_broadcasts.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.icmp_echo_ignore_broadcasts" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value='' - - -# -# Set runtime for net.ipv4.icmp_echo_ignore_broadcasts -# -/sbin/sysctl -q -n -w net.ipv4.icmp_echo_ignore_broadcasts="$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" - -# -# If net.ipv4.icmp_echo_ignore_broadcasts present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.icmp_echo_ignore_broadcasts = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_echo_ignore_broadcasts") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_echo_ignore_broadcasts\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_echo_ignore_broadcasts\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80922-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194711,6 +194796,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_icmp_echo_ignore_broadcasts + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.icmp_echo_ignore_broadcasts%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_echo_ignore_broadcasts.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.icmp_echo_ignore_broadcasts from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_echo_ignore_broadcasts.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.icmp_echo_ignore_broadcasts" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value='' + + +# +# Set runtime for net.ipv4.icmp_echo_ignore_broadcasts +# +/sbin/sysctl -q -n -w net.ipv4.icmp_echo_ignore_broadcasts="$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" + +# +# If net.ipv4.icmp_echo_ignore_broadcasts present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.icmp_echo_ignore_broadcasts = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_echo_ignore_broadcasts") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_echo_ignore_broadcasts\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_echo_ignore_broadcasts\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80922-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -194824,83 +194986,6 @@ To make sure that the setting is persistent, add the following line to a file in Ignoring bogus ICMP error responses reduces log size, although some activity would not be logged. CCE-81023-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.icmp_ignore_bogus_error_responses%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_ignore_bogus_error_responses.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.icmp_ignore_bogus_error_responses from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_ignore_bogus_error_responses.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.icmp_ignore_bogus_error_responses" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value='' - - -# -# Set runtime for net.ipv4.icmp_ignore_bogus_error_responses -# -/sbin/sysctl -q -n -w net.ipv4.icmp_ignore_bogus_error_responses="$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" - -# -# If net.ipv4.icmp_ignore_bogus_error_responses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.icmp_ignore_bogus_error_responses = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_ignore_bogus_error_responses") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_ignore_bogus_error_responses\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_ignore_bogus_error_responses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81023-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194978,35 +195063,33 @@ fi - sysctl_net_ipv4_icmp_ignore_bogus_error_responses - unknown_severity - - - - - - - - - - Set Kernel Parameter to Increase Local Port Range - To set the runtime status of the net.ipv4.ip_local_port_range kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.ip_local_port_range=32768 65535 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.ip_local_port_range = 32768 65535 - BP28(R22) - This setting defines the local port range that is used by TCP and UDP to -choose the local port. The first number is the first, the second the last -local port number. - CCE-84277-3 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.icmp_ignore_bogus_error_responses%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_ignore_bogus_error_responses.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.ip_local_port_range from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.icmp_ignore_bogus_error_responses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_local_port_range.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_ignore_bogus_error_responses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.ip_local_port_range" matches to preserve user data + # comment out "net.ipv4.icmp_ignore_bogus_error_responses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195018,35 +195101,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" +sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value='' + # -# Set runtime for net.ipv4.ip_local_port_range +# Set runtime for net.ipv4.icmp_ignore_bogus_error_responses # -/sbin/sysctl -q -n -w net.ipv4.ip_local_port_range="32768 65535" +/sbin/sysctl -q -n -w net.ipv4.icmp_ignore_bogus_error_responses="$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" # -# If net.ipv4.ip_local_port_range present in /etc/sysctl.conf, change value to "32768 65535" -# else, add "net.ipv4.ip_local_port_range = 32768 65535" to /etc/sysctl.conf +# If net.ipv4.icmp_ignore_bogus_error_responses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.icmp_ignore_bogus_error_responses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.ip_local_port_range") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_ignore_bogus_error_responses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "32768 65535" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.ip_local_port_range\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_ignore_bogus_error_responses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.ip_local_port_range\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_ignore_bogus_error_responses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84277-3" + cce="CCE-81023-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195055,6 +195140,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Set Kernel Parameter to Increase Local Port Range + To set the runtime status of the net.ipv4.ip_local_port_range kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.ip_local_port_range=32768 65535 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.ip_local_port_range = 32768 65535 + BP28(R22) + This setting defines the local port range that is used by TCP and UDP to +choose the local port. The first number is the first, the second the last +local port number. + CCE-84277-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195108,56 +195210,18 @@ fi - reboot_required - sysctl_net_ipv4_ip_local_port_range - - - - - - - - - Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments - Make sure that the system is configured to limit the maximal rate for sending -duplicate acknowledgments in response to incoming TCP packets that are for -an existing connection but that are invalid due to any of these reasons: - -(a) out-of-window sequence number, (b) out-of-window acknowledgment number, -or (c) PAWS (Protection Against Wrapped Sequence numbers) check failure -This measure protects against or limits effects of DoS attacks against the system. -Set the system to implement rate-limiting measures by adding the following line to -/etc/sysctl.conf or a configuration file in the /etc/sysctl.d/ directory -(or modify the line to have the required value): -net.ipv4.tcp_invalid_ratelimit = -Issue the following command to make the changes take effect: -# sysctl --system - CCI-002385 - CIP-007-3 R4 - CIP-007-3 R4.1 - CIP-007-3 R4.2 - CIP-007-3 R5.1 - SC-5 - SRG-OS-000420-GPOS-00186 - Denial of Service (DoS) is a condition when a resource is not available for legitimate users. When -this occurs, the organization either cannot accomplish its mission or must -operate at degraded capacity. - -This can help mitigate simple “ack loop” DoS attacks, wherein a buggy or -malicious middlebox or man-in-the-middle can rewrite TCP header fields in -manner that causes each endpoint to think that the other is sending invalid -TCP segments, thus causing each side to send an unterminating stream of -duplicate acknowledgments for invalid segments. - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.tcp_invalid_ratelimit from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.ip_local_port_range from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_invalid_ratelimit.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_local_port_range.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_invalid_ratelimit" matches to preserve user data + # comment out "net.ipv4.ip_local_port_range" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195169,36 +195233,36 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_tcp_invalid_ratelimit_value='' - # -# Set runtime for net.ipv4.tcp_invalid_ratelimit +# Set runtime for net.ipv4.ip_local_port_range # -/sbin/sysctl -q -n -w net.ipv4.tcp_invalid_ratelimit="$sysctl_net_ipv4_tcp_invalid_ratelimit_value" +/sbin/sysctl -q -n -w net.ipv4.ip_local_port_range="32768 65535" # -# If net.ipv4.tcp_invalid_ratelimit present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_invalid_ratelimit = value" to /etc/sysctl.conf +# If net.ipv4.ip_local_port_range present in /etc/sysctl.conf, change value to "32768 65535" +# else, add "net.ipv4.ip_local_port_range = 32768 65535" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_invalid_ratelimit") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.ip_local_port_range") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_invalid_ratelimit_value" +printf -v formatted_output "%s = %s" "$stripped_key" "32768 65535" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_invalid_ratelimit\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.ip_local_port_range\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_invalid_ratelimit\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.ip_local_port_range\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi + cce="CCE-84277-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195206,6 +195270,44 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments + Make sure that the system is configured to limit the maximal rate for sending +duplicate acknowledgments in response to incoming TCP packets that are for +an existing connection but that are invalid due to any of these reasons: + +(a) out-of-window sequence number, (b) out-of-window acknowledgment number, +or (c) PAWS (Protection Against Wrapped Sequence numbers) check failure +This measure protects against or limits effects of DoS attacks against the system. +Set the system to implement rate-limiting measures by adding the following line to +/etc/sysctl.conf or a configuration file in the /etc/sysctl.d/ directory +(or modify the line to have the required value): +net.ipv4.tcp_invalid_ratelimit = +Issue the following command to make the changes take effect: +# sysctl --system + CCI-002385 + CIP-007-3 R4 + CIP-007-3 R4.1 + CIP-007-3 R4.2 + CIP-007-3 R5.1 + SC-5 + SRG-OS-000420-GPOS-00186 + Denial of Service (DoS) is a condition when a resource is not available for legitimate users. When +this occurs, the organization either cannot accomplish its mission or must +operate at degraded capacity. + +This can help mitigate simple “ack loop” DoS attacks, wherein a buggy or +malicious middlebox or man-in-the-middle can rewrite TCP header fields in +manner that causes each endpoint to think that the other is sending invalid +TCP segments, thus causing each side to send an unterminating stream of +duplicate acknowledgments for invalid segments. - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195265,35 +195367,18 @@ fi - reboot_required - sysctl_net_ipv4_tcp_invalid_ratelimit - - - - - - - - - - Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces - To set the runtime status of the net.ipv4.tcp_rfc1337 kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.tcp_rfc1337=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.tcp_rfc1337 = 1 - BP28(R22) - Enable TCP behavior conformant with RFC 1337. When disabled, if a RST is -received in TIME_WAIT state, we close the socket immediately without waiting -for the end of the TIME_WAIT period. - CCE-84270-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.tcp_rfc1337 from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.tcp_invalid_ratelimit from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_rfc1337.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_invalid_ratelimit.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_rfc1337" matches to preserve user data + # comment out "net.ipv4.tcp_invalid_ratelimit" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195305,38 +195390,36 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_tcp_rfc1337_value='' +sysctl_net_ipv4_tcp_invalid_ratelimit_value='' # -# Set runtime for net.ipv4.tcp_rfc1337 +# Set runtime for net.ipv4.tcp_invalid_ratelimit # -/sbin/sysctl -q -n -w net.ipv4.tcp_rfc1337="$sysctl_net_ipv4_tcp_rfc1337_value" +/sbin/sysctl -q -n -w net.ipv4.tcp_invalid_ratelimit="$sysctl_net_ipv4_tcp_invalid_ratelimit_value" # -# If net.ipv4.tcp_rfc1337 present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_rfc1337 = value" to /etc/sysctl.conf +# If net.ipv4.tcp_invalid_ratelimit present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_invalid_ratelimit = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_rfc1337") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_invalid_ratelimit") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_rfc1337_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_invalid_ratelimit_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_rfc1337\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_invalid_ratelimit\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_rfc1337\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_invalid_ratelimit\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84270-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195344,6 +195427,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces + To set the runtime status of the net.ipv4.tcp_rfc1337 kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.tcp_rfc1337=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.tcp_rfc1337 = 1 + BP28(R22) + Enable TCP behavior conformant with RFC 1337. When disabled, if a RST is +received in TIME_WAIT state, we close the socket immediately without waiting +for the end of the TIME_WAIT period. + CCE-84270-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195401,6 +195501,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_tcp_rfc1337 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.tcp_rfc1337 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_rfc1337.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.tcp_rfc1337" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_tcp_rfc1337_value='' + + +# +# Set runtime for net.ipv4.tcp_rfc1337 +# +/sbin/sysctl -q -n -w net.ipv4.tcp_rfc1337="$sysctl_net_ipv4_tcp_rfc1337_value" + +# +# If net.ipv4.tcp_rfc1337 present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_rfc1337 = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_rfc1337") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_rfc1337_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_rfc1337\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_rfc1337\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84270-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -195513,83 +195675,6 @@ verifying the initiator is attempting a valid connection and is not a flood source. This feature is activated when a flood condition is detected, and enables the system to continue servicing valid connection requests. CCE-80923-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.tcp_syncookies%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_tcp_syncookies.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.tcp_syncookies from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_syncookies.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_syncookies" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_tcp_syncookies_value='' - - -# -# Set runtime for net.ipv4.tcp_syncookies -# -/sbin/sysctl -q -n -w net.ipv4.tcp_syncookies="$sysctl_net_ipv4_tcp_syncookies_value" - -# -# If net.ipv4.tcp_syncookies present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_syncookies = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_syncookies") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_syncookies_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_syncookies\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_syncookies\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80923-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195677,6 +195762,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_tcp_syncookies + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.tcp_syncookies%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_tcp_syncookies.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.tcp_syncookies from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_syncookies.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.tcp_syncookies" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_tcp_syncookies_value='' + + +# +# Set runtime for net.ipv4.tcp_syncookies +# +/sbin/sysctl -q -n -w net.ipv4.tcp_syncookies="$sysctl_net_ipv4_tcp_syncookies_value" + +# +# If net.ipv4.tcp_syncookies present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_syncookies = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_syncookies") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_syncookies_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_syncookies\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_syncookies\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80923-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -195854,81 +196016,6 @@ from the system's route table possibly revealing portions of the network topolog The ability to send ICMP redirects is only appropriate for systems acting as routers. CCE-80918-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.send_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_send_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.send_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.send_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.send_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv4.conf.all.send_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.send_redirects="0" - -# -# If net.ipv4.conf.all.send_redirects present in /etc/sysctl.conf, change value to "0" -# else, add "net.ipv4.conf.all.send_redirects = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.send_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.send_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80918-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -196009,6 +196096,81 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_send_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.send_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_send_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.send_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.send_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.send_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv4.conf.all.send_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.send_redirects="0" + +# +# If net.ipv4.conf.all.send_redirects present in /etc/sysctl.conf, change value to "0" +# else, add "net.ipv4.conf.all.send_redirects = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.send_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.send_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80918-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196178,81 +196340,6 @@ from the system's route table possibly revealing portions of the network topolog The ability to send ICMP redirects is only appropriate for systems acting as routers. CCE-80921-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.send_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_send_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.send_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.send_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.send_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv4.conf.default.send_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.send_redirects="0" - -# -# If net.ipv4.conf.default.send_redirects present in /etc/sysctl.conf, change value to "0" -# else, add "net.ipv4.conf.default.send_redirects = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.send_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.send_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80921-0" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -196333,6 +196420,81 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_send_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.send_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_send_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.send_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.send_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.send_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv4.conf.default.send_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.send_redirects="0" + +# +# If net.ipv4.conf.default.send_redirects present in /etc/sysctl.conf, change value to "0" +# else, add "net.ipv4.conf.default.send_redirects = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.send_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.send_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80921-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196469,12 +196631,92 @@ not required, system network information may be unnecessarily transmitted across the network. CCE-81024-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.ip_forward from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.ip_forward.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + +- name: Comment out any occurrences of net.ipv4.ip_forward from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.ip_forward + replace: '#net.ipv4.ip_forward' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + +- name: Ensure sysctl net.ipv4.ip_forward is set to 0 + sysctl: + name: net.ipv4.ip_forward + value: '0' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.ip_forward from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_forward.*$' $f | uniq ) if ! test -z "$matching_list"; then @@ -196528,86 +196770,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.ip_forward.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward - -- name: Comment out any occurrences of net.ipv4.ip_forward from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.ip_forward - replace: '#net.ipv4.ip_forward' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward - -- name: Ensure sysctl net.ipv4.ip_forward is set to 0 - sysctl: - name: net.ipv4.ip_forward - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward @@ -196816,8 +196978,25 @@ originating from within a corporate network to include malicious mobile code and configured software on a host. CCE-86376-1 - -package --add=nftables + - name: Ensure nftables is installed + package: + name: nftables + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86376-1 + - PCI-DSSv4-1.2.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_nftables_installed + + +[[packages]] +name = "nftables" +version = "*" include install_nftables @@ -196826,6 +197005,9 @@ class install_nftables { ensure => 'installed', } } + + +package --add=nftables # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -196837,26 +197019,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "nftables" -version = "*" - - - name: Ensure nftables is installed - package: - name: nftables - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86376-1 - - PCI-DSSv4-1.2.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_nftables_installed @@ -196878,31 +197040,6 @@ in the /etc/sysconfig/nftables.conf file during boot or t the nftables service CCE-86725-9 - include enable_nftables - -class enable_nftables { - service {'nftables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q nftables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'nftables.service' -"$SYSTEMCTL_EXEC" start 'nftables.service' -"$SYSTEMCTL_EXEC" enable 'nftables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["nftables"] - - name: Gather the package facts package_facts: manager: auto @@ -196940,6 +197077,31 @@ enabled = ["nftables"] - medium_severity - no_reboot_needed - service_nftables_enabled + + +[customizations.services] +enabled = ["nftables"] + + include enable_nftables + +class enable_nftables { + service {'nftables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q nftables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'nftables.service' +"$SYSTEMCTL_EXEC" start 'nftables.service' +"$SYSTEMCTL_EXEC" enable 'nftables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196960,55 +197122,6 @@ The nftables service can be disabled with the following c is actually one of the backends for firewalld management tools. CCE-88428-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nftables.service - enabled: false - mask: true - - name: nftables.socket - enabled: false - mask: true - - include disable_nftables - -class disable_nftables { - service {'nftables': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q firewalld && rpm --quiet -q nftables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nftables.service' -"$SYSTEMCTL_EXEC" disable 'nftables.service' -"$SYSTEMCTL_EXEC" mask 'nftables.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nftables.socket; then - "$SYSTEMCTL_EXEC" stop 'nftables.socket' - "$SYSTEMCTL_EXEC" mask 'nftables.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nftables.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nftables"] - - name: Gather the package facts package_facts: manager: auto @@ -197091,6 +197204,55 @@ disabled = ["nftables"] - medium_severity - no_reboot_needed - service_nftables_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: nftables.service + enabled: false + mask: true + - name: nftables.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["nftables"] + + include disable_nftables + +class disable_nftables { + service {'nftables': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q firewalld && rpm --quiet -q nftables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'nftables.service' +"$SYSTEMCTL_EXEC" disable 'nftables.service' +"$SYSTEMCTL_EXEC" mask 'nftables.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files nftables.socket; then + "$SYSTEMCTL_EXEC" stop 'nftables.socket' + "$SYSTEMCTL_EXEC" mask 'nftables.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'nftables.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197110,27 +197272,6 @@ network traffic. Note: adding rules to a running nftables can cause loss of connectivity to the system. CCE-86162-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q nftables; then - -#Set nftables family name -var_nftables_family='' - - -#Set nftables table name -var_nftables_table='' - - -IS_TABLE=$(nft list tables) -if [ -z "$IS_TABLE" ] -then - nft create table "$var_nftables_family" "$var_nftables_table" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -197181,6 +197322,27 @@ fi - no_reboot_needed - restrict_strategy - set_nftables_table + + # Remediation is applicable only in certain platforms +if rpm --quiet -q nftables; then + +#Set nftables family name +var_nftables_family='' + + +#Set nftables table name +var_nftables_table='' + + +IS_TABLE=$(nft list tables) +if [ -z "$IS_TABLE" ] +then + nft create table "$var_nftables_family" "$var_nftables_table" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197222,31 +197384,6 @@ The ufw service can be enabled with the following command SRG-OS-000297-GPOS-00115 The ufw service must be enabled and running in order for ufw to protect the system - include enable_ufw - -class enable_ufw { - service {'ufw': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q ufw ); }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ufw.service' -"$SYSTEMCTL_EXEC" start 'ufw.service' -"$SYSTEMCTL_EXEC" enable 'ufw.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ufw"] - - name: Gather the package facts package_facts: manager: auto @@ -197284,6 +197421,31 @@ enabled = ["ufw"] - medium_severity - no_reboot_needed - service_ufw_enabled + + +[customizations.services] +enabled = ["ufw"] + + include enable_ufw + +class enable_ufw { + service {'ufw': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q ufw ); }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ufw.service' +"$SYSTEMCTL_EXEC" start 'ufw.service' +"$SYSTEMCTL_EXEC" enable 'ufw.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197323,50 +197485,16 @@ add the following line to file /etc/modprobe.d/atm.conf: SRG-OS-000095-GPOS-00049 SRG-OS-000480-GPOS-00227 RHEL-08-040021 - SV-230494r792911_rule + SV-230494r942918_rule Disabling ATM protects the system against exploitation of any flaws in its implementation. CCE-82028-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20atm%20/bin/true%0Ablacklist%20atm%0A - mode: 0644 - path: /etc/modprobe.d/atm.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install atm" /etc/modprobe.d/atm.conf ; then - - sed -i 's#^install atm.*#install atm /bin/true#g' /etc/modprobe.d/atm.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/atm.conf - echo "install atm /bin/true" >> /etc/modprobe.d/atm.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist atm$" /etc/modprobe.d/atm.conf ; then - echo "blacklist atm" >> /etc/modprobe.d/atm.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'atm' is disabled lineinfile: create: true dest: /etc/modprobe.d/atm.conf regexp: install\s+atm - line: install atm /bin/true + line: install atm /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82028-2 @@ -197396,6 +197524,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20atm%20/bin/true%0Ablacklist%20atm%0A + mode: 0644 + path: /etc/modprobe.d/atm.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install atm" /etc/modprobe.d/atm.conf ; then + + sed -i 's#^install atm.*#install atm /bin/true#g' /etc/modprobe.d/atm.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/atm.conf + echo "install atm /bin/false" >> /etc/modprobe.d/atm.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist atm$" /etc/modprobe.d/atm.conf ; then + echo "blacklist atm" >> /etc/modprobe.d/atm.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197424,50 +197586,16 @@ add the following line to file /etc/modprobe.d/can.conf: SRG-OS-000095-GPOS-00049 SRG-OS-000480-GPOS-00227 RHEL-08-040022 - SV-230495r792914_rule + SV-230495r942921_rule Disabling CAN protects the system against exploitation of any flaws in its implementation. CCE-82059-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20can%20/bin/true%0Ablacklist%20can%0A - mode: 0644 - path: /etc/modprobe.d/can.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install can" /etc/modprobe.d/can.conf ; then - - sed -i 's#^install can.*#install can /bin/true#g' /etc/modprobe.d/can.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/can.conf - echo "install can /bin/true" >> /etc/modprobe.d/can.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist can$" /etc/modprobe.d/can.conf ; then - echo "blacklist can" >> /etc/modprobe.d/can.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'can' is disabled lineinfile: create: true dest: /etc/modprobe.d/can.conf regexp: install\s+can - line: install can /bin/true + line: install can /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82059-7 @@ -197497,6 +197625,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20can%20/bin/true%0Ablacklist%20can%0A + mode: 0644 + path: /etc/modprobe.d/can.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install can" /etc/modprobe.d/can.conf ; then + + sed -i 's#^install can.*#install can /bin/true#g' /etc/modprobe.d/can.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/can.conf + echo "install can /bin/false" >> /etc/modprobe.d/can.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist can$" /etc/modprobe.d/can.conf ; then + echo "blacklist can" >> /etc/modprobe.d/can.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197596,46 +197758,12 @@ add the following line to file /etc/modprobe.d/dccp.conf: Disabling DCCP protects the system against exploitation of any flaws in its implementation. CCE-80833-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20dccp%20/bin/true%0Ablacklist%20dccp%0A - mode: 0644 - path: /etc/modprobe.d/dccp.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install dccp" /etc/modprobe.d/dccp.conf ; then - - sed -i 's#^install dccp.*#install dccp /bin/true#g' /etc/modprobe.d/dccp.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/dccp.conf - echo "install dccp /bin/true" >> /etc/modprobe.d/dccp.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist dccp$" /etc/modprobe.d/dccp.conf ; then - echo "blacklist dccp" >> /etc/modprobe.d/dccp.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'dccp' is disabled lineinfile: create: true dest: /etc/modprobe.d/dccp.conf regexp: install\s+dccp - line: install dccp /bin/true + line: install dccp /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80833-7 @@ -197675,6 +197803,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20dccp%20/bin/true%0Ablacklist%20dccp%0A + mode: 0644 + path: /etc/modprobe.d/dccp.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install dccp" /etc/modprobe.d/dccp.conf ; then + + sed -i 's#^install dccp.*#install dccp /bin/true#g' /etc/modprobe.d/dccp.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/dccp.conf + echo "install dccp /bin/false" >> /etc/modprobe.d/dccp.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist dccp$" /etc/modprobe.d/dccp.conf ; then + echo "blacklist dccp" >> /etc/modprobe.d/dccp.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197700,50 +197862,16 @@ add the following line to file /etc/modprobe.d/firewire-core.confFMT_SMF_EXT.1 SRG-OS-000095-GPOS-00049 RHEL-08-040026 - SV-230499r792924_rule + SV-230499r942933_rule Disabling FireWire protects the system against exploitation of any flaws in its implementation. CCE-82005-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20firewire-core%20/bin/true%0Ablacklist%20firewire-core%0A - mode: 0644 - path: /etc/modprobe.d/firewire-core.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install firewire-core" /etc/modprobe.d/firewire-core.conf ; then - - sed -i 's#^install firewire-core.*#install firewire-core /bin/true#g' /etc/modprobe.d/firewire-core.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/firewire-core.conf - echo "install firewire-core /bin/true" >> /etc/modprobe.d/firewire-core.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist firewire-core$" /etc/modprobe.d/firewire-core.conf ; then - echo "blacklist firewire-core" >> /etc/modprobe.d/firewire-core.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'firewire-core' is disabled lineinfile: create: true dest: /etc/modprobe.d/firewire-core.conf regexp: install\s+firewire-core - line: install firewire-core /bin/true + line: install firewire-core /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82005-0 @@ -197773,6 +197901,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20firewire-core%20/bin/true%0Ablacklist%20firewire-core%0A + mode: 0644 + path: /etc/modprobe.d/firewire-core.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install firewire-core" /etc/modprobe.d/firewire-core.conf ; then + + sed -i 's#^install firewire-core.*#install firewire-core /bin/true#g' /etc/modprobe.d/firewire-core.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/firewire-core.conf + echo "install firewire-core /bin/false" >> /etc/modprobe.d/firewire-core.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist firewire-core$" /etc/modprobe.d/firewire-core.conf ; then + echo "blacklist firewire-core" >> /etc/modprobe.d/firewire-core.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197864,46 +198026,12 @@ add the following line to file /etc/modprobe.d/rds.conf: Disabling RDS protects the system against exploitation of any flaws in its implementation. CCE-82870-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20rds%20/bin/true%0Ablacklist%20rds%0A - mode: 0644 - path: /etc/modprobe.d/rds.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install rds" /etc/modprobe.d/rds.conf ; then - - sed -i 's#^install rds.*#install rds /bin/true#g' /etc/modprobe.d/rds.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/rds.conf - echo "install rds /bin/true" >> /etc/modprobe.d/rds.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist rds$" /etc/modprobe.d/rds.conf ; then - echo "blacklist rds" >> /etc/modprobe.d/rds.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'rds' is disabled lineinfile: create: true dest: /etc/modprobe.d/rds.conf regexp: install\s+rds - line: install rds /bin/true + line: install rds /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82870-7 @@ -197935,6 +198063,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20rds%20/bin/true%0Ablacklist%20rds%0A + mode: 0644 + path: /etc/modprobe.d/rds.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install rds" /etc/modprobe.d/rds.conf ; then + + sed -i 's#^install rds.*#install rds /bin/true#g' /etc/modprobe.d/rds.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/rds.conf + echo "install rds /bin/false" >> /etc/modprobe.d/rds.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist rds$" /etc/modprobe.d/rds.conf ; then + echo "blacklist rds" >> /etc/modprobe.d/rds.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198034,50 +198196,16 @@ add the following line to file /etc/modprobe.d/sctp.conf: SRG-OS-000480-GPOS-00227 RHEL-08-040023 3.1.2 - SV-230496r792917_rule + SV-230496r942924_rule Disabling SCTP protects the system against exploitation of any flaws in its implementation. CCE-80834-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20sctp%20/bin/true%0Ablacklist%20sctp%0A - mode: 0644 - path: /etc/modprobe.d/sctp.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install sctp" /etc/modprobe.d/sctp.conf ; then - - sed -i 's#^install sctp.*#install sctp /bin/true#g' /etc/modprobe.d/sctp.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/sctp.conf - echo "install sctp /bin/true" >> /etc/modprobe.d/sctp.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist sctp$" /etc/modprobe.d/sctp.conf ; then - echo "blacklist sctp" >> /etc/modprobe.d/sctp.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'sctp' is disabled lineinfile: create: true dest: /etc/modprobe.d/sctp.conf regexp: install\s+sctp - line: install sctp /bin/true + line: install sctp /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80834-5 @@ -198119,6 +198247,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20sctp%20/bin/true%0Ablacklist%20sctp%0A + mode: 0644 + path: /etc/modprobe.d/sctp.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install sctp" /etc/modprobe.d/sctp.conf ; then + + sed -i 's#^install sctp.*#install sctp /bin/true#g' /etc/modprobe.d/sctp.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/sctp.conf + echo "install sctp /bin/false" >> /etc/modprobe.d/sctp.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist sctp$" /etc/modprobe.d/sctp.conf ; then + echo "blacklist sctp" >> /etc/modprobe.d/sctp.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198215,50 +198377,16 @@ the tipc kernel module will be loaded.FMT_SMF_EXT.1 SRG-OS-000095-GPOS-00049 RHEL-08-040024 - SV-230497r792920_rule + SV-230497r942927_rule Disabling TIPC protects the system against exploitation of any flaws in its implementation. CCE-82297-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20tipc%20/bin/true%0Ablacklist%20tipc%0A - mode: 0644 - path: /etc/modprobe.d/tipc.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install tipc" /etc/modprobe.d/tipc.conf ; then - - sed -i 's#^install tipc.*#install tipc /bin/true#g' /etc/modprobe.d/tipc.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/tipc.conf - echo "install tipc /bin/true" >> /etc/modprobe.d/tipc.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist tipc$" /etc/modprobe.d/tipc.conf ; then - echo "blacklist tipc" >> /etc/modprobe.d/tipc.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'tipc' is disabled lineinfile: create: true dest: /etc/modprobe.d/tipc.conf regexp: install\s+tipc - line: install tipc /bin/true + line: install tipc /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82297-3 @@ -198292,6 +198420,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20tipc%20/bin/true%0Ablacklist%20tipc%0A + mode: 0644 + path: /etc/modprobe.d/tipc.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install tipc" /etc/modprobe.d/tipc.conf ; then + + sed -i 's#^install tipc.*#install tipc /bin/true#g' /etc/modprobe.d/tipc.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/tipc.conf + echo "install tipc /bin/false" >> /etc/modprobe.d/tipc.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist tipc$" /etc/modprobe.d/tipc.conf ; then + echo "blacklist tipc" >> /etc/modprobe.d/tipc.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198431,55 +198593,6 @@ connections to Bluetooth devices, which entails some security risk. Nevertheless, variation in this risk decision may be expected due to the utility of Bluetooth connectivity and its limited range. - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: bluetooth.service - enabled: false - mask: true - - name: bluetooth.socket - enabled: false - mask: true - - include disable_bluetooth - -class disable_bluetooth { - service {'bluetooth': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'bluetooth.service' -"$SYSTEMCTL_EXEC" disable 'bluetooth.service' -"$SYSTEMCTL_EXEC" mask 'bluetooth.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files bluetooth.socket; then - "$SYSTEMCTL_EXEC" stop 'bluetooth.socket' - "$SYSTEMCTL_EXEC" mask 'bluetooth.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'bluetooth.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["bluetooth"] - - name: Block Disable service bluetooth block: @@ -198558,6 +198671,55 @@ disabled = ["bluetooth"] - medium_severity - no_reboot_needed - service_bluetooth_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: bluetooth.service + enabled: false + mask: true + - name: bluetooth.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["bluetooth"] + + include disable_bluetooth + +class disable_bluetooth { + service {'bluetooth': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'bluetooth.service' +"$SYSTEMCTL_EXEC" disable 'bluetooth.service' +"$SYSTEMCTL_EXEC" mask 'bluetooth.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files bluetooth.socket; then + "$SYSTEMCTL_EXEC" stop 'bluetooth.socket' + "$SYSTEMCTL_EXEC" mask 'bluetooth.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'bluetooth.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198676,52 +198838,18 @@ to prevent the loading of the Bluetooth module: SRG-OS-000095-GPOS-00049 SRG-OS-000300-GPOS-00118 RHEL-08-040111 - SV-230507r833336_rule + SV-230507r942939_rule If Bluetooth functionality must be disabled, preventing the kernel from loading the kernel module provides an additional safeguard against its activation. CCE-80832-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20bluetooth%20/bin/true%0Ablacklist%20bluetooth%0A - mode: 0644 - path: /etc/modprobe.d/bluetooth.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install bluetooth" /etc/modprobe.d/bluetooth.conf ; then - - sed -i 's#^install bluetooth.*#install bluetooth /bin/true#g' /etc/modprobe.d/bluetooth.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/bluetooth.conf - echo "install bluetooth /bin/true" >> /etc/modprobe.d/bluetooth.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist bluetooth$" /etc/modprobe.d/bluetooth.conf ; then - echo "blacklist bluetooth" >> /etc/modprobe.d/bluetooth.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'bluetooth' is disabled lineinfile: create: true dest: /etc/modprobe.d/bluetooth.conf regexp: install\s+bluetooth - line: install bluetooth /bin/true + line: install bluetooth /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80832-9 @@ -198765,6 +198893,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20bluetooth%20/bin/true%0Ablacklist%20bluetooth%0A + mode: 0644 + path: /etc/modprobe.d/bluetooth.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install bluetooth" /etc/modprobe.d/bluetooth.conf ; then + + sed -i 's#^install bluetooth.*#install bluetooth /bin/true#g' /etc/modprobe.d/bluetooth.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/bluetooth.conf + echo "install bluetooth /bin/false" >> /etc/modprobe.d/bluetooth.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist bluetooth$" /etc/modprobe.d/bluetooth.conf ; then + echo "blacklist bluetooth" >> /etc/modprobe.d/bluetooth.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198794,46 +198956,12 @@ add the following line to file /etc/modprobe.d/cfg80211.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20cfg80211%20/bin/true%0Ablacklist%20cfg80211%0A - mode: 0644 - path: /etc/modprobe.d/cfg80211.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install cfg80211" /etc/modprobe.d/cfg80211.conf ; then - - sed -i 's#^install cfg80211.*#install cfg80211 /bin/true#g' /etc/modprobe.d/cfg80211.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cfg80211.conf - echo "install cfg80211 /bin/true" >> /etc/modprobe.d/cfg80211.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist cfg80211$" /etc/modprobe.d/cfg80211.conf ; then - echo "blacklist cfg80211" >> /etc/modprobe.d/cfg80211.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'cfg80211' is disabled lineinfile: create: true dest: /etc/modprobe.d/cfg80211.conf regexp: install\s+cfg80211 - line: install cfg80211 /bin/true + line: install cfg80211 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -198871,6 +198999,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20cfg80211%20/bin/true%0Ablacklist%20cfg80211%0A + mode: 0644 + path: /etc/modprobe.d/cfg80211.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install cfg80211" /etc/modprobe.d/cfg80211.conf ; then + + sed -i 's#^install cfg80211.*#install cfg80211 /bin/true#g' /etc/modprobe.d/cfg80211.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cfg80211.conf + echo "install cfg80211 /bin/false" >> /etc/modprobe.d/cfg80211.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist cfg80211$" /etc/modprobe.d/cfg80211.conf ; then + echo "blacklist cfg80211" >> /etc/modprobe.d/cfg80211.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198900,46 +199062,12 @@ add the following line to file /etc/modprobe.d/iwlmvm.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20iwlmvm%20/bin/true%0Ablacklist%20iwlmvm%0A - mode: 0644 - path: /etc/modprobe.d/iwlmvm.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install iwlmvm" /etc/modprobe.d/iwlmvm.conf ; then - - sed -i 's#^install iwlmvm.*#install iwlmvm /bin/true#g' /etc/modprobe.d/iwlmvm.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlmvm.conf - echo "install iwlmvm /bin/true" >> /etc/modprobe.d/iwlmvm.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist iwlmvm$" /etc/modprobe.d/iwlmvm.conf ; then - echo "blacklist iwlmvm" >> /etc/modprobe.d/iwlmvm.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'iwlmvm' is disabled lineinfile: create: true dest: /etc/modprobe.d/iwlmvm.conf regexp: install\s+iwlmvm - line: install iwlmvm /bin/true + line: install iwlmvm /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -198977,6 +199105,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20iwlmvm%20/bin/true%0Ablacklist%20iwlmvm%0A + mode: 0644 + path: /etc/modprobe.d/iwlmvm.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install iwlmvm" /etc/modprobe.d/iwlmvm.conf ; then + + sed -i 's#^install iwlmvm.*#install iwlmvm /bin/true#g' /etc/modprobe.d/iwlmvm.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlmvm.conf + echo "install iwlmvm /bin/false" >> /etc/modprobe.d/iwlmvm.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist iwlmvm$" /etc/modprobe.d/iwlmvm.conf ; then + echo "blacklist iwlmvm" >> /etc/modprobe.d/iwlmvm.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199006,46 +199168,12 @@ add the following line to file /etc/modprobe.d/iwlwifi.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20iwlwifi%20/bin/true%0Ablacklist%20iwlwifi%0A - mode: 0644 - path: /etc/modprobe.d/iwlwifi.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install iwlwifi" /etc/modprobe.d/iwlwifi.conf ; then - - sed -i 's#^install iwlwifi.*#install iwlwifi /bin/true#g' /etc/modprobe.d/iwlwifi.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlwifi.conf - echo "install iwlwifi /bin/true" >> /etc/modprobe.d/iwlwifi.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist iwlwifi$" /etc/modprobe.d/iwlwifi.conf ; then - echo "blacklist iwlwifi" >> /etc/modprobe.d/iwlwifi.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'iwlwifi' is disabled lineinfile: create: true dest: /etc/modprobe.d/iwlwifi.conf regexp: install\s+iwlwifi - line: install iwlwifi /bin/true + line: install iwlwifi /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -199083,6 +199211,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20iwlwifi%20/bin/true%0Ablacklist%20iwlwifi%0A + mode: 0644 + path: /etc/modprobe.d/iwlwifi.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install iwlwifi" /etc/modprobe.d/iwlwifi.conf ; then + + sed -i 's#^install iwlwifi.*#install iwlwifi /bin/true#g' /etc/modprobe.d/iwlwifi.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlwifi.conf + echo "install iwlwifi /bin/false" >> /etc/modprobe.d/iwlwifi.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist iwlwifi$" /etc/modprobe.d/iwlwifi.conf ; then + echo "blacklist iwlwifi" >> /etc/modprobe.d/iwlwifi.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199112,46 +199274,12 @@ add the following line to file /etc/modprobe.d/mac80211.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20mac80211%20/bin/true%0Ablacklist%20mac80211%0A - mode: 0644 - path: /etc/modprobe.d/mac80211.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install mac80211" /etc/modprobe.d/mac80211.conf ; then - - sed -i 's#^install mac80211.*#install mac80211 /bin/true#g' /etc/modprobe.d/mac80211.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/mac80211.conf - echo "install mac80211 /bin/true" >> /etc/modprobe.d/mac80211.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist mac80211$" /etc/modprobe.d/mac80211.conf ; then - echo "blacklist mac80211" >> /etc/modprobe.d/mac80211.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'mac80211' is disabled lineinfile: create: true dest: /etc/modprobe.d/mac80211.conf regexp: install\s+mac80211 - line: install mac80211 /bin/true + line: install mac80211 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -199189,6 +199317,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20mac80211%20/bin/true%0Ablacklist%20mac80211%0A + mode: 0644 + path: /etc/modprobe.d/mac80211.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install mac80211" /etc/modprobe.d/mac80211.conf ; then + + sed -i 's#^install mac80211.*#install mac80211 /bin/true#g' /etc/modprobe.d/mac80211.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/mac80211.conf + echo "install mac80211 /bin/false" >> /etc/modprobe.d/mac80211.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist mac80211$" /etc/modprobe.d/mac80211.conf ; then + echo "blacklist mac80211" >> /etc/modprobe.d/mac80211.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199430,25 +199592,6 @@ serve to create a man-in-the-middle attack or be used to create a denial of service to valid network resources. CCE-83501-7 - -if ! rpm -q --quiet "NetworkManager" ; then - yum install -y "NetworkManager" -fi - -if command -v nmcli >/dev/null 2>&1 && systemctl is-active NetworkManager >/dev/null 2>&1; then - nmcli radio all off -fi - -if command -v wicked >/dev/null 2>&1 && systemctl is-active wickedd >/dev/null 2>&1; then - if [ -n "$(find /sys/class/net/*/ -type d -name wireless)" ]; then - interfaces=$(find /sys/class/net/*/wireless -type d -name wireless | xargs -0 dirname | xargs basename) - for iface in $interfaces; do - wicked ifdown $iface - sed -i 's/STARTMODE=.*/STARTMODE=off/' /etc/sysconfig/network/ifcfg-$iface - done - fi -fi - - name: Gather the package facts package_facts: manager: auto @@ -199544,6 +199687,25 @@ fi - no_reboot_needed - unknown_strategy - wireless_disable_interfaces + + +if ! rpm -q --quiet "NetworkManager" ; then + yum install -y "NetworkManager" +fi + +if command -v nmcli >/dev/null 2>&1 && systemctl is-active NetworkManager >/dev/null 2>&1; then + nmcli radio all off +fi + +if command -v wicked >/dev/null 2>&1 && systemctl is-active wickedd >/dev/null 2>&1; then + if [ -n "$(find /sys/class/net/*/ -type d -name wireless)" ]; then + interfaces=$(find /sys/class/net/*/wireless -type d -name wireless | xargs -0 dirname | xargs basename) + for iface in $interfaces; do + wicked ifdown $iface + sed -i 's/STARTMODE=.*/STARTMODE=off/' /etc/sysconfig/network/ifcfg-$iface + done + fi +fi @@ -199642,16 +199804,6 @@ Following this, the files should be deleted or assigned to root user. CCE-83375-6 - -# At least under containerized env /proc can have files w/o possilibity to -# modify even as root. And touching /proc is not good idea anyways. -find / -path /proc -prune -o \ - -not -fstype afs -not -fstype ceph -not -fstype cifs -not -fstype smb3 -not -fstype smbfs \ - -not -fstype sshfs -not -fstype ncpfs -not -fstype ncp -not -fstype nfs -not -fstype nfs4 \ - -not -fstype gfs -not -fstype gfs2 -not -fstype glusterfs -not -fstype gpfs \ - -not -fstype pvfs2 -not -fstype ocfs2 -not -fstype lustre -not -fstype davfs \ - -not -fstype fuse.sshfs -type d -perm -0002 -uid +0 -exec chown root {} \; - - name: Ensure All World-Writable Directories Are Owned by root User - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -199822,6 +199974,16 @@ find / -path /proc -prune -o \ - medium_severity - no_reboot_needed - restrict_strategy + + +# At least under containerized env /proc can have files w/o possilibity to +# modify even as root. And touching /proc is not good idea anyways. +find / -path /proc -prune -o \ + -not -fstype afs -not -fstype ceph -not -fstype cifs -not -fstype smb3 -not -fstype smbfs \ + -not -fstype sshfs -not -fstype ncpfs -not -fstype ncp -not -fstype nfs -not -fstype nfs4 \ + -not -fstype gfs -not -fstype gfs2 -not -fstype glusterfs -not -fstype gpfs \ + -not -fstype pvfs2 -not -fstype ocfs2 -not -fstype lustre -not -fstype davfs \ + -not -fstype fuse.sshfs -type d -perm -0002 -uid +0 -exec chown root {} \; @@ -199912,11 +200074,6 @@ system, or those designed to be temporary file repositories. The setting is norm for directories used by the system, by users for temporary file storage (such as /tmp), and for directories requiring global read/write access. CCE-80783-4 - df --local -P | awk '{if (NR!=1) print $6}' \ -| xargs -I '$6' find '$6' -xdev -type d \ -\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null \ --exec chmod a+t {} + - - name: Verify that All World-Writable Directories Have Sticky Bits Set - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -200114,6 +200271,11 @@ and for directories requiring global read/write access. - medium_severity - no_reboot_needed - restrict_strategy + + df --local -P | awk '{if (NR!=1) print $6}' \ +| xargs -I '$6' find '$6' -xdev -type d \ +\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null \ +-exec chmod a+t {} + @@ -200269,13 +200431,6 @@ the audit log. Misconfigured audits may also make it more difficult to establish correlate, and investigate the events relating to an incident or identify those responsible for one. CCE-85871-2 - - - - - -chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf - - name: Test for existence /etc/audit/auditd.conf stat: path: /etc/audit/auditd.conf @@ -200306,6 +200461,13 @@ chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf @@ -200331,13 +200493,6 @@ the audit log. Misconfigured audits may also make it more difficult to establish correlate, and investigate the events relating to an incident or identify those responsible for one. CCE-85875-3 - - - - - -find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/audit/rules.d/ file(s) command: find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*rules$" @@ -200373,6 +200528,13 @@ find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -200942,6 +201104,68 @@ based on insecure file system accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of open() or creat(). CCE-81027-5 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*fs.protected_hardlinks.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + +- name: Comment out any occurrences of fs.protected_hardlinks from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*fs.protected_hardlinks + replace: '#fs.protected_hardlinks' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + +- name: Ensure sysctl fs.protected_hardlinks is set to 1 + sysctl: + name: fs.protected_hardlinks + value: '1' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -201017,20 +201241,57 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Enable Kernel Parameter to Enforce DAC on Symlinks + To set the runtime status of the fs.protected_symlinks kernel parameter, run the following command: $ sudo sysctl -w fs.protected_symlinks=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: fs.protected_symlinks = 1 + BP28(R23) + CCI-002165 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-6(a) + AC-6(1) + SRG-OS-000312-GPOS-00122 + SRG-OS-000312-GPOS-00123 + SRG-OS-000324-GPOS-00125 + RHEL-08-010373 + SV-230267r858751_rule + By enabling this kernel parameter, symbolic links are permitted to be followed +only when outside a sticky world-writable directory, or when the UID of the +link and follower match, or when the directory owner matches the symlink's owner. +Disallowing such symlinks helps mitigate vulnerabilities based on insecure file system +accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of +open() or creat(). + + CCE-81030-9 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*fs.protected_hardlinks.*$ + contains: ^[\s]*fs.protected_symlinks.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201038,18 +201299,18 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks -- name: Comment out any occurrences of fs.protected_hardlinks from config files +- name: Comment out any occurrences of fs.protected_symlinks from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*fs.protected_hardlinks - replace: '#fs.protected_hardlinks' + regexp: ^[\s]*fs.protected_symlinks + replace: '#fs.protected_symlinks' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201057,19 +201318,19 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks -- name: Ensure sysctl fs.protected_hardlinks is set to 1 +- name: Ensure sysctl fs.protected_symlinks is set to 1 sysctl: - name: fs.protected_hardlinks + name: fs.protected_symlinks value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201077,45 +201338,8 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks - - - - - - - - - Enable Kernel Parameter to Enforce DAC on Symlinks - To set the runtime status of the fs.protected_symlinks kernel parameter, run the following command: $ sudo sysctl -w fs.protected_symlinks=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: fs.protected_symlinks = 1 - BP28(R23) - CCI-002165 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-6(a) - AC-6(1) - SRG-OS-000312-GPOS-00122 - SRG-OS-000312-GPOS-00123 - SRG-OS-000324-GPOS-00125 - RHEL-08-010373 - SV-230267r858751_rule - By enabling this kernel parameter, symbolic links are permitted to be followed -only when outside a sticky world-writable directory, or when the UID of the -link and follower match, or when the directory owner matches the symlink's owner. -Disallowing such symlinks helps mitigate vulnerabilities based on insecure file system -accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of -open() or creat(). - - CCE-81030-9 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -201190,68 +201414,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*fs.protected_symlinks.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks - -- name: Comment out any occurrences of fs.protected_symlinks from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*fs.protected_symlinks - replace: '#fs.protected_symlinks' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks - -- name: Ensure sysctl fs.protected_symlinks is set to 1 - sysctl: - name: fs.protected_symlinks - value: '1' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks @@ -201299,8 +201461,6 @@ password reuse. Protection of this file is critical for system security. CCE-83475-4 - chgrp 0 /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -201333,6 +201493,8 @@ Protection of this file is important for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/group- @@ -201353,8 +201515,6 @@ Protection of this file is important for system security. The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83535-5 - chgrp 0 /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -201387,6 +201547,8 @@ it contains group password hashes. Protection of this file is critical for syste - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/gshadow- @@ -201408,8 +201570,6 @@ it contains group password hashes. Protection of this file is critical for syste it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83324-4 - chgrp 0 /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -201442,6 +201602,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/passwd- @@ -201461,8 +201623,6 @@ Protection of this file is critical for system security. it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83415-0 - chgrp 0 /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -201493,6 +201653,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/shadow- @@ -201563,8 +201725,6 @@ Protection of this file is critical for system security. The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80796-6 - chgrp 0 /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -201601,6 +201761,8 @@ on the system. Protection of this file is important for system security. + chgrp 0 /etc/group @@ -201668,8 +201830,6 @@ on the system. Protection of this file is important for system security.The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80797-4 - chgrp 0 /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -201700,6 +201860,8 @@ is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/gshadow @@ -201770,8 +201932,6 @@ is critical for system security. The /etc/passwd file contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-80798-2 - chgrp 0 /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -201808,6 +201968,8 @@ the system. Protection of this file is critical for system security. + chgrp 0 /etc/passwd @@ -201878,8 +202040,6 @@ the system. Protection of this file is critical for system security.The /etc/shadow file stores password hashes. Protection of this file is critical for system security. CCE-80799-0 - chgrp 0 /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -201916,6 +202076,8 @@ critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/shadow @@ -201935,8 +202097,6 @@ To properly set the group owner of /etc/shells, run the c The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-87030-3 - chgrp 0 /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -201967,6 +202127,8 @@ Since this file is used by many system programs this file should be protected. + chgrp 0 /etc/shells @@ -201988,8 +202150,6 @@ Since this file is used by many system programs this file should be protected. CCE-83473-9 - chown 0 /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -202022,6 +202182,8 @@ Protection of this file is important for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/group- @@ -202042,8 +202204,6 @@ Protection of this file is important for system security. The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83533-0 - chown 0 /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -202076,6 +202236,8 @@ it contains group password hashes. Protection of this file is critical for syste - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/gshadow- @@ -202097,8 +202259,6 @@ it contains group password hashes. Protection of this file is critical for syste it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83326-9 - chown 0 /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -202131,6 +202291,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/passwd- @@ -202152,8 +202314,6 @@ Protection of this file is critical for system security. it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83413-5 - chown 0 /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -202186,6 +202346,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/shadow- @@ -202257,8 +202419,6 @@ Protection of this file is critical for system security. The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80801-4 - chown 0 /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -202295,6 +202455,8 @@ on the system. Protection of this file is important for system security. + chown 0 /etc/group @@ -202364,8 +202526,6 @@ on the system. Protection of this file is important for system security.The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80802-2 - chown 0 /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -202396,6 +202556,8 @@ is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/gshadow @@ -202467,8 +202629,6 @@ is critical for system security. The /etc/passwd file contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-80803-0 - chown 0 /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -202505,6 +202665,8 @@ the system. Protection of this file is critical for system security. + chown 0 /etc/passwd @@ -202580,8 +202742,6 @@ critical for system security. Failure to give ownership of this file to root provides the designated owner with access to sensitive information which could weaken the system security posture. CCE-80804-8 - chown 0 /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -202618,6 +202778,8 @@ which could weaken the system security posture. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/shadow @@ -202637,8 +202799,6 @@ To properly set the owner of /etc/shells, run the command The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-87055-0 - chown 0 /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -202669,6 +202829,8 @@ Since this file is used by many system programs this file should be protected. + chown 0 /etc/shells @@ -202692,13 +202854,6 @@ To properly set the permissions of /etc/group-, run the c it contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-83483-8 - - - - - -chmod u-xs,g-xws,o-xwt /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -202731,6 +202886,13 @@ chmod u-xs,g-xws,o-xwt /etc/group- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/group- @@ -202751,13 +202913,6 @@ To properly set the permissions of /etc/gshadow-, run the The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83573-6 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -202786,6 +202941,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- @@ -202809,13 +202971,6 @@ To properly set the permissions of /etc/passwd-, run the it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83332-7 - - - - - -chmod u-xs,g-xws,o-xwt /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -202848,6 +203003,13 @@ chmod u-xs,g-xws,o-xwt /etc/passwd- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/passwd- @@ -202871,13 +203033,6 @@ To properly set the permissions of /etc/shadow-, run the it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83417-6 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -202910,6 +203065,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- @@ -202984,13 +203146,6 @@ To properly set the permissions of /etc/group, run the co The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80810-5 - - - - - -chmod u-xs,g-xws,o-xwt /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -203027,6 +203182,13 @@ chmod u-xs,g-xws,o-xwt /etc/group - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/group @@ -203098,13 +203260,6 @@ To properly set the permissions of /etc/gshadow, run the The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80811-3 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -203135,6 +203290,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow @@ -203211,13 +203373,6 @@ world the risk of its compromise is increased. The file contains the list of accounts on the system and associated information, and protection of this file is critical for system security. CCE-80812-1 - - - - - -chmod u-xs,g-xws,o-xwt /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -203254,6 +203409,13 @@ chmod u-xs,g-xws,o-xwt /etc/passwd - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/passwd @@ -203331,13 +203493,6 @@ critical for system security. Failure to give ownership of this file to root provides the designated owner with access to sensitive information which could weaken the system security posture. CCE-80813-9 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -203374,6 +203529,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow @@ -203393,13 +203555,6 @@ To properly set the permissions of /etc/shells, run the c The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-86634-3 - - - - - -chmod u-xs,g-xws,o-xwt /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -203430,6 +203585,13 @@ chmod u-xs,g-xws,o-xwt /etc/shells - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/shells @@ -203456,8 +203618,6 @@ personnel. messages in the system and should only be accessed by authorized personnel. CCE-83659-3 - find -H /var/log/ -maxdepth 1 -type d -exec chgrp 0 {} \; - - name: Ensure group owner on /var/log/ file: path: /var/log/ @@ -203472,6 +203632,8 @@ personnel. - low_disruption - medium_severity - no_reboot_needed + + find -H /var/log/ -maxdepth 1 -type d -exec chgrp 0 {} \; @@ -203490,8 +203652,6 @@ personnel. The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83660-1 - chgrp 0 /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203520,6 +203680,8 @@ the system and should only be accessed by authorized personnel. + chgrp 0 /var/log/messages @@ -203535,8 +203697,6 @@ the system and should only be accessed by authorized personnel.SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - chgrp 4 /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203561,6 +203721,8 @@ the system and should only be accessed by authorized personnel. + chgrp 4 /var/log/syslog @@ -203581,8 +203743,6 @@ the system and should only be accessed by authorized personnel. CCE-83661-9 - find -H /var/log/ -maxdepth 1 -type d -exec chown 0 {} \; - - name: Ensure owner on directory /var/log/ file: path: /var/log/ @@ -203597,6 +203757,8 @@ personnel. - low_disruption - medium_severity - no_reboot_needed + + find -H /var/log/ -maxdepth 1 -type d -exec chown 0 {} \; @@ -203615,8 +203777,6 @@ personnel. The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83662-7 - chown 0 /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203645,6 +203805,8 @@ the system and should only be accessed by authorized personnel. + chown 0 /var/log/messages @@ -203660,8 +203822,6 @@ the system and should only be accessed by authorized personnel.SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - chown 104 /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203686,6 +203846,8 @@ the system and should only be accessed by authorized personnel. + chown 104 /var/log/syslog @@ -203708,13 +203870,6 @@ To properly set the permissions of /var/log, run the comm messages in the system and should only be accessed by authorized personnel. CCE-83663-5 - - - - - -find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - - name: Find /var/log/ file(s) command: 'find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d ' register: files_found @@ -203747,6 +203902,13 @@ find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws, - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; @@ -203767,13 +203929,6 @@ To properly set the permissions of /var/log/messages, run The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83665-0 - - - - - -chmod u-xs,g-xws,o-xwrt /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203802,6 +203957,13 @@ chmod u-xs,g-xws,o-xwrt /var/log/messages - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /var/log/messages @@ -203819,13 +203981,6 @@ To properly set the permissions of /var/log/syslog, run t SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - - - - - -chmod u-xs,g-xws,o-xwrt /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203850,6 +204005,13 @@ chmod u-xs,g-xws,o-xwrt /var/log/syslog - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /var/log/syslog @@ -203893,11 +204055,6 @@ space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership of library directories is necessary to protect the integrity of the system. CCE-85894-4 - find -H /lib/ -type d -exec chgrp 0 {} \; -find -H /lib64/ -type d -exec chgrp 0 {} \; -find -H /usr/lib/ -type d -exec chgrp 0 {} \; -find -H /usr/lib64/ -type d -exec chgrp 0 {} \; - - name: Ensure group owner on /lib/ recursively file: path: /lib/ @@ -203969,6 +204126,11 @@ find -H /usr/lib64/ -type d -exec chgrp 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /lib/ -type d -exec chgrp 0 {} \; +find -H /lib64/ -type d -exec chgrp 0 {} \; +find -H /usr/lib/ -type d -exec chgrp 0 {} \; +find -H /usr/lib64/ -type d -exec chgrp 0 {} \; @@ -203995,13 +204157,6 @@ following command: System binaries are executed by privileged users as well as system services, and restrictive permissions are necessary to ensure that their execution of these programs cannot be co-opted. - find -H /bin/ -type d -exec chown 0 {} \; -find -H /sbin/ -type d -exec chown 0 {} \; -find -H /usr/bin/ -type d -exec chown 0 {} \; -find -H /usr/sbin/ -type d -exec chown 0 {} \; -find -H /usr/local/bin/ -type d -exec chown 0 {} \; -find -H /usr/local/sbin/ -type d -exec chown 0 {} \; - - name: Ensure owner on directory /bin/ recursively file: path: /bin/ @@ -204085,6 +204240,13 @@ find -H /usr/local/sbin/ -type d -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /bin/ -type d -exec chown 0 {} \; +find -H /sbin/ -type d -exec chown 0 {} \; +find -H /usr/bin/ -type d -exec chown 0 {} \; +find -H /usr/sbin/ -type d -exec chown 0 {} \; +find -H /usr/local/bin/ -type d -exec chown 0 {} \; +find -H /usr/local/sbin/ -type d -exec chown 0 {} \; @@ -204120,11 +204282,6 @@ space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership of library directories is necessary to protect the integrity of the system. CCE-89021-0 - find -H /lib/ -type d -exec chown 0 {} \; -find -H /lib64/ -type d -exec chown 0 {} \; -find -H /usr/lib/ -type d -exec chown 0 {} \; -find -H /usr/lib64/ -type d -exec chown 0 {} \; - - name: Ensure owner on directory /lib/ recursively file: path: /lib/ @@ -204196,6 +204353,11 @@ find -H /usr/lib64/ -type d -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /lib/ -type d -exec chown 0 {} \; +find -H /lib64/ -type d -exec chown 0 {} \; +find -H /usr/lib/ -type d -exec chown 0 {} \; +find -H /usr/lib64/ -type d -exec chown 0 {} \; @@ -204223,23 +204385,6 @@ following command: System binaries are executed by privileged users, as well as system services, and restrictive permissions are necessary to ensure execution of these programs cannot be co-opted. - - - - - -find -H /bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/local/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - - name: Find /bin/ file(s) recursively command: 'find -H /bin/ -perm /u+s,g+ws,o+wt -type d ' register: files_found @@ -204413,6 +204558,23 @@ find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/local/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; @@ -204455,19 +204617,6 @@ privileged programs which execute with escalated privileges. Only qualified and individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-88692-9 - - - - - -find -H /lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /usr/lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - - name: Find /lib/ file(s) recursively command: 'find -H /lib/ -perm /g+w,o+w -type d ' register: files_found @@ -204623,6 +204772,19 @@ find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /usr/lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; @@ -204655,6 +204817,7 @@ generators CCI-001494 SRG-OS-000256-GPiOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.10 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -204664,14 +204827,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86455-3 - chgrp 0 /sbin/auditctl -chgrp 0 /sbin/aureport -chgrp 0 /sbin/ausearch -chgrp 0 /sbin/autrace -chgrp 0 /sbin/auditd -chgrp 0 /sbin/audispd -chgrp 0 /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -204860,6 +205015,14 @@ chgrp 0 /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /sbin/auditctl +chgrp 0 /sbin/aureport +chgrp 0 /sbin/ausearch +chgrp 0 /sbin/autrace +chgrp 0 /sbin/auditd +chgrp 0 /sbin/audispd +chgrp 0 /sbin/augenrules @@ -204901,12 +205064,6 @@ escalated privileges. Only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-86519-6 - -for SYSCMDFILES in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin -do - find -L $SYSCMDFILES \! -group root -type f -exec chgrp root '{}' \; -done - - name: Retrieve the system command files and set their group ownership to root command: find -L {{ item }} ! -group root -type f -exec chgrp root '{}' \; with_items: @@ -204930,6 +205087,12 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for SYSCMDFILES in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin +do + find -L $SYSCMDFILES \! -group root -type f -exec chgrp root '{}' \; +done @@ -204962,6 +205125,7 @@ generators CCI-001494 SRG-OS-000256-GPiOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.9 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -204971,14 +205135,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86453-8 - chown 0 /sbin/auditctl -chown 0 /sbin/aureport -chown 0 /sbin/ausearch -chown 0 /sbin/autrace -chown 0 /sbin/auditd -chown 0 /sbin/audispd -chown 0 /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -205167,6 +205323,14 @@ chown 0 /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + chown 0 /sbin/auditctl +chown 0 /sbin/aureport +chown 0 /sbin/ausearch +chown 0 /sbin/autrace +chown 0 /sbin/auditd +chown 0 /sbin/audispd +chown 0 /sbin/augenrules @@ -205251,15 +205415,6 @@ following command: and restrictive permissions are necessary to ensure that their execution of these programs cannot be co-opted. CCE-80806-3 - find /bin/ \ -/usr/bin/ \ -/usr/local/bin/ \ -/sbin/ \ -/usr/sbin/ \ -/usr/local/sbin/ \ -/usr/libexec \ -\! -user root -execdir chown root {} \; - - name: Read list of system executables without root ownership command: find /bin/ /usr/bin/ /usr/local/bin/ /sbin/ /usr/sbin/ /usr/local/sbin/ /usr/libexec \! -user root @@ -205300,6 +205455,15 @@ execution of these programs cannot be co-opted. - medium_severity - no_reboot_needed - restrict_strategy + + find /bin/ \ +/usr/bin/ \ +/usr/local/bin/ \ +/sbin/ \ +/usr/sbin/ \ +/usr/local/sbin/ \ +/usr/libexec \ +\! -user root -execdir chown root {} \; @@ -205385,15 +205549,6 @@ ownership with the following command: space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership is necessary to protect the integrity of the system. CCE-80807-1 - -find /lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /usr/lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - - name: Find /lib/ file(s) matching ^.*$ recursively command: find -H /lib/ -type f ! -uid 0 -regex "^.*$" register: files_found @@ -205557,6 +205712,15 @@ find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + +find /lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /usr/lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; @@ -205589,6 +205753,7 @@ generators CCI-001494 SRG-OS-000256-GPOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.8 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -205598,25 +205763,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86447-0 - - - - - -chmod u-s,g-ws,o-wt /sbin/auditctl - -chmod u-s,g-ws,o-wt /sbin/aureport - -chmod u-s,g-ws,o-wt /sbin/ausearch - -chmod u-s,g-ws,o-wt /sbin/autrace - -chmod u-s,g-ws,o-wt /sbin/auditd - -chmod u-s,g-ws,o-wt /sbin/audispd - -chmod u-s,g-ws,o-wt /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -205805,6 +205951,25 @@ chmod u-s,g-ws,o-wt /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-s,g-ws,o-wt /sbin/auditctl + +chmod u-s,g-ws,o-wt /sbin/aureport + +chmod u-s,g-ws,o-wt /sbin/ausearch + +chmod u-s,g-ws,o-wt /sbin/autrace + +chmod u-s,g-ws,o-wt /sbin/auditd + +chmod u-s,g-ws,o-wt /sbin/audispd + +chmod u-s,g-ws,o-wt /sbin/augenrules @@ -205889,11 +206054,6 @@ following command: and restrictive permissions are necessary to ensure execution of these programs cannot be co-opted. CCE-80809-7 - DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec" -for dirPath in $DIRS; do - find "$dirPath" -perm /022 -exec chmod go-w '{}' \; -done - - name: Read list of world and group writable system executables ansible.builtin.command: find /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec -perm /022 -type f @@ -205935,6 +206095,11 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec" +for dirPath in $DIRS; do + find "$dirPath" -perm /022 -exec chmod go-w '{}' \; +done @@ -206020,19 +206185,6 @@ its permission with the following command: space of processes (including privileged ones) or of the kernel itself at runtime. Restrictive permissions are necessary to protect the integrity of the system. CCE-80815-4 - - - - - -find -H /lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /usr/lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - - name: Find /lib/ file(s) recursively command: find -H /lib/ -perm /g+w,o+w -type f -regex "^.*$" register: files_found @@ -206196,6 +206348,19 @@ find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w { - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /usr/lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; @@ -206234,15 +206399,6 @@ also include privileged programs which execute with escalated privileges. Only q and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-86523-8 - -find /lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /usr/lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - - name: Find /lib/ file(s) matching ^.*$ recursively command: find -H /lib/ -type f ! -group 0 -regex "^.*$" register: files_found @@ -206390,6 +206546,15 @@ find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - medium_severity - no_reboot_needed - root_permissions_syslibrary_files + + +find /lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /usr/lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; @@ -206515,52 +206680,6 @@ Additionally, automatically mounting filesystems permits easy introduction of unknown devices, thereby facilitating malicious activity. CCE-80873-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - enabled: false - name: autofs.service - - include disable_autofs - -class disable_autofs { - service {'autofs': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q autofs ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'autofs.service' -"$SYSTEMCTL_EXEC" disable 'autofs.service' -"$SYSTEMCTL_EXEC" mask 'autofs.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files autofs.socket; then - "$SYSTEMCTL_EXEC" stop 'autofs.socket' - "$SYSTEMCTL_EXEC" mask 'autofs.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'autofs.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["autofs"] - - name: Gather the package facts package_facts: manager: auto @@ -206660,6 +206779,52 @@ disabled = ["autofs"] - medium_severity - no_reboot_needed - service_autofs_disabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - enabled: false + name: autofs.service + + +[customizations.services] +disabled = ["autofs"] + + include disable_autofs + +class disable_autofs { + service {'autofs': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q autofs ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'autofs.service' +"$SYSTEMCTL_EXEC" disable 'autofs.service' +"$SYSTEMCTL_EXEC" mask 'autofs.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files autofs.socket; then + "$SYSTEMCTL_EXEC" stop 'autofs.socket' + "$SYSTEMCTL_EXEC" mask 'autofs.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'autofs.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -206872,51 +207037,17 @@ decompress the image. SRG-OS-000095-GPOS-00049 RHEL-08-040025 1.1.1.1 - SV-230498r792922_rule + SV-230498r942930_rule Removing support for unneeded filesystem types reduces the local attack surface of the server. CCE-81031-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20cramfs%20/bin/true%0Ablacklist%20cramfs%0A - mode: 0644 - path: /etc/modprobe.d/cramfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install cramfs" /etc/modprobe.d/cramfs.conf ; then - - sed -i 's#^install cramfs.*#install cramfs /bin/true#g' /etc/modprobe.d/cramfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cramfs.conf - echo "install cramfs /bin/true" >> /etc/modprobe.d/cramfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist cramfs$" /etc/modprobe.d/cramfs.conf ; then - echo "blacklist cramfs" >> /etc/modprobe.d/cramfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'cramfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/cramfs.conf regexp: install\s+cramfs - line: install cramfs /bin/true + line: install cramfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-81031-7 @@ -206952,6 +207083,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20cramfs%20/bin/true%0Ablacklist%20cramfs%0A + mode: 0644 + path: /etc/modprobe.d/cramfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install cramfs" /etc/modprobe.d/cramfs.conf ; then + + sed -i 's#^install cramfs.*#install cramfs /bin/true#g' /etc/modprobe.d/cramfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cramfs.conf + echo "install cramfs /bin/false" >> /etc/modprobe.d/cramfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist cramfs$" /etc/modprobe.d/cramfs.conf ; then + echo "blacklist cramfs" >> /etc/modprobe.d/cramfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207045,46 +207210,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86615-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20freevxfs%20/bin/true%0Ablacklist%20freevxfs%0A - mode: 0644 - path: /etc/modprobe.d/freevxfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install freevxfs" /etc/modprobe.d/freevxfs.conf ; then - - sed -i 's#^install freevxfs.*#install freevxfs /bin/true#g' /etc/modprobe.d/freevxfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/freevxfs.conf - echo "install freevxfs /bin/true" >> /etc/modprobe.d/freevxfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist freevxfs$" /etc/modprobe.d/freevxfs.conf ; then - echo "blacklist freevxfs" >> /etc/modprobe.d/freevxfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'freevxfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/freevxfs.conf regexp: install\s+freevxfs - line: install freevxfs /bin/true + line: install freevxfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86615-2 @@ -207118,6 +207249,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20freevxfs%20/bin/true%0Ablacklist%20freevxfs%0A + mode: 0644 + path: /etc/modprobe.d/freevxfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install freevxfs" /etc/modprobe.d/freevxfs.conf ; then + + sed -i 's#^install freevxfs.*#install freevxfs /bin/true#g' /etc/modprobe.d/freevxfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/freevxfs.conf + echo "install freevxfs /bin/false" >> /etc/modprobe.d/freevxfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist freevxfs$" /etc/modprobe.d/freevxfs.conf ; then + echo "blacklist freevxfs" >> /etc/modprobe.d/freevxfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207208,46 +207373,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86616-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20hfs%20/bin/true%0Ablacklist%20hfs%0A - mode: 0644 - path: /etc/modprobe.d/hfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install hfs" /etc/modprobe.d/hfs.conf ; then - - sed -i 's#^install hfs.*#install hfs /bin/true#g' /etc/modprobe.d/hfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfs.conf - echo "install hfs /bin/true" >> /etc/modprobe.d/hfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist hfs$" /etc/modprobe.d/hfs.conf ; then - echo "blacklist hfs" >> /etc/modprobe.d/hfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'hfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/hfs.conf regexp: install\s+hfs - line: install hfs /bin/true + line: install hfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86616-0 @@ -207281,6 +207412,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20hfs%20/bin/true%0Ablacklist%20hfs%0A + mode: 0644 + path: /etc/modprobe.d/hfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install hfs" /etc/modprobe.d/hfs.conf ; then + + sed -i 's#^install hfs.*#install hfs /bin/true#g' /etc/modprobe.d/hfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfs.conf + echo "install hfs /bin/false" >> /etc/modprobe.d/hfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist hfs$" /etc/modprobe.d/hfs.conf ; then + echo "blacklist hfs" >> /etc/modprobe.d/hfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207371,46 +207536,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86617-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20hfsplus%20/bin/true%0Ablacklist%20hfsplus%0A - mode: 0644 - path: /etc/modprobe.d/hfsplus.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install hfsplus" /etc/modprobe.d/hfsplus.conf ; then - - sed -i 's#^install hfsplus.*#install hfsplus /bin/true#g' /etc/modprobe.d/hfsplus.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfsplus.conf - echo "install hfsplus /bin/true" >> /etc/modprobe.d/hfsplus.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist hfsplus$" /etc/modprobe.d/hfsplus.conf ; then - echo "blacklist hfsplus" >> /etc/modprobe.d/hfsplus.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'hfsplus' is disabled lineinfile: create: true dest: /etc/modprobe.d/hfsplus.conf regexp: install\s+hfsplus - line: install hfsplus /bin/true + line: install hfsplus /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86617-8 @@ -207444,6 +207575,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20hfsplus%20/bin/true%0Ablacklist%20hfsplus%0A + mode: 0644 + path: /etc/modprobe.d/hfsplus.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install hfsplus" /etc/modprobe.d/hfsplus.conf ; then + + sed -i 's#^install hfsplus.*#install hfsplus /bin/true#g' /etc/modprobe.d/hfsplus.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfsplus.conf + echo "install hfsplus /bin/false" >> /etc/modprobe.d/hfsplus.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist hfsplus$" /etc/modprobe.d/hfsplus.conf ; then + echo "blacklist hfsplus" >> /etc/modprobe.d/hfsplus.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207534,46 +207699,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86618-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20jffs2%20/bin/true%0Ablacklist%20jffs2%0A - mode: 0644 - path: /etc/modprobe.d/jffs2.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install jffs2" /etc/modprobe.d/jffs2.conf ; then - - sed -i 's#^install jffs2.*#install jffs2 /bin/true#g' /etc/modprobe.d/jffs2.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/jffs2.conf - echo "install jffs2 /bin/true" >> /etc/modprobe.d/jffs2.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist jffs2$" /etc/modprobe.d/jffs2.conf ; then - echo "blacklist jffs2" >> /etc/modprobe.d/jffs2.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'jffs2' is disabled lineinfile: create: true dest: /etc/modprobe.d/jffs2.conf regexp: install\s+jffs2 - line: install jffs2 /bin/true + line: install jffs2 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86618-6 @@ -207607,6 +207738,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20jffs2%20/bin/true%0Ablacklist%20jffs2%0A + mode: 0644 + path: /etc/modprobe.d/jffs2.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install jffs2" /etc/modprobe.d/jffs2.conf ; then + + sed -i 's#^install jffs2.*#install jffs2 /bin/true#g' /etc/modprobe.d/jffs2.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/jffs2.conf + echo "install jffs2 /bin/false" >> /etc/modprobe.d/jffs2.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist jffs2$" /etc/modprobe.d/jffs2.conf ; then + echo "blacklist jffs2" >> /etc/modprobe.d/jffs2.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207702,46 +207867,12 @@ to first decompress the image. surface of the system. CCE-83498-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20squashfs%20/bin/true%0Ablacklist%20squashfs%0A - mode: 0644 - path: /etc/modprobe.d/squashfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install squashfs" /etc/modprobe.d/squashfs.conf ; then - - sed -i 's#^install squashfs.*#install squashfs /bin/true#g' /etc/modprobe.d/squashfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/squashfs.conf - echo "install squashfs /bin/true" >> /etc/modprobe.d/squashfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist squashfs$" /etc/modprobe.d/squashfs.conf ; then - echo "blacklist squashfs" >> /etc/modprobe.d/squashfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'squashfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/squashfs.conf regexp: install\s+squashfs - line: install squashfs /bin/true + line: install squashfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-83498-6 @@ -207775,6 +207906,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20squashfs%20/bin/true%0Ablacklist%20squashfs%0A + mode: 0644 + path: /etc/modprobe.d/squashfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install squashfs" /etc/modprobe.d/squashfs.conf ; then + + sed -i 's#^install squashfs.*#install squashfs /bin/true#g' /etc/modprobe.d/squashfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/squashfs.conf + echo "install squashfs /bin/false" >> /etc/modprobe.d/squashfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist squashfs$" /etc/modprobe.d/squashfs.conf ; then + echo "blacklist squashfs" >> /etc/modprobe.d/squashfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207871,46 +208036,12 @@ writing DVDs and newer optical disc formats. attack surface of the system. CCE-82729-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20udf%20/bin/true%0Ablacklist%20udf%0A - mode: 0644 - path: /etc/modprobe.d/udf.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install udf" /etc/modprobe.d/udf.conf ; then - - sed -i 's#^install udf.*#install udf /bin/true#g' /etc/modprobe.d/udf.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/udf.conf - echo "install udf /bin/true" >> /etc/modprobe.d/udf.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist udf$" /etc/modprobe.d/udf.conf ; then - echo "blacklist udf" >> /etc/modprobe.d/udf.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'udf' is disabled lineinfile: create: true dest: /etc/modprobe.d/udf.conf regexp: install\s+udf - line: install udf /bin/true + line: install udf /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82729-5 @@ -207944,6 +208075,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20udf%20/bin/true%0Ablacklist%20udf%0A + mode: 0644 + path: /etc/modprobe.d/udf.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install udf" /etc/modprobe.d/udf.conf ; then + + sed -i 's#^install udf.*#install udf /bin/true#g' /etc/modprobe.d/udf.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/udf.conf + echo "install udf /bin/false" >> /etc/modprobe.d/udf.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist udf$" /etc/modprobe.d/udf.conf ; then + echo "blacklist udf" >> /etc/modprobe.d/udf.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208045,51 +208210,17 @@ module, but will not prevent an administrator (or another program) from using th SRG-OS-000480-GPOS-00227 RHEL-08-040080 1.1.1.8 - SV-230503r809319_rule + SV-230503r942936_rule USB storage devices such as thumb drives can be used to introduce malicious software. CCE-80835-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20usb-storage%20/bin/true%0Ablacklist%20usb-storage%0A - mode: 0644 - path: /etc/modprobe.d/usb-storage.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install usb-storage" /etc/modprobe.d/usb-storage.conf ; then - - sed -i 's#^install usb-storage.*#install usb-storage /bin/true#g' /etc/modprobe.d/usb-storage.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/usb-storage.conf - echo "install usb-storage /bin/true" >> /etc/modprobe.d/usb-storage.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist usb-storage$" /etc/modprobe.d/usb-storage.conf ; then - echo "blacklist usb-storage" >> /etc/modprobe.d/usb-storage.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'usb-storage' is disabled lineinfile: create: true dest: /etc/modprobe.d/usb-storage.conf regexp: install\s+usb-storage - line: install usb-storage /bin/true + line: install usb-storage /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80835-2 @@ -208129,6 +208260,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20usb-storage%20/bin/true%0Ablacklist%20usb-storage%0A + mode: 0644 + path: /etc/modprobe.d/usb-storage.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install usb-storage" /etc/modprobe.d/usb-storage.conf ; then + + sed -i 's#^install usb-storage.*#install usb-storage /bin/true#g' /etc/modprobe.d/usb-storage.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/usb-storage.conf + echo "install usb-storage /bin/false" >> /etc/modprobe.d/usb-storage.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist usb-storage$" /etc/modprobe.d/usb-storage.conf ; then + echo "blacklist usb-storage" >> /etc/modprobe.d/usb-storage.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208227,46 +208392,12 @@ all of which are supported by the vfat kernel module. CCE-82170-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20vfat%20/bin/true%0Ablacklist%20vfat%0A - mode: 0644 - path: /etc/modprobe.d/vfat.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install vfat" /etc/modprobe.d/vfat.conf ; then - - sed -i 's#^install vfat.*#install vfat /bin/true#g' /etc/modprobe.d/vfat.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/vfat.conf - echo "install vfat /bin/true" >> /etc/modprobe.d/vfat.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist vfat$" /etc/modprobe.d/vfat.conf ; then - echo "blacklist vfat" >> /etc/modprobe.d/vfat.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'vfat' is disabled lineinfile: create: true dest: /etc/modprobe.d/vfat.conf regexp: install\s+vfat - line: install vfat /bin/true + line: install vfat /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82170-2 @@ -208300,6 +208431,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20vfat%20/bin/true%0Ablacklist%20vfat%0A + mode: 0644 + path: /etc/modprobe.d/vfat.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install vfat" /etc/modprobe.d/vfat.conf ; then + + sed -i 's#^install vfat.*#install vfat /bin/true#g' /etc/modprobe.d/vfat.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/vfat.conf + echo "install vfat /bin/false" >> /etc/modprobe.d/vfat.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist vfat$" /etc/modprobe.d/vfat.conf ; then + echo "blacklist vfat" >> /etc/modprobe.d/vfat.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208353,57 +208518,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from boot partitions. CCE-86038-7 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && [ -d /sys/firmware/efi ] ); then - -function perform_remediation { - - # the mount point /boot/efi has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot/efi")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/boot/efi' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /boot/efi in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot/efi)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /boot/efi defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/boot/efi"; then - if mountpoint -q "/boot/efi"; then - mount -o remount --target "/boot/efi" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /boot/efi: Check information associated to mountpoint' command: findmnt --fstab '/boot/efi' register: device_name @@ -208524,57 +208638,29 @@ fi - mount_option_boot_efi_nosuid - no_reboot_needed - - - - - - - - - Add noauto Option to /boot - The noauto mount option is used to prevent automatic mounting of th -/boot partition. -Add the noauto option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - Although contents of the /boot partition should not be needed -during normal system operation, they might need to be accessible during -system maintenance and upgrades. Make sure that applying this rule will -not break upgrade or maintenance processes affecting the system. - BP28(R12) - The /boot partition contains the kernel and the bootloader. Access -to the partition after the boot process finishes should not be needed. Files -contained within this partition can be analysed and gained information can -be used for exploit creation. - - CCE-83345-9 - -part /boot --mountoptions="noauto" - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && [ -d /sys/firmware/efi ] ); then function perform_remediation { - # the mount point /boot has to be defined in /etc/fstab + # the mount point /boot/efi has to be defined in /etc/fstab # before this remediation can be executed. In case it is not defined, the # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot")" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot/efi")" grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/boot' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /boot in /etc/fstab" >&2; return 1; } + || { echo "The mount point '/boot/efi' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /boot/efi in /etc/fstab" >&2; return 1; } - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot)" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot/efi)" # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noauto)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208582,17 +208668,17 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}noauto 0 0" >> /etc/fstab + echo " /boot/efi defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noauto"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noauto|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi - if mkdir -p "/boot"; then - if mountpoint -q "/boot"; then - mount -o remount --target "/boot" + if mkdir -p "/boot/efi"; then + if mountpoint -q "/boot/efi"; then + mount -o remount --target "/boot/efi" fi fi } @@ -208603,6 +208689,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noauto Option to /boot + The noauto mount option is used to prevent automatic mounting of th +/boot partition. +Add the noauto option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + Although contents of the /boot partition should not be needed +during normal system operation, they might need to be accessible during +system maintenance and upgrades. Make sure that applying this rule will +not break upgrade or maintenance processes affecting the system. + BP28(R12) + The /boot partition contains the kernel and the bootloader. Access +to the partition after the boot process finishes should not be needed. Files +contained within this partition can be analysed and gained information can +be used for exploit creation. + + CCE-83345-9 - name: 'Add noauto Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -208701,50 +208812,10 @@ fi - mount_option_boot_noauto - no_reboot_needed - - - - - - - - - Add nodev Option to /boot - The nodev mount option can be used to prevent device files from -being created in /boot. -Legitimate character and block devices should exist only in -the /dev directory on the root partition or within chroot -jails built for system services. -Add the nodev option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - The only legitimate location for device files is the /dev directory -located on the root partition. The only exception to this is chroot jails. - - CCE-82941-6 - -part /boot --mountoptions="nodev" + +part /boot --mountoptions="noauto" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -208766,7 +208837,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noauto)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208774,11 +208845,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}noauto 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noauto"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noauto|" /etc/fstab fi @@ -208795,6 +208866,46 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nodev Option to /boot + The nodev mount option can be used to prevent device files from +being created in /boot. +Legitimate character and block devices should exist only in +the /dev directory on the root partition or within chroot +jails built for system services. +Add the nodev option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + The only legitimate location for device files is the /dev directory +located on the root partition. The only exception to this is chroot jails. + + CCE-82941-6 - name: 'Add nodev Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -208923,30 +209034,10 @@ fi - mount_option_boot_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /boot - The noexec mount option can be used to prevent binaries from being -executed out of /boot. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - BP28(R12) - The /boot partition contains the kernel and the bootloader. No -binaries should be executed from this partition after the booting process -finishes. - - CCE-83316-0 - -part /boot --mountoptions="noexec" + +part /boot --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -208968,7 +209059,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208976,11 +209067,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -208997,6 +209088,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /boot + The noexec mount option can be used to prevent binaries from being +executed out of /boot. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + BP28(R12) + The /boot partition contains the kernel and the bootloader. No +binaries should be executed from this partition after the booting process +finishes. + + CCE-83316-0 - name: 'Add noexec Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -209095,53 +209206,10 @@ fi - mount_option_boot_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /boot - The nosuid mount option can be used to prevent -execution of setuid programs in /boot. The SUID and SGID permissions -should not be required on the boot partition. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - BP28(R12) - CCI-000366 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - SRG-OS-000480-GPOS-00227 - RHEL-08-010571 - SV-230300r743959_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from boot partitions. - - CCE-81033-3 - -part /boot --mountoptions="nosuid" + +part /boot --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -209163,7 +209231,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -209171,11 +209239,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -209192,6 +209260,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /boot + The nosuid mount option can be used to prevent +execution of setuid programs in /boot. The SUID and SGID permissions +should not be required on the boot partition. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + BP28(R12) + CCI-000366 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + SRG-OS-000480-GPOS-00227 + RHEL-08-010571 + SV-230300r743959_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from boot partitions. + + CCE-81033-3 - name: 'Add nosuid Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -209324,6 +209435,60 @@ fi - medium_severity - mount_option_boot_nosuid - no_reboot_needed + + +part /boot --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + # the mount point /boot has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/boot' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /boot in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /boot defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/boot"; then + if mountpoint -q "/boot"; then + mount -o remount --target "/boot" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -209439,48 +209604,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-80837-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -209613,6 +209736,48 @@ fi - medium_severity - mount_option_dev_shm_nodev - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="tmpfs" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -209729,48 +209894,6 @@ Add the noexec option to the fourth column of such as /dev/shm can expose the system to potential compromise. CCE-80838-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -209904,6 +210027,48 @@ fi - medium_severity - mount_option_dev_shm_noexec - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="tmpfs" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -210019,48 +210184,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from temporary storage partitions. CCE-80839-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -210195,74 +210318,38 @@ fi - mount_option_dev_shm_nosuid - no_reboot_needed - - - - - - - - - Add grpquota Option to /home - The grpquota mount option allows for the filesystem to have disk quotas configured. -Add the grpquota option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - The quota options for XFS file systems can only be activated when mounting the partition. -It is not possible to enable them by remounting an already mounted partition. Therefore, -if the desired options were not defined before mounting the partition, dismount and mount -it again to apply the quota options. - CM-6(b) - To ensure the availability of disk space on /home, it is important to limit the impact a -single user or group can cause for other users (or the wider system) by intentionally or -accidentally filling up the partition. Quotas can also be applied to inodes for filesystems -where inode exhaustion is a concern. - - CCE-86039-5 - -part /home --mountoptions="grpquota" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { - # the mount point /home has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|grpquota)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" + fs_type="tmpfs" if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}grpquota 0 0" >> /etc/fstab + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "grpquota"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,grpquota|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi - if mkdir -p "/home"; then - if mountpoint -q "/home"; then - mount -o remount --target "/home" + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" fi fi } @@ -210273,6 +210360,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add grpquota Option to /home + The grpquota mount option allows for the filesystem to have disk quotas configured. +Add the grpquota option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + The quota options for XFS file systems can only be activated when mounting the partition. +It is not possible to enable them by remounting an already mounted partition. Therefore, +if the desired options were not defined before mounting the partition, dismount and mount +it again to apply the quota options. + CM-6(b) + To ensure the availability of disk space on /home, it is important to limit the impact a +single user or group can cause for other users (or the wider system) by intentionally or +accidentally filling up the partition. Quotas can also be applied to inodes for filesystems +where inode exhaustion is a concern. + + CCE-86039-5 - name: 'Add grpquota Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210381,34 +210492,10 @@ fi - mount_option_home_grpquota - no_reboot_needed - - - - - - - - - Add nodev Option to /home - The nodev mount option can be used to prevent device files from -being created in /home. -Legitimate character and block devices should exist only in -the /dev directory on the root partition or within chroot -jails built for system services. -Add the nodev option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - BP28(R12) - SRG-OS-000368-GPOS-00154 - 1.1.2.3.2 - The only legitimate location for device files is the /dev directory -located on the root partition. The only exception to this is chroot jails. - - CCE-81048-1 - -part /home --mountoptions="nodev" + +part /home --mountoptions="grpquota" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -210430,7 +210517,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|grpquota)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -210438,11 +210525,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}grpquota 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "grpquota"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,grpquota|" /etc/fstab fi @@ -210459,6 +210546,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nodev Option to /home + The nodev mount option can be used to prevent device files from +being created in /home. +Legitimate character and block devices should exist only in +the /dev directory on the root partition or within chroot +jails built for system services. +Add the nodev option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + BP28(R12) + SRG-OS-000368-GPOS-00154 + 1.1.2.3.2 + The only legitimate location for device files is the /dev directory +located on the root partition. The only exception to this is chroot jails. + + CCE-81048-1 - name: 'Add nodev Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210562,36 +210673,11 @@ fi - no_reboot_needed - unknown_severity - - - - - - - - - Add noexec Option to /home - The noexec mount option can be used to prevent binaries from being -executed out of /home. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - BP28(R12) - CCI-000366 - CM-6(b) - SRG-OS-000480-GPOS-00227 - RHEL-08-010590 - SV-230302r627750_rule - The /home directory contains data of individual users. Binaries in -this directory should not be considered as trusted and users should not be -able to execute them. - - CCE-83328-5 - -part /home --mountoptions="noexec" + +part /home --mountoptions="nodev" - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -210612,7 +210698,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -210620,11 +210706,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -210641,6 +210727,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /home + The noexec mount option can be used to prevent binaries from being +executed out of /home. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + BP28(R12) + CCI-000366 + CM-6(b) + SRG-OS-000480-GPOS-00227 + RHEL-08-010590 + SV-230302r627750_rule + The /home directory contains data of individual users. Binaries in +this directory should not be considered as trusted and users should not be +able to execute them. + + CCE-83328-5 - name: 'Add noexec Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210748,6 +210859,60 @@ fi - medium_severity - mount_option_home_noexec - no_reboot_needed + + +part /home --mountoptions="noexec" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + # the mount point /home has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /home defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/home"; then + if mountpoint -q "/home"; then + mount -o remount --target "/home" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -210865,60 +211030,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from user home directory partitions. CCE-81050-7 - -part /home --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then - -function perform_remediation { - - # the mount point /home has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /home defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/home"; then - if mountpoint -q "/home"; then - mount -o remount --target "/home" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -211057,34 +211168,10 @@ fi - mount_option_home_nosuid - no_reboot_needed - - - - - - - - - Add usrquota Option to /home - The usrquota mount option allows for the filesystem to have disk quotas configured. -Add the usrquota option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - The quota options for XFS file systems can only be activated when mounting the partition. -It is not possible to enable them by remounting an already mounted partition. Therefore, -if the desired options were not defined before mounting the partition, dismount and mount -it again to apply the quota options. - CM-6(b) - To ensure the availability of disk space on /home, it is important to limit the impact a -single user or group can cause for other users (or the wider system) by intentionally or -accidentally filling up the partition. Quotas can also be applied to inodes for filesystems -where inode exhaustion is a concern. - - CCE-86035-3 - -part /home --mountoptions="usrquota" + +part /home --mountoptions="nosuid" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -211106,7 +211193,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|usrquota)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -211114,11 +211201,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}usrquota 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "usrquota"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,usrquota|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi @@ -211135,6 +211222,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add usrquota Option to /home + The usrquota mount option allows for the filesystem to have disk quotas configured. +Add the usrquota option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + The quota options for XFS file systems can only be activated when mounting the partition. +It is not possible to enable them by remounting an already mounted partition. Therefore, +if the desired options were not defined before mounting the partition, dismount and mount +it again to apply the quota options. + CM-6(b) + To ensure the availability of disk space on /home, it is important to limit the impact a +single user or group can cause for other users (or the wider system) by intentionally or +accidentally filling up the partition. Quotas can also be applied to inodes for filesystems +where inode exhaustion is a concern. + + CCE-86035-3 - name: 'Add usrquota Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -211242,6 +211353,60 @@ fi - medium_severity - mount_option_home_usrquota - no_reboot_needed + + +part /home --mountoptions="usrquota" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then + +function perform_remediation { + + # the mount point /home has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|usrquota)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /home defaults,${previous_mount_opts}usrquota 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "usrquota"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,usrquota|" /etc/fstab + fi + + + if mkdir -p "/home"; then + if mountpoint -q "/home"; then + mount -o remount --target "/home" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211352,6 +211517,35 @@ The only exception to this is chroot jails, for which it is not advised to set nodev on these filesystems. CCE-82069-6 + - name: Ensure non-root local partitions are mounted with nodev option + mount: + path: '{{ item.mount }}' + src: '{{ item.device }}' + opts: '{{ item.options }},nodev' + state: mounted + fstype: '{{ item.fstype }}' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - item.mount is match('/\w') + - item.options is not search('nodev') + with_items: + - '{{ ansible_facts.mounts }}' + tags: + - CCE-82069-6 + - DISA-STIG-RHEL-08-010580 + - NIST-800-53-AC-6 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-MP-7 + - configure_strategy + - high_disruption + - low_complexity + - medium_severity + - mount_option_nodev_nonroot_local_partitions + - no_reboot_needed + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -211402,35 +211596,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure non-root local partitions are mounted with nodev option - mount: - path: '{{ item.mount }}' - src: '{{ item.device }}' - opts: '{{ item.options }},nodev' - state: mounted - fstype: '{{ item.fstype }}' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - item.mount is match('/\w') - - item.options is not search('nodev') - with_items: - - '{{ ansible_facts.mounts }}' - tags: - - CCE-82069-6 - - DISA-STIG-RHEL-08-010580 - - NIST-800-53-AC-6 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-MP-7 - - configure_strategy - - high_disruption - - low_complexity - - medium_severity - - mount_option_nodev_nonroot_local_partitions - - no_reboot_needed @@ -211568,26 +211733,6 @@ not advised to set nodev on partitions which contain thei filesystems. CCE-82742-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="nodev" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -211616,6 +211761,26 @@ fi - medium_severity - mount_option_nodev_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="nodev" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211752,26 +211917,6 @@ Add the noexec option to the fourth column of the system to potential compromise. CCE-82746-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="noexec" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -211800,6 +211945,26 @@ fi - medium_severity - mount_option_noexec_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="noexec" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211962,26 +212127,6 @@ users to introduce SUID or SGID binaries from partitions mounted off of removable media would allow them to introduce their own highly-privileged programs. CCE-82744-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="nosuid" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -212010,6 +212155,26 @@ fi - medium_severity - mount_option_nosuid_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="nosuid" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212033,60 +212198,6 @@ Add the nosuid option to the fourth column of not be able to execute SUID or SGID binaries from this directory. CCE-83319-4 - -part /opt --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/opt" > /dev/null || findmnt --fstab "/opt" > /dev/null ); then - -function perform_remediation { - - # the mount point /opt has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/opt")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/opt' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /opt in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /opt)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /opt defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/opt"; then - if mountpoint -q "/opt"; then - mount -o remount --target "/opt" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /opt: Check information associated to mountpoint' command: findmnt --fstab '/opt' register: device_name @@ -212189,6 +212300,60 @@ fi - medium_severity - mount_option_opt_nosuid - no_reboot_needed + + +part /opt --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/opt" > /dev/null || findmnt --fstab "/opt" > /dev/null ); then + +function perform_remediation { + + # the mount point /opt has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/opt")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/opt' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /opt in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /opt)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /opt defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/opt"; then + if mountpoint -q "/opt"; then + mount -o remount --target "/opt" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212224,51 +212389,6 @@ related to their own processes in a system. Otherwise, sensitive information fro other users could be seem. CCE-85882-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - var_mount_option_proc_hidepid='' - - mountoption="hidepid=$var_mount_option_proc_hidepid" - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /proc)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|$mountoption)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="proc" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "proc /proc proc defaults,${previous_mount_opts}$mountoption 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "$mountoption"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,$mountoption|" /etc/fstab - fi - - - if mkdir -p "/proc"; then - if mountpoint -q "/proc"; then - mount -o remount --target "/proc" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_mount_option_proc_hidepid # promote to variable set_fact: var_mount_option_proc_hidepid: !!str @@ -212372,6 +212492,51 @@ fi - low_severity - mount_option_proc_hidepid - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + var_mount_option_proc_hidepid='' + + mountoption="hidepid=$var_mount_option_proc_hidepid" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /proc)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|$mountoption)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="proc" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "proc /proc proc defaults,${previous_mount_opts}$mountoption 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "$mountoption"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,$mountoption|" /etc/fstab + fi + + + if mkdir -p "/proc"; then + if mountpoint -q "/proc"; then + mount -o remount --target "/proc" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212395,60 +212560,6 @@ Add the nosuid option to the fourth column of not be able to execute SUID or SGID binaries from this directory. CCE-83322-8 - -part /srv --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/srv" > /dev/null || findmnt --fstab "/srv" > /dev/null ); then - -function perform_remediation { - - # the mount point /srv has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/srv")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/srv' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /srv in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /srv)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /srv defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/srv"; then - if mountpoint -q "/srv"; then - mount -o remount --target "/srv" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /srv: Check information associated to mountpoint' command: findmnt --fstab '/srv' register: device_name @@ -212551,6 +212662,60 @@ fi - medium_severity - mount_option_srv_nosuid - no_reboot_needed + + +part /srv --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/srv" > /dev/null || findmnt --fstab "/srv" > /dev/null ); then + +function perform_remediation { + + # the mount point /srv has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/srv")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/srv' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /srv in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /srv)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /srv defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/srv"; then + if mountpoint -q "/srv"; then + mount -o remount --target "/srv" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212667,60 +212832,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82623-0 - -part /tmp --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -212857,6 +212968,60 @@ fi - medium_severity - mount_option_tmp_nodev - no_reboot_needed + + +part /tmp --mountoptions="nodev" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212973,60 +213138,6 @@ such as /tmp should never be necessary in normal operatio can expose the system to potential compromise. CCE-82139-7 - -part /tmp --mountoptions="noexec" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -213164,6 +213275,60 @@ fi - medium_severity - mount_option_tmp_noexec - no_reboot_needed + + +part /tmp --mountoptions="noexec" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -213280,60 +213445,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from temporary storage partitions. CCE-82140-5 - -part /tmp --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -213471,6 +213582,60 @@ fi - medium_severity - mount_option_tmp_nosuid - no_reboot_needed + + +part /tmp --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -213516,60 +213681,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82080-3 - -part /var/log/audit --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/log/audit has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log/audit")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/log/audit' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/log/audit in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log/audit)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/log/audit defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/log/audit"; then - if mountpoint -q "/var/log/audit"; then - mount -o remount --target "/var/log/audit" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -213711,52 +213822,10 @@ fi - mount_option_var_log_audit_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var/log/audit - The noexec mount option can be used to prevent binaries -from being executed out of /var/log/audit. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log/audit. - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040131 - 1.1.2.7.4 - SV-230519r854060_rule - Allowing users to execute binaries from directories containing audit log files -such as /var/log/audit should never be necessary in normal operation and -can expose the system to potential compromise. - - CCE-82975-4 - -part /var/log/audit --mountoptions="noexec" + +part /var/log/audit --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then function perform_remediation { @@ -213778,7 +213847,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -213786,11 +213855,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log/audit defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var/log/audit defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -213807,6 +213876,48 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var/log/audit + The noexec mount option can be used to prevent binaries +from being executed out of /var/log/audit. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log/audit. + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040131 + 1.1.2.7.4 + SV-230519r854060_rule + Allowing users to execute binaries from directories containing audit log files +such as /var/log/audit should never be necessary in normal operation and +can expose the system to potential compromise. + + CCE-82975-4 - name: 'Add noexec Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -213948,53 +214059,10 @@ fi - mount_option_var_log_audit_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/log/audit - The nosuid mount option can be used to prevent -execution of setuid programs in /var/log/audit. The SUID and SGID permissions -should not be required in directories containing audit log files. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log/audit. - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040130 - 1.1.2.7.3 - SV-230518r854059_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from partitions -designated for audit log files. - - CCE-82921-8 - -part /var/log/audit --mountoptions="nosuid" + +part /var/log/audit --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then function perform_remediation { @@ -214016,7 +214084,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214024,11 +214092,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log/audit defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/log/audit defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -214045,6 +214113,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/log/audit + The nosuid mount option can be used to prevent +execution of setuid programs in /var/log/audit. The SUID and SGID permissions +should not be required in directories containing audit log files. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log/audit. + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040130 + 1.1.2.7.3 + SV-230518r854059_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from partitions +designated for audit log files. + + CCE-82921-8 - name: 'Add nosuid Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -214185,6 +214296,60 @@ fi - medium_severity - mount_option_var_log_audit_nosuid - no_reboot_needed + + +part /var/log/audit --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/log/audit has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log/audit")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/log/audit' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/log/audit in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log/audit)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/log/audit defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/log/audit"; then + if mountpoint -q "/var/log/audit"; then + mount -o remount --target "/var/log/audit" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -214230,60 +214395,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82077-9 - -part /var/log --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/log has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/log' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/log in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/log defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/log"; then - if mountpoint -q "/var/log"; then - mount -o remount --target "/var/log" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214423,53 +214534,10 @@ fi - mount_option_var_log_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var/log - The noexec mount option can be used to prevent binaries -from being executed out of /var/log. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log. - BP28(R12) - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040128 - 1.1.2.6.4 - SV-230516r854057_rule - Allowing users to execute binaries from directories containing log files -such as /var/log should never be necessary in normal operation and -can expose the system to potential compromise. - - CCE-82008-4 - -part /var/log --mountoptions="noexec" + +part /var/log --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then function perform_remediation { @@ -214491,7 +214559,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214499,11 +214567,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var/log defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -214520,6 +214588,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var/log + The noexec mount option can be used to prevent binaries +from being executed out of /var/log. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log. + BP28(R12) + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040128 + 1.1.2.6.4 + SV-230516r854057_rule + Allowing users to execute binaries from directories containing log files +such as /var/log should never be necessary in normal operation and +can expose the system to potential compromise. + + CCE-82008-4 - name: 'Add noexec Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214660,54 +214771,10 @@ fi - mount_option_var_log_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/log - The nosuid mount option can be used to prevent -execution of setuid programs in /var/log. The SUID and SGID permissions -should not be required in directories containing log files. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log. - BP28(R12) - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040127 - 1.1.2.6.3 - SV-230515r854056_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from partitions -designated for log files. - - CCE-82065-4 - -part /var/log --mountoptions="nosuid" + +part /var/log --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then function perform_remediation { @@ -214729,7 +214796,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214737,11 +214804,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/log defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -214758,6 +214825,50 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/log + The nosuid mount option can be used to prevent +execution of setuid programs in /var/log. The SUID and SGID permissions +should not be required in directories containing log files. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log. + BP28(R12) + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040127 + 1.1.2.6.3 + SV-230515r854056_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from partitions +designated for log files. + + CCE-82065-4 - name: 'Add nosuid Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214897,6 +215008,60 @@ fi - medium_severity - mount_option_var_log_nosuid - no_reboot_needed + + +part /var/log --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/log has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/log' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/log in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/log defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/log"; then + if mountpoint -q "/var/log"; then + mount -o remount --target "/var/log" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -214939,60 +215104,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82062-1 - -part /var --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then - -function perform_remediation { - - # the mount point /var has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var"; then - if mountpoint -q "/var"; then - mount -o remount --target "/var" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215125,29 +215236,10 @@ fi - mount_option_var_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var - The noexec mount option can be used to prevent binaries from being -executed out of /var. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var. - BP28(R12) - The /var directory contains variable system data such as logs, -mails and caches. No binaries should be executed from this directory. - - CCE-83330-1 - -part /var --mountoptions="noexec" + +part /var --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then function perform_remediation { @@ -215169,7 +215261,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -215177,11 +215269,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -215198,6 +215290,25 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var + The noexec mount option can be used to prevent binaries from being +executed out of /var. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var. + BP28(R12) + The /var directory contains variable system data such as logs, +mails and caches. No binaries should be executed from this directory. + + CCE-83330-1 - name: 'Add noexec Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215301,30 +215412,10 @@ fi - mount_option_var_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var - The nosuid mount option can be used to prevent -execution of setuid programs in /var. The SUID and SGID permissions -should not be required for this directory. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var. - BP28(R12) - 1.1.2.4.3 - The presence of SUID and SGID executables should be tightly controlled. - - CCE-83383-0 - -part /var --mountoptions="nosuid" + +part /var --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then function perform_remediation { @@ -215346,7 +215437,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -215354,11 +215445,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -215375,6 +215466,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var + The nosuid mount option can be used to prevent +execution of setuid programs in /var. The SUID and SGID permissions +should not be required for this directory. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var. + BP28(R12) + 1.1.2.4.3 + The presence of SUID and SGID executables should be tightly controlled. + + CCE-83383-0 - name: 'Add nosuid Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215477,6 +215588,60 @@ fi - medium_severity - mount_option_var_nosuid - no_reboot_needed + + +part /var --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then + +function perform_remediation { + + # the mount point /var has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var"; then + if mountpoint -q "/var"; then + mount -o remount --target "/var" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -215610,60 +215775,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82068-8 - -part /var/tmp --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/tmp"; then - if mountpoint -q "/var/tmp"; then - mount -o remount --target "/var/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -215772,6 +215883,60 @@ fi - medium_severity - mount_option_var_tmp_nodev - no_reboot_needed + + +part /var/tmp --mountoptions="nodev" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/var/tmp"; then + if mountpoint -q "/var/tmp"; then + mount -o remount --target "/var/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -215798,60 +215963,6 @@ such as /var/tmp should never be necessary in normal oper can expose the system to potential compromise. CCE-82151-2 - -part /var/tmp --mountoptions="noexec" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/var/tmp"; then - if mountpoint -q "/var/tmp"; then - mount -o remount --target "/var/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -215962,35 +216073,10 @@ fi - mount_option_var_tmp_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/tmp - The nosuid mount option can be used to prevent -execution of setuid programs in /var/tmp. The SUID and SGID permissions -should not be required in these world-writable directories. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/tmp. - BP28(R12) - CCI-001764 - SRG-OS-000368-GPOS-00154 - RHEL-08-040133 - 1.1.2.5.3 - SV-230521r854062_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from temporary storage partitions. - - CCE-82154-6 - -part /var/tmp --mountoptions="nosuid" + +part /var/tmp --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then function perform_remediation { @@ -216012,7 +216098,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -216020,11 +216106,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -216041,6 +216127,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/tmp + The nosuid mount option can be used to prevent +execution of setuid programs in /var/tmp. The SUID and SGID permissions +should not be required in these world-writable directories. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/tmp. + BP28(R12) + CCI-001764 + SRG-OS-000368-GPOS-00154 + RHEL-08-040133 + 1.1.2.5.3 + SV-230521r854062_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from temporary storage partitions. + + CCE-82154-6 - name: 'Add nosuid Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -216150,6 +216261,60 @@ fi - medium_severity - mount_option_var_tmp_nosuid - no_reboot_needed + + +part /var/tmp --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/tmp"; then + if mountpoint -q "/var/tmp"; then + mount -o remount --target "/var/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -216192,51 +216357,17 @@ or compromised programs. SRG-OS-000095-GPOS-00049 SRG-OS-000370-GPOS-00155 RHEL-08-040020 - SV-230493r809316_rule + SV-230493r942915_rule Failing to disconnect from collaborative computing devices (i.e., cameras) can result in subsequent compromises of organizational information. Providing easy methods to physically disconnect from such devices after a collaborative computing session helps to ensure participants actually carry out the disconnect activity without having to go through complex and tedious procedures. CCE-86960-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20uvcvideo%20/bin/true%0Ablacklist%20uvcvideo%0A - mode: 0644 - path: /etc/modprobe.d/uvcvideo.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install uvcvideo" /etc/modprobe.d/uvcvideo.conf ; then - - sed -i 's#^install uvcvideo.*#install uvcvideo /bin/true#g' /etc/modprobe.d/uvcvideo.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/uvcvideo.conf - echo "install uvcvideo /bin/true" >> /etc/modprobe.d/uvcvideo.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist uvcvideo$" /etc/modprobe.d/uvcvideo.conf ; then - echo "blacklist uvcvideo" >> /etc/modprobe.d/uvcvideo.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'uvcvideo' is disabled lineinfile: create: true dest: /etc/modprobe.d/uvcvideo.conf regexp: install\s+uvcvideo - line: install uvcvideo /bin/true + line: install uvcvideo /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86960-2 @@ -216268,6 +216399,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20uvcvideo%20/bin/true%0Ablacklist%20uvcvideo%0A + mode: 0644 + path: /etc/modprobe.d/uvcvideo.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install uvcvideo" /etc/modprobe.d/uvcvideo.conf ; then + + sed -i 's#^install uvcvideo.*#install uvcvideo /bin/true#g' /etc/modprobe.d/uvcvideo.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/uvcvideo.conf + echo "install uvcvideo /bin/false" >> /etc/modprobe.d/uvcvideo.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist uvcvideo$" /etc/modprobe.d/uvcvideo.conf ; then + echo "blacklist uvcvideo" >> /etc/modprobe.d/uvcvideo.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -216292,6 +216457,68 @@ terminates an application. The memory image could contain sensitive data and is only for developers trying to debug problems. CCE-82215-5 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.core_pattern.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + +- name: Comment out any occurrences of kernel.core_pattern from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.core_pattern + replace: '#kernel.core_pattern' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + +- name: Ensure sysctl kernel.core_pattern is set to |/bin/false + sysctl: + name: kernel.core_pattern + value: '|/bin/false' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216367,89 +216594,77 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Configure file name of core dumps + To set the runtime status of the kernel.core_uses_pid kernel parameter, run the following command: $ sudo sysctl -w kernel.core_uses_pid=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.core_uses_pid = 0 + FMT_SMF_EXT.1 + The default coredump filename is core. By setting +core_uses_pid to 1, the coredump filename becomes +core.PID. If core_pattern does not include +%p (default does not) and core_uses_pid is set, then +.PID will be appended to the filename. +When combined with kernel.core_pattern = "" configuration, it +is ensured that no core dumps are generated and also no confusing error +messages are printed by a shell. + + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.core_pattern.*$ + contains: ^[\s]*kernel.core_uses_pid.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid -- name: Comment out any occurrences of kernel.core_pattern from config files +- name: Comment out any occurrences of kernel.core_uses_pid from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.core_pattern - replace: '#kernel.core_pattern' + regexp: ^[\s]*kernel.core_uses_pid + replace: '#kernel.core_uses_pid' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid -- name: Ensure sysctl kernel.core_pattern is set to |/bin/false +- name: Ensure sysctl kernel.core_uses_pid is set to 0 sysctl: - name: kernel.core_pattern - value: '|/bin/false' + name: kernel.core_uses_pid + value: '0' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid - - - - - - - - - Configure file name of core dumps - To set the runtime status of the kernel.core_uses_pid kernel parameter, run the following command: $ sudo sysctl -w kernel.core_uses_pid=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.core_uses_pid = 0 - FMT_SMF_EXT.1 - The default coredump filename is core. By setting -core_uses_pid to 1, the coredump filename becomes -core.PID. If core_pattern does not include -%p (default does not) and core_uses_pid is set, then -.PID will be appended to the filename. -When combined with kernel.core_pattern = "" configuration, it -is ensured that no core dumps are generated and also no confusing error -messages are printed by a shell. - # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -216508,89 +216723,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Restrict Access to Kernel Message Buffer + To set the runtime status of the kernel.dmesg_restrict kernel parameter, run the following command: $ sudo sysctl -w kernel.dmesg_restrict=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.dmesg_restrict = 1 + BP28(R23) + 3.1.5 + CCI-001090 + CCI-001314 + 164.308(a)(1)(ii)(D) + 164.308(a)(3) + 164.308(a)(4) + 164.310(b) + 164.310(c) + 164.312(a) + 164.312(e) + SI-11(a) + SI-11(b) + SRG-OS-000132-GPOS-00067 + SRG-OS-000138-GPOS-00069 + SRG-APP-000243-CTR-000600 + RHEL-08-010375 + SV-230269r858756_rule + Unprivileged access to the kernel syslog can expose sensitive kernel +address information. + + CCE-80913-7 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.core_uses_pid.*$ + contains: ^[\s]*kernel.dmesg_restrict.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict -- name: Comment out any occurrences of kernel.core_uses_pid from config files +- name: Comment out any occurrences of kernel.dmesg_restrict from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.core_uses_pid - replace: '#kernel.core_uses_pid' + regexp: ^[\s]*kernel.dmesg_restrict + replace: '#kernel.dmesg_restrict' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict -- name: Ensure sysctl kernel.core_uses_pid is set to 0 +- name: Ensure sysctl kernel.dmesg_restrict is set to 1 sysctl: - name: kernel.core_uses_pid - value: '0' + name: kernel.dmesg_restrict + value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict - - - - - - - - - Restrict Access to Kernel Message Buffer - To set the runtime status of the kernel.dmesg_restrict kernel parameter, run the following command: $ sudo sysctl -w kernel.dmesg_restrict=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.dmesg_restrict = 1 - BP28(R23) - 3.1.5 - CCI-001090 - CCI-001314 - 164.308(a)(1)(ii)(D) - 164.308(a)(3) - 164.308(a)(4) - 164.310(b) - 164.310(c) - 164.312(a) - 164.312(e) - SI-11(a) - SI-11(b) - SRG-OS-000132-GPOS-00067 - SRG-OS-000138-GPOS-00069 - SRG-APP-000243-CTR-000600 - RHEL-08-010375 - SV-230269r858756_rule - Unprivileged access to the kernel syslog can expose sensitive kernel -address information. - - CCE-80913-7 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216666,93 +216896,87 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Disable Kernel Image Loading + To set the runtime status of the kernel.kexec_load_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.kexec_load_disabled=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.kexec_load_disabled = 1 + CCI-001749 + CM-6 + SRG-OS-000480-GPOS-00227 + SRG-OS-000366-GPOS-00153 + RHEL-08-010372 + SV-230266r877463_rule + Disabling kexec_load allows greater control of the kernel memory. +It makes it impossible to load another kernel image after it has been disabled. + + + CCE-80952-5 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.dmesg_restrict.*$ + contains: ^[\s]*kernel.kexec_load_disabled.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled -- name: Comment out any occurrences of kernel.dmesg_restrict from config files +- name: Comment out any occurrences of kernel.kexec_load_disabled from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.dmesg_restrict - replace: '#kernel.dmesg_restrict' + regexp: ^[\s]*kernel.kexec_load_disabled + replace: '#kernel.kexec_load_disabled' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled -- name: Ensure sysctl kernel.dmesg_restrict is set to 1 +- name: Ensure sysctl kernel.kexec_load_disabled is set to 1 sysctl: - name: kernel.dmesg_restrict + name: kernel.kexec_load_disabled value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled - - - - - - - - - Disable Kernel Image Loading - To set the runtime status of the kernel.kexec_load_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.kexec_load_disabled=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.kexec_load_disabled = 1 - CCI-001749 - CM-6 - SRG-OS-000480-GPOS-00227 - SRG-OS-000366-GPOS-00153 - RHEL-08-010372 - SV-230266r877463_rule - Disabling kexec_load allows greater control of the kernel memory. -It makes it impossible to load another kernel image after it has been disabled. - - - CCE-80952-5 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216827,65 +217051,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.kexec_load_disabled.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled - -- name: Comment out any occurrences of kernel.kexec_load_disabled from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.kexec_load_disabled - replace: '#kernel.kexec_load_disabled' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled - -- name: Ensure sysctl kernel.kexec_load_disabled is set to 1 - sysctl: - name: kernel.kexec_load_disabled - value: '1' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled @@ -216978,66 +217143,6 @@ would have allowed the system to continue operating will now result in a panic.< panicking the system will impede them from continuing. CCE-87666-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of kernel.panic_on_oops from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*kernel.panic_on_oops.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.panic_on_oops" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for kernel.panic_on_oops -# -/sbin/sysctl -q -n -w kernel.panic_on_oops="1" - -# -# If kernel.panic_on_oops present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.panic_on_oops = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.panic_on_oops") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.panic_on_oops\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.panic_on_oops\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-87666-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217091,35 +217196,18 @@ fi - reboot_required - sysctl_kernel_panic_on_oops - - - - - - - - - Limit CPU consumption of the Perf system - To set the runtime status of the kernel.perf_cpu_time_max_percent kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_cpu_time_max_percent=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_cpu_time_max_percent = 1 - BP28(R23) - The kernel.perf_cpu_time_max_percent configures a treshold of -maximum percentile of CPU that can be used by Perf system. Restricting usage -of Perf system decreases risk of potential availability problems. - - CCE-83373-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_cpu_time_max_percent from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.panic_on_oops from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_cpu_time_max_percent.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.panic_on_oops.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_cpu_time_max_percent" matches to preserve user data + # comment out "kernel.panic_on_oops" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217133,18 +217221,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_cpu_time_max_percent +# Set runtime for kernel.panic_on_oops # -/sbin/sysctl -q -n -w kernel.perf_cpu_time_max_percent="1" +/sbin/sysctl -q -n -w kernel.panic_on_oops="1" # -# If kernel.perf_cpu_time_max_percent present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.perf_cpu_time_max_percent = 1" to /etc/sysctl.conf +# If kernel.panic_on_oops present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.panic_on_oops = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_cpu_time_max_percent") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.panic_on_oops") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -217152,14 +217240,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_cpu_time_max_percent\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.panic_on_oops\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_cpu_time_max_percent\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.panic_on_oops\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83373-1" + cce="CCE-87666-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217168,6 +217256,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Limit CPU consumption of the Perf system + To set the runtime status of the kernel.perf_cpu_time_max_percent kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_cpu_time_max_percent=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_cpu_time_max_percent = 1 + BP28(R23) + The kernel.perf_cpu_time_max_percent configures a treshold of +maximum percentile of CPU that can be used by Perf system. Restricting usage +of Perf system decreases risk of potential availability problems. + + CCE-83373-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217222,36 +217327,18 @@ fi - reboot_required - sysctl_kernel_perf_cpu_time_max_percent - - - - - - - - - Limit sampling frequency of the Perf system - To set the runtime status of the kernel.perf_event_max_sample_rate kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_max_sample_rate=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_max_sample_rate = 1 - BP28(R23) - The kernel.perf_event_max_sample_rate parameter configures maximum -frequency of collecting of samples for the Perf system. It is expressed in -samples per second. Restricting usage of Perf system decreases risk -of potential availability problems. - - CCE-83368-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_event_max_sample_rate from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_cpu_time_max_percent from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_max_sample_rate.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_cpu_time_max_percent.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_event_max_sample_rate" matches to preserve user data + # comment out "kernel.perf_cpu_time_max_percent" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217265,18 +217352,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_event_max_sample_rate +# Set runtime for kernel.perf_cpu_time_max_percent # -/sbin/sysctl -q -n -w kernel.perf_event_max_sample_rate="1" +/sbin/sysctl -q -n -w kernel.perf_cpu_time_max_percent="1" # -# If kernel.perf_event_max_sample_rate present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.perf_event_max_sample_rate = 1" to /etc/sysctl.conf +# If kernel.perf_cpu_time_max_percent present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.perf_cpu_time_max_percent = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_max_sample_rate") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_cpu_time_max_percent") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -217284,14 +217371,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_max_sample_rate\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_cpu_time_max_percent\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_max_sample_rate\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_cpu_time_max_percent\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83368-1" + cce="CCE-83373-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217300,6 +217387,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Limit sampling frequency of the Perf system + To set the runtime status of the kernel.perf_event_max_sample_rate kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_max_sample_rate=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_max_sample_rate = 1 + BP28(R23) + The kernel.perf_event_max_sample_rate parameter configures maximum +frequency of collecting of samples for the Perf system. It is expressed in +samples per second. Restricting usage of Perf system decreases risk +of potential availability problems. + + CCE-83368-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217354,56 +217459,18 @@ fi - reboot_required - sysctl_kernel_perf_event_max_sample_rate - - - - - - - - - Disallow kernel profiling by unprivileged users - To set the runtime status of the kernel.perf_event_paranoid kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_paranoid=2 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_paranoid = 2 - BP28(R23) - CCI-001090 - AC-6 - FMT_SMF_EXT.1 - SRG-OS-000132-GPOS-00067 - SRG-OS-000138-GPOS-00069 - SRG-APP-000243-CTR-000600 - RHEL-08-010376 - SV-230270r858758_rule - Kernel profiling can reveal sensitive information about kernel behaviour. - - CCE-81054-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,kernel.perf_event_paranoid%3D2%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_perf_event_paranoid.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_event_paranoid from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_event_max_sample_rate from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_paranoid.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_max_sample_rate.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_event_paranoid" matches to preserve user data + # comment out "kernel.perf_event_max_sample_rate" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217417,33 +217484,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_event_paranoid +# Set runtime for kernel.perf_event_max_sample_rate # -/sbin/sysctl -q -n -w kernel.perf_event_paranoid="2" +/sbin/sysctl -q -n -w kernel.perf_event_max_sample_rate="1" # -# If kernel.perf_event_paranoid present in /etc/sysctl.conf, change value to "2" -# else, add "kernel.perf_event_paranoid = 2" to /etc/sysctl.conf +# If kernel.perf_event_max_sample_rate present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.perf_event_max_sample_rate = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_paranoid") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_max_sample_rate") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "2" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_paranoid\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_max_sample_rate\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_paranoid\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_max_sample_rate\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-81054-9" + cce="CCE-83368-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217452,6 +217519,29 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disallow kernel profiling by unprivileged users + To set the runtime status of the kernel.perf_event_paranoid kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_paranoid=2 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_paranoid = 2 + BP28(R23) + CCI-001090 + AC-6 + FMT_SMF_EXT.1 + SRG-OS-000132-GPOS-00067 + SRG-OS-000138-GPOS-00069 + SRG-APP-000243-CTR-000600 + RHEL-08-010376 + SV-230270r858758_rule + Kernel profiling can reveal sensitive information about kernel behaviour. + + CCE-81054-9 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217511,36 +217601,33 @@ fi - reboot_required - sysctl_kernel_perf_event_paranoid - - - - - - - - - Configure maximum number of process identifiers - To set the runtime status of the kernel.pid_max kernel parameter, run the following command: $ sudo sysctl -w kernel.pid_max=65536 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.pid_max = 65536 - BP28(R23) - The kernel.pid_max parameter configures upper limit on process -identifiers (PID). If this number is not high enough, it might happen that -forking of new processes is not possible, because all available PIDs are -exhausted. Increasing this number enhances availability. - - CCE-83366-5 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,kernel.perf_event_paranoid%3D2%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_kernel_perf_event_paranoid.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.pid_max from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_event_paranoid from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.pid_max.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_paranoid.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.pid_max" matches to preserve user data + # comment out "kernel.perf_event_paranoid" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217554,33 +217641,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.pid_max +# Set runtime for kernel.perf_event_paranoid # -/sbin/sysctl -q -n -w kernel.pid_max="65536" +/sbin/sysctl -q -n -w kernel.perf_event_paranoid="2" # -# If kernel.pid_max present in /etc/sysctl.conf, change value to "65536" -# else, add "kernel.pid_max = 65536" to /etc/sysctl.conf +# If kernel.perf_event_paranoid present in /etc/sysctl.conf, change value to "2" +# else, add "kernel.perf_event_paranoid = 2" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.pid_max") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_paranoid") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "65536" +printf -v formatted_output "%s = %s" "$stripped_key" "2" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.pid_max\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_paranoid\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.pid_max\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_paranoid\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83366-5" + cce="CCE-81054-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217589,6 +217676,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Configure maximum number of process identifiers + To set the runtime status of the kernel.pid_max kernel parameter, run the following command: $ sudo sysctl -w kernel.pid_max=65536 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.pid_max = 65536 + BP28(R23) + The kernel.pid_max parameter configures upper limit on process +identifiers (PID). If this number is not high enough, it might happen that +forking of new processes is not possible, because all available PIDs are +exhausted. Increasing this number enhances availability. + + CCE-83366-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217642,36 +217747,18 @@ fi - reboot_required - sysctl_kernel_pid_max - - - - - - - - - Disallow magic SysRq key - To set the runtime status of the kernel.sysrq kernel parameter, run the following command: $ sudo sysctl -w kernel.sysrq=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.sysrq = 0 - BP28(R23) - The Magic SysRq key allows sending certain commands directly to the running -kernel. It can dump various system and process information, potentially -revealing sensitive information. It can also reboot or shutdown the machine, -disturbing its availability. - - CCE-83355-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.sysrq from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.pid_max from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.sysrq.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.pid_max.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.sysrq" matches to preserve user data + # comment out "kernel.pid_max" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217685,33 +217772,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.sysrq +# Set runtime for kernel.pid_max # -/sbin/sysctl -q -n -w kernel.sysrq="0" +/sbin/sysctl -q -n -w kernel.pid_max="65536" # -# If kernel.sysrq present in /etc/sysctl.conf, change value to "0" -# else, add "kernel.sysrq = 0" to /etc/sysctl.conf +# If kernel.pid_max present in /etc/sysctl.conf, change value to "65536" +# else, add "kernel.pid_max = 65536" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.sysrq") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.pid_max") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" +printf -v formatted_output "%s = %s" "$stripped_key" "65536" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.sysrq\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.pid_max\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.sysrq\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.pid_max\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83355-8" + cce="CCE-83366-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217720,6 +217807,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disallow magic SysRq key + To set the runtime status of the kernel.sysrq kernel parameter, run the following command: $ sudo sysctl -w kernel.sysrq=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.sysrq = 0 + BP28(R23) + The Magic SysRq key allows sending certain commands directly to the running +kernel. It can dump various system and process information, potentially +revealing sensitive information. It can also reboot or shutdown the machine, +disturbing its availability. + + CCE-83355-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217773,57 +217878,18 @@ fi - reboot_required - sysctl_kernel_sysrq - - - - - - - - - Disable Access to Network bpf() Syscall From Unprivileged Processes - To set the runtime status of the kernel.unprivileged_bpf_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.unprivileged_bpf_disabled=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.unprivileged_bpf_disabled = 1 - BP28(R9) - CCI-000366 - AC-6 - SC-7(10) - FMT_SMF_EXT.1 - SRG-OS-000132-GPOS-00067 - SRG-OS-000480-GPOS-00227 - RHEL-08-040281 - SV-230545r858822_rule - Loading and accessing the packet filters programs and maps using the bpf() -syscall has the potential of revealing sensitive information about the kernel state. - - CCE-82974-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,kernel.unprivileged_bpf_disabled%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_unprivileged_bpf_disabled.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.unprivileged_bpf_disabled from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.sysrq from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.unprivileged_bpf_disabled.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.sysrq.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.unprivileged_bpf_disabled" matches to preserve user data + # comment out "kernel.sysrq" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217837,33 +217903,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.unprivileged_bpf_disabled +# Set runtime for kernel.sysrq # -/sbin/sysctl -q -n -w kernel.unprivileged_bpf_disabled="1" +/sbin/sysctl -q -n -w kernel.sysrq="0" # -# If kernel.unprivileged_bpf_disabled present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.unprivileged_bpf_disabled = 1" to /etc/sysctl.conf +# If kernel.sysrq present in /etc/sysctl.conf, change value to "0" +# else, add "kernel.sysrq = 0" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.unprivileged_bpf_disabled") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.sysrq") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" +printf -v formatted_output "%s = %s" "$stripped_key" "0" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.unprivileged_bpf_disabled\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.sysrq\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.unprivileged_bpf_disabled\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.sysrq\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82974-7" + cce="CCE-83355-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217872,6 +217938,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Access to Network bpf() Syscall From Unprivileged Processes + To set the runtime status of the kernel.unprivileged_bpf_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.unprivileged_bpf_disabled=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.unprivileged_bpf_disabled = 1 + BP28(R9) + CCI-000366 + AC-6 + SC-7(10) + FMT_SMF_EXT.1 + SRG-OS-000132-GPOS-00067 + SRG-OS-000480-GPOS-00227 + RHEL-08-040281 + SV-230545r858822_rule + Loading and accessing the packet filters programs and maps using the bpf() +syscall has the potential of revealing sensitive information about the kernel state. + + CCE-82974-7 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217935,33 +218025,7 @@ fi - reboot_required - sysctl_kernel_unprivileged_bpf_disabled - - - - - - - - - Restrict usage of ptrace to descendant processes - To set the runtime status of the kernel.yama.ptrace_scope kernel parameter, run the following command: $ sudo sysctl -w kernel.yama.ptrace_scope=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.yama.ptrace_scope = 1 - BP28(R25) - CCI-000366 - SC-7(10) - SRG-OS-000132-GPOS-00067 - SRG-OS-000480-GPOS-00227 - RHEL-08-040282 - 1.4.2 - SV-230546r858824_rule - Unrestricted usage of ptrace allows compromised binaries to run ptrace -on another processes of the user. Like this, the attacker can steal -sensitive information from the target processes (e.g. SSH sessions, web browser, ...) -without any additional assistance from the user (i.e. without resorting to phishing). - - - CCE-80953-3 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -217971,23 +218035,23 @@ spec: storage: files: - contents: - source: data:,kernel.yama.ptrace_scope%3D1%0A + source: data:,kernel.unprivileged_bpf_disabled%3D1%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_yama_ptrace_scope.conf + path: /etc/sysctl.d/75-sysctl_kernel_unprivileged_bpf_disabled.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.yama.ptrace_scope from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.unprivileged_bpf_disabled from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.yama.ptrace_scope.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.unprivileged_bpf_disabled.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.yama.ptrace_scope" matches to preserve user data + # comment out "kernel.unprivileged_bpf_disabled" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218001,18 +218065,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.yama.ptrace_scope +# Set runtime for kernel.unprivileged_bpf_disabled # -/sbin/sysctl -q -n -w kernel.yama.ptrace_scope="1" +/sbin/sysctl -q -n -w kernel.unprivileged_bpf_disabled="1" # -# If kernel.yama.ptrace_scope present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.yama.ptrace_scope = 1" to /etc/sysctl.conf +# If kernel.unprivileged_bpf_disabled present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.unprivileged_bpf_disabled = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.yama.ptrace_scope") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.unprivileged_bpf_disabled") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -218020,14 +218084,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.yama.ptrace_scope\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.unprivileged_bpf_disabled\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.yama.ptrace_scope\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.unprivileged_bpf_disabled\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-80953-3" + cce="CCE-82974-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218036,6 +218100,32 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Restrict usage of ptrace to descendant processes + To set the runtime status of the kernel.yama.ptrace_scope kernel parameter, run the following command: $ sudo sysctl -w kernel.yama.ptrace_scope=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.yama.ptrace_scope = 1 + BP28(R25) + CCI-000366 + SC-7(10) + SRG-OS-000132-GPOS-00067 + SRG-OS-000480-GPOS-00227 + RHEL-08-040282 + 1.4.2 + SV-230546r858824_rule + Unrestricted usage of ptrace allows compromised binaries to run ptrace +on another processes of the user. Like this, the attacker can steal +sensitive information from the target processes (e.g. SSH sessions, web browser, ...) +without any additional assistance from the user (i.e. without resorting to phishing). + + + CCE-80953-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218095,31 +218185,7 @@ fi - reboot_required - sysctl_kernel_yama_ptrace_scope - - - - - - - - - Harden the operation of the BPF just-in-time compiler - To set the runtime status of the net.core.bpf_jit_harden kernel parameter, run the following command: $ sudo sysctl -w net.core.bpf_jit_harden=2 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.core.bpf_jit_harden = 2 - BP28(R12) - CCI-000366 - CM-6 - SC-7(10) - FMT_SMF_EXT.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-040286 - SV-244554r858832_rule - When hardened, the extended Berkeley Packet Filter just-in-time compiler -will randomize any kernel addresses in the BPF programs and maps, -and will not expose the JIT addresses in /proc/kallsyms. - - CCE-82934-1 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218129,23 +218195,23 @@ spec: storage: files: - contents: - source: data:,net.core.bpf_jit_harden%3D2%0A + source: data:,kernel.yama.ptrace_scope%3D1%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_core_bpf_jit_harden.conf + path: /etc/sysctl.d/75-sysctl_kernel_yama_ptrace_scope.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.core.bpf_jit_harden from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.yama.ptrace_scope from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.core.bpf_jit_harden.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.yama.ptrace_scope.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.core.bpf_jit_harden" matches to preserve user data + # comment out "kernel.yama.ptrace_scope" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218159,33 +218225,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for net.core.bpf_jit_harden +# Set runtime for kernel.yama.ptrace_scope # -/sbin/sysctl -q -n -w net.core.bpf_jit_harden="2" +/sbin/sysctl -q -n -w kernel.yama.ptrace_scope="1" # -# If net.core.bpf_jit_harden present in /etc/sysctl.conf, change value to "2" -# else, add "net.core.bpf_jit_harden = 2" to /etc/sysctl.conf +# If kernel.yama.ptrace_scope present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.yama.ptrace_scope = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.core.bpf_jit_harden") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.yama.ptrace_scope") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "2" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.core.bpf_jit_harden\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.yama.ptrace_scope\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.core.bpf_jit_harden\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.yama.ptrace_scope\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82934-1" + cce="CCE-80953-3" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218194,6 +218260,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Harden the operation of the BPF just-in-time compiler + To set the runtime status of the net.core.bpf_jit_harden kernel parameter, run the following command: $ sudo sysctl -w net.core.bpf_jit_harden=2 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.core.bpf_jit_harden = 2 + BP28(R12) + CCI-000366 + CM-6 + SC-7(10) + FMT_SMF_EXT.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-040286 + SV-244554r858832_rule + When hardened, the extended Berkeley Packet Filter just-in-time compiler +will randomize any kernel addresses in the BPF programs and maps, +and will not expose the JIT addresses in /proc/kallsyms. + + CCE-82934-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218256,42 +218346,7 @@ fi - reboot_required - sysctl_net_core_bpf_jit_harden - - - - - - - - - Disable the use of user namespaces - To set the runtime status of the user.max_user_namespaces kernel parameter, -run the following command: -$ sudo sysctl -w user.max_user_namespaces=0 - -To make sure that the setting is persistent, -add the following line to a file in the directory /etc/sysctl.d: -user.max_user_namespaces = 0 -When containers are deployed on the machine, the value should be set -to large non-zero value. - This configuration baseline was created to deploy the base operating system for general purpose -workloads. When the operating system is configured for certain purposes, such as to host Linux Containers, -it is expected that user.max_user_namespaces will be enabled. - CCI-000366 - SC-39 - CM-6(a) - FMT_SMF_EXT.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-040284 - SV-230548r858828_rule - It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or system objectives. -These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. -They increase the risk to the platform by providing additional attack vectors. -User namespaces are used primarily for Linux containers. The value 0 -disallows the use of user namespaces. - - CCE-82211-4 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218301,23 +218356,23 @@ spec: storage: files: - contents: - source: data:,user.max_user_namespaces%20%3D%200%0A + source: data:,net.core.bpf_jit_harden%3D2%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_user_max_user_namespaces.conf + path: /etc/sysctl.d/75-sysctl_net_core_bpf_jit_harden.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of user.max_user_namespaces from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.core.bpf_jit_harden from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*user.max_user_namespaces.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.core.bpf_jit_harden.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "user.max_user_namespaces" matches to preserve user data + # comment out "net.core.bpf_jit_harden" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218331,33 +218386,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for user.max_user_namespaces +# Set runtime for net.core.bpf_jit_harden # -/sbin/sysctl -q -n -w user.max_user_namespaces="0" +/sbin/sysctl -q -n -w net.core.bpf_jit_harden="2" # -# If user.max_user_namespaces present in /etc/sysctl.conf, change value to "0" -# else, add "user.max_user_namespaces = 0" to /etc/sysctl.conf +# If net.core.bpf_jit_harden present in /etc/sysctl.conf, change value to "2" +# else, add "net.core.bpf_jit_harden = 2" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^user.max_user_namespaces") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.core.bpf_jit_harden") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" +printf -v formatted_output "%s = %s" "$stripped_key" "2" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^user.max_user_namespaces\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.core.bpf_jit_harden\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^user.max_user_namespaces\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.core.bpf_jit_harden\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82211-4" + cce="CCE-82934-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218366,6 +218421,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable the use of user namespaces + To set the runtime status of the user.max_user_namespaces kernel parameter, +run the following command: +$ sudo sysctl -w user.max_user_namespaces=0 + +To make sure that the setting is persistent, +add the following line to a file in the directory /etc/sysctl.d: +user.max_user_namespaces = 0 +When containers are deployed on the machine, the value should be set +to large non-zero value. + This configuration baseline was created to deploy the base operating system for general purpose +workloads. When the operating system is configured for certain purposes, such as to host Linux Containers, +it is expected that user.max_user_namespaces will be enabled. + CCI-000366 + SC-39 + CM-6(a) + FMT_SMF_EXT.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-040284 + SV-230548r858828_rule + It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or system objectives. +These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. +They increase the risk to the platform by providing additional attack vectors. +User namespaces are used primarily for Linux containers. The value 0 +disallows the use of user namespaces. + + CCE-82211-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218428,36 +218518,33 @@ fi - reboot_required - sysctl_user_max_user_namespaces - - - - - - - - - Prevent applications from mapping low portion of virtual memory - To set the runtime status of the vm.mmap_min_addr kernel parameter, run the following command: $ sudo sysctl -w vm.mmap_min_addr=65536 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: vm.mmap_min_addr = 65536 - BP28(R23) - The vm.mmap_min_addr parameter specifies the minimum virtual -address that a process is allowed to mmap. Allowing a process to mmap low -portion of virtual memory can have security implications such as such as -heightened risk of kernel null pointer dereference defects. - - CCE-83363-2 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,user.max_user_namespaces%20%3D%200%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_user_max_user_namespaces.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of vm.mmap_min_addr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of user.max_user_namespaces from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*vm.mmap_min_addr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*user.max_user_namespaces.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "vm.mmap_min_addr" matches to preserve user data + # comment out "user.max_user_namespaces" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218471,33 +218558,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for vm.mmap_min_addr +# Set runtime for user.max_user_namespaces # -/sbin/sysctl -q -n -w vm.mmap_min_addr="65536" +/sbin/sysctl -q -n -w user.max_user_namespaces="0" # -# If vm.mmap_min_addr present in /etc/sysctl.conf, change value to "65536" -# else, add "vm.mmap_min_addr = 65536" to /etc/sysctl.conf +# If user.max_user_namespaces present in /etc/sysctl.conf, change value to "0" +# else, add "user.max_user_namespaces = 0" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^vm.mmap_min_addr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^user.max_user_namespaces") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "65536" +printf -v formatted_output "%s = %s" "$stripped_key" "0" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^vm.mmap_min_addr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^user.max_user_namespaces\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^vm.mmap_min_addr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^user.max_user_namespaces\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83363-2" + cce="CCE-82211-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218506,6 +218593,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Prevent applications from mapping low portion of virtual memory + To set the runtime status of the vm.mmap_min_addr kernel parameter, run the following command: $ sudo sysctl -w vm.mmap_min_addr=65536 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: vm.mmap_min_addr = 65536 + BP28(R23) + The vm.mmap_min_addr parameter specifies the minimum virtual +address that a process is allowed to mmap. Allowing a process to mmap low +portion of virtual memory can have security implications such as such as +heightened risk of kernel null pointer dereference defects. + + CCE-83363-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218558,6 +218663,66 @@ fi - medium_severity - reboot_required - sysctl_vm_mmap_min_addr + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of vm.mmap_min_addr from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*vm.mmap_min_addr.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "vm.mmap_min_addr" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for vm.mmap_min_addr +# +/sbin/sysctl -q -n -w vm.mmap_min_addr="65536" + +# +# If vm.mmap_min_addr present in /etc/sysctl.conf, change value to "65536" +# else, add "vm.mmap_min_addr = 65536" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^vm.mmap_min_addr") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "65536" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^vm.mmap_min_addr\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^vm.mmap_min_addr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-83363-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218602,21 +218767,6 @@ terminates an application. The memory image could contain sensitive data and is generally useful only for developers trying to debug problems. CCE-82881-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SOCKET_NAME="systemd-coredump.socket" -SYSTEMCTL_EXEC='/usr/bin/systemctl' - -if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then - "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" - "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable acquiring, saving, and processing core dumps - Collect systemd Socket Units Present in the System ansible.builtin.command: @@ -218655,6 +218805,21 @@ fi - medium_severity - no_reboot_needed - service_systemd-coredump_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SOCKET_NAME="systemd-coredump.socket" +SYSTEMCTL_EXEC='/usr/bin/systemctl' + +if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then + "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" + "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218693,43 +218858,6 @@ debuging. Permitting temporary enablement of core dumps during such situations should be reviewed through local needs and policy. CCE-82251-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%20%20This%20file%20is%20part%20of%20systemd.%0A%23%0A%23%20%20systemd%20is%20free%20software%3B%20you%20can%20redistribute%20it%20and/or%20modify%20it%0A%23%20%20under%20the%20terms%20of%20the%20GNU%20Lesser%20General%20Public%20License%20as%20published%20by%0A%23%20%20the%20Free%20Software%20Foundation%3B%20either%20version%202.1%20of%20the%20License%2C%20or%0A%23%20%20%28at%20your%20option%29%20any%20later%20version.%0A%23%0A%23%20Entries%20in%20this%20file%20show%20the%20compile%20time%20defaults.%0A%23%20You%20can%20change%20settings%20by%20editing%20this%20file.%0A%23%20Defaults%20can%20be%20restored%20by%20simply%20deleting%20this%20file.%0A%23%0A%23%20See%20coredump.conf%285%29%20for%20details.%0A%0A%5BCoredump%5D%0A%23Storage%3Dexternal%0A%23Compress%3Dyes%0A%23ProcessSizeMax%3D2G%0A%23ExternalSizeMax%3D2G%0A%23JournalSizeMax%3D767M%0A%23MaxUse%3D%0A%23KeepFree%3D%0AStorage%3Dnone%0AProcessSizeMax%3D0%0A - mode: 0644 - path: /etc/systemd/coredump.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if rpm --quiet -q systemd; then - -if [ -e "/etc/systemd/coredump.conf" ] ; then - - LC_ALL=C sed -i "/^\s*ProcessSizeMax\s*=\s*/Id" "/etc/systemd/coredump.conf" -else - touch "/etc/systemd/coredump.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/systemd/coredump.conf" - -cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" -# Insert at the end of the file -printf '%s\n' "ProcessSizeMax=0" >> "/etc/systemd/coredump.conf" -# Clean up after ourselves. -rm "/etc/systemd/coredump.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -218788,39 +218916,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Disable storing core dump - The Storage option in [Coredump] sectionof /etc/systemd/coredump.conf -can be set to none to disable storing core dumps permanently. - If the /etc/systemd/coredump.conf file -does not already contain the [Coredump] section, -the value will not be configured correctly. - CCI-000366 - CM-6 - FMT_SMF_EXT.1 - Req-3.2 - 3.3.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-010674 - 1.4.4 - SV-230314r627750_rule - A core dump includes a memory image taken at the time the operating system -terminates an application. The memory image could contain sensitive data -and is generally useful only for developers or system operators trying to -debug problems. Enabling core dumps on production systems is not recommended, -however there may be overriding operational requirements to enable advanced -debuging. Permitting temporary enablement of core dumps during such situations -should be reviewed through local needs and policy. - - CCE-82252-8 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218835,12 +218931,12 @@ spec: path: /etc/systemd/coredump.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q systemd; then if [ -e "/etc/systemd/coredump.conf" ] ; then - LC_ALL=C sed -i "/^\s*Storage\s*=\s*/Id" "/etc/systemd/coredump.conf" + LC_ALL=C sed -i "/^\s*ProcessSizeMax\s*=\s*/Id" "/etc/systemd/coredump.conf" else touch "/etc/systemd/coredump.conf" fi @@ -218849,7 +218945,7 @@ sed -i -e '$a\' "/etc/systemd/coredump.conf" cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" # Insert at the end of the file -printf '%s\n' "Storage=none" >> "/etc/systemd/coredump.conf" +printf '%s\n' "ProcessSizeMax=0" >> "/etc/systemd/coredump.conf" # Clean up after ourselves. rm "/etc/systemd/coredump.conf.bak" @@ -218857,6 +218953,38 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable storing core dump + The Storage option in [Coredump] sectionof /etc/systemd/coredump.conf +can be set to none to disable storing core dumps permanently. + If the /etc/systemd/coredump.conf file +does not already contain the [Coredump] section, +the value will not be configured correctly. + CCI-000366 + CM-6 + FMT_SMF_EXT.1 + Req-3.2 + 3.3.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-010674 + 1.4.4 + SV-230314r627750_rule + A core dump includes a memory image taken at the time the operating system +terminates an application. The memory image could contain sensitive data +and is generally useful only for developers or system operators trying to +debug problems. Enabling core dumps on production systems is not recommended, +however there may be overriding operational requirements to enable advanced +debuging. Permitting temporary enablement of core dumps during such situations +should be reviewed through local needs and policy. + + CCE-82252-8 - name: Gather the package facts package_facts: manager: auto @@ -218914,6 +219042,43 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%20%20This%20file%20is%20part%20of%20systemd.%0A%23%0A%23%20%20systemd%20is%20free%20software%3B%20you%20can%20redistribute%20it%20and/or%20modify%20it%0A%23%20%20under%20the%20terms%20of%20the%20GNU%20Lesser%20General%20Public%20License%20as%20published%20by%0A%23%20%20the%20Free%20Software%20Foundation%3B%20either%20version%202.1%20of%20the%20License%2C%20or%0A%23%20%20%28at%20your%20option%29%20any%20later%20version.%0A%23%0A%23%20Entries%20in%20this%20file%20show%20the%20compile%20time%20defaults.%0A%23%20You%20can%20change%20settings%20by%20editing%20this%20file.%0A%23%20Defaults%20can%20be%20restored%20by%20simply%20deleting%20this%20file.%0A%23%0A%23%20See%20coredump.conf%285%29%20for%20details.%0A%0A%5BCoredump%5D%0A%23Storage%3Dexternal%0A%23Compress%3Dyes%0A%23ProcessSizeMax%3D2G%0A%23ExternalSizeMax%3D2G%0A%23JournalSizeMax%3D767M%0A%23MaxUse%3D%0A%23KeepFree%3D%0AStorage%3Dnone%0AProcessSizeMax%3D0%0A + mode: 0644 + path: /etc/systemd/coredump.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if rpm --quiet -q systemd; then + +if [ -e "/etc/systemd/coredump.conf" ] ; then + + LC_ALL=C sed -i "/^\s*Storage\s*=\s*/Id" "/etc/systemd/coredump.conf" +else + touch "/etc/systemd/coredump.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/systemd/coredump.conf" + +cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" +# Insert at the end of the file +printf '%s\n' "Storage=none" >> "/etc/systemd/coredump.conf" +# Clean up after ourselves. +rm "/etc/systemd/coredump.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218961,40 +219126,6 @@ terminates an application. The memory image could contain sensitive data and is only for developers trying to debug problems. CCE-81038-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%2A%20%20%20%20%20hard%20%20%20core%20%20%20%200 - mode: 0644 - path: /etc/security/limits.d/75-disable_users_coredumps.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -SECURITY_LIMITS_FILE="/etc/security/limits.conf" - -if grep -qE '^\s*\*\s+hard\s+core' $SECURITY_LIMITS_FILE; then - sed -ri 's/(hard\s+core\s+)[[:digit:]]+/\1 0/' $SECURITY_LIMITS_FILE -else - echo "* hard core 0" >> $SECURITY_LIMITS_FILE -fi - -if ls /etc/security/limits.d/*.conf > /dev/null; then - sed -ri '/^\s*\*\s+hard\s+core/d' /etc/security/limits.d/*.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -219030,6 +219161,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%2A%20%20%20%20%20hard%20%20%20core%20%20%20%200 + mode: 0644 + path: /etc/security/limits.d/75-disable_users_coredumps.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +SECURITY_LIMITS_FILE="/etc/security/limits.conf" + +if grep -qE '^\s*\*\s+hard\s+core' $SECURITY_LIMITS_FILE; then + sed -ri 's/(hard\s+core\s+)[[:digit:]]+/\1 0/' $SECURITY_LIMITS_FILE +else + echo "* hard core 0" >> $SECURITY_LIMITS_FILE +fi + +if ls /etc/security/limits.d/*.conf > /dev/null; then + sed -ri '/^\s*\*\s+hard\s+core/d' /etc/security/limits.d/*.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219061,66 +219226,6 @@ setuid program to write a core file decreases the risk of unauthorized access of such data. CCE-80912-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of fs.suid_dumpable from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*fs.suid_dumpable.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "fs.suid_dumpable" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for fs.suid_dumpable -# -/sbin/sysctl -q -n -w fs.suid_dumpable="0" - -# -# If fs.suid_dumpable present in /etc/sysctl.conf, change value to "0" -# else, add "fs.suid_dumpable = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^fs.suid_dumpable") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^fs.suid_dumpable\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^fs.suid_dumpable\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80912-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -219182,6 +219287,66 @@ fi - medium_severity - reboot_required - sysctl_fs_suid_dumpable + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of fs.suid_dumpable from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*fs.suid_dumpable.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "fs.suid_dumpable" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for fs.suid_dumpable +# +/sbin/sysctl -q -n -w fs.suid_dumpable="0" + +# +# If fs.suid_dumpable present in /etc/sysctl.conf, change value to "0" +# else, add "fs.suid_dumpable = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^fs.suid_dumpable") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^fs.suid_dumpable\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^fs.suid_dumpable\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80912-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219342,15 +219507,6 @@ prevents execution in that address range. This is enabled by default on the latest Red Hat and Fedora systems if supported by the hardware. CCE-80914-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -grubby --update-kernel=ALL --remove-args=noexec --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Update grub defaults and the bootloader menu command: /sbin/grubby --update-kernel=ALL --remove-args="noexec" when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] @@ -219365,6 +219521,15 @@ fi - reboot_required - restrict_strategy - sysctl_kernel_exec_shield + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +grubby --update-kernel=ALL --remove-args=noexec --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219419,6 +219584,79 @@ be compromised. This option disallow any program without the CAP_SYSLOG capabili to get the addresses of kernel pointers by replacing them with 0. CCE-80915-2 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.kptr_restrict.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict + +- name: Comment out any occurrences of kernel.kptr_restrict from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.kptr_restrict + replace: '#kernel.kptr_restrict' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict +- name: XCCDF Value sysctl_kernel_kptr_restrict_value # promote to variable + set_fact: + sysctl_kernel_kptr_restrict_value: !!str + tags: + - always + +- name: Ensure sysctl kernel.kptr_restrict is set + sysctl: + name: kernel.kptr_restrict + value: '{{ sysctl_kernel_kptr_restrict_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -219495,79 +219733,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.kptr_restrict.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict - -- name: Comment out any occurrences of kernel.kptr_restrict from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.kptr_restrict - replace: '#kernel.kptr_restrict' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict -- name: XCCDF Value sysctl_kernel_kptr_restrict_value # promote to variable - set_fact: - sysctl_kernel_kptr_restrict_value: !!str - tags: - - always - -- name: Ensure sysctl kernel.kptr_restrict is set - sysctl: - name: kernel.kptr_restrict - value: '{{ sysctl_kernel_kptr_restrict_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict @@ -219633,6 +219798,80 @@ existing code in order to re-purpose it using return oriented programming (ROP) techniques. CCE-80916-0 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.randomize_va_space.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + +- name: Comment out any occurrences of kernel.randomize_va_space from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.randomize_va_space + replace: '#kernel.randomize_va_space' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + +- name: Ensure sysctl kernel.randomize_va_space is set to 2 + sysctl: + name: kernel.randomize_va_space + value: '2' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -219707,80 +219946,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.randomize_va_space.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space - -- name: Comment out any occurrences of kernel.randomize_va_space from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.randomize_va_space - replace: '#kernel.randomize_va_space' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space - -- name: Ensure sysctl kernel.randomize_va_space is set to 2 - sysctl: - name: kernel.randomize_va_space - value: '2' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space @@ -219936,18 +220101,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-80944-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=page_poison=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "page_poison=1" - - name: Gather the package facts package_facts: manager: auto @@ -219977,6 +220130,18 @@ append = "page_poison=1" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "page_poison=1" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=page_poison=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -220010,22 +220175,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-80945-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -var_slub_debug_options='' - - - -grubby --update-kernel=ALL --args=slub_debug=$var_slub_debug_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "slub_debug=" - - name: Gather the package facts package_facts: manager: auto @@ -220061,6 +220210,22 @@ append = "slub_debug=[customizations.kernel] +append = "slub_debug=" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +var_slub_debug_options='' + + + +grubby --update-kernel=ALL --args=slub_debug=$var_slub_debug_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -220131,8 +220296,25 @@ with enhanced security functionality designed to add mandatory access controls t The libselinux package contains the core library of the Security-enhanced Linux system. CCE-82877-2 - -package --add=libselinux + - name: Ensure libselinux is installed + package: + name: libselinux + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82877-2 + - PCI-DSSv4-1.2.6 + - enable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_libselinux_installed + + +[[packages]] +name = "libselinux" +version = "*" include install_libselinux @@ -220141,6 +220323,9 @@ class install_libselinux { ensure => 'installed', } } + + +package --add=libselinux # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220152,26 +220337,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "libselinux" -version = "*" - - - name: Ensure libselinux is installed - package: - name: libselinux - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82877-2 - - PCI-DSSv4-1.2.6 - - enable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_libselinux_installed @@ -220189,8 +220354,24 @@ $ sudo yum install policycoreutils-python-utilsThis package is required to operate and manage an SELinux environment and its policies. It provides utilities such as semanage, audit2allow, audit2why, chcat and sandbox. CCE-82724-6 - -package --add=policycoreutils-python-utils + - name: Ensure policycoreutils-python-utils is installed + package: + name: policycoreutils-python-utils + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82724-6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_policycoreutils-python-utils_installed + + +[[packages]] +name = "policycoreutils-python-utils" +version = "*" include install_policycoreutils-python-utils @@ -220199,6 +220380,9 @@ class install_policycoreutils-python-utils { ensure => 'installed', } } + + +package --add=policycoreutils-python-utils # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220210,25 +220394,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "policycoreutils-python-utils" -version = "*" - - - name: Ensure policycoreutils-python-utils is installed - package: - name: policycoreutils-python-utils - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82724-6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_policycoreutils-python-utils_installed @@ -220260,8 +220425,25 @@ basic operation of an SELinux-enabled system. These utilities include setfiles to label filesystems, newrole to switch roles, and so on. CCE-82976-2 - -package --add=policycoreutils + - name: Ensure policycoreutils is installed + package: + name: policycoreutils + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82976-2 + - DISA-STIG-RHEL-08-010171 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_policycoreutils_installed + + +[[packages]] +name = "policycoreutils" +version = "*" include install_policycoreutils @@ -220270,6 +220452,9 @@ class install_policycoreutils { ensure => 'installed', } } + + +package --add=policycoreutils # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220281,26 +220466,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "policycoreutils" -version = "*" - - - name: Ensure policycoreutils is installed - package: - name: policycoreutils - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82976-2 - - DISA-STIG-RHEL-08-010171 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_policycoreutils_installed @@ -220321,8 +220486,19 @@ $ sudo yum erase mcstrans Since this service is not used very often, disable it to reduce the amount of potentially vulnerable code running on the system. CCE-82756-8 - -package --remove=mcstrans + - name: Ensure mcstrans is removed + package: + name: mcstrans + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82756-8 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_mcstrans_removed include remove_mcstrans @@ -220331,6 +220507,9 @@ class remove_mcstrans { ensure => 'purged', } } + + +package --remove=mcstrans # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220350,20 +220529,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure mcstrans is removed - package: - name: mcstrans - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82756-8 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_mcstrans_removed @@ -220380,8 +220545,19 @@ $ sudo yum erase setroubleshoot-plugins The SETroubleshoot service is an unnecessary daemon to have running on a server. CCE-84250-0 - -package --remove=setroubleshoot-plugins + - name: Ensure setroubleshoot-plugins is removed + package: + name: setroubleshoot-plugins + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84250-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot-plugins_removed include remove_setroubleshoot-plugins @@ -220390,6 +220566,9 @@ class remove_setroubleshoot-plugins { ensure => 'purged', } } + + +package --remove=setroubleshoot-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220409,20 +220588,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot-plugins is removed - package: - name: setroubleshoot-plugins - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84250-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot-plugins_removed @@ -220443,8 +220608,19 @@ $ sudo yum erase setroubleshoot-server The SETroubleshoot service is an unnecessary daemon to have running on a server. CCE-83490-3 - -package --remove=setroubleshoot-server + - name: Ensure setroubleshoot-server is removed + package: + name: setroubleshoot-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83490-3 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot-server_removed include remove_setroubleshoot-server @@ -220453,6 +220629,9 @@ class remove_setroubleshoot-server { ensure => 'purged', } } + + +package --remove=setroubleshoot-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220472,20 +220651,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot-server is removed - package: - name: setroubleshoot-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83490-3 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot-server_removed @@ -220508,8 +220673,19 @@ $ sudo yum erase setroubleshoot have running on a server, especially if X Windows is removed or disabled. CCE-82755-0 - -package --remove=setroubleshoot + - name: Ensure setroubleshoot is removed + package: + name: setroubleshoot + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82755-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot_removed include remove_setroubleshoot @@ -220518,6 +220694,9 @@ class remove_setroubleshoot { ensure => 'purged', } } + + +package --remove=setroubleshoot # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220537,20 +220716,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot is removed - package: - name: setroubleshoot - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82755-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot_removed @@ -220901,16 +221066,6 @@ it from confining system services at boot time. Further, it increases the chances that it will remain off during system operation. CCE-80827-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -sed -i --follow-symlinks "s/selinux=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* -sed -i --follow-symlinks "s/enforcing=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -221064,6 +221219,16 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +sed -i --follow-symlinks "s/selinux=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* +sed -i --follow-symlinks "s/enforcing=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221433,31 +221598,6 @@ before setting it to "enforcing", which is strongly recommended. CCE-86151-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUX=permissive" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -fixfiles onboot -fixfiles -f relabel - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure SELinux is Not Disabled block: @@ -221495,6 +221635,31 @@ fi - reboot_required - restrict_strategy - selinux_not_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUX=permissive" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +fixfiles onboot +fixfiles -f relabel + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221693,31 +221858,6 @@ temporary cases, SELinux policies should be developed, and once work is completed, the system should be reconfigured to . CCE-80868-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_selinux_policy_name='' - - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUXTYPE=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUXTYPE=$var_selinux_policy_name" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_selinux_policy_name # promote to variable set_fact: var_selinux_policy_name: !!str @@ -221769,6 +221909,31 @@ fi - reboot_required - restrict_strategy - selinux_policytype + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_selinux_policy_name='' + + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUXTYPE=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUXTYPE=$var_selinux_policy_name" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221960,34 +222125,6 @@ potentially compromised processes to the security policy, which is designed to prevent them from causing damage to the system or further elevating their privileges. CCE-80869-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_selinux_state='' - - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUX=$var_selinux_state" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -fixfiles onboot -fixfiles -f relabel - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_selinux_state # promote to variable set_fact: var_selinux_state: !!str @@ -222038,6 +222175,34 @@ fi - no_reboot_needed - restrict_strategy - selinux_state + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_selinux_state='' + + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUX=$var_selinux_state" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +fixfiles onboot +fixfiles -f relabel + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -224759,29 +224924,6 @@ To disable the abrt_anon_write SELinux boolean, run the f $ sudo setsebool -P abrt_anon_write off 3.7.2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_abrt_anon_write='' - - setsebool -P abrt_anon_write $var_abrt_anon_write - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the abrt_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -224819,24 +224961,7 @@ fi - no_reboot_needed - sebool_abrt_anon_write - - - - - - - - - - Disable the abrt_handle_event SELinux Boolean - By default, the SELinux boolean abrt_handle_event is disabled. -If this setting is enabled, it should be disabled. - -To disable the abrt_handle_event SELinux boolean, run the following command: -$ sudo setsebool -P abrt_handle_event off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -224846,9 +224971,9 @@ fi if selinuxenabled; then - var_abrt_handle_event='' + var_abrt_anon_write='' - setsebool -P abrt_handle_event $var_abrt_handle_event + setsebool -P abrt_anon_write $var_abrt_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -224859,6 +224984,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the abrt_handle_event SELinux Boolean + By default, the SELinux boolean abrt_handle_event is disabled. +If this setting is enabled, it should be disabled. + +To disable the abrt_handle_event SELinux boolean, run the following command: +$ sudo setsebool -P abrt_handle_event off + 3.7.2 + - name: Disable the abrt_handle_event SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -224897,25 +225039,7 @@ fi - no_reboot_needed - sebool_abrt_handle_event - - - - - - - - - - Disable the abrt_upload_watch_anon_write SELinux Boolean - By default, the SELinux boolean abrt_upload_watch_anon_write is enabled. -This setting should be disabled as it allows the Automatic Bug Report Tool (ABRT) -to modify public files used for public file transfer services. - -To disable the abrt_upload_watch_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P abrt_upload_watch_anon_write off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -224925,9 +225049,9 @@ fi if selinuxenabled; then - var_abrt_upload_watch_anon_write='' + var_abrt_handle_event='' - setsebool -P abrt_upload_watch_anon_write $var_abrt_upload_watch_anon_write + setsebool -P abrt_handle_event $var_abrt_handle_event else echo "Skipping remediation, SELinux is disabled"; @@ -224938,6 +225062,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the abrt_upload_watch_anon_write SELinux Boolean + By default, the SELinux boolean abrt_upload_watch_anon_write is enabled. +This setting should be disabled as it allows the Automatic Bug Report Tool (ABRT) +to modify public files used for public file transfer services. + +To disable the abrt_upload_watch_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P abrt_upload_watch_anon_write off + 3.7.2 + - name: Disable the abrt_upload_watch_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -224976,25 +225118,7 @@ fi - no_reboot_needed - sebool_abrt_upload_watch_anon_write - - - - - - - - - - Enable the antivirus_can_scan_system SELinux Boolean - By default, the SELinux boolean antivirus_can_scan_system is disabled. -This setting should be enabled as it allows antivirus programs to read non-security -files on a system. - -To enable the antivirus_can_scan_system SELinux boolean, run the following command: -$ sudo setsebool -P antivirus_can_scan_system on - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225004,9 +225128,9 @@ fi if selinuxenabled; then - var_antivirus_can_scan_system='' + var_abrt_upload_watch_anon_write='' - setsebool -P antivirus_can_scan_system $var_antivirus_can_scan_system + setsebool -P abrt_upload_watch_anon_write $var_abrt_upload_watch_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -225017,6 +225141,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the antivirus_can_scan_system SELinux Boolean + By default, the SELinux boolean antivirus_can_scan_system is disabled. +This setting should be enabled as it allows antivirus programs to read non-security +files on a system. + +To enable the antivirus_can_scan_system SELinux boolean, run the following command: +$ sudo setsebool -P antivirus_can_scan_system on + 3.7.2 + - name: Enable the antivirus_can_scan_system SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225055,24 +225197,7 @@ fi - no_reboot_needed - sebool_antivirus_can_scan_system - - - - - - - - - - Disable the antivirus_use_jit SELinux Boolean - By default, the SELinux boolean antivirus_use_jit is disabled. -If this setting is enabled, it should be disabled. - -To disable the antivirus_use_jit SELinux boolean, run the following command: -$ sudo setsebool -P antivirus_use_jit off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225082,9 +225207,9 @@ fi if selinuxenabled; then - var_antivirus_use_jit='' + var_antivirus_can_scan_system='' - setsebool -P antivirus_use_jit $var_antivirus_use_jit + setsebool -P antivirus_can_scan_system $var_antivirus_can_scan_system else echo "Skipping remediation, SELinux is disabled"; @@ -225095,6 +225220,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the antivirus_use_jit SELinux Boolean + By default, the SELinux boolean antivirus_use_jit is disabled. +If this setting is enabled, it should be disabled. + +To disable the antivirus_use_jit SELinux boolean, run the following command: +$ sudo setsebool -P antivirus_use_jit off + 3.7.2 + - name: Disable the antivirus_use_jit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225132,6 +225274,29 @@ fi - medium_severity - no_reboot_needed - sebool_antivirus_use_jit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_antivirus_use_jit='' + + setsebool -P antivirus_use_jit $var_antivirus_use_jit + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225157,29 +225322,6 @@ To enable the auditadm_exec_content SELinux boolean, run 0957 CCE-84297-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_auditadm_exec_content='' - - setsebool -P auditadm_exec_content $var_auditadm_exec_content - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the auditadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225219,6 +225361,29 @@ fi - medium_severity - no_reboot_needed - sebool_auditadm_exec_content + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_auditadm_exec_content='' + + setsebool -P auditadm_exec_content $var_auditadm_exec_content + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225252,29 +225417,6 @@ To disable the authlogin_nsswitch_use_ldap SELinux boolea 1561 CCE-84296-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_authlogin_nsswitch_use_ldap='' - - setsebool -P authlogin_nsswitch_use_ldap $var_authlogin_nsswitch_use_ldap - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the authlogin_nsswitch_use_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225314,6 +225456,29 @@ fi - medium_severity - no_reboot_needed - sebool_authlogin_nsswitch_use_ldap + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_authlogin_nsswitch_use_ldap='' + + setsebool -P authlogin_nsswitch_use_ldap $var_authlogin_nsswitch_use_ldap + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225347,29 +225512,6 @@ To disable the authlogin_radius SELinux boolean, run the 1561 CCE-84294-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_authlogin_radius='' - - setsebool -P authlogin_radius $var_authlogin_radius - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the authlogin_radius SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225410,24 +225552,7 @@ fi - no_reboot_needed - sebool_authlogin_radius - - - - - - - - - - Disable the authlogin_yubikey SELinux Boolean - By default, the SELinux boolean authlogin_yubikey is disabled. -If this setting is enabled, it should be disabled. - -To disable the authlogin_yubikey SELinux boolean, run the following command: -$ sudo setsebool -P authlogin_yubikey off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225437,9 +225562,9 @@ fi if selinuxenabled; then - var_authlogin_yubikey='' + var_authlogin_radius='' - setsebool -P authlogin_yubikey $var_authlogin_yubikey + setsebool -P authlogin_radius $var_authlogin_radius else echo "Skipping remediation, SELinux is disabled"; @@ -225450,6 +225575,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the authlogin_yubikey SELinux Boolean + By default, the SELinux boolean authlogin_yubikey is disabled. +If this setting is enabled, it should be disabled. + +To disable the authlogin_yubikey SELinux boolean, run the following command: +$ sudo setsebool -P authlogin_yubikey off + 3.7.2 + - name: Disable the authlogin_yubikey SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225488,24 +225630,7 @@ fi - no_reboot_needed - sebool_authlogin_yubikey - - - - - - - - - - Disable the awstats_purge_apache_log_files SELinux Boolean - By default, the SELinux boolean awstats_purge_apache_log_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the awstats_purge_apache_log_files SELinux boolean, run the following command: -$ sudo setsebool -P awstats_purge_apache_log_files off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225515,9 +225640,9 @@ fi if selinuxenabled; then - var_awstats_purge_apache_log_files='' + var_authlogin_yubikey='' - setsebool -P awstats_purge_apache_log_files $var_awstats_purge_apache_log_files + setsebool -P authlogin_yubikey $var_authlogin_yubikey else echo "Skipping remediation, SELinux is disabled"; @@ -225528,6 +225653,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the awstats_purge_apache_log_files SELinux Boolean + By default, the SELinux boolean awstats_purge_apache_log_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the awstats_purge_apache_log_files SELinux boolean, run the following command: +$ sudo setsebool -P awstats_purge_apache_log_files off + 3.7.2 + - name: Disable the awstats_purge_apache_log_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225566,26 +225708,7 @@ fi - no_reboot_needed - sebool_awstats_purge_apache_log_files - - - - - - - - - - Disable the boinc_execmem SELinux Boolean - By default, the SELinux boolean boinc_execmem is enabled. -This setting should be disabled. - -To disable the boinc_execmem SELinux boolean, run the following command: -$ sudo setsebool -P boinc_execmem off - BP28(R67) - 3.7.2 - - CCE-83304-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225595,9 +225718,9 @@ fi if selinuxenabled; then - var_boinc_execmem='' + var_awstats_purge_apache_log_files='' - setsebool -P boinc_execmem $var_boinc_execmem + setsebool -P awstats_purge_apache_log_files $var_awstats_purge_apache_log_files else echo "Skipping remediation, SELinux is disabled"; @@ -225608,6 +225731,25 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the boinc_execmem SELinux Boolean + By default, the SELinux boolean boinc_execmem is enabled. +This setting should be disabled. + +To disable the boinc_execmem SELinux boolean, run the following command: +$ sudo setsebool -P boinc_execmem off + BP28(R67) + 3.7.2 + + CCE-83304-6 - name: Disable the boinc_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -225647,23 +225789,7 @@ fi - no_reboot_needed - sebool_boinc_execmem - - - - - - - - - - Disable the cdrecord_read_content SELinux Boolean - By default, the SELinux boolean cdrecord_read_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the cdrecord_read_content SELinux boolean, run the following command: -$ sudo setsebool -P cdrecord_read_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225673,9 +225799,9 @@ fi if selinuxenabled; then - var_cdrecord_read_content='' + var_boinc_execmem='' - setsebool -P cdrecord_read_content $var_cdrecord_read_content + setsebool -P boinc_execmem $var_boinc_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -225686,6 +225812,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cdrecord_read_content SELinux Boolean + By default, the SELinux boolean cdrecord_read_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the cdrecord_read_content SELinux boolean, run the following command: +$ sudo setsebool -P cdrecord_read_content off + - name: Disable the cdrecord_read_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225722,23 +225864,7 @@ fi - no_reboot_needed - sebool_cdrecord_read_content - - - - - - - - - - Disable the cluster_can_network_connect SELinux Boolean - By default, the SELinux boolean cluster_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P cluster_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225748,9 +225874,9 @@ fi if selinuxenabled; then - var_cluster_can_network_connect='' + var_cdrecord_read_content='' - setsebool -P cluster_can_network_connect $var_cluster_can_network_connect + setsebool -P cdrecord_read_content $var_cdrecord_read_content else echo "Skipping remediation, SELinux is disabled"; @@ -225761,6 +225887,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_can_network_connect SELinux Boolean + By default, the SELinux boolean cluster_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P cluster_can_network_connect off + - name: Disable the cluster_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225797,23 +225939,7 @@ fi - no_reboot_needed - sebool_cluster_can_network_connect - - - - - - - - - - Disable the cluster_manage_all_files SELinux Boolean - By default, the SELinux boolean cluster_manage_all_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_manage_all_files SELinux boolean, run the following command: -$ sudo setsebool -P cluster_manage_all_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225823,9 +225949,9 @@ fi if selinuxenabled; then - var_cluster_manage_all_files='' + var_cluster_can_network_connect='' - setsebool -P cluster_manage_all_files $var_cluster_manage_all_files + setsebool -P cluster_can_network_connect $var_cluster_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -225836,6 +225962,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_manage_all_files SELinux Boolean + By default, the SELinux boolean cluster_manage_all_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_manage_all_files SELinux boolean, run the following command: +$ sudo setsebool -P cluster_manage_all_files off + - name: Disable the cluster_manage_all_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225872,25 +226014,7 @@ fi - no_reboot_needed - sebool_cluster_manage_all_files - - - - - - - - - - Disable the cluster_use_execmem SELinux Boolean - By default, the SELinux boolean cluster_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P cluster_use_execmem off - BP28(R67) - - CCE-83305-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225900,9 +226024,9 @@ fi if selinuxenabled; then - var_cluster_use_execmem='' + var_cluster_manage_all_files='' - setsebool -P cluster_use_execmem $var_cluster_use_execmem + setsebool -P cluster_manage_all_files $var_cluster_manage_all_files else echo "Skipping remediation, SELinux is disabled"; @@ -225913,6 +226037,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_use_execmem SELinux Boolean + By default, the SELinux boolean cluster_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P cluster_use_execmem off + BP28(R67) + + CCE-83305-3 - name: Disable the cluster_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225951,23 +226093,7 @@ fi - no_reboot_needed - sebool_cluster_use_execmem - - - - - - - - - - Disable the cobbler_anon_write SELinux Boolean - By default, the SELinux boolean cobbler_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225977,9 +226103,9 @@ fi if selinuxenabled; then - var_cobbler_anon_write='' + var_cluster_use_execmem='' - setsebool -P cobbler_anon_write $var_cobbler_anon_write + setsebool -P cluster_use_execmem $var_cluster_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -225990,6 +226116,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_anon_write SELinux Boolean + By default, the SELinux boolean cobbler_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_anon_write off + - name: Disable the cobbler_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226026,23 +226168,7 @@ fi - no_reboot_needed - sebool_cobbler_anon_write - - - - - - - - - - Disable the cobbler_can_network_connect SELinux Boolean - By default, the SELinux boolean cobbler_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226052,9 +226178,9 @@ fi if selinuxenabled; then - var_cobbler_can_network_connect='' + var_cobbler_anon_write='' - setsebool -P cobbler_can_network_connect $var_cobbler_can_network_connect + setsebool -P cobbler_anon_write $var_cobbler_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -226065,6 +226191,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_can_network_connect SELinux Boolean + By default, the SELinux boolean cobbler_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_can_network_connect off + - name: Disable the cobbler_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226101,23 +226243,7 @@ fi - no_reboot_needed - sebool_cobbler_can_network_connect - - - - - - - - - - Disable the cobbler_use_cifs SELinux Boolean - By default, the SELinux boolean cobbler_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226127,9 +226253,9 @@ fi if selinuxenabled; then - var_cobbler_use_cifs='' + var_cobbler_can_network_connect='' - setsebool -P cobbler_use_cifs $var_cobbler_use_cifs + setsebool -P cobbler_can_network_connect $var_cobbler_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226140,6 +226266,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_use_cifs SELinux Boolean + By default, the SELinux boolean cobbler_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_use_cifs off + - name: Disable the cobbler_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226176,23 +226318,7 @@ fi - no_reboot_needed - sebool_cobbler_use_cifs - - - - - - - - - - Disable the cobbler_use_nfs SELinux Boolean - By default, the SELinux boolean cobbler_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226202,9 +226328,9 @@ fi if selinuxenabled; then - var_cobbler_use_nfs='' + var_cobbler_use_cifs='' - setsebool -P cobbler_use_nfs $var_cobbler_use_nfs + setsebool -P cobbler_use_cifs $var_cobbler_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -226215,6 +226341,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_use_nfs SELinux Boolean + By default, the SELinux boolean cobbler_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_use_nfs off + - name: Disable the cobbler_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226250,23 +226392,7 @@ fi - no_reboot_needed - sebool_cobbler_use_nfs - - - - - - - - - - Disable the collectd_tcp_network_connect SELinux Boolean - By default, the SELinux boolean collectd_tcp_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the collectd_tcp_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P collectd_tcp_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226276,9 +226402,9 @@ fi if selinuxenabled; then - var_collectd_tcp_network_connect='' + var_cobbler_use_nfs='' - setsebool -P collectd_tcp_network_connect $var_collectd_tcp_network_connect + setsebool -P cobbler_use_nfs $var_cobbler_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -226289,6 +226415,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the collectd_tcp_network_connect SELinux Boolean + By default, the SELinux boolean collectd_tcp_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the collectd_tcp_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P collectd_tcp_network_connect off + - name: Disable the collectd_tcp_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226325,23 +226467,7 @@ fi - no_reboot_needed - sebool_collectd_tcp_network_connect - - - - - - - - - - Disable the condor_tcp_network_connect SELinux Boolean - By default, the SELinux boolean condor_tcp_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the condor_tcp_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P condor_tcp_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226351,9 +226477,9 @@ fi if selinuxenabled; then - var_condor_tcp_network_connect='' + var_collectd_tcp_network_connect='' - setsebool -P condor_tcp_network_connect $var_condor_tcp_network_connect + setsebool -P collectd_tcp_network_connect $var_collectd_tcp_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226364,6 +226490,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the condor_tcp_network_connect SELinux Boolean + By default, the SELinux boolean condor_tcp_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the condor_tcp_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P condor_tcp_network_connect off + - name: Disable the condor_tcp_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226400,23 +226542,7 @@ fi - no_reboot_needed - sebool_condor_tcp_network_connect - - - - - - - - - - Disable the conman_can_network SELinux Boolean - By default, the SELinux boolean conman_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the conman_can_network SELinux boolean, run the following command: -$ sudo setsebool -P conman_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226426,9 +226552,9 @@ fi if selinuxenabled; then - var_conman_can_network='' + var_condor_tcp_network_connect='' - setsebool -P conman_can_network $var_conman_can_network + setsebool -P condor_tcp_network_connect $var_condor_tcp_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226439,6 +226565,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the conman_can_network SELinux Boolean + By default, the SELinux boolean conman_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the conman_can_network SELinux boolean, run the following command: +$ sudo setsebool -P conman_can_network off + - name: Disable the conman_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226475,23 +226617,7 @@ fi - no_reboot_needed - sebool_conman_can_network - - - - - - - - - - Disable the container_connect_any SELinux Boolean - By default, the SELinux boolean container_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the container_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P container_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226501,9 +226627,9 @@ fi if selinuxenabled; then - var_container_connect_any='' + var_conman_can_network='' - setsebool -P container_connect_any $var_container_connect_any + setsebool -P conman_can_network $var_conman_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -226514,6 +226640,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the container_connect_any SELinux Boolean + By default, the SELinux boolean container_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the container_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P container_connect_any off + - name: Disable the container_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226550,23 +226692,7 @@ fi - no_reboot_needed - sebool_container_connect_any - - - - - - - - - - Disable the cron_can_relabel SELinux Boolean - By default, the SELinux boolean cron_can_relabel is disabled. -If this setting is enabled, it should be disabled. - -To disable the cron_can_relabel SELinux boolean, run the following command: -$ sudo setsebool -P cron_can_relabel off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226576,9 +226702,9 @@ fi if selinuxenabled; then - var_cron_can_relabel='' + var_container_connect_any='' - setsebool -P cron_can_relabel $var_cron_can_relabel + setsebool -P container_connect_any $var_container_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -226589,6 +226715,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cron_can_relabel SELinux Boolean + By default, the SELinux boolean cron_can_relabel is disabled. +If this setting is enabled, it should be disabled. + +To disable the cron_can_relabel SELinux boolean, run the following command: +$ sudo setsebool -P cron_can_relabel off + - name: Disable the cron_can_relabel SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226625,23 +226767,7 @@ fi - no_reboot_needed - sebool_cron_can_relabel - - - - - - - - - - Disable the cron_system_cronjob_use_shares SELinux Boolean - By default, the SELinux boolean cron_system_cronjob_use_shares is disabled. -If this setting is enabled, it should be disabled. - -To disable the cron_system_cronjob_use_shares SELinux boolean, run the following command: -$ sudo setsebool -P cron_system_cronjob_use_shares off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226651,9 +226777,9 @@ fi if selinuxenabled; then - var_cron_system_cronjob_use_shares='' + var_cron_can_relabel='' - setsebool -P cron_system_cronjob_use_shares $var_cron_system_cronjob_use_shares + setsebool -P cron_can_relabel $var_cron_can_relabel else echo "Skipping remediation, SELinux is disabled"; @@ -226664,6 +226790,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cron_system_cronjob_use_shares SELinux Boolean + By default, the SELinux boolean cron_system_cronjob_use_shares is disabled. +If this setting is enabled, it should be disabled. + +To disable the cron_system_cronjob_use_shares SELinux boolean, run the following command: +$ sudo setsebool -P cron_system_cronjob_use_shares off + - name: Disable the cron_system_cronjob_use_shares SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226700,24 +226842,7 @@ fi - no_reboot_needed - sebool_cron_system_cronjob_use_shares - - - - - - - - - - Enable the cron_userdomain_transition SELinux Boolean - By default, the SELinux boolean cron_userdomain_transition is enabled. -This setting should be enabled as end user cron jobs run in their default -associated user domain(s) instead of the general cronjob domain. - -To enable the cron_userdomain_transition SELinux boolean, run the following command: -$ sudo setsebool -P cron_userdomain_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226727,9 +226852,9 @@ fi if selinuxenabled; then - var_cron_userdomain_transition='' + var_cron_system_cronjob_use_shares='' - setsebool -P cron_userdomain_transition $var_cron_userdomain_transition + setsebool -P cron_system_cronjob_use_shares $var_cron_system_cronjob_use_shares else echo "Skipping remediation, SELinux is disabled"; @@ -226740,6 +226865,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the cron_userdomain_transition SELinux Boolean + By default, the SELinux boolean cron_userdomain_transition is enabled. +This setting should be enabled as end user cron jobs run in their default +associated user domain(s) instead of the general cronjob domain. + +To enable the cron_userdomain_transition SELinux boolean, run the following command: +$ sudo setsebool -P cron_userdomain_transition on + - name: Enable the cron_userdomain_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226776,25 +226918,7 @@ fi - no_reboot_needed - sebool_cron_userdomain_transition - - - - - - - - - - Disable the cups_execmem SELinux Boolean - By default, the SELinux boolean cups_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the cups_execmem SELinux boolean, run the following command: -$ sudo setsebool -P cups_execmem off - BP28(R67) - - CCE-83306-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226804,9 +226928,9 @@ fi if selinuxenabled; then - var_cups_execmem='' + var_cron_userdomain_transition='' - setsebool -P cups_execmem $var_cups_execmem + setsebool -P cron_userdomain_transition $var_cron_userdomain_transition else echo "Skipping remediation, SELinux is disabled"; @@ -226817,6 +226941,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cups_execmem SELinux Boolean + By default, the SELinux boolean cups_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the cups_execmem SELinux boolean, run the following command: +$ sudo setsebool -P cups_execmem off + BP28(R67) + + CCE-83306-1 - name: Disable the cups_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226854,23 +226996,7 @@ fi - no_reboot_needed - sebool_cups_execmem - - - - - - - - - - Disable the cvs_read_shadow SELinux Boolean - By default, the SELinux boolean cvs_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the cvs_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P cvs_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226880,9 +227006,9 @@ fi if selinuxenabled; then - var_cvs_read_shadow='' + var_cups_execmem='' - setsebool -P cvs_read_shadow $var_cvs_read_shadow + setsebool -P cups_execmem $var_cups_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -226893,6 +227019,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cvs_read_shadow SELinux Boolean + By default, the SELinux boolean cvs_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the cvs_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P cvs_read_shadow off + - name: Disable the cvs_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226928,23 +227070,7 @@ fi - no_reboot_needed - sebool_cvs_read_shadow - - - - - - - - - - Disable the daemons_dump_core SELinux Boolean - By default, the SELinux boolean daemons_dump_core is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_dump_core SELinux boolean, run the following command: -$ sudo setsebool -P daemons_dump_core off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226954,9 +227080,9 @@ fi if selinuxenabled; then - var_daemons_dump_core='' + var_cvs_read_shadow='' - setsebool -P daemons_dump_core $var_daemons_dump_core + setsebool -P cvs_read_shadow $var_cvs_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -226967,6 +227093,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_dump_core SELinux Boolean + By default, the SELinux boolean daemons_dump_core is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_dump_core SELinux boolean, run the following command: +$ sudo setsebool -P daemons_dump_core off + - name: Disable the daemons_dump_core SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227003,23 +227145,7 @@ fi - no_reboot_needed - sebool_daemons_dump_core - - - - - - - - - - Disable the daemons_enable_cluster_mode SELinux Boolean - By default, the SELinux boolean daemons_enable_cluster_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_enable_cluster_mode SELinux boolean, run the following command: -$ sudo setsebool -P daemons_enable_cluster_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227029,9 +227155,9 @@ fi if selinuxenabled; then - var_daemons_enable_cluster_mode='' + var_daemons_dump_core='' - setsebool -P daemons_enable_cluster_mode $var_daemons_enable_cluster_mode + setsebool -P daemons_dump_core $var_daemons_dump_core else echo "Skipping remediation, SELinux is disabled"; @@ -227042,6 +227168,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_enable_cluster_mode SELinux Boolean + By default, the SELinux boolean daemons_enable_cluster_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_enable_cluster_mode SELinux boolean, run the following command: +$ sudo setsebool -P daemons_enable_cluster_mode off + - name: Disable the daemons_enable_cluster_mode SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227078,23 +227220,7 @@ fi - no_reboot_needed - sebool_daemons_enable_cluster_mode - - - - - - - - - - Disable the daemons_use_tcp_wrapper SELinux Boolean - By default, the SELinux boolean daemons_use_tcp_wrapper is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_use_tcp_wrapper SELinux boolean, run the following command: -$ sudo setsebool -P daemons_use_tcp_wrapper off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227104,9 +227230,9 @@ fi if selinuxenabled; then - var_daemons_use_tcp_wrapper='' + var_daemons_enable_cluster_mode='' - setsebool -P daemons_use_tcp_wrapper $var_daemons_use_tcp_wrapper + setsebool -P daemons_enable_cluster_mode $var_daemons_enable_cluster_mode else echo "Skipping remediation, SELinux is disabled"; @@ -227117,14 +227243,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the daemons_use_tcp_wrapper SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy + + + + + + + + + + Disable the daemons_use_tcp_wrapper SELinux Boolean + By default, the SELinux boolean daemons_use_tcp_wrapper is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_use_tcp_wrapper SELinux boolean, run the following command: +$ sudo setsebool -P daemons_use_tcp_wrapper off + + - name: Disable the daemons_use_tcp_wrapper SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy - low_complexity - low_disruption - medium_severity @@ -227153,23 +227295,7 @@ fi - no_reboot_needed - sebool_daemons_use_tcp_wrapper - - - - - - - - - - Disable the daemons_use_tty SELinux Boolean - By default, the SELinux boolean daemons_use_tty is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_use_tty SELinux boolean, run the following command: -$ sudo setsebool -P daemons_use_tty off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227179,9 +227305,9 @@ fi if selinuxenabled; then - var_daemons_use_tty='' + var_daemons_use_tcp_wrapper='' - setsebool -P daemons_use_tty $var_daemons_use_tty + setsebool -P daemons_use_tcp_wrapper $var_daemons_use_tcp_wrapper else echo "Skipping remediation, SELinux is disabled"; @@ -227192,6 +227318,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_use_tty SELinux Boolean + By default, the SELinux boolean daemons_use_tty is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_use_tty SELinux boolean, run the following command: +$ sudo setsebool -P daemons_use_tty off + - name: Disable the daemons_use_tty SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227227,23 +227369,7 @@ fi - no_reboot_needed - sebool_daemons_use_tty - - - - - - - - - - Enable the dbadm_exec_content SELinux Boolean - By default, the SELinux boolean dbadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the dbadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227253,9 +227379,9 @@ fi if selinuxenabled; then - var_dbadm_exec_content='' + var_daemons_use_tty='' - setsebool -P dbadm_exec_content $var_dbadm_exec_content + setsebool -P daemons_use_tty $var_daemons_use_tty else echo "Skipping remediation, SELinux is disabled"; @@ -227266,6 +227392,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the dbadm_exec_content SELinux Boolean + By default, the SELinux boolean dbadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the dbadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_exec_content on + - name: Enable the dbadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227302,23 +227444,7 @@ fi - no_reboot_needed - sebool_dbadm_exec_content - - - - - - - - - - Disable the dbadm_manage_user_files SELinux Boolean - By default, the SELinux boolean dbadm_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the dbadm_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227328,9 +227454,9 @@ fi if selinuxenabled; then - var_dbadm_manage_user_files='' + var_dbadm_exec_content='' - setsebool -P dbadm_manage_user_files $var_dbadm_manage_user_files + setsebool -P dbadm_exec_content $var_dbadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -227341,6 +227467,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dbadm_manage_user_files SELinux Boolean + By default, the SELinux boolean dbadm_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the dbadm_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_manage_user_files off + - name: Disable the dbadm_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227377,23 +227519,7 @@ fi - no_reboot_needed - sebool_dbadm_manage_user_files - - - - - - - - - - Disable the dbadm_read_user_files SELinux Boolean - By default, the SELinux boolean dbadm_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the dbadm_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227403,9 +227529,9 @@ fi if selinuxenabled; then - var_dbadm_read_user_files='' + var_dbadm_manage_user_files='' - setsebool -P dbadm_read_user_files $var_dbadm_read_user_files + setsebool -P dbadm_manage_user_files $var_dbadm_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -227416,6 +227542,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dbadm_read_user_files SELinux Boolean + By default, the SELinux boolean dbadm_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the dbadm_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_read_user_files off + - name: Disable the dbadm_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227451,6 +227593,29 @@ fi - medium_severity - no_reboot_needed - sebool_dbadm_read_user_files + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_dbadm_read_user_files='' + + setsebool -P dbadm_read_user_files $var_dbadm_read_user_files + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -227491,29 +227656,6 @@ If this setting is enabled, it should be disabled. To disable the deny_ptrace SELinux boolean, run the following command: $ sudo setsebool -P deny_ptrace off - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_deny_ptrace='' - - setsebool -P deny_ptrace $var_deny_ptrace - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the deny_ptrace SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227549,23 +227691,7 @@ fi - no_reboot_needed - sebool_deny_ptrace - - - - - - - - - - Disable the dhcpc_exec_iptables SELinux Boolean - By default, the SELinux boolean dhcpc_exec_iptables is disabled. -If this setting is enabled, it should be disabled. - -To disable the dhcpc_exec_iptables SELinux boolean, run the following command: -$ sudo setsebool -P dhcpc_exec_iptables off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227575,9 +227701,9 @@ fi if selinuxenabled; then - var_dhcpc_exec_iptables='' + var_deny_ptrace='' - setsebool -P dhcpc_exec_iptables $var_dhcpc_exec_iptables + setsebool -P deny_ptrace $var_deny_ptrace else echo "Skipping remediation, SELinux is disabled"; @@ -227588,6 +227714,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dhcpc_exec_iptables SELinux Boolean + By default, the SELinux boolean dhcpc_exec_iptables is disabled. +If this setting is enabled, it should be disabled. + +To disable the dhcpc_exec_iptables SELinux boolean, run the following command: +$ sudo setsebool -P dhcpc_exec_iptables off + - name: Disable the dhcpc_exec_iptables SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227624,23 +227766,7 @@ fi - no_reboot_needed - sebool_dhcpc_exec_iptables - - - - - - - - - - Disable the dhcpd_use_ldap SELinux Boolean - By default, the SELinux boolean dhcpd_use_ldap is disabled. -If this setting is enabled, it should be disabled. - -To disable the dhcpd_use_ldap SELinux boolean, run the following command: -$ sudo setsebool -P dhcpd_use_ldap off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227650,9 +227776,9 @@ fi if selinuxenabled; then - var_dhcpd_use_ldap='' + var_dhcpc_exec_iptables='' - setsebool -P dhcpd_use_ldap $var_dhcpd_use_ldap + setsebool -P dhcpc_exec_iptables $var_dhcpc_exec_iptables else echo "Skipping remediation, SELinux is disabled"; @@ -227663,6 +227789,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dhcpd_use_ldap SELinux Boolean + By default, the SELinux boolean dhcpd_use_ldap is disabled. +If this setting is enabled, it should be disabled. + +To disable the dhcpd_use_ldap SELinux boolean, run the following command: +$ sudo setsebool -P dhcpd_use_ldap off + - name: Disable the dhcpd_use_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227698,23 +227840,7 @@ fi - no_reboot_needed - sebool_dhcpd_use_ldap - - - - - - - - - - Enable the domain_fd_use SELinux Boolean - By default, the SELinux boolean domain_fd_use is enabled. -If this setting is disabled, it should be enabled. - -To enable the domain_fd_use SELinux boolean, run the following command: -$ sudo setsebool -P domain_fd_use on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227724,9 +227850,9 @@ fi if selinuxenabled; then - var_domain_fd_use='' + var_dhcpd_use_ldap='' - setsebool -P domain_fd_use $var_domain_fd_use + setsebool -P dhcpd_use_ldap $var_dhcpd_use_ldap else echo "Skipping remediation, SELinux is disabled"; @@ -227737,6 +227863,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the domain_fd_use SELinux Boolean + By default, the SELinux boolean domain_fd_use is enabled. +If this setting is disabled, it should be enabled. + +To enable the domain_fd_use SELinux boolean, run the following command: +$ sudo setsebool -P domain_fd_use on + - name: Enable the domain_fd_use SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227772,23 +227914,7 @@ fi - no_reboot_needed - sebool_domain_fd_use - - - - - - - - - - Disable the domain_kernel_load_modules SELinux Boolean - By default, the SELinux boolean domain_kernel_load_modules is disabled. -If this setting is enabled, it should be disabled. - -To disable the domain_kernel_load_modules SELinux boolean, run the following command: -$ sudo setsebool -P domain_kernel_load_modules off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227798,9 +227924,9 @@ fi if selinuxenabled; then - var_domain_kernel_load_modules='' + var_domain_fd_use='' - setsebool -P domain_kernel_load_modules $var_domain_kernel_load_modules + setsebool -P domain_fd_use $var_domain_fd_use else echo "Skipping remediation, SELinux is disabled"; @@ -227811,6 +227937,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the domain_kernel_load_modules SELinux Boolean + By default, the SELinux boolean domain_kernel_load_modules is disabled. +If this setting is enabled, it should be disabled. + +To disable the domain_kernel_load_modules SELinux boolean, run the following command: +$ sudo setsebool -P domain_kernel_load_modules off + - name: Disable the domain_kernel_load_modules SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227847,23 +227989,7 @@ fi - no_reboot_needed - sebool_domain_kernel_load_modules - - - - - - - - - - Disable the entropyd_use_audio SELinux Boolean - By default, the SELinux boolean entropyd_use_audio is enabled. -This setting should be disabled as it uses audit input to generate entropy. - -To disable the entropyd_use_audio SELinux boolean, run the following command: -$ sudo setsebool -P entropyd_use_audio off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227873,9 +227999,9 @@ fi if selinuxenabled; then - var_entropyd_use_audio='' + var_domain_kernel_load_modules='' - setsebool -P entropyd_use_audio $var_entropyd_use_audio + setsebool -P domain_kernel_load_modules $var_domain_kernel_load_modules else echo "Skipping remediation, SELinux is disabled"; @@ -227886,6 +228012,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the entropyd_use_audio SELinux Boolean + By default, the SELinux boolean entropyd_use_audio is enabled. +This setting should be disabled as it uses audit input to generate entropy. + +To disable the entropyd_use_audio SELinux boolean, run the following command: +$ sudo setsebool -P entropyd_use_audio off + - name: Disable the entropyd_use_audio SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227922,23 +228064,7 @@ fi - no_reboot_needed - sebool_entropyd_use_audio - - - - - - - - - - Disable the exim_can_connect_db SELinux Boolean - By default, the SELinux boolean exim_can_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_can_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P exim_can_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227948,9 +228074,9 @@ fi if selinuxenabled; then - var_exim_can_connect_db='' + var_entropyd_use_audio='' - setsebool -P exim_can_connect_db $var_exim_can_connect_db + setsebool -P entropyd_use_audio $var_entropyd_use_audio else echo "Skipping remediation, SELinux is disabled"; @@ -227961,6 +228087,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_can_connect_db SELinux Boolean + By default, the SELinux boolean exim_can_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_can_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P exim_can_connect_db off + - name: Disable the exim_can_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227997,23 +228139,7 @@ fi - no_reboot_needed - sebool_exim_can_connect_db - - - - - - - - - - Disable the exim_manage_user_files SELinux Boolean - By default, the SELinux boolean exim_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P exim_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228023,9 +228149,9 @@ fi if selinuxenabled; then - var_exim_manage_user_files='' + var_exim_can_connect_db='' - setsebool -P exim_manage_user_files $var_exim_manage_user_files + setsebool -P exim_can_connect_db $var_exim_can_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -228036,6 +228162,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_manage_user_files SELinux Boolean + By default, the SELinux boolean exim_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P exim_manage_user_files off + - name: Disable the exim_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228072,23 +228214,7 @@ fi - no_reboot_needed - sebool_exim_manage_user_files - - - - - - - - - - Disable the exim_read_user_files SELinux Boolean - By default, the SELinux boolean exim_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P exim_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228098,9 +228224,9 @@ fi if selinuxenabled; then - var_exim_read_user_files='' + var_exim_manage_user_files='' - setsebool -P exim_read_user_files $var_exim_read_user_files + setsebool -P exim_manage_user_files $var_exim_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -228111,6 +228237,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_read_user_files SELinux Boolean + By default, the SELinux boolean exim_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P exim_read_user_files off + - name: Disable the exim_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228147,23 +228289,7 @@ fi - no_reboot_needed - sebool_exim_read_user_files - - - - - - - - - - Disable the fcron_crond SELinux Boolean - By default, the SELinux boolean fcron_crond is disabled. -If this setting is enabled, it should be disabled. - -To disable the fcron_crond SELinux boolean, run the following command: -$ sudo setsebool -P fcron_crond off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228173,9 +228299,9 @@ fi if selinuxenabled; then - var_fcron_crond='' + var_exim_read_user_files='' - setsebool -P fcron_crond $var_fcron_crond + setsebool -P exim_read_user_files $var_exim_read_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -228186,6 +228312,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fcron_crond SELinux Boolean + By default, the SELinux boolean fcron_crond is disabled. +If this setting is enabled, it should be disabled. + +To disable the fcron_crond SELinux boolean, run the following command: +$ sudo setsebool -P fcron_crond off + - name: Disable the fcron_crond SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228221,23 +228363,7 @@ fi - no_reboot_needed - sebool_fcron_crond - - - - - - - - - - Disable the fenced_can_network_connect SELinux Boolean - By default, the SELinux boolean fenced_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the fenced_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P fenced_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228247,9 +228373,9 @@ fi if selinuxenabled; then - var_fenced_can_network_connect='' + var_fcron_crond='' - setsebool -P fenced_can_network_connect $var_fenced_can_network_connect + setsebool -P fcron_crond $var_fcron_crond else echo "Skipping remediation, SELinux is disabled"; @@ -228260,6 +228386,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fenced_can_network_connect SELinux Boolean + By default, the SELinux boolean fenced_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the fenced_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P fenced_can_network_connect off + - name: Disable the fenced_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228296,23 +228438,7 @@ fi - no_reboot_needed - sebool_fenced_can_network_connect - - - - - - - - - - Disable the fenced_can_ssh SELinux Boolean - By default, the SELinux boolean fenced_can_ssh is disabled. -If this setting is enabled, it should be disabled. - -To disable the fenced_can_ssh SELinux boolean, run the following command: -$ sudo setsebool -P fenced_can_ssh off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228322,9 +228448,9 @@ fi if selinuxenabled; then - var_fenced_can_ssh='' + var_fenced_can_network_connect='' - setsebool -P fenced_can_ssh $var_fenced_can_ssh + setsebool -P fenced_can_network_connect $var_fenced_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -228335,6 +228461,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fenced_can_ssh SELinux Boolean + By default, the SELinux boolean fenced_can_ssh is disabled. +If this setting is enabled, it should be disabled. + +To disable the fenced_can_ssh SELinux boolean, run the following command: +$ sudo setsebool -P fenced_can_ssh off + - name: Disable the fenced_can_ssh SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228369,6 +228511,29 @@ fi - medium_severity - no_reboot_needed - sebool_fenced_can_ssh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_fenced_can_ssh='' + + setsebool -P fenced_can_ssh $var_fenced_can_ssh + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -228424,29 +228589,6 @@ To enable the fips_mode SELinux boolean, run the followin SC-12 PR.DS-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_fips_mode='' - - setsebool -P fips_mode $var_fips_mode - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the fips_mode SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228495,23 +228637,7 @@ fi - no_reboot_needed - sebool_fips_mode - - - - - - - - - - Disable the ftpd_anon_write SELinux Boolean - By default, the SELinux boolean ftpd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228521,9 +228647,9 @@ fi if selinuxenabled; then - var_ftpd_anon_write='' + var_fips_mode='' - setsebool -P ftpd_anon_write $var_ftpd_anon_write + setsebool -P fips_mode $var_fips_mode else echo "Skipping remediation, SELinux is disabled"; @@ -228534,6 +228660,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_anon_write SELinux Boolean + By default, the SELinux boolean ftpd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_anon_write off + - name: Disable the ftpd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228569,23 +228711,7 @@ fi - no_reboot_needed - sebool_ftpd_anon_write - - - - - - - - - - Disable the ftpd_connect_all_unreserved SELinux Boolean - By default, the SELinux boolean ftpd_connect_all_unreserved is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_connect_all_unreserved SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_connect_all_unreserved off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228595,9 +228721,9 @@ fi if selinuxenabled; then - var_ftpd_connect_all_unreserved='' + var_ftpd_anon_write='' - setsebool -P ftpd_connect_all_unreserved $var_ftpd_connect_all_unreserved + setsebool -P ftpd_anon_write $var_ftpd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -228608,6 +228734,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_connect_all_unreserved SELinux Boolean + By default, the SELinux boolean ftpd_connect_all_unreserved is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_connect_all_unreserved SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_connect_all_unreserved off + - name: Disable the ftpd_connect_all_unreserved SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228644,23 +228786,7 @@ fi - no_reboot_needed - sebool_ftpd_connect_all_unreserved - - - - - - - - - - Disable the ftpd_connect_db SELinux Boolean - By default, the SELinux boolean ftpd_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228670,9 +228796,9 @@ fi if selinuxenabled; then - var_ftpd_connect_db='' + var_ftpd_connect_all_unreserved='' - setsebool -P ftpd_connect_db $var_ftpd_connect_db + setsebool -P ftpd_connect_all_unreserved $var_ftpd_connect_all_unreserved else echo "Skipping remediation, SELinux is disabled"; @@ -228683,6 +228809,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_connect_db SELinux Boolean + By default, the SELinux boolean ftpd_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_connect_db off + - name: Disable the ftpd_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228718,23 +228860,7 @@ fi - no_reboot_needed - sebool_ftpd_connect_db - - - - - - - - - - Disable the ftpd_full_access SELinux Boolean - By default, the SELinux boolean ftpd_full_access is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_full_access SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_full_access off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228744,9 +228870,9 @@ fi if selinuxenabled; then - var_ftpd_full_access='' + var_ftpd_connect_db='' - setsebool -P ftpd_full_access $var_ftpd_full_access + setsebool -P ftpd_connect_db $var_ftpd_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -228757,6 +228883,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_full_access SELinux Boolean + By default, the SELinux boolean ftpd_full_access is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_full_access SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_full_access off + - name: Disable the ftpd_full_access SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228793,23 +228935,7 @@ fi - no_reboot_needed - sebool_ftpd_full_access - - - - - - - - - - Disable the ftpd_use_cifs SELinux Boolean - By default, the SELinux boolean ftpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228819,9 +228945,9 @@ fi if selinuxenabled; then - var_ftpd_use_cifs='' + var_ftpd_full_access='' - setsebool -P ftpd_use_cifs $var_ftpd_use_cifs + setsebool -P ftpd_full_access $var_ftpd_full_access else echo "Skipping remediation, SELinux is disabled"; @@ -228832,6 +228958,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_cifs SELinux Boolean + By default, the SELinux boolean ftpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_cifs off + - name: Disable the ftpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228867,23 +229009,7 @@ fi - no_reboot_needed - sebool_ftpd_use_cifs - - - - - - - - - - Disable the ftpd_use_fusefs SELinux Boolean - By default, the SELinux boolean ftpd_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228893,9 +229019,9 @@ fi if selinuxenabled; then - var_ftpd_use_fusefs='' + var_ftpd_use_cifs='' - setsebool -P ftpd_use_fusefs $var_ftpd_use_fusefs + setsebool -P ftpd_use_cifs $var_ftpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -228906,6 +229032,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_fusefs SELinux Boolean + By default, the SELinux boolean ftpd_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_fusefs off + - name: Disable the ftpd_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228941,23 +229083,7 @@ fi - no_reboot_needed - sebool_ftpd_use_fusefs - - - - - - - - - - Disable the ftpd_use_nfs SELinux Boolean - By default, the SELinux boolean ftpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228967,9 +229093,9 @@ fi if selinuxenabled; then - var_ftpd_use_nfs='' + var_ftpd_use_fusefs='' - setsebool -P ftpd_use_nfs $var_ftpd_use_nfs + setsebool -P ftpd_use_fusefs $var_ftpd_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -228980,6 +229106,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_nfs SELinux Boolean + By default, the SELinux boolean ftpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_nfs off + - name: Disable the ftpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -229015,23 +229157,7 @@ fi - no_reboot_needed - sebool_ftpd_use_nfs - - - - - - - - - - Disable the ftpd_use_passive_mode SELinux Boolean - By default, the SELinux boolean ftpd_use_passive_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_passive_mode SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_passive_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229041,9 +229167,9 @@ fi if selinuxenabled; then - var_ftpd_use_passive_mode='' + var_ftpd_use_nfs='' - setsebool -P ftpd_use_passive_mode $var_ftpd_use_passive_mode + setsebool -P ftpd_use_nfs $var_ftpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229054,6 +229180,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_passive_mode SELinux Boolean + By default, the SELinux boolean ftpd_use_passive_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_passive_mode SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_passive_mode off + - name: Disable the ftpd_use_passive_mode SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229090,23 +229232,7 @@ fi - no_reboot_needed - sebool_ftpd_use_passive_mode - - - - - - - - - - Disable the git_cgi_enable_homedirs SELinux Boolean - By default, the SELinux boolean git_cgi_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229116,9 +229242,9 @@ fi if selinuxenabled; then - var_git_cgi_enable_homedirs='' + var_ftpd_use_passive_mode='' - setsebool -P git_cgi_enable_homedirs $var_git_cgi_enable_homedirs + setsebool -P ftpd_use_passive_mode $var_ftpd_use_passive_mode else echo "Skipping remediation, SELinux is disabled"; @@ -229129,18 +229255,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the git_cgi_enable_homedirs SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the git_cgi_enable_homedirs SELinux Boolean + By default, the SELinux boolean git_cgi_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_enable_homedirs off + + - name: Disable the git_cgi_enable_homedirs SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_git_cgi_enable_homedirs - name: XCCDF Value var_git_cgi_enable_homedirs # promote to variable set_fact: @@ -229165,23 +229307,7 @@ fi - no_reboot_needed - sebool_git_cgi_enable_homedirs - - - - - - - - - - Disable the git_cgi_use_cifs SELinux Boolean - By default, the SELinux boolean git_cgi_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229191,9 +229317,9 @@ fi if selinuxenabled; then - var_git_cgi_use_cifs='' + var_git_cgi_enable_homedirs='' - setsebool -P git_cgi_use_cifs $var_git_cgi_use_cifs + setsebool -P git_cgi_enable_homedirs $var_git_cgi_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -229204,6 +229330,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_cgi_use_cifs SELinux Boolean + By default, the SELinux boolean git_cgi_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_use_cifs off + - name: Disable the git_cgi_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229240,23 +229382,7 @@ fi - no_reboot_needed - sebool_git_cgi_use_cifs - - - - - - - - - - Disable the git_cgi_use_nfs SELinux Boolean - By default, the SELinux boolean git_cgi_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229266,9 +229392,9 @@ fi if selinuxenabled; then - var_git_cgi_use_nfs='' + var_git_cgi_use_cifs='' - setsebool -P git_cgi_use_nfs $var_git_cgi_use_nfs + setsebool -P git_cgi_use_cifs $var_git_cgi_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -229279,6 +229405,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_cgi_use_nfs SELinux Boolean + By default, the SELinux boolean git_cgi_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_use_nfs off + - name: Disable the git_cgi_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -229314,23 +229456,7 @@ fi - no_reboot_needed - sebool_git_cgi_use_nfs - - - - - - - - - - Disable the git_session_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean git_session_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_session_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P git_session_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229340,9 +229466,9 @@ fi if selinuxenabled; then - var_git_session_bind_all_unreserved_ports='' + var_git_cgi_use_nfs='' - setsebool -P git_session_bind_all_unreserved_ports $var_git_session_bind_all_unreserved_ports + setsebool -P git_cgi_use_nfs $var_git_cgi_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229353,6 +229479,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_session_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean git_session_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_session_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P git_session_bind_all_unreserved_ports off + - name: Disable the git_session_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229389,23 +229531,7 @@ fi - no_reboot_needed - sebool_git_session_bind_all_unreserved_ports - - - - - - - - - - Disable the git_session_users SELinux Boolean - By default, the SELinux boolean git_session_users is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_session_users SELinux boolean, run the following command: -$ sudo setsebool -P git_session_users off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229415,9 +229541,9 @@ fi if selinuxenabled; then - var_git_session_users='' + var_git_session_bind_all_unreserved_ports='' - setsebool -P git_session_users $var_git_session_users + setsebool -P git_session_bind_all_unreserved_ports $var_git_session_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -229428,6 +229554,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_session_users SELinux Boolean + By default, the SELinux boolean git_session_users is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_session_users SELinux boolean, run the following command: +$ sudo setsebool -P git_session_users off + - name: Disable the git_session_users SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229464,23 +229606,7 @@ fi - no_reboot_needed - sebool_git_session_users - - - - - - - - - - Disable the git_system_enable_homedirs SELinux Boolean - By default, the SELinux boolean git_system_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229490,9 +229616,9 @@ fi if selinuxenabled; then - var_git_system_enable_homedirs='' + var_git_session_users='' - setsebool -P git_system_enable_homedirs $var_git_system_enable_homedirs + setsebool -P git_session_users $var_git_session_users else echo "Skipping remediation, SELinux is disabled"; @@ -229503,6 +229629,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_enable_homedirs SELinux Boolean + By default, the SELinux boolean git_system_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_enable_homedirs off + - name: Disable the git_system_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229539,23 +229681,7 @@ fi - no_reboot_needed - sebool_git_system_enable_homedirs - - - - - - - - - - Disable the git_system_use_cifs SELinux Boolean - By default, the SELinux boolean git_system_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229565,9 +229691,9 @@ fi if selinuxenabled; then - var_git_system_use_cifs='' + var_git_system_enable_homedirs='' - setsebool -P git_system_use_cifs $var_git_system_use_cifs + setsebool -P git_system_enable_homedirs $var_git_system_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -229578,6 +229704,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_use_cifs SELinux Boolean + By default, the SELinux boolean git_system_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_use_cifs off + - name: Disable the git_system_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229614,23 +229756,7 @@ fi - no_reboot_needed - sebool_git_system_use_cifs - - - - - - - - - - Disable the git_system_use_nfs SELinux Boolean - By default, the SELinux boolean git_system_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229640,9 +229766,9 @@ fi if selinuxenabled; then - var_git_system_use_nfs='' + var_git_system_use_cifs='' - setsebool -P git_system_use_nfs $var_git_system_use_nfs + setsebool -P git_system_use_cifs $var_git_system_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -229653,6 +229779,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_use_nfs SELinux Boolean + By default, the SELinux boolean git_system_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_use_nfs off + - name: Disable the git_system_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229689,23 +229831,7 @@ fi - no_reboot_needed - sebool_git_system_use_nfs - - - - - - - - - - Disable the gitosis_can_sendmail SELinux Boolean - By default, the SELinux boolean gitosis_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the gitosis_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P gitosis_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229715,9 +229841,9 @@ fi if selinuxenabled; then - var_gitosis_can_sendmail='' + var_git_system_use_nfs='' - setsebool -P gitosis_can_sendmail $var_gitosis_can_sendmail + setsebool -P git_system_use_nfs $var_git_system_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229728,6 +229854,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gitosis_can_sendmail SELinux Boolean + By default, the SELinux boolean gitosis_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the gitosis_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P gitosis_can_sendmail off + - name: Disable the gitosis_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229764,23 +229906,7 @@ fi - no_reboot_needed - sebool_gitosis_can_sendmail - - - - - - - - - - Disable the glance_api_can_network SELinux Boolean - By default, the SELinux boolean glance_api_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_api_can_network SELinux boolean, run the following command: -$ sudo setsebool -P glance_api_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229790,9 +229916,9 @@ fi if selinuxenabled; then - var_glance_api_can_network='' + var_gitosis_can_sendmail='' - setsebool -P glance_api_can_network $var_glance_api_can_network + setsebool -P gitosis_can_sendmail $var_gitosis_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -229803,6 +229929,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_api_can_network SELinux Boolean + By default, the SELinux boolean glance_api_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_api_can_network SELinux boolean, run the following command: +$ sudo setsebool -P glance_api_can_network off + - name: Disable the glance_api_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229839,25 +229981,7 @@ fi - no_reboot_needed - sebool_glance_api_can_network - - - - - - - - - - Disable the glance_use_execmem SELinux Boolean - By default, the SELinux boolean glance_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P glance_use_execmem off - BP28(R67) - - CCE-83308-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229867,9 +229991,9 @@ fi if selinuxenabled; then - var_glance_use_execmem='' + var_glance_api_can_network='' - setsebool -P glance_use_execmem $var_glance_use_execmem + setsebool -P glance_api_can_network $var_glance_api_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -229880,6 +230004,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_use_execmem SELinux Boolean + By default, the SELinux boolean glance_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P glance_use_execmem off + BP28(R67) + + CCE-83308-7 - name: Disable the glance_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229918,23 +230060,7 @@ fi - no_reboot_needed - sebool_glance_use_execmem - - - - - - - - - - Disable the glance_use_fusefs SELinux Boolean - By default, the SELinux boolean glance_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P glance_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229944,9 +230070,9 @@ fi if selinuxenabled; then - var_glance_use_fusefs='' + var_glance_use_execmem='' - setsebool -P glance_use_fusefs $var_glance_use_fusefs + setsebool -P glance_use_execmem $var_glance_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -229957,6 +230083,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_use_fusefs SELinux Boolean + By default, the SELinux boolean glance_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P glance_use_fusefs off + - name: Disable the glance_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229993,23 +230135,7 @@ fi - no_reboot_needed - sebool_glance_use_fusefs - - - - - - - - - - Disable the global_ssp SELinux Boolean - By default, the SELinux boolean global_ssp is disabled. -If this setting is enabled, it should be disabled. - -To disable the global_ssp SELinux boolean, run the following command: -$ sudo setsebool -P global_ssp off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230019,9 +230145,9 @@ fi if selinuxenabled; then - var_global_ssp='' + var_glance_use_fusefs='' - setsebool -P global_ssp $var_global_ssp + setsebool -P glance_use_fusefs $var_glance_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -230032,6 +230158,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the global_ssp SELinux Boolean + By default, the SELinux boolean global_ssp is disabled. +If this setting is enabled, it should be disabled. + +To disable the global_ssp SELinux boolean, run the following command: +$ sudo setsebool -P global_ssp off + - name: Disable the global_ssp SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -230066,23 +230208,7 @@ fi - no_reboot_needed - sebool_global_ssp - - - - - - - - - - Disable the gluster_anon_write SELinux Boolean - By default, the SELinux boolean gluster_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the gluster_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P gluster_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230092,9 +230218,9 @@ fi if selinuxenabled; then - var_gluster_anon_write='' + var_global_ssp='' - setsebool -P gluster_anon_write $var_gluster_anon_write + setsebool -P global_ssp $var_global_ssp else echo "Skipping remediation, SELinux is disabled"; @@ -230105,6 +230231,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gluster_anon_write SELinux Boolean + By default, the SELinux boolean gluster_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the gluster_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P gluster_anon_write off + - name: Disable the gluster_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230141,23 +230283,7 @@ fi - no_reboot_needed - sebool_gluster_anon_write - - - - - - - - - - Disable the gluster_export_all_ro SELinux Boolean - By default, the SELinux boolean gluster_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the gluster_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P gluster_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230167,9 +230293,9 @@ fi if selinuxenabled; then - var_gluster_export_all_ro='' + var_gluster_anon_write='' - setsebool -P gluster_export_all_ro $var_gluster_export_all_ro + setsebool -P gluster_anon_write $var_gluster_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230180,6 +230306,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gluster_export_all_ro SELinux Boolean + By default, the SELinux boolean gluster_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the gluster_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P gluster_export_all_ro off + - name: Disable the gluster_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230216,24 +230358,7 @@ fi - no_reboot_needed - sebool_gluster_export_all_ro - - - - - - - - - - Configure the gluster_export_all_rw SELinux Boolean - By default, the SELinux boolean gluster_export_all_rw is enabled. -If GlusterFS is in use, this setting should be enabled. Otherwise, -disable it. - -To disable the gluster_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P gluster_export_all_rw off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230243,9 +230368,9 @@ fi if selinuxenabled; then - var_gluster_export_all_rw='' + var_gluster_export_all_ro='' - setsebool -P gluster_export_all_rw $var_gluster_export_all_rw + setsebool -P gluster_export_all_ro $var_gluster_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -230256,6 +230381,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the gluster_export_all_rw SELinux Boolean + By default, the SELinux boolean gluster_export_all_rw is enabled. +If GlusterFS is in use, this setting should be enabled. Otherwise, +disable it. + +To disable the gluster_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P gluster_export_all_rw off + - name: Configure the gluster_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230292,23 +230434,7 @@ fi - no_reboot_needed - sebool_gluster_export_all_rw - - - - - - - - - - Disable the gpg_web_anon_write SELinux Boolean - By default, the SELinux boolean gpg_web_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the gpg_web_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P gpg_web_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230318,9 +230444,9 @@ fi if selinuxenabled; then - var_gpg_web_anon_write='' + var_gluster_export_all_rw='' - setsebool -P gpg_web_anon_write $var_gpg_web_anon_write + setsebool -P gluster_export_all_rw $var_gluster_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -230331,6 +230457,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gpg_web_anon_write SELinux Boolean + By default, the SELinux boolean gpg_web_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the gpg_web_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P gpg_web_anon_write off + - name: Disable the gpg_web_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230367,25 +230509,7 @@ fi - no_reboot_needed - sebool_gpg_web_anon_write - - - - - - - - - - Enable the gssd_read_tmp SELinux Boolean - By default, the SELinux boolean gssd_read_tmp is enabled. -This setting allows gssd processes to access Kerberos to read -TGTs in the temp directory. If this setting is disabled, it should -be enabled. - -To enable the gssd_read_tmp SELinux boolean, run the following command: -$ sudo setsebool -P gssd_read_tmp on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230395,9 +230519,9 @@ fi if selinuxenabled; then - var_gssd_read_tmp='' + var_gpg_web_anon_write='' - setsebool -P gssd_read_tmp $var_gssd_read_tmp + setsebool -P gpg_web_anon_write $var_gpg_web_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230408,6 +230532,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the gssd_read_tmp SELinux Boolean + By default, the SELinux boolean gssd_read_tmp is enabled. +This setting allows gssd processes to access Kerberos to read +TGTs in the temp directory. If this setting is disabled, it should +be enabled. + +To enable the gssd_read_tmp SELinux boolean, run the following command: +$ sudo setsebool -P gssd_read_tmp on + - name: Enable the gssd_read_tmp SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -230443,23 +230585,7 @@ fi - no_reboot_needed - sebool_gssd_read_tmp - - - - - - - - - - Disable the guest_exec_content SELinux Boolean - By default, the SELinux boolean guest_exec_content is enabled. -This setting should be disabled as no guest accounts should be used. - -To disable the guest_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P guest_exec_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230469,9 +230595,9 @@ fi if selinuxenabled; then - var_guest_exec_content='' + var_gssd_read_tmp='' - setsebool -P guest_exec_content $var_guest_exec_content + setsebool -P gssd_read_tmp $var_gssd_read_tmp else echo "Skipping remediation, SELinux is disabled"; @@ -230482,6 +230608,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the guest_exec_content SELinux Boolean + By default, the SELinux boolean guest_exec_content is enabled. +This setting should be disabled as no guest accounts should be used. + +To disable the guest_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P guest_exec_content off + - name: Disable the guest_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230518,23 +230660,7 @@ fi - no_reboot_needed - sebool_guest_exec_content - - - - - - - - - - Disable the haproxy_connect_any SELinux Boolean - By default, the SELinux boolean haproxy_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the haproxy_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P haproxy_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230544,9 +230670,9 @@ fi if selinuxenabled; then - var_haproxy_connect_any='' + var_guest_exec_content='' - setsebool -P haproxy_connect_any $var_haproxy_connect_any + setsebool -P guest_exec_content $var_guest_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -230557,6 +230683,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the haproxy_connect_any SELinux Boolean + By default, the SELinux boolean haproxy_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the haproxy_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P haproxy_connect_any off + - name: Disable the haproxy_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230593,23 +230735,7 @@ fi - no_reboot_needed - sebool_haproxy_connect_any - - - - - - - - - - Disable the httpd_anon_write SELinux Boolean - By default, the SELinux boolean httpd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P httpd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230619,9 +230745,9 @@ fi if selinuxenabled; then - var_httpd_anon_write='' + var_haproxy_connect_any='' - setsebool -P httpd_anon_write $var_httpd_anon_write + setsebool -P haproxy_connect_any $var_haproxy_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -230632,6 +230758,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_anon_write SELinux Boolean + By default, the SELinux boolean httpd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P httpd_anon_write off + - name: Disable the httpd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230668,24 +230810,7 @@ fi - no_reboot_needed - sebool_httpd_anon_write - - - - - - - - - - Configure the httpd_builtin_scripting SELinux Boolean - By default, the SELinux boolean httpd_builtin_scripting is enabled. -This setting should be disabled if httpd is not running php -or some similary scripting language. - -To disable the httpd_builtin_scripting SELinux boolean, run the following command: -$ sudo setsebool -P httpd_builtin_scripting off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230695,9 +230820,9 @@ fi if selinuxenabled; then - var_httpd_builtin_scripting='' + var_httpd_anon_write='' - setsebool -P httpd_builtin_scripting $var_httpd_builtin_scripting + setsebool -P httpd_anon_write $var_httpd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230708,6 +230833,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the httpd_builtin_scripting SELinux Boolean + By default, the SELinux boolean httpd_builtin_scripting is enabled. +This setting should be disabled if httpd is not running php +or some similary scripting language. + +To disable the httpd_builtin_scripting SELinux boolean, run the following command: +$ sudo setsebool -P httpd_builtin_scripting off + - name: Configure the httpd_builtin_scripting SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230744,23 +230886,7 @@ fi - no_reboot_needed - sebool_httpd_builtin_scripting - - - - - - - - - - Disable the httpd_can_check_spam SELinux Boolean - By default, the SELinux boolean httpd_can_check_spam is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_check_spam SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_check_spam off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230770,9 +230896,9 @@ fi if selinuxenabled; then - var_httpd_can_check_spam='' + var_httpd_builtin_scripting='' - setsebool -P httpd_can_check_spam $var_httpd_can_check_spam + setsebool -P httpd_builtin_scripting $var_httpd_builtin_scripting else echo "Skipping remediation, SELinux is disabled"; @@ -230783,6 +230909,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_check_spam SELinux Boolean + By default, the SELinux boolean httpd_can_check_spam is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_check_spam SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_check_spam off + - name: Disable the httpd_can_check_spam SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230819,23 +230961,7 @@ fi - no_reboot_needed - sebool_httpd_can_check_spam - - - - - - - - - - Disable the httpd_can_connect_ftp SELinux Boolean - By default, the SELinux boolean httpd_can_connect_ftp is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_ftp SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_ftp off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230845,9 +230971,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_ftp='' + var_httpd_can_check_spam='' - setsebool -P httpd_can_connect_ftp $var_httpd_can_connect_ftp + setsebool -P httpd_can_check_spam $var_httpd_can_check_spam else echo "Skipping remediation, SELinux is disabled"; @@ -230858,6 +230984,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_ftp SELinux Boolean + By default, the SELinux boolean httpd_can_connect_ftp is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_ftp SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_ftp off + - name: Disable the httpd_can_connect_ftp SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230894,23 +231036,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_ftp - - - - - - - - - - Disable the httpd_can_connect_ldap SELinux Boolean - By default, the SELinux boolean httpd_can_connect_ldap is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_ldap SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_ldap off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230920,9 +231046,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_ldap='' + var_httpd_can_connect_ftp='' - setsebool -P httpd_can_connect_ldap $var_httpd_can_connect_ldap + setsebool -P httpd_can_connect_ftp $var_httpd_can_connect_ftp else echo "Skipping remediation, SELinux is disabled"; @@ -230933,6 +231059,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_ldap SELinux Boolean + By default, the SELinux boolean httpd_can_connect_ldap is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_ldap SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_ldap off + - name: Disable the httpd_can_connect_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230969,23 +231111,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_ldap - - - - - - - - - - Disable the httpd_can_connect_mythtv SELinux Boolean - By default, the SELinux boolean httpd_can_connect_mythtv is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_mythtv SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_mythtv off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230995,9 +231121,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_mythtv='' + var_httpd_can_connect_ldap='' - setsebool -P httpd_can_connect_mythtv $var_httpd_can_connect_mythtv + setsebool -P httpd_can_connect_ldap $var_httpd_can_connect_ldap else echo "Skipping remediation, SELinux is disabled"; @@ -231008,6 +231134,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_mythtv SELinux Boolean + By default, the SELinux boolean httpd_can_connect_mythtv is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_mythtv SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_mythtv off + - name: Disable the httpd_can_connect_mythtv SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231044,23 +231186,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_mythtv - - - - - - - - - - Disable the httpd_can_connect_zabbix SELinux Boolean - By default, the SELinux boolean httpd_can_connect_zabbix is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_zabbix SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_zabbix off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231070,9 +231196,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_zabbix='' + var_httpd_can_connect_mythtv='' - setsebool -P httpd_can_connect_zabbix $var_httpd_can_connect_zabbix + setsebool -P httpd_can_connect_mythtv $var_httpd_can_connect_mythtv else echo "Skipping remediation, SELinux is disabled"; @@ -231083,18 +231209,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the httpd_can_connect_zabbix SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the httpd_can_connect_zabbix SELinux Boolean + By default, the SELinux boolean httpd_can_connect_zabbix is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_zabbix SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_zabbix off + + - name: Disable the httpd_can_connect_zabbix SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_httpd_can_connect_zabbix - name: XCCDF Value var_httpd_can_connect_zabbix # promote to variable set_fact: @@ -231119,23 +231261,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_zabbix - - - - - - - - - - Disable the httpd_can_network_connect SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231145,9 +231271,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect='' + var_httpd_can_connect_zabbix='' - setsebool -P httpd_can_network_connect $var_httpd_can_network_connect + setsebool -P httpd_can_connect_zabbix $var_httpd_can_connect_zabbix else echo "Skipping remediation, SELinux is disabled"; @@ -231158,6 +231284,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect off + - name: Disable the httpd_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231194,23 +231336,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect - - - - - - - - - - Disable the httpd_can_network_connect_cobbler SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect_cobbler is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect_cobbler SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect_cobbler off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231220,9 +231346,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect_cobbler='' + var_httpd_can_network_connect='' - setsebool -P httpd_can_network_connect_cobbler $var_httpd_can_network_connect_cobbler + setsebool -P httpd_can_network_connect $var_httpd_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -231233,6 +231359,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect_cobbler SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect_cobbler is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect_cobbler SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect_cobbler off + - name: Disable the httpd_can_network_connect_cobbler SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231269,23 +231411,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect_cobbler - - - - - - - - - - Disable the httpd_can_network_connect_db SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231295,9 +231421,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect_db='' + var_httpd_can_network_connect_cobbler='' - setsebool -P httpd_can_network_connect_db $var_httpd_can_network_connect_db + setsebool -P httpd_can_network_connect_cobbler $var_httpd_can_network_connect_cobbler else echo "Skipping remediation, SELinux is disabled"; @@ -231308,6 +231434,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect_db SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect_db off + - name: Disable the httpd_can_network_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231344,23 +231486,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect_db - - - - - - - - - - Disable the httpd_can_network_memcache SELinux Boolean - By default, the SELinux boolean httpd_can_network_memcache is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_memcache SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_memcache off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231370,9 +231496,9 @@ fi if selinuxenabled; then - var_httpd_can_network_memcache='' + var_httpd_can_network_connect_db='' - setsebool -P httpd_can_network_memcache $var_httpd_can_network_memcache + setsebool -P httpd_can_network_connect_db $var_httpd_can_network_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -231383,6 +231509,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_memcache SELinux Boolean + By default, the SELinux boolean httpd_can_network_memcache is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_memcache SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_memcache off + - name: Disable the httpd_can_network_memcache SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231419,23 +231561,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_memcache - - - - - - - - - - Disable the httpd_can_network_relay SELinux Boolean - By default, the SELinux boolean httpd_can_network_relay is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_relay SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_relay off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231445,9 +231571,9 @@ fi if selinuxenabled; then - var_httpd_can_network_relay='' + var_httpd_can_network_memcache='' - setsebool -P httpd_can_network_relay $var_httpd_can_network_relay + setsebool -P httpd_can_network_memcache $var_httpd_can_network_memcache else echo "Skipping remediation, SELinux is disabled"; @@ -231458,6 +231584,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_relay SELinux Boolean + By default, the SELinux boolean httpd_can_network_relay is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_relay SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_relay off + - name: Disable the httpd_can_network_relay SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231494,23 +231636,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_relay - - - - - - - - - - Disable the httpd_can_sendmail SELinux Boolean - By default, the SELinux boolean httpd_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231520,9 +231646,9 @@ fi if selinuxenabled; then - var_httpd_can_sendmail='' + var_httpd_can_network_relay='' - setsebool -P httpd_can_sendmail $var_httpd_can_sendmail + setsebool -P httpd_can_network_relay $var_httpd_can_network_relay else echo "Skipping remediation, SELinux is disabled"; @@ -231533,6 +231659,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_sendmail SELinux Boolean + By default, the SELinux boolean httpd_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_sendmail off + - name: Disable the httpd_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231569,23 +231711,7 @@ fi - no_reboot_needed - sebool_httpd_can_sendmail - - - - - - - - - - Disable the httpd_dbus_avahi SELinux Boolean - By default, the SELinux boolean httpd_dbus_avahi is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dbus_avahi SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dbus_avahi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231595,9 +231721,9 @@ fi if selinuxenabled; then - var_httpd_dbus_avahi='' + var_httpd_can_sendmail='' - setsebool -P httpd_dbus_avahi $var_httpd_dbus_avahi + setsebool -P httpd_can_sendmail $var_httpd_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -231608,6 +231734,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dbus_avahi SELinux Boolean + By default, the SELinux boolean httpd_dbus_avahi is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dbus_avahi SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dbus_avahi off + - name: Disable the httpd_dbus_avahi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231644,23 +231786,7 @@ fi - no_reboot_needed - sebool_httpd_dbus_avahi - - - - - - - - - - Disable the httpd_dbus_sssd SELinux Boolean - By default, the SELinux boolean httpd_dbus_sssd is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dbus_sssd SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dbus_sssd off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231670,9 +231796,9 @@ fi if selinuxenabled; then - var_httpd_dbus_sssd='' + var_httpd_dbus_avahi='' - setsebool -P httpd_dbus_sssd $var_httpd_dbus_sssd + setsebool -P httpd_dbus_avahi $var_httpd_dbus_avahi else echo "Skipping remediation, SELinux is disabled"; @@ -231683,6 +231809,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dbus_sssd SELinux Boolean + By default, the SELinux boolean httpd_dbus_sssd is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dbus_sssd SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dbus_sssd off + - name: Disable the httpd_dbus_sssd SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -231718,23 +231860,7 @@ fi - no_reboot_needed - sebool_httpd_dbus_sssd - - - - - - - - - - Disable the httpd_dontaudit_search_dirs SELinux Boolean - By default, the SELinux boolean httpd_dontaudit_search_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dontaudit_search_dirs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dontaudit_search_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231744,9 +231870,9 @@ fi if selinuxenabled; then - var_httpd_dontaudit_search_dirs='' + var_httpd_dbus_sssd='' - setsebool -P httpd_dontaudit_search_dirs $var_httpd_dontaudit_search_dirs + setsebool -P httpd_dbus_sssd $var_httpd_dbus_sssd else echo "Skipping remediation, SELinux is disabled"; @@ -231757,6 +231883,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dontaudit_search_dirs SELinux Boolean + By default, the SELinux boolean httpd_dontaudit_search_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dontaudit_search_dirs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dontaudit_search_dirs off + - name: Disable the httpd_dontaudit_search_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231793,24 +231935,7 @@ fi - no_reboot_needed - sebool_httpd_dontaudit_search_dirs - - - - - - - - - - Configure the httpd_enable_cgi SELinux Boolean - By default, the SELinux boolean httpd_enable_cgi is enabled. -This setting should be disabled unless httpd is used with CGI -scripting. - -To disable the httpd_enable_cgi SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_cgi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231820,9 +231945,9 @@ fi if selinuxenabled; then - var_httpd_enable_cgi='' + var_httpd_dontaudit_search_dirs='' - setsebool -P httpd_enable_cgi $var_httpd_enable_cgi + setsebool -P httpd_dontaudit_search_dirs $var_httpd_dontaudit_search_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -231833,6 +231958,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the httpd_enable_cgi SELinux Boolean + By default, the SELinux boolean httpd_enable_cgi is enabled. +This setting should be disabled unless httpd is used with CGI +scripting. + +To disable the httpd_enable_cgi SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_cgi off + - name: Configure the httpd_enable_cgi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231869,23 +232011,7 @@ fi - no_reboot_needed - sebool_httpd_enable_cgi - - - - - - - - - - Disable the httpd_enable_ftp_server SELinux Boolean - By default, the SELinux boolean httpd_enable_ftp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_enable_ftp_server SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_ftp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231895,9 +232021,9 @@ fi if selinuxenabled; then - var_httpd_enable_ftp_server='' + var_httpd_enable_cgi='' - setsebool -P httpd_enable_ftp_server $var_httpd_enable_ftp_server + setsebool -P httpd_enable_cgi $var_httpd_enable_cgi else echo "Skipping remediation, SELinux is disabled"; @@ -231908,6 +232034,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_enable_ftp_server SELinux Boolean + By default, the SELinux boolean httpd_enable_ftp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_enable_ftp_server SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_ftp_server off + - name: Disable the httpd_enable_ftp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231944,23 +232086,7 @@ fi - no_reboot_needed - sebool_httpd_enable_ftp_server - - - - - - - - - - Disable the httpd_enable_homedirs SELinux Boolean - By default, the SELinux boolean httpd_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231970,9 +232096,9 @@ fi if selinuxenabled; then - var_httpd_enable_homedirs='' + var_httpd_enable_ftp_server='' - setsebool -P httpd_enable_homedirs $var_httpd_enable_homedirs + setsebool -P httpd_enable_ftp_server $var_httpd_enable_ftp_server else echo "Skipping remediation, SELinux is disabled"; @@ -231983,6 +232109,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_enable_homedirs SELinux Boolean + By default, the SELinux boolean httpd_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_homedirs off + - name: Disable the httpd_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232019,25 +232161,7 @@ fi - no_reboot_needed - sebool_httpd_enable_homedirs - - - - - - - - - - Disable the httpd_execmem SELinux Boolean - By default, the SELinux boolean httpd_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_execmem SELinux boolean, run the following command: -$ sudo setsebool -P httpd_execmem off - BP28(R67) - - CCE-83309-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232047,9 +232171,9 @@ fi if selinuxenabled; then - var_httpd_execmem='' + var_httpd_enable_homedirs='' - setsebool -P httpd_execmem $var_httpd_execmem + setsebool -P httpd_enable_homedirs $var_httpd_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -232060,6 +232184,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_execmem SELinux Boolean + By default, the SELinux boolean httpd_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_execmem SELinux boolean, run the following command: +$ sudo setsebool -P httpd_execmem off + BP28(R67) + + CCE-83309-5 - name: Disable the httpd_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232097,23 +232239,7 @@ fi - no_reboot_needed - sebool_httpd_execmem - - - - - - - - - - Enable the httpd_graceful_shutdown SELinux Boolean - By default, the SELinux boolean httpd_graceful_shutdown is enabled. -If this setting is disabled, it should be enabled. - -To enable the httpd_graceful_shutdown SELinux boolean, run the following command: -$ sudo setsebool -P httpd_graceful_shutdown on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232123,9 +232249,9 @@ fi if selinuxenabled; then - var_httpd_graceful_shutdown='' + var_httpd_execmem='' - setsebool -P httpd_graceful_shutdown $var_httpd_graceful_shutdown + setsebool -P httpd_execmem $var_httpd_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -232136,6 +232262,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the httpd_graceful_shutdown SELinux Boolean + By default, the SELinux boolean httpd_graceful_shutdown is enabled. +If this setting is disabled, it should be enabled. + +To enable the httpd_graceful_shutdown SELinux boolean, run the following command: +$ sudo setsebool -P httpd_graceful_shutdown on + - name: Enable the httpd_graceful_shutdown SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232172,23 +232314,7 @@ fi - no_reboot_needed - sebool_httpd_graceful_shutdown - - - - - - - - - - Disable the httpd_manage_ipa SELinux Boolean - By default, the SELinux boolean httpd_manage_ipa is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_manage_ipa SELinux boolean, run the following command: -$ sudo setsebool -P httpd_manage_ipa off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232198,9 +232324,9 @@ fi if selinuxenabled; then - var_httpd_manage_ipa='' + var_httpd_graceful_shutdown='' - setsebool -P httpd_manage_ipa $var_httpd_manage_ipa + setsebool -P httpd_graceful_shutdown $var_httpd_graceful_shutdown else echo "Skipping remediation, SELinux is disabled"; @@ -232211,6 +232337,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_manage_ipa SELinux Boolean + By default, the SELinux boolean httpd_manage_ipa is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_manage_ipa SELinux boolean, run the following command: +$ sudo setsebool -P httpd_manage_ipa off + - name: Disable the httpd_manage_ipa SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232247,23 +232389,7 @@ fi - no_reboot_needed - sebool_httpd_manage_ipa - - - - - - - - - - Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - By default, the SELinux boolean httpd_mod_auth_ntlm_winbind is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_mod_auth_ntlm_winbind SELinux boolean, run the following command: -$ sudo setsebool -P httpd_mod_auth_ntlm_winbind off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232273,9 +232399,9 @@ fi if selinuxenabled; then - var_httpd_mod_auth_ntlm_winbind='' + var_httpd_manage_ipa='' - setsebool -P httpd_mod_auth_ntlm_winbind $var_httpd_mod_auth_ntlm_winbind + setsebool -P httpd_manage_ipa $var_httpd_manage_ipa else echo "Skipping remediation, SELinux is disabled"; @@ -232286,6 +232412,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean + By default, the SELinux boolean httpd_mod_auth_ntlm_winbind is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_mod_auth_ntlm_winbind SELinux boolean, run the following command: +$ sudo setsebool -P httpd_mod_auth_ntlm_winbind off + - name: Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232322,23 +232464,7 @@ fi - no_reboot_needed - sebool_httpd_mod_auth_ntlm_winbind - - - - - - - - - - Disable the httpd_mod_auth_pam SELinux Boolean - By default, the SELinux boolean httpd_mod_auth_pam is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_mod_auth_pam SELinux boolean, run the following command: -$ sudo setsebool -P httpd_mod_auth_pam off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232348,9 +232474,9 @@ fi if selinuxenabled; then - var_httpd_mod_auth_pam='' + var_httpd_mod_auth_ntlm_winbind='' - setsebool -P httpd_mod_auth_pam $var_httpd_mod_auth_pam + setsebool -P httpd_mod_auth_ntlm_winbind $var_httpd_mod_auth_ntlm_winbind else echo "Skipping remediation, SELinux is disabled"; @@ -232361,6 +232487,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_mod_auth_pam SELinux Boolean + By default, the SELinux boolean httpd_mod_auth_pam is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_mod_auth_pam SELinux boolean, run the following command: +$ sudo setsebool -P httpd_mod_auth_pam off + - name: Disable the httpd_mod_auth_pam SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232397,23 +232539,7 @@ fi - no_reboot_needed - sebool_httpd_mod_auth_pam - - - - - - - - - - Disable the httpd_read_user_content SELinux Boolean - By default, the SELinux boolean httpd_read_user_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_read_user_content SELinux boolean, run the following command: -$ sudo setsebool -P httpd_read_user_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232423,9 +232549,9 @@ fi if selinuxenabled; then - var_httpd_read_user_content='' + var_httpd_mod_auth_pam='' - setsebool -P httpd_read_user_content $var_httpd_read_user_content + setsebool -P httpd_mod_auth_pam $var_httpd_mod_auth_pam else echo "Skipping remediation, SELinux is disabled"; @@ -232436,6 +232562,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_read_user_content SELinux Boolean + By default, the SELinux boolean httpd_read_user_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_read_user_content SELinux boolean, run the following command: +$ sudo setsebool -P httpd_read_user_content off + - name: Disable the httpd_read_user_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232472,23 +232614,7 @@ fi - no_reboot_needed - sebool_httpd_read_user_content - - - - - - - - - - Disable the httpd_run_ipa SELinux Boolean - By default, the SELinux boolean httpd_run_ipa is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_ipa SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_ipa off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232498,9 +232624,9 @@ fi if selinuxenabled; then - var_httpd_run_ipa='' + var_httpd_read_user_content='' - setsebool -P httpd_run_ipa $var_httpd_run_ipa + setsebool -P httpd_read_user_content $var_httpd_read_user_content else echo "Skipping remediation, SELinux is disabled"; @@ -232511,6 +232637,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_ipa SELinux Boolean + By default, the SELinux boolean httpd_run_ipa is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_ipa SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_ipa off + - name: Disable the httpd_run_ipa SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232546,23 +232688,7 @@ fi - no_reboot_needed - sebool_httpd_run_ipa - - - - - - - - - - Disable the httpd_run_preupgrade SELinux Boolean - By default, the SELinux boolean httpd_run_preupgrade is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_preupgrade SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_preupgrade off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232572,9 +232698,9 @@ fi if selinuxenabled; then - var_httpd_run_preupgrade='' + var_httpd_run_ipa='' - setsebool -P httpd_run_preupgrade $var_httpd_run_preupgrade + setsebool -P httpd_run_ipa $var_httpd_run_ipa else echo "Skipping remediation, SELinux is disabled"; @@ -232585,6 +232711,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_preupgrade SELinux Boolean + By default, the SELinux boolean httpd_run_preupgrade is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_preupgrade SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_preupgrade off + - name: Disable the httpd_run_preupgrade SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232621,23 +232763,7 @@ fi - no_reboot_needed - sebool_httpd_run_preupgrade - - - - - - - - - - Disable the httpd_run_stickshift SELinux Boolean - By default, the SELinux boolean httpd_run_stickshift is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_stickshift SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_stickshift off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232647,9 +232773,9 @@ fi if selinuxenabled; then - var_httpd_run_stickshift='' + var_httpd_run_preupgrade='' - setsebool -P httpd_run_stickshift $var_httpd_run_stickshift + setsebool -P httpd_run_preupgrade $var_httpd_run_preupgrade else echo "Skipping remediation, SELinux is disabled"; @@ -232660,6 +232786,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_stickshift SELinux Boolean + By default, the SELinux boolean httpd_run_stickshift is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_stickshift SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_stickshift off + - name: Disable the httpd_run_stickshift SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232696,23 +232838,7 @@ fi - no_reboot_needed - sebool_httpd_run_stickshift - - - - - - - - - - Disable the httpd_serve_cobbler_files SELinux Boolean - By default, the SELinux boolean httpd_serve_cobbler_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_serve_cobbler_files SELinux boolean, run the following command: -$ sudo setsebool -P httpd_serve_cobbler_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232722,9 +232848,9 @@ fi if selinuxenabled; then - var_httpd_serve_cobbler_files='' + var_httpd_run_stickshift='' - setsebool -P httpd_serve_cobbler_files $var_httpd_serve_cobbler_files + setsebool -P httpd_run_stickshift $var_httpd_run_stickshift else echo "Skipping remediation, SELinux is disabled"; @@ -232735,6 +232861,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_serve_cobbler_files SELinux Boolean + By default, the SELinux boolean httpd_serve_cobbler_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_serve_cobbler_files SELinux boolean, run the following command: +$ sudo setsebool -P httpd_serve_cobbler_files off + - name: Disable the httpd_serve_cobbler_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232771,23 +232913,7 @@ fi - no_reboot_needed - sebool_httpd_serve_cobbler_files - - - - - - - - - - Disable the httpd_setrlimit SELinux Boolean - By default, the SELinux boolean httpd_setrlimit is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_setrlimit SELinux boolean, run the following command: -$ sudo setsebool -P httpd_setrlimit off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232797,9 +232923,9 @@ fi if selinuxenabled; then - var_httpd_setrlimit='' + var_httpd_serve_cobbler_files='' - setsebool -P httpd_setrlimit $var_httpd_setrlimit + setsebool -P httpd_serve_cobbler_files $var_httpd_serve_cobbler_files else echo "Skipping remediation, SELinux is disabled"; @@ -232810,6 +232936,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_setrlimit SELinux Boolean + By default, the SELinux boolean httpd_setrlimit is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_setrlimit SELinux boolean, run the following command: +$ sudo setsebool -P httpd_setrlimit off + - name: Disable the httpd_setrlimit SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232845,23 +232987,7 @@ fi - no_reboot_needed - sebool_httpd_setrlimit - - - - - - - - - - Disable the httpd_ssi_exec SELinux Boolean - By default, the SELinux boolean httpd_ssi_exec is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_ssi_exec SELinux boolean, run the following command: -$ sudo setsebool -P httpd_ssi_exec off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232871,9 +232997,9 @@ fi if selinuxenabled; then - var_httpd_ssi_exec='' + var_httpd_setrlimit='' - setsebool -P httpd_ssi_exec $var_httpd_ssi_exec + setsebool -P httpd_setrlimit $var_httpd_setrlimit else echo "Skipping remediation, SELinux is disabled"; @@ -232884,6 +233010,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_ssi_exec SELinux Boolean + By default, the SELinux boolean httpd_ssi_exec is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_ssi_exec SELinux boolean, run the following command: +$ sudo setsebool -P httpd_ssi_exec off + - name: Disable the httpd_ssi_exec SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232919,23 +233061,7 @@ fi - no_reboot_needed - sebool_httpd_ssi_exec - - - - - - - - - - Disable the httpd_sys_script_anon_write SELinux Boolean - By default, the SELinux boolean httpd_sys_script_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_sys_script_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P httpd_sys_script_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232945,9 +233071,9 @@ fi if selinuxenabled; then - var_httpd_sys_script_anon_write='' + var_httpd_ssi_exec='' - setsebool -P httpd_sys_script_anon_write $var_httpd_sys_script_anon_write + setsebool -P httpd_ssi_exec $var_httpd_ssi_exec else echo "Skipping remediation, SELinux is disabled"; @@ -232958,6 +233084,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_sys_script_anon_write SELinux Boolean + By default, the SELinux boolean httpd_sys_script_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_sys_script_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P httpd_sys_script_anon_write off + - name: Disable the httpd_sys_script_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232994,23 +233136,7 @@ fi - no_reboot_needed - sebool_httpd_sys_script_anon_write - - - - - - - - - - Disable the httpd_tmp_exec SELinux Boolean - By default, the SELinux boolean httpd_tmp_exec is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_tmp_exec SELinux boolean, run the following command: -$ sudo setsebool -P httpd_tmp_exec off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233020,9 +233146,9 @@ fi if selinuxenabled; then - var_httpd_tmp_exec='' + var_httpd_sys_script_anon_write='' - setsebool -P httpd_tmp_exec $var_httpd_tmp_exec + setsebool -P httpd_sys_script_anon_write $var_httpd_sys_script_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -233033,6 +233159,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_tmp_exec SELinux Boolean + By default, the SELinux boolean httpd_tmp_exec is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_tmp_exec SELinux boolean, run the following command: +$ sudo setsebool -P httpd_tmp_exec off + - name: Disable the httpd_tmp_exec SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233068,23 +233210,7 @@ fi - no_reboot_needed - sebool_httpd_tmp_exec - - - - - - - - - - Disable the httpd_tty_comm SELinux Boolean - By default, the SELinux boolean httpd_tty_comm is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_tty_comm SELinux boolean, run the following command: -$ sudo setsebool -P httpd_tty_comm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233094,9 +233220,9 @@ fi if selinuxenabled; then - var_httpd_tty_comm='' + var_httpd_tmp_exec='' - setsebool -P httpd_tty_comm $var_httpd_tty_comm + setsebool -P httpd_tmp_exec $var_httpd_tmp_exec else echo "Skipping remediation, SELinux is disabled"; @@ -233107,6 +233233,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_tty_comm SELinux Boolean + By default, the SELinux boolean httpd_tty_comm is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_tty_comm SELinux boolean, run the following command: +$ sudo setsebool -P httpd_tty_comm off + - name: Disable the httpd_tty_comm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233142,23 +233284,7 @@ fi - no_reboot_needed - sebool_httpd_tty_comm - - - - - - - - - - Disable the httpd_unified SELinux Boolean - By default, the SELinux boolean httpd_unified is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_unified SELinux boolean, run the following command: -$ sudo setsebool -P httpd_unified off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233168,9 +233294,9 @@ fi if selinuxenabled; then - var_httpd_unified='' + var_httpd_tty_comm='' - setsebool -P httpd_unified $var_httpd_unified + setsebool -P httpd_tty_comm $var_httpd_tty_comm else echo "Skipping remediation, SELinux is disabled"; @@ -233181,6 +233307,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_unified SELinux Boolean + By default, the SELinux boolean httpd_unified is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_unified SELinux boolean, run the following command: +$ sudo setsebool -P httpd_unified off + - name: Disable the httpd_unified SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233216,23 +233358,7 @@ fi - no_reboot_needed - sebool_httpd_unified - - - - - - - - - - Disable the httpd_use_cifs SELinux Boolean - By default, the SELinux boolean httpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233242,9 +233368,9 @@ fi if selinuxenabled; then - var_httpd_use_cifs='' + var_httpd_unified='' - setsebool -P httpd_use_cifs $var_httpd_use_cifs + setsebool -P httpd_unified $var_httpd_unified else echo "Skipping remediation, SELinux is disabled"; @@ -233255,6 +233381,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_cifs SELinux Boolean + By default, the SELinux boolean httpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_cifs off + - name: Disable the httpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233290,23 +233432,7 @@ fi - no_reboot_needed - sebool_httpd_use_cifs - - - - - - - - - - Disable the httpd_use_fusefs SELinux Boolean - By default, the SELinux boolean httpd_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233316,9 +233442,9 @@ fi if selinuxenabled; then - var_httpd_use_fusefs='' + var_httpd_use_cifs='' - setsebool -P httpd_use_fusefs $var_httpd_use_fusefs + setsebool -P httpd_use_cifs $var_httpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -233329,6 +233455,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_fusefs SELinux Boolean + By default, the SELinux boolean httpd_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_fusefs off + - name: Disable the httpd_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233365,23 +233507,7 @@ fi - no_reboot_needed - sebool_httpd_use_fusefs - - - - - - - - - - Disable the httpd_use_gpg SELinux Boolean - By default, the SELinux boolean httpd_use_gpg is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_gpg SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_gpg off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233391,9 +233517,9 @@ fi if selinuxenabled; then - var_httpd_use_gpg='' + var_httpd_use_fusefs='' - setsebool -P httpd_use_gpg $var_httpd_use_gpg + setsebool -P httpd_use_fusefs $var_httpd_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -233404,6 +233530,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_gpg SELinux Boolean + By default, the SELinux boolean httpd_use_gpg is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_gpg SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_gpg off + - name: Disable the httpd_use_gpg SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233439,23 +233581,7 @@ fi - no_reboot_needed - sebool_httpd_use_gpg - - - - - - - - - - Disable the httpd_use_nfs SELinux Boolean - By default, the SELinux boolean httpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233465,9 +233591,9 @@ fi if selinuxenabled; then - var_httpd_use_nfs='' + var_httpd_use_gpg='' - setsebool -P httpd_use_nfs $var_httpd_use_nfs + setsebool -P httpd_use_gpg $var_httpd_use_gpg else echo "Skipping remediation, SELinux is disabled"; @@ -233478,6 +233604,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_nfs SELinux Boolean + By default, the SELinux boolean httpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_nfs off + - name: Disable the httpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233513,23 +233655,7 @@ fi - no_reboot_needed - sebool_httpd_use_nfs - - - - - - - - - - Disable the httpd_use_openstack SELinux Boolean - By default, the SELinux boolean httpd_use_openstack is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_openstack SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_openstack off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233539,9 +233665,9 @@ fi if selinuxenabled; then - var_httpd_use_openstack='' + var_httpd_use_nfs='' - setsebool -P httpd_use_openstack $var_httpd_use_openstack + setsebool -P httpd_use_nfs $var_httpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -233552,6 +233678,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_openstack SELinux Boolean + By default, the SELinux boolean httpd_use_openstack is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_openstack SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_openstack off + - name: Disable the httpd_use_openstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233588,23 +233730,7 @@ fi - no_reboot_needed - sebool_httpd_use_openstack - - - - - - - - - - Disable the httpd_use_sasl SELinux Boolean - By default, the SELinux boolean httpd_use_sasl is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_sasl SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_sasl off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233614,9 +233740,9 @@ fi if selinuxenabled; then - var_httpd_use_sasl='' + var_httpd_use_openstack='' - setsebool -P httpd_use_sasl $var_httpd_use_sasl + setsebool -P httpd_use_openstack $var_httpd_use_openstack else echo "Skipping remediation, SELinux is disabled"; @@ -233627,6 +233753,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_sasl SELinux Boolean + By default, the SELinux boolean httpd_use_sasl is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_sasl SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_sasl off + - name: Disable the httpd_use_sasl SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233662,23 +233804,7 @@ fi - no_reboot_needed - sebool_httpd_use_sasl - - - - - - - - - - Disable the httpd_verify_dns SELinux Boolean - By default, the SELinux boolean httpd_verify_dns is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_verify_dns SELinux boolean, run the following command: -$ sudo setsebool -P httpd_verify_dns off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233688,9 +233814,9 @@ fi if selinuxenabled; then - var_httpd_verify_dns='' + var_httpd_use_sasl='' - setsebool -P httpd_verify_dns $var_httpd_verify_dns + setsebool -P httpd_use_sasl $var_httpd_use_sasl else echo "Skipping remediation, SELinux is disabled"; @@ -233701,6 +233827,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_verify_dns SELinux Boolean + By default, the SELinux boolean httpd_verify_dns is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_verify_dns SELinux boolean, run the following command: +$ sudo setsebool -P httpd_verify_dns off + - name: Disable the httpd_verify_dns SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233737,23 +233879,7 @@ fi - no_reboot_needed - sebool_httpd_verify_dns - - - - - - - - - - Disable the icecast_use_any_tcp_ports SELinux Boolean - By default, the SELinux boolean icecast_use_any_tcp_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the icecast_use_any_tcp_ports SELinux boolean, run the following command: -$ sudo setsebool -P icecast_use_any_tcp_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233763,9 +233889,9 @@ fi if selinuxenabled; then - var_icecast_use_any_tcp_ports='' + var_httpd_verify_dns='' - setsebool -P icecast_use_any_tcp_ports $var_icecast_use_any_tcp_ports + setsebool -P httpd_verify_dns $var_httpd_verify_dns else echo "Skipping remediation, SELinux is disabled"; @@ -233776,6 +233902,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the icecast_use_any_tcp_ports SELinux Boolean + By default, the SELinux boolean icecast_use_any_tcp_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the icecast_use_any_tcp_ports SELinux boolean, run the following command: +$ sudo setsebool -P icecast_use_any_tcp_ports off + - name: Disable the icecast_use_any_tcp_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233812,23 +233954,7 @@ fi - no_reboot_needed - sebool_icecast_use_any_tcp_ports - - - - - - - - - - Disable the irc_use_any_tcp_ports SELinux Boolean - By default, the SELinux boolean irc_use_any_tcp_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the irc_use_any_tcp_ports SELinux boolean, run the following command: -$ sudo setsebool -P irc_use_any_tcp_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233838,9 +233964,9 @@ fi if selinuxenabled; then - var_irc_use_any_tcp_ports='' + var_icecast_use_any_tcp_ports='' - setsebool -P irc_use_any_tcp_ports $var_irc_use_any_tcp_ports + setsebool -P icecast_use_any_tcp_ports $var_icecast_use_any_tcp_ports else echo "Skipping remediation, SELinux is disabled"; @@ -233851,6 +233977,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the irc_use_any_tcp_ports SELinux Boolean + By default, the SELinux boolean irc_use_any_tcp_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the irc_use_any_tcp_ports SELinux boolean, run the following command: +$ sudo setsebool -P irc_use_any_tcp_ports off + - name: Disable the irc_use_any_tcp_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233887,23 +234029,7 @@ fi - no_reboot_needed - sebool_irc_use_any_tcp_ports - - - - - - - - - - Disable the irssi_use_full_network SELinux Boolean - By default, the SELinux boolean irssi_use_full_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the irssi_use_full_network SELinux boolean, run the following command: -$ sudo setsebool -P irssi_use_full_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233913,9 +234039,9 @@ fi if selinuxenabled; then - var_irssi_use_full_network='' + var_irc_use_any_tcp_ports='' - setsebool -P irssi_use_full_network $var_irssi_use_full_network + setsebool -P irc_use_any_tcp_ports $var_irc_use_any_tcp_ports else echo "Skipping remediation, SELinux is disabled"; @@ -233926,6 +234052,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the irssi_use_full_network SELinux Boolean + By default, the SELinux boolean irssi_use_full_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the irssi_use_full_network SELinux boolean, run the following command: +$ sudo setsebool -P irssi_use_full_network off + - name: Disable the irssi_use_full_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233962,23 +234104,7 @@ fi - no_reboot_needed - sebool_irssi_use_full_network - - - - - - - - - - Disable the kdumpgui_run_bootloader SELinux Boolean - By default, the SELinux boolean kdumpgui_run_bootloader is disabled. -If this setting is enabled, it should be disabled. - -To disable the kdumpgui_run_bootloader SELinux boolean, run the following command: -$ sudo setsebool -P kdumpgui_run_bootloader off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233988,9 +234114,9 @@ fi if selinuxenabled; then - var_kdumpgui_run_bootloader='' + var_irssi_use_full_network='' - setsebool -P kdumpgui_run_bootloader $var_kdumpgui_run_bootloader + setsebool -P irssi_use_full_network $var_irssi_use_full_network else echo "Skipping remediation, SELinux is disabled"; @@ -234001,6 +234127,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the kdumpgui_run_bootloader SELinux Boolean + By default, the SELinux boolean kdumpgui_run_bootloader is disabled. +If this setting is enabled, it should be disabled. + +To disable the kdumpgui_run_bootloader SELinux boolean, run the following command: +$ sudo setsebool -P kdumpgui_run_bootloader off + - name: Disable the kdumpgui_run_bootloader SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234036,6 +234178,29 @@ fi - medium_severity - no_reboot_needed - sebool_kdumpgui_run_bootloader + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_kdumpgui_run_bootloader='' + + setsebool -P kdumpgui_run_bootloader $var_kdumpgui_run_bootloader + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -234058,29 +234223,6 @@ To enable the kerberos_enabled SELinux boolean, run the f 1402 CCE-84293-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_kerberos_enabled='' - - setsebool -P kerberos_enabled $var_kerberos_enabled - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the kerberos_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -234118,23 +234260,7 @@ fi - no_reboot_needed - sebool_kerberos_enabled - - - - - - - - - - Disable the ksmtuned_use_cifs SELinux Boolean - By default, the SELinux boolean ksmtuned_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ksmtuned_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P ksmtuned_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234144,9 +234270,9 @@ fi if selinuxenabled; then - var_ksmtuned_use_cifs='' + var_kerberos_enabled='' - setsebool -P ksmtuned_use_cifs $var_ksmtuned_use_cifs + setsebool -P kerberos_enabled $var_kerberos_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -234157,6 +234283,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ksmtuned_use_cifs SELinux Boolean + By default, the SELinux boolean ksmtuned_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ksmtuned_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P ksmtuned_use_cifs off + - name: Disable the ksmtuned_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234193,23 +234335,7 @@ fi - no_reboot_needed - sebool_ksmtuned_use_cifs - - - - - - - - - - Disable the ksmtuned_use_nfs SELinux Boolean - By default, the SELinux boolean ksmtuned_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ksmtuned_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P ksmtuned_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234219,9 +234345,9 @@ fi if selinuxenabled; then - var_ksmtuned_use_nfs='' + var_ksmtuned_use_cifs='' - setsebool -P ksmtuned_use_nfs $var_ksmtuned_use_nfs + setsebool -P ksmtuned_use_cifs $var_ksmtuned_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -234232,6 +234358,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ksmtuned_use_nfs SELinux Boolean + By default, the SELinux boolean ksmtuned_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ksmtuned_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P ksmtuned_use_nfs off + - name: Disable the ksmtuned_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234268,23 +234410,7 @@ fi - no_reboot_needed - sebool_ksmtuned_use_nfs - - - - - - - - - - Enable the logadm_exec_content SELinux Boolean - By default, the SELinux boolean logadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the logadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P logadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234294,9 +234420,9 @@ fi if selinuxenabled; then - var_logadm_exec_content='' + var_ksmtuned_use_nfs='' - setsebool -P logadm_exec_content $var_logadm_exec_content + setsebool -P ksmtuned_use_nfs $var_ksmtuned_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -234307,6 +234433,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the logadm_exec_content SELinux Boolean + By default, the SELinux boolean logadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the logadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P logadm_exec_content on + - name: Enable the logadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234343,23 +234485,7 @@ fi - no_reboot_needed - sebool_logadm_exec_content - - - - - - - - - - Disable the logging_syslogd_can_sendmail SELinux Boolean - By default, the SELinux boolean logging_syslogd_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the logging_syslogd_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234369,9 +234495,9 @@ fi if selinuxenabled; then - var_logging_syslogd_can_sendmail='' + var_logadm_exec_content='' - setsebool -P logging_syslogd_can_sendmail $var_logging_syslogd_can_sendmail + setsebool -P logadm_exec_content $var_logadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -234382,6 +234508,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logging_syslogd_can_sendmail SELinux Boolean + By default, the SELinux boolean logging_syslogd_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the logging_syslogd_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_can_sendmail off + - name: Disable the logging_syslogd_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234418,23 +234560,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_can_sendmail - - - - - - - - - - Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - By default, the SELinux boolean logging_syslogd_run_nagios_plugins is disabled. -If this setting is enabled, it should be disabled. - -To disable the logging_syslogd_run_nagios_plugins SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_run_nagios_plugins off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234444,9 +234570,9 @@ fi if selinuxenabled; then - var_logging_syslogd_run_nagios_plugins='' + var_logging_syslogd_can_sendmail='' - setsebool -P logging_syslogd_run_nagios_plugins $var_logging_syslogd_run_nagios_plugins + setsebool -P logging_syslogd_can_sendmail $var_logging_syslogd_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -234457,6 +234583,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logging_syslogd_run_nagios_plugins SELinux Boolean + By default, the SELinux boolean logging_syslogd_run_nagios_plugins is disabled. +If this setting is enabled, it should be disabled. + +To disable the logging_syslogd_run_nagios_plugins SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_run_nagios_plugins off + - name: Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234493,24 +234635,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_run_nagios_plugins - - - - - - - - - - Enable the logging_syslogd_use_tty SELinux Boolean - By default, the SELinux boolean logging_syslogd_use_tty is enabled. -If this setting is disabled, it should be enabled as it allows syslog -the ability to read/write to terminal. - -To enable the logging_syslogd_use_tty SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_use_tty on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234520,9 +234645,9 @@ fi if selinuxenabled; then - var_logging_syslogd_use_tty='' + var_logging_syslogd_run_nagios_plugins='' - setsebool -P logging_syslogd_use_tty $var_logging_syslogd_use_tty + setsebool -P logging_syslogd_run_nagios_plugins $var_logging_syslogd_run_nagios_plugins else echo "Skipping remediation, SELinux is disabled"; @@ -234533,6 +234658,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the logging_syslogd_use_tty SELinux Boolean + By default, the SELinux boolean logging_syslogd_use_tty is enabled. +If this setting is disabled, it should be enabled as it allows syslog +the ability to read/write to terminal. + +To enable the logging_syslogd_use_tty SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_use_tty on + - name: Enable the logging_syslogd_use_tty SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234569,24 +234711,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_use_tty - - - - - - - - - - Enable the login_console_enabled SELinux Boolean - By default, the SELinux boolean login_console_enabled is enabled. -If this setting is disabled, it should be enabled as it allows login from -/dev/console to a console session. - -To enable the login_console_enabled SELinux boolean, run the following command: -$ sudo setsebool -P login_console_enabled on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234596,9 +234721,9 @@ fi if selinuxenabled; then - var_login_console_enabled='' + var_logging_syslogd_use_tty='' - setsebool -P login_console_enabled $var_login_console_enabled + setsebool -P logging_syslogd_use_tty $var_logging_syslogd_use_tty else echo "Skipping remediation, SELinux is disabled"; @@ -234609,6 +234734,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the login_console_enabled SELinux Boolean + By default, the SELinux boolean login_console_enabled is enabled. +If this setting is disabled, it should be enabled as it allows login from +/dev/console to a console session. + +To enable the login_console_enabled SELinux boolean, run the following command: +$ sudo setsebool -P login_console_enabled on + - name: Enable the login_console_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234645,23 +234787,7 @@ fi - no_reboot_needed - sebool_login_console_enabled - - - - - - - - - - Disable the logrotate_use_nfs SELinux Boolean - By default, the SELinux boolean logrotate_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the logrotate_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P logrotate_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234671,9 +234797,9 @@ fi if selinuxenabled; then - var_logrotate_use_nfs='' + var_login_console_enabled='' - setsebool -P logrotate_use_nfs $var_logrotate_use_nfs + setsebool -P login_console_enabled $var_login_console_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -234684,6 +234810,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logrotate_use_nfs SELinux Boolean + By default, the SELinux boolean logrotate_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the logrotate_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P logrotate_use_nfs off + - name: Disable the logrotate_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234720,23 +234862,7 @@ fi - no_reboot_needed - sebool_logrotate_use_nfs - - - - - - - - - - Disable the logwatch_can_network_connect_mail SELinux Boolean - By default, the SELinux boolean logwatch_can_network_connect_mail is disabled. -If this setting is enabled, it should be disabled. - -To disable the logwatch_can_network_connect_mail SELinux boolean, run the following command: -$ sudo setsebool -P logwatch_can_network_connect_mail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234746,9 +234872,9 @@ fi if selinuxenabled; then - var_logwatch_can_network_connect_mail='' + var_logrotate_use_nfs='' - setsebool -P logwatch_can_network_connect_mail $var_logwatch_can_network_connect_mail + setsebool -P logrotate_use_nfs $var_logrotate_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -234759,6 +234885,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logwatch_can_network_connect_mail SELinux Boolean + By default, the SELinux boolean logwatch_can_network_connect_mail is disabled. +If this setting is enabled, it should be disabled. + +To disable the logwatch_can_network_connect_mail SELinux boolean, run the following command: +$ sudo setsebool -P logwatch_can_network_connect_mail off + - name: Disable the logwatch_can_network_connect_mail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234795,23 +234937,7 @@ fi - no_reboot_needed - sebool_logwatch_can_network_connect_mail - - - - - - - - - - Disable the lsmd_plugin_connect_any SELinux Boolean - By default, the SELinux boolean lsmd_plugin_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the lsmd_plugin_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P lsmd_plugin_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234821,9 +234947,9 @@ fi if selinuxenabled; then - var_lsmd_plugin_connect_any='' + var_logwatch_can_network_connect_mail='' - setsebool -P lsmd_plugin_connect_any $var_lsmd_plugin_connect_any + setsebool -P logwatch_can_network_connect_mail $var_logwatch_can_network_connect_mail else echo "Skipping remediation, SELinux is disabled"; @@ -234834,6 +234960,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the lsmd_plugin_connect_any SELinux Boolean + By default, the SELinux boolean lsmd_plugin_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the lsmd_plugin_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P lsmd_plugin_connect_any off + - name: Disable the lsmd_plugin_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234870,23 +235012,7 @@ fi - no_reboot_needed - sebool_lsmd_plugin_connect_any - - - - - - - - - - Disable the mailman_use_fusefs SELinux Boolean - By default, the SELinux boolean mailman_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mailman_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P mailman_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234896,9 +235022,9 @@ fi if selinuxenabled; then - var_mailman_use_fusefs='' + var_lsmd_plugin_connect_any='' - setsebool -P mailman_use_fusefs $var_mailman_use_fusefs + setsebool -P lsmd_plugin_connect_any $var_lsmd_plugin_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -234909,6 +235035,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mailman_use_fusefs SELinux Boolean + By default, the SELinux boolean mailman_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mailman_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P mailman_use_fusefs off + - name: Disable the mailman_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234945,23 +235087,7 @@ fi - no_reboot_needed - sebool_mailman_use_fusefs - - - - - - - - - - Disable the mcelog_client SELinux Boolean - By default, the SELinux boolean mcelog_client is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_client SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_client off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234971,9 +235097,9 @@ fi if selinuxenabled; then - var_mcelog_client='' + var_mailman_use_fusefs='' - setsebool -P mcelog_client $var_mcelog_client + setsebool -P mailman_use_fusefs $var_mailman_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -234984,6 +235110,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_client SELinux Boolean + By default, the SELinux boolean mcelog_client is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_client SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_client off + - name: Disable the mcelog_client SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235019,23 +235161,7 @@ fi - no_reboot_needed - sebool_mcelog_client - - - - - - - - - - Enable the mcelog_exec_scripts SELinux Boolean - By default, the SELinux boolean mcelog_exec_scripts is enabled. -If this setting is disabled, it should be enabled. - -To enable the mcelog_exec_scripts SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_exec_scripts on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235045,9 +235171,9 @@ fi if selinuxenabled; then - var_mcelog_exec_scripts='' + var_mcelog_client='' - setsebool -P mcelog_exec_scripts $var_mcelog_exec_scripts + setsebool -P mcelog_client $var_mcelog_client else echo "Skipping remediation, SELinux is disabled"; @@ -235058,10 +235184,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Enable the mcelog_exec_scripts SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage + + + + + + + + + + Enable the mcelog_exec_scripts SELinux Boolean + By default, the SELinux boolean mcelog_exec_scripts is enabled. +If this setting is disabled, it should be enabled. + +To enable the mcelog_exec_scripts SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_exec_scripts on + + - name: Enable the mcelog_exec_scripts SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: @@ -235094,23 +235236,7 @@ fi - no_reboot_needed - sebool_mcelog_exec_scripts - - - - - - - - - - Disable the mcelog_foreground SELinux Boolean - By default, the SELinux boolean mcelog_foreground is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_foreground SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_foreground off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235120,9 +235246,9 @@ fi if selinuxenabled; then - var_mcelog_foreground='' + var_mcelog_exec_scripts='' - setsebool -P mcelog_foreground $var_mcelog_foreground + setsebool -P mcelog_exec_scripts $var_mcelog_exec_scripts else echo "Skipping remediation, SELinux is disabled"; @@ -235133,6 +235259,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_foreground SELinux Boolean + By default, the SELinux boolean mcelog_foreground is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_foreground SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_foreground off + - name: Disable the mcelog_foreground SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235169,23 +235311,7 @@ fi - no_reboot_needed - sebool_mcelog_foreground - - - - - - - - - - Disable the mcelog_server SELinux Boolean - By default, the SELinux boolean mcelog_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_server SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235195,9 +235321,9 @@ fi if selinuxenabled; then - var_mcelog_server='' + var_mcelog_foreground='' - setsebool -P mcelog_server $var_mcelog_server + setsebool -P mcelog_foreground $var_mcelog_foreground else echo "Skipping remediation, SELinux is disabled"; @@ -235208,6 +235334,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_server SELinux Boolean + By default, the SELinux boolean mcelog_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_server SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_server off + - name: Disable the mcelog_server SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235243,23 +235385,7 @@ fi - no_reboot_needed - sebool_mcelog_server - - - - - - - - - - Disable the minidlna_read_generic_user_content SELinux Boolean - By default, the SELinux boolean minidlna_read_generic_user_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the minidlna_read_generic_user_content SELinux boolean, run the following command: -$ sudo setsebool -P minidlna_read_generic_user_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235269,9 +235395,9 @@ fi if selinuxenabled; then - var_minidlna_read_generic_user_content='' + var_mcelog_server='' - setsebool -P minidlna_read_generic_user_content $var_minidlna_read_generic_user_content + setsebool -P mcelog_server $var_mcelog_server else echo "Skipping remediation, SELinux is disabled"; @@ -235282,6 +235408,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the minidlna_read_generic_user_content SELinux Boolean + By default, the SELinux boolean minidlna_read_generic_user_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the minidlna_read_generic_user_content SELinux boolean, run the following command: +$ sudo setsebool -P minidlna_read_generic_user_content off + - name: Disable the minidlna_read_generic_user_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235318,23 +235460,7 @@ fi - no_reboot_needed - sebool_minidlna_read_generic_user_content - - - - - - - - - - Disable the mmap_low_allowed SELinux Boolean - By default, the SELinux boolean mmap_low_allowed is disabled. -If this setting is enabled, it should be disabled. - -To disable the mmap_low_allowed SELinux boolean, run the following command: -$ sudo setsebool -P mmap_low_allowed off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235344,9 +235470,9 @@ fi if selinuxenabled; then - var_mmap_low_allowed='' + var_minidlna_read_generic_user_content='' - setsebool -P mmap_low_allowed $var_mmap_low_allowed + setsebool -P minidlna_read_generic_user_content $var_minidlna_read_generic_user_content else echo "Skipping remediation, SELinux is disabled"; @@ -235357,6 +235483,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mmap_low_allowed SELinux Boolean + By default, the SELinux boolean mmap_low_allowed is disabled. +If this setting is enabled, it should be disabled. + +To disable the mmap_low_allowed SELinux boolean, run the following command: +$ sudo setsebool -P mmap_low_allowed off + - name: Disable the mmap_low_allowed SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235393,23 +235535,7 @@ fi - no_reboot_needed - sebool_mmap_low_allowed - - - - - - - - - - Disable the mock_enable_homedirs SELinux Boolean - By default, the SELinux boolean mock_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mock_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P mock_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235419,9 +235545,9 @@ fi if selinuxenabled; then - var_mock_enable_homedirs='' + var_mmap_low_allowed='' - setsebool -P mock_enable_homedirs $var_mock_enable_homedirs + setsebool -P mmap_low_allowed $var_mmap_low_allowed else echo "Skipping remediation, SELinux is disabled"; @@ -235432,6 +235558,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mock_enable_homedirs SELinux Boolean + By default, the SELinux boolean mock_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mock_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P mock_enable_homedirs off + - name: Disable the mock_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235468,24 +235610,7 @@ fi - no_reboot_needed - sebool_mock_enable_homedirs - - - - - - - - - - Enable the mount_anyfile SELinux Boolean - By default, the SELinux boolean mount_anyfile is enabled. -If this setting is disabled, it should be enabled to allow any file -or directory to be mounted. - -To enable the mount_anyfile SELinux boolean, run the following command: -$ sudo setsebool -P mount_anyfile on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235495,9 +235620,9 @@ fi if selinuxenabled; then - var_mount_anyfile='' + var_mock_enable_homedirs='' - setsebool -P mount_anyfile $var_mount_anyfile + setsebool -P mock_enable_homedirs $var_mock_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -235508,6 +235633,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the mount_anyfile SELinux Boolean + By default, the SELinux boolean mount_anyfile is enabled. +If this setting is disabled, it should be enabled to allow any file +or directory to be mounted. + +To enable the mount_anyfile SELinux boolean, run the following command: +$ sudo setsebool -P mount_anyfile on + - name: Enable the mount_anyfile SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235543,23 +235685,7 @@ fi - no_reboot_needed - sebool_mount_anyfile - - - - - - - - - - Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - By default, the SELinux boolean mozilla_plugin_bind_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_bind_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_bind_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235569,9 +235695,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_bind_unreserved_ports='' + var_mount_anyfile='' - setsebool -P mozilla_plugin_bind_unreserved_ports $var_mozilla_plugin_bind_unreserved_ports + setsebool -P mount_anyfile $var_mount_anyfile else echo "Skipping remediation, SELinux is disabled"; @@ -235582,6 +235708,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean + By default, the SELinux boolean mozilla_plugin_bind_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_bind_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_bind_unreserved_ports off + - name: Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235618,23 +235760,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_bind_unreserved_ports - - - - - - - - - - Disable the mozilla_plugin_can_network_connect SELinux Boolean - By default, the SELinux boolean mozilla_plugin_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235644,9 +235770,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_can_network_connect='' + var_mozilla_plugin_bind_unreserved_ports='' - setsebool -P mozilla_plugin_can_network_connect $var_mozilla_plugin_can_network_connect + setsebool -P mozilla_plugin_bind_unreserved_ports $var_mozilla_plugin_bind_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -235657,6 +235783,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_can_network_connect SELinux Boolean + By default, the SELinux boolean mozilla_plugin_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_can_network_connect off + - name: Disable the mozilla_plugin_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235693,23 +235835,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_can_network_connect - - - - - - - - - - Disable the mozilla_plugin_use_bluejeans SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_bluejeans is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_bluejeans SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_bluejeans off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235719,9 +235845,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_bluejeans='' + var_mozilla_plugin_can_network_connect='' - setsebool -P mozilla_plugin_use_bluejeans $var_mozilla_plugin_use_bluejeans + setsebool -P mozilla_plugin_can_network_connect $var_mozilla_plugin_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -235732,6 +235858,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_bluejeans SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_bluejeans is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_bluejeans SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_bluejeans off + - name: Disable the mozilla_plugin_use_bluejeans SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235768,23 +235910,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_bluejeans - - - - - - - - - - Disable the mozilla_plugin_use_gps SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_gps is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_gps SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_gps off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235794,9 +235920,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_gps='' + var_mozilla_plugin_use_bluejeans='' - setsebool -P mozilla_plugin_use_gps $var_mozilla_plugin_use_gps + setsebool -P mozilla_plugin_use_bluejeans $var_mozilla_plugin_use_bluejeans else echo "Skipping remediation, SELinux is disabled"; @@ -235807,6 +235933,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_gps SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_gps is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_gps SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_gps off + - name: Disable the mozilla_plugin_use_gps SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235843,23 +235985,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_gps - - - - - - - - - - Disable the mozilla_plugin_use_spice SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_spice is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_spice SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_spice off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235869,9 +235995,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_spice='' + var_mozilla_plugin_use_gps='' - setsebool -P mozilla_plugin_use_spice $var_mozilla_plugin_use_spice + setsebool -P mozilla_plugin_use_gps $var_mozilla_plugin_use_gps else echo "Skipping remediation, SELinux is disabled"; @@ -235882,6 +236008,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_spice SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_spice is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_spice SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_spice off + - name: Disable the mozilla_plugin_use_spice SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235918,23 +236060,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_spice - - - - - - - - - - Disable the mozilla_read_content SELinux Boolean - By default, the SELinux boolean mozilla_read_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_read_content SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_read_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235944,9 +236070,9 @@ fi if selinuxenabled; then - var_mozilla_read_content='' + var_mozilla_plugin_use_spice='' - setsebool -P mozilla_read_content $var_mozilla_read_content + setsebool -P mozilla_plugin_use_spice $var_mozilla_plugin_use_spice else echo "Skipping remediation, SELinux is disabled"; @@ -235957,6 +236083,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_read_content SELinux Boolean + By default, the SELinux boolean mozilla_read_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_read_content SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_read_content off + - name: Disable the mozilla_read_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235993,23 +236135,7 @@ fi - no_reboot_needed - sebool_mozilla_read_content - - - - - - - - - - Disable the mpd_enable_homedirs SELinux Boolean - By default, the SELinux boolean mpd_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236019,9 +236145,9 @@ fi if selinuxenabled; then - var_mpd_enable_homedirs='' + var_mozilla_read_content='' - setsebool -P mpd_enable_homedirs $var_mpd_enable_homedirs + setsebool -P mozilla_read_content $var_mozilla_read_content else echo "Skipping remediation, SELinux is disabled"; @@ -236032,6 +236158,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_enable_homedirs SELinux Boolean + By default, the SELinux boolean mpd_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_enable_homedirs off + - name: Disable the mpd_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236068,23 +236210,7 @@ fi - no_reboot_needed - sebool_mpd_enable_homedirs - - - - - - - - - - Disable the mpd_use_cifs SELinux Boolean - By default, the SELinux boolean mpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236094,9 +236220,9 @@ fi if selinuxenabled; then - var_mpd_use_cifs='' + var_mpd_enable_homedirs='' - setsebool -P mpd_use_cifs $var_mpd_use_cifs + setsebool -P mpd_enable_homedirs $var_mpd_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -236107,6 +236233,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_use_cifs SELinux Boolean + By default, the SELinux boolean mpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_use_cifs off + - name: Disable the mpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236142,23 +236284,7 @@ fi - no_reboot_needed - sebool_mpd_use_cifs - - - - - - - - - - Disable the mpd_use_nfs SELinux Boolean - By default, the SELinux boolean mpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236168,9 +236294,9 @@ fi if selinuxenabled; then - var_mpd_use_nfs='' + var_mpd_use_cifs='' - setsebool -P mpd_use_nfs $var_mpd_use_nfs + setsebool -P mpd_use_cifs $var_mpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -236181,6 +236307,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_use_nfs SELinux Boolean + By default, the SELinux boolean mpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_use_nfs off + - name: Disable the mpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236216,23 +236358,7 @@ fi - no_reboot_needed - sebool_mpd_use_nfs - - - - - - - - - - Disable the mplayer_execstack SELinux Boolean - By default, the SELinux boolean mplayer_execstack is disabled. -If this setting is enabled, it should be disabled. - -To disable the mplayer_execstack SELinux boolean, run the following command: -$ sudo setsebool -P mplayer_execstack off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236242,9 +236368,9 @@ fi if selinuxenabled; then - var_mplayer_execstack='' + var_mpd_use_nfs='' - setsebool -P mplayer_execstack $var_mplayer_execstack + setsebool -P mpd_use_nfs $var_mpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -236255,6 +236381,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mplayer_execstack SELinux Boolean + By default, the SELinux boolean mplayer_execstack is disabled. +If this setting is enabled, it should be disabled. + +To disable the mplayer_execstack SELinux boolean, run the following command: +$ sudo setsebool -P mplayer_execstack off + - name: Disable the mplayer_execstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236291,23 +236433,7 @@ fi - no_reboot_needed - sebool_mplayer_execstack - - - - - - - - - - Disable the mysql_connect_any SELinux Boolean - By default, the SELinux boolean mysql_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the mysql_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P mysql_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236317,9 +236443,9 @@ fi if selinuxenabled; then - var_mysql_connect_any='' + var_mplayer_execstack='' - setsebool -P mysql_connect_any $var_mysql_connect_any + setsebool -P mplayer_execstack $var_mplayer_execstack else echo "Skipping remediation, SELinux is disabled"; @@ -236330,6 +236456,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mysql_connect_any SELinux Boolean + By default, the SELinux boolean mysql_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the mysql_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P mysql_connect_any off + - name: Disable the mysql_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236366,23 +236508,7 @@ fi - no_reboot_needed - sebool_mysql_connect_any - - - - - - - - - - Disable the nagios_run_pnp4nagios SELinux Boolean - By default, the SELinux boolean nagios_run_pnp4nagios is disabled. -If this setting is enabled, it should be disabled. - -To disable the nagios_run_pnp4nagios SELinux boolean, run the following command: -$ sudo setsebool -P nagios_run_pnp4nagios off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236392,9 +236518,9 @@ fi if selinuxenabled; then - var_nagios_run_pnp4nagios='' + var_mysql_connect_any='' - setsebool -P nagios_run_pnp4nagios $var_nagios_run_pnp4nagios + setsebool -P mysql_connect_any $var_mysql_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -236405,6 +236531,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nagios_run_pnp4nagios SELinux Boolean + By default, the SELinux boolean nagios_run_pnp4nagios is disabled. +If this setting is enabled, it should be disabled. + +To disable the nagios_run_pnp4nagios SELinux boolean, run the following command: +$ sudo setsebool -P nagios_run_pnp4nagios off + - name: Disable the nagios_run_pnp4nagios SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236441,23 +236583,7 @@ fi - no_reboot_needed - sebool_nagios_run_pnp4nagios - - - - - - - - - - Disable the nagios_run_sudo SELinux Boolean - By default, the SELinux boolean nagios_run_sudo is disabled. -If this setting is enabled, it should be disabled. - -To disable the nagios_run_sudo SELinux boolean, run the following command: -$ sudo setsebool -P nagios_run_sudo off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236467,9 +236593,9 @@ fi if selinuxenabled; then - var_nagios_run_sudo='' + var_nagios_run_pnp4nagios='' - setsebool -P nagios_run_sudo $var_nagios_run_sudo + setsebool -P nagios_run_pnp4nagios $var_nagios_run_pnp4nagios else echo "Skipping remediation, SELinux is disabled"; @@ -236480,6 +236606,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nagios_run_sudo SELinux Boolean + By default, the SELinux boolean nagios_run_sudo is disabled. +If this setting is enabled, it should be disabled. + +To disable the nagios_run_sudo SELinux boolean, run the following command: +$ sudo setsebool -P nagios_run_sudo off + - name: Disable the nagios_run_sudo SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236515,23 +236657,7 @@ fi - no_reboot_needed - sebool_nagios_run_sudo - - - - - - - - - - Disable the named_tcp_bind_http_port SELinux Boolean - By default, the SELinux boolean named_tcp_bind_http_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the named_tcp_bind_http_port SELinux boolean, run the following command: -$ sudo setsebool -P named_tcp_bind_http_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236541,9 +236667,9 @@ fi if selinuxenabled; then - var_named_tcp_bind_http_port='' + var_nagios_run_sudo='' - setsebool -P named_tcp_bind_http_port $var_named_tcp_bind_http_port + setsebool -P nagios_run_sudo $var_nagios_run_sudo else echo "Skipping remediation, SELinux is disabled"; @@ -236554,6 +236680,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the named_tcp_bind_http_port SELinux Boolean + By default, the SELinux boolean named_tcp_bind_http_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the named_tcp_bind_http_port SELinux boolean, run the following command: +$ sudo setsebool -P named_tcp_bind_http_port off + - name: Disable the named_tcp_bind_http_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236590,23 +236732,7 @@ fi - no_reboot_needed - sebool_named_tcp_bind_http_port - - - - - - - - - - Disable the named_write_master_zones SELinux Boolean - By default, the SELinux boolean named_write_master_zones is disabled. -If this setting is enabled, it should be disabled. - -To disable the named_write_master_zones SELinux boolean, run the following command: -$ sudo setsebool -P named_write_master_zones off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236616,9 +236742,9 @@ fi if selinuxenabled; then - var_named_write_master_zones='' + var_named_tcp_bind_http_port='' - setsebool -P named_write_master_zones $var_named_write_master_zones + setsebool -P named_tcp_bind_http_port $var_named_tcp_bind_http_port else echo "Skipping remediation, SELinux is disabled"; @@ -236629,6 +236755,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the named_write_master_zones SELinux Boolean + By default, the SELinux boolean named_write_master_zones is disabled. +If this setting is enabled, it should be disabled. + +To disable the named_write_master_zones SELinux boolean, run the following command: +$ sudo setsebool -P named_write_master_zones off + - name: Disable the named_write_master_zones SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236665,23 +236807,7 @@ fi - no_reboot_needed - sebool_named_write_master_zones - - - - - - - - - - Disable the neutron_can_network SELinux Boolean - By default, the SELinux boolean neutron_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the neutron_can_network SELinux boolean, run the following command: -$ sudo setsebool -P neutron_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236691,9 +236817,9 @@ fi if selinuxenabled; then - var_neutron_can_network='' + var_named_write_master_zones='' - setsebool -P neutron_can_network $var_neutron_can_network + setsebool -P named_write_master_zones $var_named_write_master_zones else echo "Skipping remediation, SELinux is disabled"; @@ -236704,6 +236830,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the neutron_can_network SELinux Boolean + By default, the SELinux boolean neutron_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the neutron_can_network SELinux boolean, run the following command: +$ sudo setsebool -P neutron_can_network off + - name: Disable the neutron_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236740,24 +236882,7 @@ fi - no_reboot_needed - sebool_neutron_can_network - - - - - - - - - - Enable the nfs_export_all_ro SELinux Boolean - By default, the SELinux boolean nfs_export_all_ro is enabled. -If this setting is disabled, it should be enabled as it allows NFS to -export read-only mounts. - -To enable the nfs_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P nfs_export_all_ro on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236767,9 +236892,9 @@ fi if selinuxenabled; then - var_nfs_export_all_ro='' + var_neutron_can_network='' - setsebool -P nfs_export_all_ro $var_nfs_export_all_ro + setsebool -P neutron_can_network $var_neutron_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -236780,6 +236905,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nfs_export_all_ro SELinux Boolean + By default, the SELinux boolean nfs_export_all_ro is enabled. +If this setting is disabled, it should be enabled as it allows NFS to +export read-only mounts. + +To enable the nfs_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P nfs_export_all_ro on + - name: Enable the nfs_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236816,24 +236958,7 @@ fi - no_reboot_needed - sebool_nfs_export_all_ro - - - - - - - - - - Enable the nfs_export_all_rw SELinux Boolean - By default, the SELinux boolean nfs_export_all_rw is enabled. -If this setting is disabled, it should be enabled as it allows NFS to -export read/write mounts. - -To enable the nfs_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P nfs_export_all_rw on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236843,9 +236968,9 @@ fi if selinuxenabled; then - var_nfs_export_all_rw='' + var_nfs_export_all_ro='' - setsebool -P nfs_export_all_rw $var_nfs_export_all_rw + setsebool -P nfs_export_all_ro $var_nfs_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -236856,6 +236981,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nfs_export_all_rw SELinux Boolean + By default, the SELinux boolean nfs_export_all_rw is enabled. +If this setting is disabled, it should be enabled as it allows NFS to +export read/write mounts. + +To enable the nfs_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P nfs_export_all_rw on + - name: Enable the nfs_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236892,23 +237034,7 @@ fi - no_reboot_needed - sebool_nfs_export_all_rw - - - - - - - - - - Disable the nfsd_anon_write SELinux Boolean - By default, the SELinux boolean nfsd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the nfsd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P nfsd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236918,9 +237044,9 @@ fi if selinuxenabled; then - var_nfsd_anon_write='' + var_nfs_export_all_rw='' - setsebool -P nfsd_anon_write $var_nfsd_anon_write + setsebool -P nfs_export_all_rw $var_nfs_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -236931,6 +237057,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nfsd_anon_write SELinux Boolean + By default, the SELinux boolean nfsd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the nfsd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P nfsd_anon_write off + - name: Disable the nfsd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236966,23 +237108,7 @@ fi - no_reboot_needed - sebool_nfsd_anon_write - - - - - - - - - - Disable the nis_enabled SELinux Boolean - By default, the SELinux boolean nis_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the nis_enabled SELinux boolean, run the following command: -$ sudo setsebool -P nis_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236992,9 +237118,9 @@ fi if selinuxenabled; then - var_nis_enabled='' + var_nfsd_anon_write='' - setsebool -P nis_enabled $var_nis_enabled + setsebool -P nfsd_anon_write $var_nfsd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -237005,6 +237131,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nis_enabled SELinux Boolean + By default, the SELinux boolean nis_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the nis_enabled SELinux boolean, run the following command: +$ sudo setsebool -P nis_enabled off + - name: Disable the nis_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237040,24 +237182,7 @@ fi - no_reboot_needed - sebool_nis_enabled - - - - - - - - - - Enable the nscd_use_shm SELinux Boolean - By default, the SELinux boolean nscd_use_shm is enabled. -If this setting is disabled, it should be enabled to allow nscd -to use shared memory. - -To enable the nscd_use_shm SELinux boolean, run the following command: -$ sudo setsebool -P nscd_use_shm on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237067,9 +237192,9 @@ fi if selinuxenabled; then - var_nscd_use_shm='' + var_nis_enabled='' - setsebool -P nscd_use_shm $var_nscd_use_shm + setsebool -P nis_enabled $var_nis_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -237080,6 +237205,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nscd_use_shm SELinux Boolean + By default, the SELinux boolean nscd_use_shm is enabled. +If this setting is disabled, it should be enabled to allow nscd +to use shared memory. + +To enable the nscd_use_shm SELinux boolean, run the following command: +$ sudo setsebool -P nscd_use_shm on + - name: Enable the nscd_use_shm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237115,23 +237257,7 @@ fi - no_reboot_needed - sebool_nscd_use_shm - - - - - - - - - - Disable the openshift_use_nfs SELinux Boolean - By default, the SELinux boolean openshift_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the openshift_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P openshift_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237141,9 +237267,9 @@ fi if selinuxenabled; then - var_openshift_use_nfs='' + var_nscd_use_shm='' - setsebool -P openshift_use_nfs $var_openshift_use_nfs + setsebool -P nscd_use_shm $var_nscd_use_shm else echo "Skipping remediation, SELinux is disabled"; @@ -237154,6 +237280,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openshift_use_nfs SELinux Boolean + By default, the SELinux boolean openshift_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the openshift_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P openshift_use_nfs off + - name: Disable the openshift_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237190,23 +237332,7 @@ fi - no_reboot_needed - sebool_openshift_use_nfs - - - - - - - - - - Disable the openvpn_can_network_connect SELinux Boolean - By default, the SELinux boolean openvpn_can_network_connect is enabled. -This setting should be disabled. - -To disable the openvpn_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237216,9 +237342,9 @@ fi if selinuxenabled; then - var_openvpn_can_network_connect='' + var_openshift_use_nfs='' - setsebool -P openvpn_can_network_connect $var_openvpn_can_network_connect + setsebool -P openshift_use_nfs $var_openshift_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -237229,6 +237355,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_can_network_connect SELinux Boolean + By default, the SELinux boolean openvpn_can_network_connect is enabled. +This setting should be disabled. + +To disable the openvpn_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_can_network_connect off + - name: Disable the openvpn_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237265,23 +237407,7 @@ fi - no_reboot_needed - sebool_openvpn_can_network_connect - - - - - - - - - - Disable the openvpn_enable_homedirs SELinux Boolean - By default, the SELinux boolean openvpn_enable_homedirs is enabled. -This setting should be disabled. - -To disable the openvpn_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237291,9 +237417,9 @@ fi if selinuxenabled; then - var_openvpn_enable_homedirs='' + var_openvpn_can_network_connect='' - setsebool -P openvpn_enable_homedirs $var_openvpn_enable_homedirs + setsebool -P openvpn_can_network_connect $var_openvpn_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -237304,6 +237430,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_enable_homedirs SELinux Boolean + By default, the SELinux boolean openvpn_enable_homedirs is enabled. +This setting should be disabled. + +To disable the openvpn_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_enable_homedirs off + - name: Disable the openvpn_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237340,23 +237482,7 @@ fi - no_reboot_needed - sebool_openvpn_enable_homedirs - - - - - - - - - - Disable the openvpn_run_unconfined SELinux Boolean - By default, the SELinux boolean openvpn_run_unconfined is disabled. -If this setting is enabled, it should be disabled. - -To disable the openvpn_run_unconfined SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_run_unconfined off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237366,9 +237492,9 @@ fi if selinuxenabled; then - var_openvpn_run_unconfined='' + var_openvpn_enable_homedirs='' - setsebool -P openvpn_run_unconfined $var_openvpn_run_unconfined + setsebool -P openvpn_enable_homedirs $var_openvpn_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -237379,6 +237505,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_run_unconfined SELinux Boolean + By default, the SELinux boolean openvpn_run_unconfined is disabled. +If this setting is enabled, it should be disabled. + +To disable the openvpn_run_unconfined SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_run_unconfined off + - name: Disable the openvpn_run_unconfined SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237415,23 +237557,7 @@ fi - no_reboot_needed - sebool_openvpn_run_unconfined - - - - - - - - - - Disable the pcp_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean pcp_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the pcp_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P pcp_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237441,9 +237567,9 @@ fi if selinuxenabled; then - var_pcp_bind_all_unreserved_ports='' + var_openvpn_run_unconfined='' - setsebool -P pcp_bind_all_unreserved_ports $var_pcp_bind_all_unreserved_ports + setsebool -P openvpn_run_unconfined $var_openvpn_run_unconfined else echo "Skipping remediation, SELinux is disabled"; @@ -237454,6 +237580,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pcp_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean pcp_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the pcp_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P pcp_bind_all_unreserved_ports off + - name: Disable the pcp_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237490,23 +237632,7 @@ fi - no_reboot_needed - sebool_pcp_bind_all_unreserved_ports - - - - - - - - - - Disable the pcp_read_generic_logs SELinux Boolean - By default, the SELinux boolean pcp_read_generic_logs is disabled. -If this setting is enabled, it should be disabled. - -To disable the pcp_read_generic_logs SELinux boolean, run the following command: -$ sudo setsebool -P pcp_read_generic_logs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237516,9 +237642,9 @@ fi if selinuxenabled; then - var_pcp_read_generic_logs='' + var_pcp_bind_all_unreserved_ports='' - setsebool -P pcp_read_generic_logs $var_pcp_read_generic_logs + setsebool -P pcp_bind_all_unreserved_ports $var_pcp_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -237529,6 +237655,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pcp_read_generic_logs SELinux Boolean + By default, the SELinux boolean pcp_read_generic_logs is disabled. +If this setting is enabled, it should be disabled. + +To disable the pcp_read_generic_logs SELinux boolean, run the following command: +$ sudo setsebool -P pcp_read_generic_logs off + - name: Disable the pcp_read_generic_logs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237565,23 +237707,7 @@ fi - no_reboot_needed - sebool_pcp_read_generic_logs - - - - - - - - - - Disable the piranha_lvs_can_network_connect SELinux Boolean - By default, the SELinux boolean piranha_lvs_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the piranha_lvs_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P piranha_lvs_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237591,9 +237717,9 @@ fi if selinuxenabled; then - var_piranha_lvs_can_network_connect='' + var_pcp_read_generic_logs='' - setsebool -P piranha_lvs_can_network_connect $var_piranha_lvs_can_network_connect + setsebool -P pcp_read_generic_logs $var_pcp_read_generic_logs else echo "Skipping remediation, SELinux is disabled"; @@ -237604,6 +237730,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the piranha_lvs_can_network_connect SELinux Boolean + By default, the SELinux boolean piranha_lvs_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the piranha_lvs_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P piranha_lvs_can_network_connect off + - name: Disable the piranha_lvs_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237640,23 +237782,7 @@ fi - no_reboot_needed - sebool_piranha_lvs_can_network_connect - - - - - - - - - - Disable the polipo_connect_all_unreserved SELinux Boolean - By default, the SELinux boolean polipo_connect_all_unreserved is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_connect_all_unreserved SELinux boolean, run the following command: -$ sudo setsebool -P polipo_connect_all_unreserved off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237666,9 +237792,9 @@ fi if selinuxenabled; then - var_polipo_connect_all_unreserved='' + var_piranha_lvs_can_network_connect='' - setsebool -P polipo_connect_all_unreserved $var_polipo_connect_all_unreserved + setsebool -P piranha_lvs_can_network_connect $var_piranha_lvs_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -237679,6 +237805,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_connect_all_unreserved SELinux Boolean + By default, the SELinux boolean polipo_connect_all_unreserved is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_connect_all_unreserved SELinux boolean, run the following command: +$ sudo setsebool -P polipo_connect_all_unreserved off + - name: Disable the polipo_connect_all_unreserved SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237715,23 +237857,7 @@ fi - no_reboot_needed - sebool_polipo_connect_all_unreserved - - - - - - - - - - Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean polipo_session_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_session_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P polipo_session_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237741,9 +237867,9 @@ fi if selinuxenabled; then - var_polipo_session_bind_all_unreserved_ports='' + var_polipo_connect_all_unreserved='' - setsebool -P polipo_session_bind_all_unreserved_ports $var_polipo_session_bind_all_unreserved_ports + setsebool -P polipo_connect_all_unreserved $var_polipo_connect_all_unreserved else echo "Skipping remediation, SELinux is disabled"; @@ -237754,6 +237880,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean polipo_session_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_session_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P polipo_session_bind_all_unreserved_ports off + - name: Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237790,23 +237932,7 @@ fi - no_reboot_needed - sebool_polipo_session_bind_all_unreserved_ports - - - - - - - - - - Disable the polipo_session_users SELinux Boolean - By default, the SELinux boolean polipo_session_users is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_session_users SELinux boolean, run the following command: -$ sudo setsebool -P polipo_session_users off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237816,9 +237942,9 @@ fi if selinuxenabled; then - var_polipo_session_users='' + var_polipo_session_bind_all_unreserved_ports='' - setsebool -P polipo_session_users $var_polipo_session_users + setsebool -P polipo_session_bind_all_unreserved_ports $var_polipo_session_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -237829,6 +237955,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_session_users SELinux Boolean + By default, the SELinux boolean polipo_session_users is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_session_users SELinux boolean, run the following command: +$ sudo setsebool -P polipo_session_users off + - name: Disable the polipo_session_users SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237865,23 +238007,7 @@ fi - no_reboot_needed - sebool_polipo_session_users - - - - - - - - - - Disable the polipo_use_cifs SELinux Boolean - By default, the SELinux boolean polipo_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P polipo_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237891,9 +238017,9 @@ fi if selinuxenabled; then - var_polipo_use_cifs='' + var_polipo_session_users='' - setsebool -P polipo_use_cifs $var_polipo_use_cifs + setsebool -P polipo_session_users $var_polipo_session_users else echo "Skipping remediation, SELinux is disabled"; @@ -237904,6 +238030,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_use_cifs SELinux Boolean + By default, the SELinux boolean polipo_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P polipo_use_cifs off + - name: Disable the polipo_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237939,23 +238081,7 @@ fi - no_reboot_needed - sebool_polipo_use_cifs - - - - - - - - - - Disable the polipo_use_nfs SELinux Boolean - By default, the SELinux boolean polipo_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P polipo_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237965,9 +238091,9 @@ fi if selinuxenabled; then - var_polipo_use_nfs='' + var_polipo_use_cifs='' - setsebool -P polipo_use_nfs $var_polipo_use_nfs + setsebool -P polipo_use_cifs $var_polipo_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -237978,6 +238104,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_use_nfs SELinux Boolean + By default, the SELinux boolean polipo_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P polipo_use_nfs off + - name: Disable the polipo_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238013,25 +238155,7 @@ fi - no_reboot_needed - sebool_polipo_use_nfs - - - - - - - - - - Configure the polyinstantiation_enabled SELinux Boolean - By default, the SELinux boolean polyinstantiation_enabled is disabled. -This setting should be configured to . - -To set the polyinstantiation_enabled SELinux boolean, run the following command: -$ sudo setsebool -P polyinstantiation_enabled - BP28(R39) - - CCE-84230-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238041,9 +238165,9 @@ fi if selinuxenabled; then - var_polyinstantiation_enabled='' + var_polipo_use_nfs='' - setsebool -P polyinstantiation_enabled $var_polyinstantiation_enabled + setsebool -P polipo_use_nfs $var_polipo_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -238054,6 +238178,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the polyinstantiation_enabled SELinux Boolean + By default, the SELinux boolean polyinstantiation_enabled is disabled. +This setting should be configured to . + +To set the polyinstantiation_enabled SELinux boolean, run the following command: +$ sudo setsebool -P polyinstantiation_enabled + BP28(R39) + + CCE-84230-2 - name: Configure the polyinstantiation_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238092,24 +238234,7 @@ fi - no_reboot_needed - sebool_polyinstantiation_enabled - - - - - - - - - - Enable the postfix_local_write_mail_spool SELinux Boolean - By default, the SELinux boolean postfix_local_write_mail_spool is enabled. -If this setting is disabled, it should be enabled as it allows Postfix to write -to the mail spool directories. - -To enable the postfix_local_write_mail_spool SELinux boolean, run the following command: -$ sudo setsebool -P postfix_local_write_mail_spool on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238119,9 +238244,9 @@ fi if selinuxenabled; then - var_postfix_local_write_mail_spool='' + var_polyinstantiation_enabled='' - setsebool -P postfix_local_write_mail_spool $var_postfix_local_write_mail_spool + setsebool -P polyinstantiation_enabled $var_polyinstantiation_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -238132,6 +238257,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postfix_local_write_mail_spool SELinux Boolean + By default, the SELinux boolean postfix_local_write_mail_spool is enabled. +If this setting is disabled, it should be enabled as it allows Postfix to write +to the mail spool directories. + +To enable the postfix_local_write_mail_spool SELinux boolean, run the following command: +$ sudo setsebool -P postfix_local_write_mail_spool on + - name: Enable the postfix_local_write_mail_spool SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238168,23 +238310,7 @@ fi - no_reboot_needed - sebool_postfix_local_write_mail_spool - - - - - - - - - - Disable the postgresql_can_rsync SELinux Boolean - By default, the SELinux boolean postgresql_can_rsync is disabled. -If this setting is enabled, it should be disabled. - -To disable the postgresql_can_rsync SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_can_rsync off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238194,9 +238320,9 @@ fi if selinuxenabled; then - var_postgresql_can_rsync='' + var_postfix_local_write_mail_spool='' - setsebool -P postgresql_can_rsync $var_postgresql_can_rsync + setsebool -P postfix_local_write_mail_spool $var_postfix_local_write_mail_spool else echo "Skipping remediation, SELinux is disabled"; @@ -238207,6 +238333,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the postgresql_can_rsync SELinux Boolean + By default, the SELinux boolean postgresql_can_rsync is disabled. +If this setting is enabled, it should be disabled. + +To disable the postgresql_can_rsync SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_can_rsync off + - name: Disable the postgresql_can_rsync SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238243,23 +238385,7 @@ fi - no_reboot_needed - sebool_postgresql_can_rsync - - - - - - - - - - Disable the postgresql_selinux_transmit_client_label SELinux Boolean - By default, the SELinux boolean postgresql_selinux_transmit_client_label is disabled. -If this setting is enabled, it should be disabled. - -To disable the postgresql_selinux_transmit_client_label SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_transmit_client_label off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238269,9 +238395,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_transmit_client_label='' + var_postgresql_can_rsync='' - setsebool -P postgresql_selinux_transmit_client_label $var_postgresql_selinux_transmit_client_label + setsebool -P postgresql_can_rsync $var_postgresql_can_rsync else echo "Skipping remediation, SELinux is disabled"; @@ -238282,6 +238408,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the postgresql_selinux_transmit_client_label SELinux Boolean + By default, the SELinux boolean postgresql_selinux_transmit_client_label is disabled. +If this setting is enabled, it should be disabled. + +To disable the postgresql_selinux_transmit_client_label SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_transmit_client_label off + - name: Disable the postgresql_selinux_transmit_client_label SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238318,24 +238460,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_transmit_client_label - - - - - - - - - - Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - By default, the SELinux boolean postgresql_selinux_unconfined_dbadm is enabled. -If this setting is disabled, it should be enabled as it allows Database Administrators to -execute Data Manipulation Language (DML) statements. - -To enable the postgresql_selinux_unconfined_dbadm SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_unconfined_dbadm on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238345,9 +238470,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_unconfined_dbadm='' + var_postgresql_selinux_transmit_client_label='' - setsebool -P postgresql_selinux_unconfined_dbadm $var_postgresql_selinux_unconfined_dbadm + setsebool -P postgresql_selinux_transmit_client_label $var_postgresql_selinux_transmit_client_label else echo "Skipping remediation, SELinux is disabled"; @@ -238358,6 +238483,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean + By default, the SELinux boolean postgresql_selinux_unconfined_dbadm is enabled. +If this setting is disabled, it should be enabled as it allows Database Administrators to +execute Data Manipulation Language (DML) statements. + +To enable the postgresql_selinux_unconfined_dbadm SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_unconfined_dbadm on + - name: Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238394,24 +238536,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_unconfined_dbadm - - - - - - - - - - Enable the postgresql_selinux_users_ddl SELinux Boolean - By default, the SELinux boolean postgresql_selinux_users_ddl is enabled. -If this setting is disabled, it should be enabled as it allows Database Administrators to -execute Data Definition Language (DDL) statements. - -To enable the postgresql_selinux_users_ddl SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_users_ddl on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238421,9 +238546,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_users_ddl='' + var_postgresql_selinux_unconfined_dbadm='' - setsebool -P postgresql_selinux_users_ddl $var_postgresql_selinux_users_ddl + setsebool -P postgresql_selinux_unconfined_dbadm $var_postgresql_selinux_unconfined_dbadm else echo "Skipping remediation, SELinux is disabled"; @@ -238434,6 +238559,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postgresql_selinux_users_ddl SELinux Boolean + By default, the SELinux boolean postgresql_selinux_users_ddl is enabled. +If this setting is disabled, it should be enabled as it allows Database Administrators to +execute Data Definition Language (DDL) statements. + +To enable the postgresql_selinux_users_ddl SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_users_ddl on + - name: Enable the postgresql_selinux_users_ddl SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238470,23 +238612,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_users_ddl - - - - - - - - - - Disable the pppd_can_insmod SELinux Boolean - By default, the SELinux boolean pppd_can_insmod is disabled. -If this setting is enabled, it should be disabled. - -To disable the pppd_can_insmod SELinux boolean, run the following command: -$ sudo setsebool -P pppd_can_insmod off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238496,9 +238622,9 @@ fi if selinuxenabled; then - var_pppd_can_insmod='' + var_postgresql_selinux_users_ddl='' - setsebool -P pppd_can_insmod $var_pppd_can_insmod + setsebool -P postgresql_selinux_users_ddl $var_postgresql_selinux_users_ddl else echo "Skipping remediation, SELinux is disabled"; @@ -238509,6 +238635,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pppd_can_insmod SELinux Boolean + By default, the SELinux boolean pppd_can_insmod is disabled. +If this setting is enabled, it should be disabled. + +To disable the pppd_can_insmod SELinux boolean, run the following command: +$ sudo setsebool -P pppd_can_insmod off + - name: Disable the pppd_can_insmod SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238544,23 +238686,7 @@ fi - no_reboot_needed - sebool_pppd_can_insmod - - - - - - - - - - Disable the pppd_for_user SELinux Boolean - By default, the SELinux boolean pppd_for_user is disabled. -If this setting is enabled, it should be disabled. - -To disable the pppd_for_user SELinux boolean, run the following command: -$ sudo setsebool -P pppd_for_user off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238570,9 +238696,9 @@ fi if selinuxenabled; then - var_pppd_for_user='' + var_pppd_can_insmod='' - setsebool -P pppd_for_user $var_pppd_for_user + setsebool -P pppd_can_insmod $var_pppd_can_insmod else echo "Skipping remediation, SELinux is disabled"; @@ -238583,6 +238709,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pppd_for_user SELinux Boolean + By default, the SELinux boolean pppd_for_user is disabled. +If this setting is enabled, it should be disabled. + +To disable the pppd_for_user SELinux boolean, run the following command: +$ sudo setsebool -P pppd_for_user off + - name: Disable the pppd_for_user SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238618,23 +238760,7 @@ fi - no_reboot_needed - sebool_pppd_for_user - - - - - - - - - - Disable the privoxy_connect_any SELinux Boolean - By default, the SELinux boolean privoxy_connect_any is enabled. -This setting should be disabled. - -To disable the privoxy_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P privoxy_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238644,9 +238770,9 @@ fi if selinuxenabled; then - var_privoxy_connect_any='' + var_pppd_for_user='' - setsebool -P privoxy_connect_any $var_privoxy_connect_any + setsebool -P pppd_for_user $var_pppd_for_user else echo "Skipping remediation, SELinux is disabled"; @@ -238657,6 +238783,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the privoxy_connect_any SELinux Boolean + By default, the SELinux boolean privoxy_connect_any is enabled. +This setting should be disabled. + +To disable the privoxy_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P privoxy_connect_any off + - name: Disable the privoxy_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238693,23 +238835,7 @@ fi - no_reboot_needed - sebool_privoxy_connect_any - - - - - - - - - - Disable the prosody_bind_http_port SELinux Boolean - By default, the SELinux boolean prosody_bind_http_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the prosody_bind_http_port SELinux boolean, run the following command: -$ sudo setsebool -P prosody_bind_http_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238719,9 +238845,9 @@ fi if selinuxenabled; then - var_prosody_bind_http_port='' + var_privoxy_connect_any='' - setsebool -P prosody_bind_http_port $var_prosody_bind_http_port + setsebool -P privoxy_connect_any $var_privoxy_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -238732,6 +238858,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the prosody_bind_http_port SELinux Boolean + By default, the SELinux boolean prosody_bind_http_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the prosody_bind_http_port SELinux boolean, run the following command: +$ sudo setsebool -P prosody_bind_http_port off + - name: Disable the prosody_bind_http_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238768,23 +238910,7 @@ fi - no_reboot_needed - sebool_prosody_bind_http_port - - - - - - - - - - Disable the puppetagent_manage_all_files SELinux Boolean - By default, the SELinux boolean puppetagent_manage_all_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the puppetagent_manage_all_files SELinux boolean, run the following command: -$ sudo setsebool -P puppetagent_manage_all_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238794,9 +238920,9 @@ fi if selinuxenabled; then - var_puppetagent_manage_all_files='' + var_prosody_bind_http_port='' - setsebool -P puppetagent_manage_all_files $var_puppetagent_manage_all_files + setsebool -P prosody_bind_http_port $var_prosody_bind_http_port else echo "Skipping remediation, SELinux is disabled"; @@ -238807,6 +238933,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the puppetagent_manage_all_files SELinux Boolean + By default, the SELinux boolean puppetagent_manage_all_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the puppetagent_manage_all_files SELinux boolean, run the following command: +$ sudo setsebool -P puppetagent_manage_all_files off + - name: Disable the puppetagent_manage_all_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238843,23 +238985,7 @@ fi - no_reboot_needed - sebool_puppetagent_manage_all_files - - - - - - - - - - Disable the puppetmaster_use_db SELinux Boolean - By default, the SELinux boolean puppetmaster_use_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the puppetmaster_use_db SELinux boolean, run the following command: -$ sudo setsebool -P puppetmaster_use_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238869,9 +238995,9 @@ fi if selinuxenabled; then - var_puppetmaster_use_db='' + var_puppetagent_manage_all_files='' - setsebool -P puppetmaster_use_db $var_puppetmaster_use_db + setsebool -P puppetagent_manage_all_files $var_puppetagent_manage_all_files else echo "Skipping remediation, SELinux is disabled"; @@ -238882,6 +239008,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the puppetmaster_use_db SELinux Boolean + By default, the SELinux boolean puppetmaster_use_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the puppetmaster_use_db SELinux boolean, run the following command: +$ sudo setsebool -P puppetmaster_use_db off + - name: Disable the puppetmaster_use_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238918,23 +239060,7 @@ fi - no_reboot_needed - sebool_puppetmaster_use_db - - - - - - - - - - Disable the racoon_read_shadow SELinux Boolean - By default, the SELinux boolean racoon_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the racoon_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P racoon_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238944,9 +239070,9 @@ fi if selinuxenabled; then - var_racoon_read_shadow='' + var_puppetmaster_use_db='' - setsebool -P racoon_read_shadow $var_racoon_read_shadow + setsebool -P puppetmaster_use_db $var_puppetmaster_use_db else echo "Skipping remediation, SELinux is disabled"; @@ -238957,6 +239083,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the racoon_read_shadow SELinux Boolean + By default, the SELinux boolean racoon_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the racoon_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P racoon_read_shadow off + - name: Disable the racoon_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238993,23 +239135,7 @@ fi - no_reboot_needed - sebool_racoon_read_shadow - - - - - - - - - - Disable the rsync_anon_write SELinux Boolean - By default, the SELinux boolean rsync_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P rsync_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239019,9 +239145,9 @@ fi if selinuxenabled; then - var_rsync_anon_write='' + var_racoon_read_shadow='' - setsebool -P rsync_anon_write $var_rsync_anon_write + setsebool -P racoon_read_shadow $var_racoon_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -239032,18 +239158,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the rsync_anon_write SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the rsync_anon_write SELinux Boolean + By default, the SELinux boolean rsync_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P rsync_anon_write off + + - name: Disable the rsync_anon_write SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_rsync_anon_write - name: XCCDF Value var_rsync_anon_write # promote to variable set_fact: @@ -239068,23 +239210,7 @@ fi - no_reboot_needed - sebool_rsync_anon_write - - - - - - - - - - Disable the rsync_client SELinux Boolean - By default, the SELinux boolean rsync_client is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_client SELinux boolean, run the following command: -$ sudo setsebool -P rsync_client off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239094,9 +239220,9 @@ fi if selinuxenabled; then - var_rsync_client='' + var_rsync_anon_write='' - setsebool -P rsync_client $var_rsync_client + setsebool -P rsync_anon_write $var_rsync_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -239107,6 +239233,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_client SELinux Boolean + By default, the SELinux boolean rsync_client is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_client SELinux boolean, run the following command: +$ sudo setsebool -P rsync_client off + - name: Disable the rsync_client SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -239142,23 +239284,7 @@ fi - no_reboot_needed - sebool_rsync_client - - - - - - - - - - Disable the rsync_export_all_ro SELinux Boolean - By default, the SELinux boolean rsync_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P rsync_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239168,9 +239294,9 @@ fi if selinuxenabled; then - var_rsync_export_all_ro='' + var_rsync_client='' - setsebool -P rsync_export_all_ro $var_rsync_export_all_ro + setsebool -P rsync_client $var_rsync_client else echo "Skipping remediation, SELinux is disabled"; @@ -239181,6 +239307,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_export_all_ro SELinux Boolean + By default, the SELinux boolean rsync_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P rsync_export_all_ro off + - name: Disable the rsync_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239217,23 +239359,7 @@ fi - no_reboot_needed - sebool_rsync_export_all_ro - - - - - - - - - - Disable the rsync_full_access SELinux Boolean - By default, the SELinux boolean rsync_full_access is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_full_access SELinux boolean, run the following command: -$ sudo setsebool -P rsync_full_access off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239243,9 +239369,9 @@ fi if selinuxenabled; then - var_rsync_full_access='' + var_rsync_export_all_ro='' - setsebool -P rsync_full_access $var_rsync_full_access + setsebool -P rsync_export_all_ro $var_rsync_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -239256,6 +239382,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_full_access SELinux Boolean + By default, the SELinux boolean rsync_full_access is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_full_access SELinux boolean, run the following command: +$ sudo setsebool -P rsync_full_access off + - name: Disable the rsync_full_access SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239292,23 +239434,7 @@ fi - no_reboot_needed - sebool_rsync_full_access - - - - - - - - - - Disable the samba_create_home_dirs SELinux Boolean - By default, the SELinux boolean samba_create_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_create_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P samba_create_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239318,9 +239444,9 @@ fi if selinuxenabled; then - var_samba_create_home_dirs='' + var_rsync_full_access='' - setsebool -P samba_create_home_dirs $var_samba_create_home_dirs + setsebool -P rsync_full_access $var_rsync_full_access else echo "Skipping remediation, SELinux is disabled"; @@ -239331,6 +239457,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_create_home_dirs SELinux Boolean + By default, the SELinux boolean samba_create_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_create_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P samba_create_home_dirs off + - name: Disable the samba_create_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239367,23 +239509,7 @@ fi - no_reboot_needed - sebool_samba_create_home_dirs - - - - - - - - - - Disable the samba_domain_controller SELinux Boolean - By default, the SELinux boolean samba_domain_controller is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_domain_controller SELinux boolean, run the following command: -$ sudo setsebool -P samba_domain_controller off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239393,9 +239519,9 @@ fi if selinuxenabled; then - var_samba_domain_controller='' + var_samba_create_home_dirs='' - setsebool -P samba_domain_controller $var_samba_domain_controller + setsebool -P samba_create_home_dirs $var_samba_create_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -239406,6 +239532,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_domain_controller SELinux Boolean + By default, the SELinux boolean samba_domain_controller is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_domain_controller SELinux boolean, run the following command: +$ sudo setsebool -P samba_domain_controller off + - name: Disable the samba_domain_controller SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239442,23 +239584,7 @@ fi - no_reboot_needed - sebool_samba_domain_controller - - - - - - - - - - Disable the samba_enable_home_dirs SELinux Boolean - By default, the SELinux boolean samba_enable_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_enable_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P samba_enable_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239468,9 +239594,9 @@ fi if selinuxenabled; then - var_samba_enable_home_dirs='' + var_samba_domain_controller='' - setsebool -P samba_enable_home_dirs $var_samba_enable_home_dirs + setsebool -P samba_domain_controller $var_samba_domain_controller else echo "Skipping remediation, SELinux is disabled"; @@ -239481,6 +239607,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_enable_home_dirs SELinux Boolean + By default, the SELinux boolean samba_enable_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_enable_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P samba_enable_home_dirs off + - name: Disable the samba_enable_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239517,23 +239659,7 @@ fi - no_reboot_needed - sebool_samba_enable_home_dirs - - - - - - - - - - Disable the samba_export_all_ro SELinux Boolean - By default, the SELinux boolean samba_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P samba_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239543,9 +239669,9 @@ fi if selinuxenabled; then - var_samba_export_all_ro='' + var_samba_enable_home_dirs='' - setsebool -P samba_export_all_ro $var_samba_export_all_ro + setsebool -P samba_enable_home_dirs $var_samba_enable_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -239556,6 +239682,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_export_all_ro SELinux Boolean + By default, the SELinux boolean samba_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P samba_export_all_ro off + - name: Disable the samba_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239592,23 +239734,7 @@ fi - no_reboot_needed - sebool_samba_export_all_ro - - - - - - - - - - Disable the samba_export_all_rw SELinux Boolean - By default, the SELinux boolean samba_export_all_rw is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P samba_export_all_rw off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239618,9 +239744,9 @@ fi if selinuxenabled; then - var_samba_export_all_rw='' + var_samba_export_all_ro='' - setsebool -P samba_export_all_rw $var_samba_export_all_rw + setsebool -P samba_export_all_ro $var_samba_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -239631,6 +239757,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_export_all_rw SELinux Boolean + By default, the SELinux boolean samba_export_all_rw is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P samba_export_all_rw off + - name: Disable the samba_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239667,23 +239809,7 @@ fi - no_reboot_needed - sebool_samba_export_all_rw - - - - - - - - - - Disable the samba_load_libgfapi SELinux Boolean - By default, the SELinux boolean samba_load_libgfapi is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_load_libgfapi SELinux boolean, run the following command: -$ sudo setsebool -P samba_load_libgfapi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239693,9 +239819,9 @@ fi if selinuxenabled; then - var_samba_load_libgfapi='' + var_samba_export_all_rw='' - setsebool -P samba_load_libgfapi $var_samba_load_libgfapi + setsebool -P samba_export_all_rw $var_samba_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -239706,6 +239832,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_load_libgfapi SELinux Boolean + By default, the SELinux boolean samba_load_libgfapi is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_load_libgfapi SELinux boolean, run the following command: +$ sudo setsebool -P samba_load_libgfapi off + - name: Disable the samba_load_libgfapi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239742,23 +239884,7 @@ fi - no_reboot_needed - sebool_samba_load_libgfapi - - - - - - - - - - Disable the samba_portmapper SELinux Boolean - By default, the SELinux boolean samba_portmapper is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_portmapper SELinux boolean, run the following command: -$ sudo setsebool -P samba_portmapper off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239768,9 +239894,9 @@ fi if selinuxenabled; then - var_samba_portmapper='' + var_samba_load_libgfapi='' - setsebool -P samba_portmapper $var_samba_portmapper + setsebool -P samba_load_libgfapi $var_samba_load_libgfapi else echo "Skipping remediation, SELinux is disabled"; @@ -239781,6 +239907,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_portmapper SELinux Boolean + By default, the SELinux boolean samba_portmapper is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_portmapper SELinux boolean, run the following command: +$ sudo setsebool -P samba_portmapper off + - name: Disable the samba_portmapper SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239817,23 +239959,7 @@ fi - no_reboot_needed - sebool_samba_portmapper - - - - - - - - - - Disable the samba_run_unconfined SELinux Boolean - By default, the SELinux boolean samba_run_unconfined is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_run_unconfined SELinux boolean, run the following command: -$ sudo setsebool -P samba_run_unconfined off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239843,9 +239969,9 @@ fi if selinuxenabled; then - var_samba_run_unconfined='' + var_samba_portmapper='' - setsebool -P samba_run_unconfined $var_samba_run_unconfined + setsebool -P samba_portmapper $var_samba_portmapper else echo "Skipping remediation, SELinux is disabled"; @@ -239856,6 +239982,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_run_unconfined SELinux Boolean + By default, the SELinux boolean samba_run_unconfined is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_run_unconfined SELinux boolean, run the following command: +$ sudo setsebool -P samba_run_unconfined off + - name: Disable the samba_run_unconfined SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239892,23 +240034,7 @@ fi - no_reboot_needed - sebool_samba_run_unconfined - - - - - - - - - - Disable the samba_share_fusefs SELinux Boolean - By default, the SELinux boolean samba_share_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_share_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P samba_share_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239918,9 +240044,9 @@ fi if selinuxenabled; then - var_samba_share_fusefs='' + var_samba_run_unconfined='' - setsebool -P samba_share_fusefs $var_samba_share_fusefs + setsebool -P samba_run_unconfined $var_samba_run_unconfined else echo "Skipping remediation, SELinux is disabled"; @@ -239931,6 +240057,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_share_fusefs SELinux Boolean + By default, the SELinux boolean samba_share_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_share_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P samba_share_fusefs off + - name: Disable the samba_share_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239967,23 +240109,7 @@ fi - no_reboot_needed - sebool_samba_share_fusefs - - - - - - - - - - Disable the samba_share_nfs SELinux Boolean - By default, the SELinux boolean samba_share_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_share_nfs SELinux boolean, run the following command: -$ sudo setsebool -P samba_share_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239993,9 +240119,9 @@ fi if selinuxenabled; then - var_samba_share_nfs='' + var_samba_share_fusefs='' - setsebool -P samba_share_nfs $var_samba_share_nfs + setsebool -P samba_share_fusefs $var_samba_share_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -240006,6 +240132,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_share_nfs SELinux Boolean + By default, the SELinux boolean samba_share_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_share_nfs SELinux boolean, run the following command: +$ sudo setsebool -P samba_share_nfs off + - name: Disable the samba_share_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240041,23 +240183,7 @@ fi - no_reboot_needed - sebool_samba_share_nfs - - - - - - - - - - Disable the sanlock_use_fusefs SELinux Boolean - By default, the SELinux boolean sanlock_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240067,9 +240193,9 @@ fi if selinuxenabled; then - var_sanlock_use_fusefs='' + var_samba_share_nfs='' - setsebool -P sanlock_use_fusefs $var_sanlock_use_fusefs + setsebool -P samba_share_nfs $var_samba_share_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -240080,6 +240206,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_fusefs SELinux Boolean + By default, the SELinux boolean sanlock_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_fusefs off + - name: Disable the sanlock_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240116,23 +240258,7 @@ fi - no_reboot_needed - sebool_sanlock_use_fusefs - - - - - - - - - - Disable the sanlock_use_nfs SELinux Boolean - By default, the SELinux boolean sanlock_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240142,9 +240268,9 @@ fi if selinuxenabled; then - var_sanlock_use_nfs='' + var_sanlock_use_fusefs='' - setsebool -P sanlock_use_nfs $var_sanlock_use_nfs + setsebool -P sanlock_use_fusefs $var_sanlock_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -240155,6 +240281,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_nfs SELinux Boolean + By default, the SELinux boolean sanlock_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_nfs off + - name: Disable the sanlock_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240190,23 +240332,7 @@ fi - no_reboot_needed - sebool_sanlock_use_nfs - - - - - - - - - - Disable the sanlock_use_samba SELinux Boolean - By default, the SELinux boolean sanlock_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240216,9 +240342,9 @@ fi if selinuxenabled; then - var_sanlock_use_samba='' + var_sanlock_use_nfs='' - setsebool -P sanlock_use_samba $var_sanlock_use_samba + setsebool -P sanlock_use_nfs $var_sanlock_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -240229,6 +240355,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_samba SELinux Boolean + By default, the SELinux boolean sanlock_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_samba off + - name: Disable the sanlock_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240265,23 +240407,7 @@ fi - no_reboot_needed - sebool_sanlock_use_samba - - - - - - - - - - Disable the saslauthd_read_shadow SELinux Boolean - By default, the SELinux boolean saslauthd_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the saslauthd_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P saslauthd_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240291,9 +240417,9 @@ fi if selinuxenabled; then - var_saslauthd_read_shadow='' + var_sanlock_use_samba='' - setsebool -P saslauthd_read_shadow $var_saslauthd_read_shadow + setsebool -P sanlock_use_samba $var_sanlock_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -240304,6 +240430,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the saslauthd_read_shadow SELinux Boolean + By default, the SELinux boolean saslauthd_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the saslauthd_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P saslauthd_read_shadow off + - name: Disable the saslauthd_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240340,23 +240482,7 @@ fi - no_reboot_needed - sebool_saslauthd_read_shadow - - - - - - - - - - Enable the secadm_exec_content SELinux Boolean - By default, the SELinux boolean secadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the secadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P secadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240366,9 +240492,9 @@ fi if selinuxenabled; then - var_secadm_exec_content='' + var_saslauthd_read_shadow='' - setsebool -P secadm_exec_content $var_secadm_exec_content + setsebool -P saslauthd_read_shadow $var_saslauthd_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -240379,6 +240505,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the secadm_exec_content SELinux Boolean + By default, the SELinux boolean secadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the secadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P secadm_exec_content on + - name: Enable the secadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240415,23 +240557,7 @@ fi - no_reboot_needed - sebool_secadm_exec_content - - - - - - - - - - Disable the secure_mode SELinux Boolean - By default, the SELinux boolean secure_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the secure_mode SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240441,9 +240567,9 @@ fi if selinuxenabled; then - var_secure_mode='' + var_secadm_exec_content='' - setsebool -P secure_mode $var_secure_mode + setsebool -P secadm_exec_content $var_secadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -240454,6 +240580,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the secure_mode SELinux Boolean + By default, the SELinux boolean secure_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the secure_mode SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode off + - name: Disable the secure_mode SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240489,25 +240631,7 @@ fi - no_reboot_needed - sebool_secure_mode - - - - - - - - - - Configure the secure_mode_insmod SELinux Boolean - By default, the SELinux boolean secure_mode_insmod is disabled. -This setting should be configured to . - -To set the secure_mode_insmod SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode_insmod - BP28(R67) - - CCE-83310-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240517,9 +240641,9 @@ fi if selinuxenabled; then - var_secure_mode_insmod='' + var_secure_mode='' - setsebool -P secure_mode_insmod $var_secure_mode_insmod + setsebool -P secure_mode $var_secure_mode else echo "Skipping remediation, SELinux is disabled"; @@ -240530,6 +240654,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the secure_mode_insmod SELinux Boolean + By default, the SELinux boolean secure_mode_insmod is disabled. +This setting should be configured to . + +To set the secure_mode_insmod SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode_insmod + BP28(R67) + + CCE-83310-3 - name: Configure the secure_mode_insmod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240568,23 +240710,7 @@ fi - no_reboot_needed - sebool_secure_mode_insmod - - - - - - - - - - Disable the secure_mode_policyload SELinux Boolean - By default, the SELinux boolean secure_mode_policyload is disabled. -If this setting is enabled, it should be disabled. - -To disable the secure_mode_policyload SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode_policyload off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240594,9 +240720,9 @@ fi if selinuxenabled; then - var_secure_mode_policyload='' + var_secure_mode_insmod='' - setsebool -P secure_mode_policyload $var_secure_mode_policyload + setsebool -P secure_mode_insmod $var_secure_mode_insmod else echo "Skipping remediation, SELinux is disabled"; @@ -240607,6 +240733,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the secure_mode_policyload SELinux Boolean + By default, the SELinux boolean secure_mode_policyload is disabled. +If this setting is enabled, it should be disabled. + +To disable the secure_mode_policyload SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode_policyload off + - name: Disable the secure_mode_policyload SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240643,24 +240785,7 @@ fi - no_reboot_needed - sebool_secure_mode_policyload - - - - - - - - - - Configure the selinuxuser_direct_dri_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_direct_dri_enabled is enabled. -If XWindows is not installed or used on the system, this setting should be disabled. -Otherwise, enable it. - -To disable the selinuxuser_direct_dri_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_direct_dri_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240670,9 +240795,9 @@ fi if selinuxenabled; then - var_selinuxuser_direct_dri_enabled='' + var_secure_mode_policyload='' - setsebool -P selinuxuser_direct_dri_enabled $var_selinuxuser_direct_dri_enabled + setsebool -P secure_mode_policyload $var_secure_mode_policyload else echo "Skipping remediation, SELinux is disabled"; @@ -240683,6 +240808,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the selinuxuser_direct_dri_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_direct_dri_enabled is enabled. +If XWindows is not installed or used on the system, this setting should be disabled. +Otherwise, enable it. + +To disable the selinuxuser_direct_dri_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_direct_dri_enabled off + - name: Configure the selinuxuser_direct_dri_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240718,6 +240860,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_direct_dri_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_direct_dri_enabled='' + + setsebool -P selinuxuser_direct_dri_enabled $var_selinuxuser_direct_dri_enabled + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240745,29 +240910,6 @@ To disable the selinuxuser_execheap SELinux boolean, run 164.312(e) Disabling code execution from the heap blocks buffer overflow attacks. CCE-80949-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execheap='' - - setsebool -P selinuxuser_execheap $var_selinuxuser_execheap - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the selinuxuser_execheap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240805,6 +240947,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_execheap + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_execheap='' + + setsebool -P selinuxuser_execheap $var_selinuxuser_execheap + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240830,29 +240995,6 @@ To enable the selinuxuser_execmod SELinux boolean, run th 164.312(e) CCE-80950-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execmod='' - - setsebool -P selinuxuser_execmod $var_selinuxuser_execmod - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the selinuxuser_execmod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240890,6 +241032,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_execmod + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_execmod='' + + setsebool -P selinuxuser_execmod $var_selinuxuser_execmod + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240917,29 +241082,6 @@ To disable the selinuxuser_execstack SELinux boolean, run 164.312(e) Disabling code execution from the stack blocks buffer overflow attacks. CCE-80951-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execstack='' - - setsebool -P selinuxuser_execstack $var_selinuxuser_execstack - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the selinuxuser_execstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240978,24 +241120,8 @@ fi - no_reboot_needed - sebool_selinuxuser_execstack - - - - - - - - - - Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_mysql_connect_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_mysql_connect_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_mysql_connect_enabled off - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then yum install -y "python3-libsemanage" @@ -241004,9 +241130,9 @@ fi if selinuxenabled; then - var_selinuxuser_mysql_connect_enabled='' + var_selinuxuser_execstack='' - setsebool -P selinuxuser_mysql_connect_enabled $var_selinuxuser_mysql_connect_enabled + setsebool -P selinuxuser_execstack $var_selinuxuser_execstack else echo "Skipping remediation, SELinux is disabled"; @@ -241017,6 +241143,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_mysql_connect_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_mysql_connect_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_mysql_connect_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_mysql_connect_enabled off + - name: Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241053,24 +241195,7 @@ fi - no_reboot_needed - sebool_selinuxuser_mysql_connect_enabled - - - - - - - - - - Enable the selinuxuser_ping SELinux Boolean - By default, the SELinux boolean selinuxuser_ping is enabled. -If this setting is disabled, it should be enabled as it allows confined users -to use ping and traceroute which is helpful for network troubleshooting. - -To enable the selinuxuser_ping SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_ping on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241080,9 +241205,9 @@ fi if selinuxenabled; then - var_selinuxuser_ping='' + var_selinuxuser_mysql_connect_enabled='' - setsebool -P selinuxuser_ping $var_selinuxuser_ping + setsebool -P selinuxuser_mysql_connect_enabled $var_selinuxuser_mysql_connect_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -241093,6 +241218,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the selinuxuser_ping SELinux Boolean + By default, the SELinux boolean selinuxuser_ping is enabled. +If this setting is disabled, it should be enabled as it allows confined users +to use ping and traceroute which is helpful for network troubleshooting. + +To enable the selinuxuser_ping SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_ping on + - name: Enable the selinuxuser_ping SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241128,23 +241270,7 @@ fi - no_reboot_needed - sebool_selinuxuser_ping - - - - - - - - - - Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_postgresql_connect_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_postgresql_connect_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_postgresql_connect_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241154,9 +241280,9 @@ fi if selinuxenabled; then - var_selinuxuser_postgresql_connect_enabled='' + var_selinuxuser_ping='' - setsebool -P selinuxuser_postgresql_connect_enabled $var_selinuxuser_postgresql_connect_enabled + setsebool -P selinuxuser_ping $var_selinuxuser_ping else echo "Skipping remediation, SELinux is disabled"; @@ -241167,6 +241293,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_postgresql_connect_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_postgresql_connect_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_postgresql_connect_enabled off + - name: Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241203,24 +241345,7 @@ fi - no_reboot_needed - sebool_selinuxuser_postgresql_connect_enabled - - - - - - - - - - Disable the selinuxuser_rw_noexattrfile SELinux Boolean - By default, the SELinux boolean selinuxuser_rw_noexattrfile is enabled. -This setting should be disabled as users should not be able to read/write files -on filesystems that do not have extended attributes e.g. FAT, CDROM, FLOPPY, etc. - -To disable the selinuxuser_rw_noexattrfile SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_rw_noexattrfile off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241230,9 +241355,9 @@ fi if selinuxenabled; then - var_selinuxuser_rw_noexattrfile='' + var_selinuxuser_postgresql_connect_enabled='' - setsebool -P selinuxuser_rw_noexattrfile $var_selinuxuser_rw_noexattrfile + setsebool -P selinuxuser_postgresql_connect_enabled $var_selinuxuser_postgresql_connect_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -241243,6 +241368,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_rw_noexattrfile SELinux Boolean + By default, the SELinux boolean selinuxuser_rw_noexattrfile is enabled. +This setting should be disabled as users should not be able to read/write files +on filesystems that do not have extended attributes e.g. FAT, CDROM, FLOPPY, etc. + +To disable the selinuxuser_rw_noexattrfile SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_rw_noexattrfile off + - name: Disable the selinuxuser_rw_noexattrfile SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241279,23 +241421,7 @@ fi - no_reboot_needed - sebool_selinuxuser_rw_noexattrfile - - - - - - - - - - Disable the selinuxuser_share_music SELinux Boolean - By default, the SELinux boolean selinuxuser_share_music is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_share_music SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_share_music off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241305,9 +241431,9 @@ fi if selinuxenabled; then - var_selinuxuser_share_music='' + var_selinuxuser_rw_noexattrfile='' - setsebool -P selinuxuser_share_music $var_selinuxuser_share_music + setsebool -P selinuxuser_rw_noexattrfile $var_selinuxuser_rw_noexattrfile else echo "Skipping remediation, SELinux is disabled"; @@ -241318,6 +241444,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_share_music SELinux Boolean + By default, the SELinux boolean selinuxuser_share_music is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_share_music SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_share_music off + - name: Disable the selinuxuser_share_music SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241354,23 +241496,7 @@ fi - no_reboot_needed - sebool_selinuxuser_share_music - - - - - - - - - - Disable the selinuxuser_tcp_server SELinux Boolean - By default, the SELinux boolean selinuxuser_tcp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_tcp_server SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_tcp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241380,9 +241506,9 @@ fi if selinuxenabled; then - var_selinuxuser_tcp_server='' + var_selinuxuser_share_music='' - setsebool -P selinuxuser_tcp_server $var_selinuxuser_tcp_server + setsebool -P selinuxuser_share_music $var_selinuxuser_share_music else echo "Skipping remediation, SELinux is disabled"; @@ -241393,6 +241519,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_tcp_server SELinux Boolean + By default, the SELinux boolean selinuxuser_tcp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_tcp_server SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_tcp_server off + - name: Disable the selinuxuser_tcp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241429,23 +241571,7 @@ fi - no_reboot_needed - sebool_selinuxuser_tcp_server - - - - - - - - - - Disable the selinuxuser_udp_server SELinux Boolean - By default, the SELinux boolean selinuxuser_udp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_udp_server SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_udp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241455,9 +241581,9 @@ fi if selinuxenabled; then - var_selinuxuser_udp_server='' + var_selinuxuser_tcp_server='' - setsebool -P selinuxuser_udp_server $var_selinuxuser_udp_server + setsebool -P selinuxuser_tcp_server $var_selinuxuser_tcp_server else echo "Skipping remediation, SELinux is disabled"; @@ -241468,6 +241594,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_udp_server SELinux Boolean + By default, the SELinux boolean selinuxuser_udp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_udp_server SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_udp_server off + - name: Disable the selinuxuser_udp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241504,23 +241646,7 @@ fi - no_reboot_needed - sebool_selinuxuser_udp_server - - - - - - - - - - Disable the selinuxuser_use_ssh_chroot SELinux Boolean - By default, the SELinux boolean selinuxuser_use_ssh_chroot is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_use_ssh_chroot SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_use_ssh_chroot off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241530,9 +241656,9 @@ fi if selinuxenabled; then - var_selinuxuser_use_ssh_chroot='' + var_selinuxuser_udp_server='' - setsebool -P selinuxuser_use_ssh_chroot $var_selinuxuser_use_ssh_chroot + setsebool -P selinuxuser_udp_server $var_selinuxuser_udp_server else echo "Skipping remediation, SELinux is disabled"; @@ -241543,6 +241669,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_use_ssh_chroot SELinux Boolean + By default, the SELinux boolean selinuxuser_use_ssh_chroot is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_use_ssh_chroot SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_use_ssh_chroot off + - name: Disable the selinuxuser_use_ssh_chroot SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241579,23 +241721,7 @@ fi - no_reboot_needed - sebool_selinuxuser_use_ssh_chroot - - - - - - - - - - Disable the sge_domain_can_network_connect SELinux Boolean - By default, the SELinux boolean sge_domain_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the sge_domain_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P sge_domain_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241605,9 +241731,9 @@ fi if selinuxenabled; then - var_sge_domain_can_network_connect='' + var_selinuxuser_use_ssh_chroot='' - setsebool -P sge_domain_can_network_connect $var_sge_domain_can_network_connect + setsebool -P selinuxuser_use_ssh_chroot $var_selinuxuser_use_ssh_chroot else echo "Skipping remediation, SELinux is disabled"; @@ -241618,6 +241744,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sge_domain_can_network_connect SELinux Boolean + By default, the SELinux boolean sge_domain_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the sge_domain_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P sge_domain_can_network_connect off + - name: Disable the sge_domain_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241654,23 +241796,7 @@ fi - no_reboot_needed - sebool_sge_domain_can_network_connect - - - - - - - - - - Disable the sge_use_nfs SELinux Boolean - By default, the SELinux boolean sge_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sge_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P sge_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241680,9 +241806,9 @@ fi if selinuxenabled; then - var_sge_use_nfs='' + var_sge_domain_can_network_connect='' - setsebool -P sge_use_nfs $var_sge_use_nfs + setsebool -P sge_domain_can_network_connect $var_sge_domain_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -241693,6 +241819,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sge_use_nfs SELinux Boolean + By default, the SELinux boolean sge_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sge_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P sge_use_nfs off + - name: Disable the sge_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241728,23 +241870,7 @@ fi - no_reboot_needed - sebool_sge_use_nfs - - - - - - - - - - Disable the smartmon_3ware SELinux Boolean - By default, the SELinux boolean smartmon_3ware is disabled. -If this setting is enabled, it should be disabled. - -To disable the smartmon_3ware SELinux boolean, run the following command: -$ sudo setsebool -P smartmon_3ware off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241754,9 +241880,9 @@ fi if selinuxenabled; then - var_smartmon_3ware='' + var_sge_use_nfs='' - setsebool -P smartmon_3ware $var_smartmon_3ware + setsebool -P sge_use_nfs $var_sge_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -241767,6 +241893,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the smartmon_3ware SELinux Boolean + By default, the SELinux boolean smartmon_3ware is disabled. +If this setting is enabled, it should be disabled. + +To disable the smartmon_3ware SELinux boolean, run the following command: +$ sudo setsebool -P smartmon_3ware off + - name: Disable the smartmon_3ware SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241802,23 +241944,7 @@ fi - no_reboot_needed - sebool_smartmon_3ware - - - - - - - - - - Disable the smbd_anon_write SELinux Boolean - By default, the SELinux boolean smbd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the smbd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P smbd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241828,9 +241954,9 @@ fi if selinuxenabled; then - var_smbd_anon_write='' + var_smartmon_3ware='' - setsebool -P smbd_anon_write $var_smbd_anon_write + setsebool -P smartmon_3ware $var_smartmon_3ware else echo "Skipping remediation, SELinux is disabled"; @@ -241841,6 +241967,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the smbd_anon_write SELinux Boolean + By default, the SELinux boolean smbd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the smbd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P smbd_anon_write off + - name: Disable the smbd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241876,23 +242018,7 @@ fi - no_reboot_needed - sebool_smbd_anon_write - - - - - - - - - - Disable the spamassassin_can_network SELinux Boolean - By default, the SELinux boolean spamassassin_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the spamassassin_can_network SELinux boolean, run the following command: -$ sudo setsebool -P spamassassin_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241902,9 +242028,9 @@ fi if selinuxenabled; then - var_spamassassin_can_network='' + var_smbd_anon_write='' - setsebool -P spamassassin_can_network $var_spamassassin_can_network + setsebool -P smbd_anon_write $var_smbd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -241915,6 +242041,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the spamassassin_can_network SELinux Boolean + By default, the SELinux boolean spamassassin_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the spamassassin_can_network SELinux boolean, run the following command: +$ sudo setsebool -P spamassassin_can_network off + - name: Disable the spamassassin_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241951,23 +242093,7 @@ fi - no_reboot_needed - sebool_spamassassin_can_network - - - - - - - - - - Enable the spamd_enable_home_dirs SELinux Boolean - By default, the SELinux boolean spamd_enable_home_dirs is enabled. -If this setting is disabled, it should be enabled. - -To enable the spamd_enable_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P spamd_enable_home_dirs on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241977,9 +242103,9 @@ fi if selinuxenabled; then - var_spamd_enable_home_dirs='' + var_spamassassin_can_network='' - setsebool -P spamd_enable_home_dirs $var_spamd_enable_home_dirs + setsebool -P spamassassin_can_network $var_spamassassin_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -241990,6 +242116,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the spamd_enable_home_dirs SELinux Boolean + By default, the SELinux boolean spamd_enable_home_dirs is enabled. +If this setting is disabled, it should be enabled. + +To enable the spamd_enable_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P spamd_enable_home_dirs on + - name: Enable the spamd_enable_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242026,24 +242168,7 @@ fi - no_reboot_needed - sebool_spamd_enable_home_dirs - - - - - - - - - - Disable the squid_connect_any SELinux Boolean - By default, the SELinux boolean squid_connect_any is enabled. -This setting should be disabled as squid should only connect on specified -ports. - -To disable the squid_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P squid_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242053,9 +242178,9 @@ fi if selinuxenabled; then - var_squid_connect_any='' + var_spamd_enable_home_dirs='' - setsebool -P squid_connect_any $var_squid_connect_any + setsebool -P spamd_enable_home_dirs $var_spamd_enable_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -242066,6 +242191,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the squid_connect_any SELinux Boolean + By default, the SELinux boolean squid_connect_any is enabled. +This setting should be disabled as squid should only connect on specified +ports. + +To disable the squid_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P squid_connect_any off + - name: Disable the squid_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242102,23 +242244,7 @@ fi - no_reboot_needed - sebool_squid_connect_any - - - - - - - - - - Disable the squid_use_tproxy SELinux Boolean - By default, the SELinux boolean squid_use_tproxy is disabled. -If this setting is enabled, it should be disabled. - -To disable the squid_use_tproxy SELinux boolean, run the following command: -$ sudo setsebool -P squid_use_tproxy off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242128,9 +242254,9 @@ fi if selinuxenabled; then - var_squid_use_tproxy='' + var_squid_connect_any='' - setsebool -P squid_use_tproxy $var_squid_use_tproxy + setsebool -P squid_connect_any $var_squid_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -242141,6 +242267,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the squid_use_tproxy SELinux Boolean + By default, the SELinux boolean squid_use_tproxy is disabled. +If this setting is enabled, it should be disabled. + +To disable the squid_use_tproxy SELinux boolean, run the following command: +$ sudo setsebool -P squid_use_tproxy off + - name: Disable the squid_use_tproxy SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242177,23 +242319,7 @@ fi - no_reboot_needed - sebool_squid_use_tproxy - - - - - - - - - - Disable the ssh_chroot_rw_homedirs SELinux Boolean - By default, the SELinux boolean ssh_chroot_rw_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ssh_chroot_rw_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P ssh_chroot_rw_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242203,9 +242329,9 @@ fi if selinuxenabled; then - var_ssh_chroot_rw_homedirs='' + var_squid_use_tproxy='' - setsebool -P ssh_chroot_rw_homedirs $var_ssh_chroot_rw_homedirs + setsebool -P squid_use_tproxy $var_squid_use_tproxy else echo "Skipping remediation, SELinux is disabled"; @@ -242216,6 +242342,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ssh_chroot_rw_homedirs SELinux Boolean + By default, the SELinux boolean ssh_chroot_rw_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ssh_chroot_rw_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P ssh_chroot_rw_homedirs off + - name: Disable the ssh_chroot_rw_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242252,23 +242394,7 @@ fi - no_reboot_needed - sebool_ssh_chroot_rw_homedirs - - - - - - - - - - Disable the ssh_keysign SELinux Boolean - By default, the SELinux boolean ssh_keysign is disabled. -If this setting is enabled, it should be disabled. - -To disable the ssh_keysign SELinux boolean, run the following command: -$ sudo setsebool -P ssh_keysign off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242278,9 +242404,9 @@ fi if selinuxenabled; then - var_ssh_keysign='' + var_ssh_chroot_rw_homedirs='' - setsebool -P ssh_keysign $var_ssh_keysign + setsebool -P ssh_chroot_rw_homedirs $var_ssh_chroot_rw_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -242291,6 +242417,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ssh_keysign SELinux Boolean + By default, the SELinux boolean ssh_keysign is disabled. +If this setting is enabled, it should be disabled. + +To disable the ssh_keysign SELinux boolean, run the following command: +$ sudo setsebool -P ssh_keysign off + - name: Disable the ssh_keysign SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242325,6 +242467,29 @@ fi - medium_severity - no_reboot_needed - sebool_ssh_keysign + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_ssh_keysign='' + + setsebool -P ssh_keysign $var_ssh_keysign + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -242356,29 +242521,6 @@ authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users. CCE-83311-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_ssh_sysadm_login='' - - setsebool -P ssh_sysadm_login $var_ssh_sysadm_login - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the ssh_sysadm_login SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242417,23 +242559,7 @@ fi - no_reboot_needed - sebool_ssh_sysadm_login - - - - - - - - - - Enable the staff_exec_content SELinux Boolean - By default, the SELinux boolean staff_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the staff_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P staff_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242443,9 +242569,9 @@ fi if selinuxenabled; then - var_staff_exec_content='' + var_ssh_sysadm_login='' - setsebool -P staff_exec_content $var_staff_exec_content + setsebool -P ssh_sysadm_login $var_ssh_sysadm_login else echo "Skipping remediation, SELinux is disabled"; @@ -242456,6 +242582,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the staff_exec_content SELinux Boolean + By default, the SELinux boolean staff_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the staff_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P staff_exec_content on + - name: Enable the staff_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242492,23 +242634,7 @@ fi - no_reboot_needed - sebool_staff_exec_content - - - - - - - - - - Disable the staff_use_svirt SELinux Boolean - By default, the SELinux boolean staff_use_svirt is disabled. -If this setting is enabled, it should be disabled. - -To disable the staff_use_svirt SELinux boolean, run the following command: -$ sudo setsebool -P staff_use_svirt off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242518,9 +242644,9 @@ fi if selinuxenabled; then - var_staff_use_svirt='' + var_staff_exec_content='' - setsebool -P staff_use_svirt $var_staff_use_svirt + setsebool -P staff_exec_content $var_staff_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -242531,6 +242657,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the staff_use_svirt SELinux Boolean + By default, the SELinux boolean staff_use_svirt is disabled. +If this setting is enabled, it should be disabled. + +To disable the staff_use_svirt SELinux boolean, run the following command: +$ sudo setsebool -P staff_use_svirt off + - name: Disable the staff_use_svirt SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242566,23 +242708,7 @@ fi - no_reboot_needed - sebool_staff_use_svirt - - - - - - - - - - Disable the swift_can_network SELinux Boolean - By default, the SELinux boolean swift_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the swift_can_network SELinux boolean, run the following command: -$ sudo setsebool -P swift_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242592,9 +242718,9 @@ fi if selinuxenabled; then - var_swift_can_network='' + var_staff_use_svirt='' - setsebool -P swift_can_network $var_swift_can_network + setsebool -P staff_use_svirt $var_staff_use_svirt else echo "Skipping remediation, SELinux is disabled"; @@ -242605,6 +242731,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the swift_can_network SELinux Boolean + By default, the SELinux boolean swift_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the swift_can_network SELinux boolean, run the following command: +$ sudo setsebool -P swift_can_network off + - name: Disable the swift_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242641,23 +242783,7 @@ fi - no_reboot_needed - sebool_swift_can_network - - - - - - - - - - Enable the sysadm_exec_content SELinux Boolean - By default, the SELinux boolean sysadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the sysadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P sysadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242667,9 +242793,9 @@ fi if selinuxenabled; then - var_sysadm_exec_content='' + var_swift_can_network='' - setsebool -P sysadm_exec_content $var_sysadm_exec_content + setsebool -P swift_can_network $var_swift_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -242680,6 +242806,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the sysadm_exec_content SELinux Boolean + By default, the SELinux boolean sysadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the sysadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P sysadm_exec_content on + - name: Enable the sysadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242716,23 +242858,7 @@ fi - no_reboot_needed - sebool_sysadm_exec_content - - - - - - - - - - Disable the telepathy_connect_all_ports SELinux Boolean - By default, the SELinux boolean telepathy_connect_all_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the telepathy_connect_all_ports SELinux boolean, run the following command: -$ sudo setsebool -P telepathy_connect_all_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242742,9 +242868,9 @@ fi if selinuxenabled; then - var_telepathy_connect_all_ports='' + var_sysadm_exec_content='' - setsebool -P telepathy_connect_all_ports $var_telepathy_connect_all_ports + setsebool -P sysadm_exec_content $var_sysadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -242755,6 +242881,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the telepathy_connect_all_ports SELinux Boolean + By default, the SELinux boolean telepathy_connect_all_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the telepathy_connect_all_ports SELinux boolean, run the following command: +$ sudo setsebool -P telepathy_connect_all_ports off + - name: Disable the telepathy_connect_all_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242791,24 +242933,7 @@ fi - no_reboot_needed - sebool_telepathy_connect_all_ports - - - - - - - - - - Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - By default, the SELinux boolean telepathy_tcp_connect_generic_network_ports is enabled. -This setting should be disabled as telepathy should not connect to any generic network -ports. - -To disable the telepathy_tcp_connect_generic_network_ports SELinux boolean, run the following command: -$ sudo setsebool -P telepathy_tcp_connect_generic_network_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242818,9 +242943,9 @@ fi if selinuxenabled; then - var_telepathy_tcp_connect_generic_network_ports='' + var_telepathy_connect_all_ports='' - setsebool -P telepathy_tcp_connect_generic_network_ports $var_telepathy_tcp_connect_generic_network_ports + setsebool -P telepathy_connect_all_ports $var_telepathy_connect_all_ports else echo "Skipping remediation, SELinux is disabled"; @@ -242831,6 +242956,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean + By default, the SELinux boolean telepathy_tcp_connect_generic_network_ports is enabled. +This setting should be disabled as telepathy should not connect to any generic network +ports. + +To disable the telepathy_tcp_connect_generic_network_ports SELinux boolean, run the following command: +$ sudo setsebool -P telepathy_tcp_connect_generic_network_ports off + - name: Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242867,23 +243009,7 @@ fi - no_reboot_needed - sebool_telepathy_tcp_connect_generic_network_ports - - - - - - - - - - Disable the tftp_anon_write SELinux Boolean - By default, the SELinux boolean tftp_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the tftp_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P tftp_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242893,9 +243019,9 @@ fi if selinuxenabled; then - var_tftp_anon_write='' + var_telepathy_tcp_connect_generic_network_ports='' - setsebool -P tftp_anon_write $var_tftp_anon_write + setsebool -P telepathy_tcp_connect_generic_network_ports $var_telepathy_tcp_connect_generic_network_ports else echo "Skipping remediation, SELinux is disabled"; @@ -242906,6 +243032,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tftp_anon_write SELinux Boolean + By default, the SELinux boolean tftp_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the tftp_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P tftp_anon_write off + - name: Disable the tftp_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242941,23 +243083,7 @@ fi - no_reboot_needed - sebool_tftp_anon_write - - - - - - - - - - Disable the tftp_home_dir SELinux Boolean - By default, the SELinux boolean tftp_home_dir is disabled. -If this setting is enabled, it should be disabled. - -To disable the tftp_home_dir SELinux boolean, run the following command: -$ sudo setsebool -P tftp_home_dir off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242967,9 +243093,9 @@ fi if selinuxenabled; then - var_tftp_home_dir='' + var_tftp_anon_write='' - setsebool -P tftp_home_dir $var_tftp_home_dir + setsebool -P tftp_anon_write $var_tftp_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -242980,18 +243106,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the tftp_home_dir SELinux Boolean - Ensure python3-libsemanage Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - sebool_tftp_home_dir + + + + + + + + + + Disable the tftp_home_dir SELinux Boolean + By default, the SELinux boolean tftp_home_dir is disabled. +If this setting is enabled, it should be disabled. + +To disable the tftp_home_dir SELinux boolean, run the following command: +$ sudo setsebool -P tftp_home_dir off + + - name: Disable the tftp_home_dir SELinux Boolean - Ensure python3-libsemanage Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - sebool_tftp_home_dir - name: XCCDF Value var_tftp_home_dir # promote to variable set_fact: var_tftp_home_dir: !!str @@ -243015,23 +243157,7 @@ fi - no_reboot_needed - sebool_tftp_home_dir - - - - - - - - - - Disable the tmpreaper_use_nfs SELinux Boolean - By default, the SELinux boolean tmpreaper_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the tmpreaper_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P tmpreaper_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243041,9 +243167,9 @@ fi if selinuxenabled; then - var_tmpreaper_use_nfs='' + var_tftp_home_dir='' - setsebool -P tmpreaper_use_nfs $var_tmpreaper_use_nfs + setsebool -P tftp_home_dir $var_tftp_home_dir else echo "Skipping remediation, SELinux is disabled"; @@ -243054,6 +243180,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tmpreaper_use_nfs SELinux Boolean + By default, the SELinux boolean tmpreaper_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the tmpreaper_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P tmpreaper_use_nfs off + - name: Disable the tmpreaper_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243090,23 +243232,7 @@ fi - no_reboot_needed - sebool_tmpreaper_use_nfs - - - - - - - - - - Disable the tmpreaper_use_samba SELinux Boolean - By default, the SELinux boolean tmpreaper_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the tmpreaper_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P tmpreaper_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243116,9 +243242,9 @@ fi if selinuxenabled; then - var_tmpreaper_use_samba='' + var_tmpreaper_use_nfs='' - setsebool -P tmpreaper_use_samba $var_tmpreaper_use_samba + setsebool -P tmpreaper_use_nfs $var_tmpreaper_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -243129,6 +243255,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tmpreaper_use_samba SELinux Boolean + By default, the SELinux boolean tmpreaper_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the tmpreaper_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P tmpreaper_use_samba off + - name: Disable the tmpreaper_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243165,23 +243307,7 @@ fi - no_reboot_needed - sebool_tmpreaper_use_samba - - - - - - - - - - Disable the tor_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean tor_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the tor_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P tor_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243191,9 +243317,9 @@ fi if selinuxenabled; then - var_tor_bind_all_unreserved_ports='' + var_tmpreaper_use_samba='' - setsebool -P tor_bind_all_unreserved_ports $var_tor_bind_all_unreserved_ports + setsebool -P tmpreaper_use_samba $var_tmpreaper_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -243204,6 +243330,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tor_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean tor_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the tor_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P tor_bind_all_unreserved_ports off + - name: Disable the tor_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243240,23 +243382,7 @@ fi - no_reboot_needed - sebool_tor_bind_all_unreserved_ports - - - - - - - - - - Disable the tor_can_network_relay SELinux Boolean - By default, the SELinux boolean tor_can_network_relay is disabled. -If this setting is enabled, it should be disabled. - -To disable the tor_can_network_relay SELinux boolean, run the following command: -$ sudo setsebool -P tor_can_network_relay off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243266,9 +243392,9 @@ fi if selinuxenabled; then - var_tor_can_network_relay='' + var_tor_bind_all_unreserved_ports='' - setsebool -P tor_can_network_relay $var_tor_can_network_relay + setsebool -P tor_bind_all_unreserved_ports $var_tor_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -243279,6 +243405,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tor_can_network_relay SELinux Boolean + By default, the SELinux boolean tor_can_network_relay is disabled. +If this setting is enabled, it should be disabled. + +To disable the tor_can_network_relay SELinux boolean, run the following command: +$ sudo setsebool -P tor_can_network_relay off + - name: Disable the tor_can_network_relay SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243315,23 +243457,7 @@ fi - no_reboot_needed - sebool_tor_can_network_relay - - - - - - - - - - Enable the unconfined_chrome_sandbox_transition SELinux Boolean - By default, the SELinux boolean unconfined_chrome_sandbox_transition is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_chrome_sandbox_transition SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_chrome_sandbox_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243341,9 +243467,9 @@ fi if selinuxenabled; then - var_unconfined_chrome_sandbox_transition='' + var_tor_can_network_relay='' - setsebool -P unconfined_chrome_sandbox_transition $var_unconfined_chrome_sandbox_transition + setsebool -P tor_can_network_relay $var_tor_can_network_relay else echo "Skipping remediation, SELinux is disabled"; @@ -243354,6 +243480,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_chrome_sandbox_transition SELinux Boolean + By default, the SELinux boolean unconfined_chrome_sandbox_transition is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_chrome_sandbox_transition SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_chrome_sandbox_transition on + - name: Enable the unconfined_chrome_sandbox_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243390,23 +243532,7 @@ fi - no_reboot_needed - sebool_unconfined_chrome_sandbox_transition - - - - - - - - - - Enable the unconfined_login SELinux Boolean - By default, the SELinux boolean unconfined_login is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_login SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_login on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243416,9 +243542,9 @@ fi if selinuxenabled; then - var_unconfined_login='' + var_unconfined_chrome_sandbox_transition='' - setsebool -P unconfined_login $var_unconfined_login + setsebool -P unconfined_chrome_sandbox_transition $var_unconfined_chrome_sandbox_transition else echo "Skipping remediation, SELinux is disabled"; @@ -243429,6 +243555,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_login SELinux Boolean + By default, the SELinux boolean unconfined_login is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_login SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_login on + - name: Enable the unconfined_login SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -243464,23 +243606,7 @@ fi - no_reboot_needed - sebool_unconfined_login - - - - - - - - - - Enable the unconfined_mozilla_plugin_transition SELinux Boolean - By default, the SELinux boolean unconfined_mozilla_plugin_transition is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_mozilla_plugin_transition SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_mozilla_plugin_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243490,9 +243616,9 @@ fi if selinuxenabled; then - var_unconfined_mozilla_plugin_transition='' + var_unconfined_login='' - setsebool -P unconfined_mozilla_plugin_transition $var_unconfined_mozilla_plugin_transition + setsebool -P unconfined_login $var_unconfined_login else echo "Skipping remediation, SELinux is disabled"; @@ -243503,6 +243629,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_mozilla_plugin_transition SELinux Boolean + By default, the SELinux boolean unconfined_mozilla_plugin_transition is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_mozilla_plugin_transition SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_mozilla_plugin_transition on + - name: Enable the unconfined_mozilla_plugin_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243539,23 +243681,7 @@ fi - no_reboot_needed - sebool_unconfined_mozilla_plugin_transition - - - - - - - - - - Disable the unprivuser_use_svirt SELinux Boolean - By default, the SELinux boolean unprivuser_use_svirt is disabled. -If this setting is enabled, it should be disabled. - -To disable the unprivuser_use_svirt SELinux boolean, run the following command: -$ sudo setsebool -P unprivuser_use_svirt off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243565,9 +243691,9 @@ fi if selinuxenabled; then - var_unprivuser_use_svirt='' + var_unconfined_mozilla_plugin_transition='' - setsebool -P unprivuser_use_svirt $var_unprivuser_use_svirt + setsebool -P unconfined_mozilla_plugin_transition $var_unconfined_mozilla_plugin_transition else echo "Skipping remediation, SELinux is disabled"; @@ -243578,6 +243704,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the unprivuser_use_svirt SELinux Boolean + By default, the SELinux boolean unprivuser_use_svirt is disabled. +If this setting is enabled, it should be disabled. + +To disable the unprivuser_use_svirt SELinux boolean, run the following command: +$ sudo setsebool -P unprivuser_use_svirt off + - name: Disable the unprivuser_use_svirt SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243614,23 +243756,7 @@ fi - no_reboot_needed - sebool_unprivuser_use_svirt - - - - - - - - - - Disable the use_ecryptfs_home_dirs SELinux Boolean - By default, the SELinux boolean use_ecryptfs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_ecryptfs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_ecryptfs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243640,9 +243766,9 @@ fi if selinuxenabled; then - var_use_ecryptfs_home_dirs='' + var_unprivuser_use_svirt='' - setsebool -P use_ecryptfs_home_dirs $var_use_ecryptfs_home_dirs + setsebool -P unprivuser_use_svirt $var_unprivuser_use_svirt else echo "Skipping remediation, SELinux is disabled"; @@ -243653,6 +243779,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_ecryptfs_home_dirs SELinux Boolean + By default, the SELinux boolean use_ecryptfs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_ecryptfs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_ecryptfs_home_dirs off + - name: Disable the use_ecryptfs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243689,23 +243831,7 @@ fi - no_reboot_needed - sebool_use_ecryptfs_home_dirs - - - - - - - - - - Disable the use_fusefs_home_dirs SELinux Boolean - By default, the SELinux boolean use_fusefs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_fusefs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_fusefs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243715,9 +243841,9 @@ fi if selinuxenabled; then - var_use_fusefs_home_dirs='' + var_use_ecryptfs_home_dirs='' - setsebool -P use_fusefs_home_dirs $var_use_fusefs_home_dirs + setsebool -P use_ecryptfs_home_dirs $var_use_ecryptfs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243728,6 +243854,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_fusefs_home_dirs SELinux Boolean + By default, the SELinux boolean use_fusefs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_fusefs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_fusefs_home_dirs off + - name: Disable the use_fusefs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243764,23 +243906,7 @@ fi - no_reboot_needed - sebool_use_fusefs_home_dirs - - - - - - - - - - Disable the use_lpd_server SELinux Boolean - By default, the SELinux boolean use_lpd_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_lpd_server SELinux boolean, run the following command: -$ sudo setsebool -P use_lpd_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243790,9 +243916,9 @@ fi if selinuxenabled; then - var_use_lpd_server='' + var_use_fusefs_home_dirs='' - setsebool -P use_lpd_server $var_use_lpd_server + setsebool -P use_fusefs_home_dirs $var_use_fusefs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243803,6 +243929,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_lpd_server SELinux Boolean + By default, the SELinux boolean use_lpd_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_lpd_server SELinux boolean, run the following command: +$ sudo setsebool -P use_lpd_server off + - name: Disable the use_lpd_server SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -243838,23 +243980,7 @@ fi - no_reboot_needed - sebool_use_lpd_server - - - - - - - - - - Disable the use_nfs_home_dirs SELinux Boolean - By default, the SELinux boolean use_nfs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_nfs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_nfs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243864,9 +243990,9 @@ fi if selinuxenabled; then - var_use_nfs_home_dirs='' + var_use_lpd_server='' - setsebool -P use_nfs_home_dirs $var_use_nfs_home_dirs + setsebool -P use_lpd_server $var_use_lpd_server else echo "Skipping remediation, SELinux is disabled"; @@ -243877,6 +244003,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_nfs_home_dirs SELinux Boolean + By default, the SELinux boolean use_nfs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_nfs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_nfs_home_dirs off + - name: Disable the use_nfs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243913,23 +244055,7 @@ fi - no_reboot_needed - sebool_use_nfs_home_dirs - - - - - - - - - - Disable the use_samba_home_dirs SELinux Boolean - By default, the SELinux boolean use_samba_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_samba_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_samba_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243939,9 +244065,9 @@ fi if selinuxenabled; then - var_use_samba_home_dirs='' + var_use_nfs_home_dirs='' - setsebool -P use_samba_home_dirs $var_use_samba_home_dirs + setsebool -P use_nfs_home_dirs $var_use_nfs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243952,6 +244078,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_samba_home_dirs SELinux Boolean + By default, the SELinux boolean use_samba_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_samba_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_samba_home_dirs off + - name: Disable the use_samba_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243988,23 +244130,7 @@ fi - no_reboot_needed - sebool_use_samba_home_dirs - - - - - - - - - - Enable the user_exec_content SELinux Boolean - By default, the SELinux boolean user_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the user_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P user_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244014,9 +244140,9 @@ fi if selinuxenabled; then - var_user_exec_content='' + var_use_samba_home_dirs='' - setsebool -P user_exec_content $var_user_exec_content + setsebool -P use_samba_home_dirs $var_use_samba_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -244027,6 +244153,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the user_exec_content SELinux Boolean + By default, the SELinux boolean user_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the user_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P user_exec_content on + - name: Enable the user_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244063,23 +244205,7 @@ fi - no_reboot_needed - sebool_user_exec_content - - - - - - - - - - Disable the varnishd_connect_any SELinux Boolean - By default, the SELinux boolean varnishd_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the varnishd_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P varnishd_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244089,9 +244215,9 @@ fi if selinuxenabled; then - var_varnishd_connect_any='' + var_user_exec_content='' - setsebool -P varnishd_connect_any $var_varnishd_connect_any + setsebool -P user_exec_content $var_user_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -244102,6 +244228,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the varnishd_connect_any SELinux Boolean + By default, the SELinux boolean varnishd_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the varnishd_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P varnishd_connect_any off + - name: Disable the varnishd_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244138,23 +244280,7 @@ fi - no_reboot_needed - sebool_varnishd_connect_any - - - - - - - - - - Disable the virt_read_qemu_ga_data SELinux Boolean - By default, the SELinux boolean virt_read_qemu_ga_data is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_read_qemu_ga_data SELinux boolean, run the following command: -$ sudo setsebool -P virt_read_qemu_ga_data off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244164,9 +244290,9 @@ fi if selinuxenabled; then - var_virt_read_qemu_ga_data='' + var_varnishd_connect_any='' - setsebool -P virt_read_qemu_ga_data $var_virt_read_qemu_ga_data + setsebool -P varnishd_connect_any $var_varnishd_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -244177,6 +244303,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_read_qemu_ga_data SELinux Boolean + By default, the SELinux boolean virt_read_qemu_ga_data is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_read_qemu_ga_data SELinux boolean, run the following command: +$ sudo setsebool -P virt_read_qemu_ga_data off + - name: Disable the virt_read_qemu_ga_data SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244213,23 +244355,7 @@ fi - no_reboot_needed - sebool_virt_read_qemu_ga_data - - - - - - - - - - Disable the virt_rw_qemu_ga_data SELinux Boolean - By default, the SELinux boolean virt_rw_qemu_ga_data is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_rw_qemu_ga_data SELinux boolean, run the following command: -$ sudo setsebool -P virt_rw_qemu_ga_data off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244239,9 +244365,9 @@ fi if selinuxenabled; then - var_virt_rw_qemu_ga_data='' + var_virt_read_qemu_ga_data='' - setsebool -P virt_rw_qemu_ga_data $var_virt_rw_qemu_ga_data + setsebool -P virt_read_qemu_ga_data $var_virt_read_qemu_ga_data else echo "Skipping remediation, SELinux is disabled"; @@ -244252,6 +244378,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_rw_qemu_ga_data SELinux Boolean + By default, the SELinux boolean virt_rw_qemu_ga_data is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_rw_qemu_ga_data SELinux boolean, run the following command: +$ sudo setsebool -P virt_rw_qemu_ga_data off + - name: Disable the virt_rw_qemu_ga_data SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244288,23 +244430,7 @@ fi - no_reboot_needed - sebool_virt_rw_qemu_ga_data - - - - - - - - - - Disable the virt_sandbox_use_all_caps SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_all_caps is enabled. -This setting is disabled as containers should not run with privileges. - -To disable the virt_sandbox_use_all_caps SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_all_caps off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244314,9 +244440,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_all_caps='' + var_virt_rw_qemu_ga_data='' - setsebool -P virt_sandbox_use_all_caps $var_virt_sandbox_use_all_caps + setsebool -P virt_rw_qemu_ga_data $var_virt_rw_qemu_ga_data else echo "Skipping remediation, SELinux is disabled"; @@ -244327,6 +244453,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_all_caps SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_all_caps is enabled. +This setting is disabled as containers should not run with privileges. + +To disable the virt_sandbox_use_all_caps SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_all_caps off + - name: Disable the virt_sandbox_use_all_caps SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244363,24 +244505,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_all_caps - - - - - - - - - - Enable the virt_sandbox_use_audit SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_audit is enabled. -If this setting is disabled, it should be enabled to allow sandboxed containers -to send audit messages. - -To enable the virt_sandbox_use_audit SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_audit on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244390,9 +244515,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_audit='' + var_virt_sandbox_use_all_caps='' - setsebool -P virt_sandbox_use_audit $var_virt_sandbox_use_audit + setsebool -P virt_sandbox_use_all_caps $var_virt_sandbox_use_all_caps else echo "Skipping remediation, SELinux is disabled"; @@ -244403,6 +244528,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the virt_sandbox_use_audit SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_audit is enabled. +If this setting is disabled, it should be enabled to allow sandboxed containers +to send audit messages. + +To enable the virt_sandbox_use_audit SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_audit on + - name: Enable the virt_sandbox_use_audit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244439,23 +244581,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_audit - - - - - - - - - - Disable the virt_sandbox_use_mknod SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_mknod is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_mknod SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_mknod off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244465,9 +244591,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_mknod='' + var_virt_sandbox_use_audit='' - setsebool -P virt_sandbox_use_mknod $var_virt_sandbox_use_mknod + setsebool -P virt_sandbox_use_audit $var_virt_sandbox_use_audit else echo "Skipping remediation, SELinux is disabled"; @@ -244478,6 +244604,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_mknod SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_mknod is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_mknod SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_mknod off + - name: Disable the virt_sandbox_use_mknod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244514,23 +244656,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_mknod - - - - - - - - - - Disable the virt_sandbox_use_netlink SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_netlink is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_netlink SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_netlink off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244540,9 +244666,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_netlink='' + var_virt_sandbox_use_mknod='' - setsebool -P virt_sandbox_use_netlink $var_virt_sandbox_use_netlink + setsebool -P virt_sandbox_use_mknod $var_virt_sandbox_use_mknod else echo "Skipping remediation, SELinux is disabled"; @@ -244553,6 +244679,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_netlink SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_netlink is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_netlink SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_netlink off + - name: Disable the virt_sandbox_use_netlink SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244589,23 +244731,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_netlink - - - - - - - - - - Disable the virt_sandbox_use_sys_admin SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_sys_admin is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_sys_admin SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_sys_admin off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244615,9 +244741,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_sys_admin='' + var_virt_sandbox_use_netlink='' - setsebool -P virt_sandbox_use_sys_admin $var_virt_sandbox_use_sys_admin + setsebool -P virt_sandbox_use_netlink $var_virt_sandbox_use_netlink else echo "Skipping remediation, SELinux is disabled"; @@ -244628,6 +244754,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_sys_admin SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_sys_admin is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_sys_admin SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_sys_admin off + - name: Disable the virt_sandbox_use_sys_admin SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244664,23 +244806,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_sys_admin - - - - - - - - - - Disable the virt_transition_userdomain SELinux Boolean - By default, the SELinux boolean virt_transition_userdomain is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_transition_userdomain SELinux boolean, run the following command: -$ sudo setsebool -P virt_transition_userdomain off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244690,9 +244816,9 @@ fi if selinuxenabled; then - var_virt_transition_userdomain='' + var_virt_sandbox_use_sys_admin='' - setsebool -P virt_transition_userdomain $var_virt_transition_userdomain + setsebool -P virt_sandbox_use_sys_admin $var_virt_sandbox_use_sys_admin else echo "Skipping remediation, SELinux is disabled"; @@ -244703,6 +244829,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_transition_userdomain SELinux Boolean + By default, the SELinux boolean virt_transition_userdomain is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_transition_userdomain SELinux boolean, run the following command: +$ sudo setsebool -P virt_transition_userdomain off + - name: Disable the virt_transition_userdomain SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244739,23 +244881,7 @@ fi - no_reboot_needed - sebool_virt_transition_userdomain - - - - - - - - - - Disable the virt_use_comm SELinux Boolean - By default, the SELinux boolean virt_use_comm is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_comm SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_comm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244765,9 +244891,9 @@ fi if selinuxenabled; then - var_virt_use_comm='' + var_virt_transition_userdomain='' - setsebool -P virt_use_comm $var_virt_use_comm + setsebool -P virt_transition_userdomain $var_virt_transition_userdomain else echo "Skipping remediation, SELinux is disabled"; @@ -244778,6 +244904,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_comm SELinux Boolean + By default, the SELinux boolean virt_use_comm is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_comm SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_comm off + - name: Disable the virt_use_comm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -244813,25 +244955,7 @@ fi - no_reboot_needed - sebool_virt_use_comm - - - - - - - - - - Disable the virt_use_execmem SELinux Boolean - By default, the SELinux boolean virt_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_execmem off - BP28(R67) - - CCE-83312-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244841,9 +244965,9 @@ fi if selinuxenabled; then - var_virt_use_execmem='' + var_virt_use_comm='' - setsebool -P virt_use_execmem $var_virt_use_execmem + setsebool -P virt_use_comm $var_virt_use_comm else echo "Skipping remediation, SELinux is disabled"; @@ -244854,6 +244978,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_execmem SELinux Boolean + By default, the SELinux boolean virt_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_execmem off + BP28(R67) + + CCE-83312-9 - name: Disable the virt_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244892,23 +245034,7 @@ fi - no_reboot_needed - sebool_virt_use_execmem - - - - - - - - - - Disable the virt_use_fusefs SELinux Boolean - By default, the SELinux boolean virt_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244918,9 +245044,9 @@ fi if selinuxenabled; then - var_virt_use_fusefs='' + var_virt_use_execmem='' - setsebool -P virt_use_fusefs $var_virt_use_fusefs + setsebool -P virt_use_execmem $var_virt_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -244931,6 +245057,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_fusefs SELinux Boolean + By default, the SELinux boolean virt_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_fusefs off + - name: Disable the virt_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -244966,23 +245108,7 @@ fi - no_reboot_needed - sebool_virt_use_fusefs - - - - - - - - - - Disable the virt_use_nfs SELinux Boolean - By default, the SELinux boolean virt_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244992,9 +245118,9 @@ fi if selinuxenabled; then - var_virt_use_nfs='' + var_virt_use_fusefs='' - setsebool -P virt_use_nfs $var_virt_use_nfs + setsebool -P virt_use_fusefs $var_virt_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -245005,6 +245131,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_nfs SELinux Boolean + By default, the SELinux boolean virt_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_nfs off + - name: Disable the virt_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245040,23 +245182,7 @@ fi - no_reboot_needed - sebool_virt_use_nfs - - - - - - - - - - Disable the virt_use_rawip SELinux Boolean - By default, the SELinux boolean virt_use_rawip is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_rawip SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_rawip off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245066,9 +245192,9 @@ fi if selinuxenabled; then - var_virt_use_rawip='' + var_virt_use_nfs='' - setsebool -P virt_use_rawip $var_virt_use_rawip + setsebool -P virt_use_nfs $var_virt_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -245079,6 +245205,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_rawip SELinux Boolean + By default, the SELinux boolean virt_use_rawip is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_rawip SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_rawip off + - name: Disable the virt_use_rawip SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245114,23 +245256,7 @@ fi - no_reboot_needed - sebool_virt_use_rawip - - - - - - - - - - Disable the virt_use_samba SELinux Boolean - By default, the SELinux boolean virt_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245140,9 +245266,9 @@ fi if selinuxenabled; then - var_virt_use_samba='' + var_virt_use_rawip='' - setsebool -P virt_use_samba $var_virt_use_samba + setsebool -P virt_use_rawip $var_virt_use_rawip else echo "Skipping remediation, SELinux is disabled"; @@ -245153,6 +245279,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_samba SELinux Boolean + By default, the SELinux boolean virt_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_samba off + - name: Disable the virt_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245188,23 +245330,7 @@ fi - no_reboot_needed - sebool_virt_use_samba - - - - - - - - - - Disable the virt_use_sanlock SELinux Boolean - By default, the SELinux boolean virt_use_sanlock is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_sanlock SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_sanlock off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245214,9 +245340,9 @@ fi if selinuxenabled; then - var_virt_use_sanlock='' + var_virt_use_samba='' - setsebool -P virt_use_sanlock $var_virt_use_sanlock + setsebool -P virt_use_samba $var_virt_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -245227,6 +245353,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_sanlock SELinux Boolean + By default, the SELinux boolean virt_use_sanlock is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_sanlock SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_sanlock off + - name: Disable the virt_use_sanlock SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245263,23 +245405,7 @@ fi - no_reboot_needed - sebool_virt_use_sanlock - - - - - - - - - - Disable the virt_use_usb SELinux Boolean - By default, the SELinux boolean virt_use_usb is enabled. -This setting should be disabled. - -To disable the virt_use_usb SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_usb off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245289,9 +245415,9 @@ fi if selinuxenabled; then - var_virt_use_usb='' + var_virt_use_sanlock='' - setsebool -P virt_use_usb $var_virt_use_usb + setsebool -P virt_use_sanlock $var_virt_use_sanlock else echo "Skipping remediation, SELinux is disabled"; @@ -245302,6 +245428,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_usb SELinux Boolean + By default, the SELinux boolean virt_use_usb is enabled. +This setting should be disabled. + +To disable the virt_use_usb SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_usb off + - name: Disable the virt_use_usb SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245337,23 +245479,7 @@ fi - no_reboot_needed - sebool_virt_use_usb - - - - - - - - - - Disable the virt_use_xserver SELinux Boolean - By default, the SELinux boolean virt_use_xserver is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_xserver SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_xserver off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245363,9 +245489,9 @@ fi if selinuxenabled; then - var_virt_use_xserver='' + var_virt_use_usb='' - setsebool -P virt_use_xserver $var_virt_use_xserver + setsebool -P virt_use_usb $var_virt_use_usb else echo "Skipping remediation, SELinux is disabled"; @@ -245376,6 +245502,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_xserver SELinux Boolean + By default, the SELinux boolean virt_use_xserver is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_xserver SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_xserver off + - name: Disable the virt_use_xserver SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245412,23 +245554,7 @@ fi - no_reboot_needed - sebool_virt_use_xserver - - - - - - - - - - Disable the webadm_manage_user_files SELinux Boolean - By default, the SELinux boolean webadm_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the webadm_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P webadm_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245438,9 +245564,9 @@ fi if selinuxenabled; then - var_webadm_manage_user_files='' + var_virt_use_xserver='' - setsebool -P webadm_manage_user_files $var_webadm_manage_user_files + setsebool -P virt_use_xserver $var_virt_use_xserver else echo "Skipping remediation, SELinux is disabled"; @@ -245451,6 +245577,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the webadm_manage_user_files SELinux Boolean + By default, the SELinux boolean webadm_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the webadm_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P webadm_manage_user_files off + - name: Disable the webadm_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245487,23 +245629,7 @@ fi - no_reboot_needed - sebool_webadm_manage_user_files - - - - - - - - - - Disable the webadm_read_user_files SELinux Boolean - By default, the SELinux boolean webadm_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the webadm_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P webadm_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245513,9 +245639,9 @@ fi if selinuxenabled; then - var_webadm_read_user_files='' + var_webadm_manage_user_files='' - setsebool -P webadm_read_user_files $var_webadm_read_user_files + setsebool -P webadm_manage_user_files $var_webadm_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -245526,6 +245652,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the webadm_read_user_files SELinux Boolean + By default, the SELinux boolean webadm_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the webadm_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P webadm_read_user_files off + - name: Disable the webadm_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245562,23 +245704,7 @@ fi - no_reboot_needed - sebool_webadm_read_user_files - - - - - - - - - - Disable the wine_mmap_zero_ignore SELinux Boolean - By default, the SELinux boolean wine_mmap_zero_ignore is disabled. -If this setting is enabled, it should be disabled. - -To disable the wine_mmap_zero_ignore SELinux boolean, run the following command: -$ sudo setsebool -P wine_mmap_zero_ignore off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245588,9 +245714,9 @@ fi if selinuxenabled; then - var_wine_mmap_zero_ignore='' + var_webadm_read_user_files='' - setsebool -P wine_mmap_zero_ignore $var_wine_mmap_zero_ignore + setsebool -P webadm_read_user_files $var_webadm_read_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -245601,6 +245727,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the wine_mmap_zero_ignore SELinux Boolean + By default, the SELinux boolean wine_mmap_zero_ignore is disabled. +If this setting is enabled, it should be disabled. + +To disable the wine_mmap_zero_ignore SELinux boolean, run the following command: +$ sudo setsebool -P wine_mmap_zero_ignore off + - name: Disable the wine_mmap_zero_ignore SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245637,23 +245779,7 @@ fi - no_reboot_needed - sebool_wine_mmap_zero_ignore - - - - - - - - - - Disable the xdm_bind_vnc_tcp_port SELinux Boolean - By default, the SELinux boolean xdm_bind_vnc_tcp_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_bind_vnc_tcp_port SELinux boolean, run the following command: -$ sudo setsebool -P xdm_bind_vnc_tcp_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245663,9 +245789,9 @@ fi if selinuxenabled; then - var_xdm_bind_vnc_tcp_port='' + var_wine_mmap_zero_ignore='' - setsebool -P xdm_bind_vnc_tcp_port $var_xdm_bind_vnc_tcp_port + setsebool -P wine_mmap_zero_ignore $var_wine_mmap_zero_ignore else echo "Skipping remediation, SELinux is disabled"; @@ -245676,6 +245802,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_bind_vnc_tcp_port SELinux Boolean + By default, the SELinux boolean xdm_bind_vnc_tcp_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_bind_vnc_tcp_port SELinux boolean, run the following command: +$ sudo setsebool -P xdm_bind_vnc_tcp_port off + - name: Disable the xdm_bind_vnc_tcp_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245712,23 +245854,7 @@ fi - no_reboot_needed - sebool_xdm_bind_vnc_tcp_port - - - - - - - - - - Disable the xdm_exec_bootloader SELinux Boolean - By default, the SELinux boolean xdm_exec_bootloader is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_exec_bootloader SELinux boolean, run the following command: -$ sudo setsebool -P xdm_exec_bootloader off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245738,9 +245864,9 @@ fi if selinuxenabled; then - var_xdm_exec_bootloader='' + var_xdm_bind_vnc_tcp_port='' - setsebool -P xdm_exec_bootloader $var_xdm_exec_bootloader + setsebool -P xdm_bind_vnc_tcp_port $var_xdm_bind_vnc_tcp_port else echo "Skipping remediation, SELinux is disabled"; @@ -245751,6 +245877,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_exec_bootloader SELinux Boolean + By default, the SELinux boolean xdm_exec_bootloader is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_exec_bootloader SELinux boolean, run the following command: +$ sudo setsebool -P xdm_exec_bootloader off + - name: Disable the xdm_exec_bootloader SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245787,23 +245929,7 @@ fi - no_reboot_needed - sebool_xdm_exec_bootloader - - - - - - - - - - Disable the xdm_sysadm_login SELinux Boolean - By default, the SELinux boolean xdm_sysadm_login is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_sysadm_login SELinux boolean, run the following command: -$ sudo setsebool -P xdm_sysadm_login off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245813,9 +245939,9 @@ fi if selinuxenabled; then - var_xdm_sysadm_login='' + var_xdm_exec_bootloader='' - setsebool -P xdm_sysadm_login $var_xdm_sysadm_login + setsebool -P xdm_exec_bootloader $var_xdm_exec_bootloader else echo "Skipping remediation, SELinux is disabled"; @@ -245826,6 +245952,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_sysadm_login SELinux Boolean + By default, the SELinux boolean xdm_sysadm_login is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_sysadm_login SELinux boolean, run the following command: +$ sudo setsebool -P xdm_sysadm_login off + - name: Disable the xdm_sysadm_login SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245862,23 +246004,7 @@ fi - no_reboot_needed - sebool_xdm_sysadm_login - - - - - - - - - - Disable the xdm_write_home SELinux Boolean - By default, the SELinux boolean xdm_write_home is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_write_home SELinux boolean, run the following command: -$ sudo setsebool -P xdm_write_home off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245888,9 +246014,9 @@ fi if selinuxenabled; then - var_xdm_write_home='' + var_xdm_sysadm_login='' - setsebool -P xdm_write_home $var_xdm_write_home + setsebool -P xdm_sysadm_login $var_xdm_sysadm_login else echo "Skipping remediation, SELinux is disabled"; @@ -245901,6 +246027,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_write_home SELinux Boolean + By default, the SELinux boolean xdm_write_home is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_write_home SELinux boolean, run the following command: +$ sudo setsebool -P xdm_write_home off + - name: Disable the xdm_write_home SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245936,23 +246078,7 @@ fi - no_reboot_needed - sebool_xdm_write_home - - - - - - - - - - Disable the xen_use_nfs SELinux Boolean - By default, the SELinux boolean xen_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the xen_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P xen_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245962,9 +246088,9 @@ fi if selinuxenabled; then - var_xen_use_nfs='' + var_xdm_write_home='' - setsebool -P xen_use_nfs $var_xen_use_nfs + setsebool -P xdm_write_home $var_xdm_write_home else echo "Skipping remediation, SELinux is disabled"; @@ -245975,6 +246101,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xen_use_nfs SELinux Boolean + By default, the SELinux boolean xen_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the xen_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P xen_use_nfs off + - name: Disable the xen_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246010,23 +246152,7 @@ fi - no_reboot_needed - sebool_xen_use_nfs - - - - - - - - - - Enable the xend_run_blktap SELinux Boolean - By default, the SELinux boolean xend_run_blktap is enabled. -If this setting is disabled, it should be enabled. - -To enable the xend_run_blktap SELinux boolean, run the following command: -$ sudo setsebool -P xend_run_blktap on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246036,9 +246162,9 @@ fi if selinuxenabled; then - var_xend_run_blktap='' + var_xen_use_nfs='' - setsebool -P xend_run_blktap $var_xend_run_blktap + setsebool -P xen_use_nfs $var_xen_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -246049,6 +246175,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the xend_run_blktap SELinux Boolean + By default, the SELinux boolean xend_run_blktap is enabled. +If this setting is disabled, it should be enabled. + +To enable the xend_run_blktap SELinux boolean, run the following command: +$ sudo setsebool -P xend_run_blktap on + - name: Enable the xend_run_blktap SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246084,23 +246226,7 @@ fi - no_reboot_needed - sebool_xend_run_blktap - - - - - - - - - - Enable the xend_run_qemu SELinux Boolean - By default, the SELinux boolean xend_run_qemu is enabled. -If this setting is disabled, it should be enabled. - -To enable the xend_run_qemu SELinux boolean, run the following command: -$ sudo setsebool -P xend_run_qemu on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246110,9 +246236,9 @@ fi if selinuxenabled; then - var_xend_run_qemu='' + var_xend_run_blktap='' - setsebool -P xend_run_qemu $var_xend_run_qemu + setsebool -P xend_run_blktap $var_xend_run_blktap else echo "Skipping remediation, SELinux is disabled"; @@ -246123,6 +246249,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the xend_run_qemu SELinux Boolean + By default, the SELinux boolean xend_run_qemu is enabled. +If this setting is disabled, it should be enabled. + +To enable the xend_run_qemu SELinux boolean, run the following command: +$ sudo setsebool -P xend_run_qemu on + - name: Enable the xend_run_qemu SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246158,24 +246300,7 @@ fi - no_reboot_needed - sebool_xend_run_qemu - - - - - - - - - - Disable the xguest_connect_network SELinux Boolean - By default, the SELinux boolean xguest_connect_network is enabled. -This setting should be disabled as guest users should not be able to configure -NetworkManager. - -To disable the xguest_connect_network SELinux boolean, run the following command: -$ sudo setsebool -P xguest_connect_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246185,9 +246310,9 @@ fi if selinuxenabled; then - var_xguest_connect_network='' + var_xend_run_qemu='' - setsebool -P xguest_connect_network $var_xguest_connect_network + setsebool -P xend_run_qemu $var_xend_run_qemu else echo "Skipping remediation, SELinux is disabled"; @@ -246198,6 +246323,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_connect_network SELinux Boolean + By default, the SELinux boolean xguest_connect_network is enabled. +This setting should be disabled as guest users should not be able to configure +NetworkManager. + +To disable the xguest_connect_network SELinux boolean, run the following command: +$ sudo setsebool -P xguest_connect_network off + - name: Disable the xguest_connect_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246234,24 +246376,7 @@ fi - no_reboot_needed - sebool_xguest_connect_network - - - - - - - - - - Disable the xguest_exec_content SELinux Boolean - By default, the SELinux boolean xguest_exec_content is enabled. -This setting should be disabled as guest users should not be able to run -executables. - -To disable the xguest_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P xguest_exec_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246261,9 +246386,9 @@ fi if selinuxenabled; then - var_xguest_exec_content='' + var_xguest_connect_network='' - setsebool -P xguest_exec_content $var_xguest_exec_content + setsebool -P xguest_connect_network $var_xguest_connect_network else echo "Skipping remediation, SELinux is disabled"; @@ -246274,6 +246399,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_exec_content SELinux Boolean + By default, the SELinux boolean xguest_exec_content is enabled. +This setting should be disabled as guest users should not be able to run +executables. + +To disable the xguest_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P xguest_exec_content off + - name: Disable the xguest_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246310,24 +246452,7 @@ fi - no_reboot_needed - sebool_xguest_exec_content - - - - - - - - - - Disable the xguest_mount_media SELinux Boolean - By default, the SELinux boolean xguest_mount_media is enabled. -This setting should be disabled as guest users should not be able to mount -any media. - -To disable the xguest_mount_media SELinux boolean, run the following command: -$ sudo setsebool -P xguest_mount_media off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246337,9 +246462,9 @@ fi if selinuxenabled; then - var_xguest_mount_media='' + var_xguest_exec_content='' - setsebool -P xguest_mount_media $var_xguest_mount_media + setsebool -P xguest_exec_content $var_xguest_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -246350,6 +246475,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_mount_media SELinux Boolean + By default, the SELinux boolean xguest_mount_media is enabled. +This setting should be disabled as guest users should not be able to mount +any media. + +To disable the xguest_mount_media SELinux boolean, run the following command: +$ sudo setsebool -P xguest_mount_media off + - name: Disable the xguest_mount_media SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246386,24 +246528,7 @@ fi - no_reboot_needed - sebool_xguest_mount_media - - - - - - - - - - Disable the xguest_use_bluetooth SELinux Boolean - By default, the SELinux boolean xguest_use_bluetooth is enabled. -This setting should be disabled as guests users should not be able to access -or use bluetooth. - -To disable the xguest_use_bluetooth SELinux boolean, run the following command: -$ sudo setsebool -P xguest_use_bluetooth off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246413,9 +246538,9 @@ fi if selinuxenabled; then - var_xguest_use_bluetooth='' + var_xguest_mount_media='' - setsebool -P xguest_use_bluetooth $var_xguest_use_bluetooth + setsebool -P xguest_mount_media $var_xguest_mount_media else echo "Skipping remediation, SELinux is disabled"; @@ -246426,6 +246551,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_use_bluetooth SELinux Boolean + By default, the SELinux boolean xguest_use_bluetooth is enabled. +This setting should be disabled as guests users should not be able to access +or use bluetooth. + +To disable the xguest_use_bluetooth SELinux boolean, run the following command: +$ sudo setsebool -P xguest_use_bluetooth off + - name: Disable the xguest_use_bluetooth SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246462,23 +246604,7 @@ fi - no_reboot_needed - sebool_xguest_use_bluetooth - - - - - - - - - - Disable the xserver_clients_write_xshm SELinux Boolean - By default, the SELinux boolean xserver_clients_write_xshm is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_clients_write_xshm SELinux boolean, run the following command: -$ sudo setsebool -P xserver_clients_write_xshm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246488,9 +246614,9 @@ fi if selinuxenabled; then - var_xserver_clients_write_xshm='' + var_xguest_use_bluetooth='' - setsebool -P xserver_clients_write_xshm $var_xserver_clients_write_xshm + setsebool -P xguest_use_bluetooth $var_xguest_use_bluetooth else echo "Skipping remediation, SELinux is disabled"; @@ -246501,6 +246627,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_clients_write_xshm SELinux Boolean + By default, the SELinux boolean xserver_clients_write_xshm is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_clients_write_xshm SELinux boolean, run the following command: +$ sudo setsebool -P xserver_clients_write_xshm off + - name: Disable the xserver_clients_write_xshm SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246537,25 +246679,7 @@ fi - no_reboot_needed - sebool_xserver_clients_write_xshm - - - - - - - - - - Disable the xserver_execmem SELinux Boolean - By default, the SELinux boolean xserver_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_execmem SELinux boolean, run the following command: -$ sudo setsebool -P xserver_execmem off - BP28(R67) - - CCE-83313-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246565,9 +246689,9 @@ fi if selinuxenabled; then - var_xserver_execmem='' + var_xserver_clients_write_xshm='' - setsebool -P xserver_execmem $var_xserver_execmem + setsebool -P xserver_clients_write_xshm $var_xserver_clients_write_xshm else echo "Skipping remediation, SELinux is disabled"; @@ -246578,6 +246702,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_execmem SELinux Boolean + By default, the SELinux boolean xserver_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_execmem SELinux boolean, run the following command: +$ sudo setsebool -P xserver_execmem off + BP28(R67) + + CCE-83313-7 - name: Disable the xserver_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246615,23 +246757,7 @@ fi - no_reboot_needed - sebool_xserver_execmem - - - - - - - - - - Disable the xserver_object_manager SELinux Boolean - By default, the SELinux boolean xserver_object_manager is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_object_manager SELinux boolean, run the following command: -$ sudo setsebool -P xserver_object_manager off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246641,9 +246767,9 @@ fi if selinuxenabled; then - var_xserver_object_manager='' + var_xserver_execmem='' - setsebool -P xserver_object_manager $var_xserver_object_manager + setsebool -P xserver_execmem $var_xserver_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -246654,6 +246780,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_object_manager SELinux Boolean + By default, the SELinux boolean xserver_object_manager is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_object_manager SELinux boolean, run the following command: +$ sudo setsebool -P xserver_object_manager off + - name: Disable the xserver_object_manager SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246690,23 +246832,7 @@ fi - no_reboot_needed - sebool_xserver_object_manager - - - - - - - - - - Disable the zabbix_can_network SELinux Boolean - By default, the SELinux boolean zabbix_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the zabbix_can_network SELinux boolean, run the following command: -$ sudo setsebool -P zabbix_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246716,9 +246842,9 @@ fi if selinuxenabled; then - var_zabbix_can_network='' + var_xserver_object_manager='' - setsebool -P zabbix_can_network $var_zabbix_can_network + setsebool -P xserver_object_manager $var_xserver_object_manager else echo "Skipping remediation, SELinux is disabled"; @@ -246729,6 +246855,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zabbix_can_network SELinux Boolean + By default, the SELinux boolean zabbix_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the zabbix_can_network SELinux boolean, run the following command: +$ sudo setsebool -P zabbix_can_network off + - name: Disable the zabbix_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246765,23 +246907,7 @@ fi - no_reboot_needed - sebool_zabbix_can_network - - - - - - - - - - Disable the zarafa_setrlimit SELinux Boolean - By default, the SELinux boolean zarafa_setrlimit is disabled. -If this setting is enabled, it should be disabled. - -To disable the zarafa_setrlimit SELinux boolean, run the following command: -$ sudo setsebool -P zarafa_setrlimit off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246791,9 +246917,9 @@ fi if selinuxenabled; then - var_zarafa_setrlimit='' + var_zabbix_can_network='' - setsebool -P zarafa_setrlimit $var_zarafa_setrlimit + setsebool -P zabbix_can_network $var_zabbix_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -246804,6 +246930,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zarafa_setrlimit SELinux Boolean + By default, the SELinux boolean zarafa_setrlimit is disabled. +If this setting is enabled, it should be disabled. + +To disable the zarafa_setrlimit SELinux boolean, run the following command: +$ sudo setsebool -P zarafa_setrlimit off + - name: Disable the zarafa_setrlimit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246840,23 +246982,7 @@ fi - no_reboot_needed - sebool_zarafa_setrlimit - - - - - - - - - - Disable the zebra_write_config SELinux Boolean - By default, the SELinux boolean zebra_write_config is disabled. -If this setting is enabled, it should be disabled. - -To disable the zebra_write_config SELinux boolean, run the following command: -$ sudo setsebool -P zebra_write_config off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246866,9 +246992,9 @@ fi if selinuxenabled; then - var_zebra_write_config='' + var_zarafa_setrlimit='' - setsebool -P zebra_write_config $var_zebra_write_config + setsebool -P zarafa_setrlimit $var_zarafa_setrlimit else echo "Skipping remediation, SELinux is disabled"; @@ -246879,6 +247005,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zebra_write_config SELinux Boolean + By default, the SELinux boolean zebra_write_config is disabled. +If this setting is enabled, it should be disabled. + +To disable the zebra_write_config SELinux boolean, run the following command: +$ sudo setsebool -P zebra_write_config off + - name: Disable the zebra_write_config SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246915,23 +247057,7 @@ fi - no_reboot_needed - sebool_zebra_write_config - - - - - - - - - - Disable the zoneminder_anon_write SELinux Boolean - By default, the SELinux boolean zoneminder_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the zoneminder_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P zoneminder_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246941,9 +247067,9 @@ fi if selinuxenabled; then - var_zoneminder_anon_write='' + var_zebra_write_config='' - setsebool -P zoneminder_anon_write $var_zoneminder_anon_write + setsebool -P zebra_write_config $var_zebra_write_config else echo "Skipping remediation, SELinux is disabled"; @@ -246954,10 +247080,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the zoneminder_anon_write SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage + + + + + + + + + + Disable the zoneminder_anon_write SELinux Boolean + By default, the SELinux boolean zoneminder_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the zoneminder_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P zoneminder_anon_write off + + - name: Disable the zoneminder_anon_write SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: @@ -246990,23 +247132,7 @@ fi - no_reboot_needed - sebool_zoneminder_anon_write - - - - - - - - - - Disable the zoneminder_run_sudo SELinux Boolean - By default, the SELinux boolean zoneminder_run_sudo is disabled. -If this setting is enabled, it should be disabled. - -To disable the zoneminder_run_sudo SELinux boolean, run the following command: -$ sudo setsebool -P zoneminder_run_sudo off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -247016,9 +247142,9 @@ fi if selinuxenabled; then - var_zoneminder_run_sudo='' + var_zoneminder_anon_write='' - setsebool -P zoneminder_run_sudo $var_zoneminder_run_sudo + setsebool -P zoneminder_anon_write $var_zoneminder_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -247029,6 +247155,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zoneminder_run_sudo SELinux Boolean + By default, the SELinux boolean zoneminder_run_sudo is disabled. +If this setting is enabled, it should be disabled. + +To disable the zoneminder_run_sudo SELinux boolean, run the following command: +$ sudo setsebool -P zoneminder_run_sudo off + - name: Disable the zoneminder_run_sudo SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -247064,6 +247206,29 @@ fi - medium_severity - no_reboot_needed - sebool_zoneminder_run_sudo + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_zoneminder_run_sudo='' + + setsebool -P zoneminder_run_sudo $var_zoneminder_run_sudo + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -247592,8 +247757,21 @@ the avahi-autoipd and avahi packages can be uninstalled. system functionality. It is recommended to remove this package to reduce the potential attack surface. CCE-86515-4 - -package --remove=avahi-autoipd + - name: Ensure avahi-autoipd is removed + package: + name: avahi-autoipd + state: absent + tags: + - CCE-86515-4 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_avahi-autoipd_removed include remove_avahi-autoipd @@ -247602,6 +247780,9 @@ class remove_avahi-autoipd { ensure => 'purged', } } + + +package --remove=avahi-autoipd # CAUTION: This remediation script will remove avahi-autoipd @@ -247615,22 +247796,6 @@ if rpm -q --quiet "avahi-autoipd" ; then yum remove -y "avahi-autoipd" fi - - - name: Ensure avahi-autoipd is removed - package: - name: avahi-autoipd - state: absent - tags: - - CCE-86515-4 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_avahi-autoipd_removed @@ -247717,8 +247882,21 @@ the avahi-autoipd and avahi packages can be uninstalled. system functionality. It is recommended to remove this package to reduce the potential attack surface. CCE-86512-1 - -package --remove=avahi + - name: Ensure avahi is removed + package: + name: avahi + state: absent + tags: + - CCE-86512-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_avahi_removed include remove_avahi @@ -247727,6 +247905,9 @@ class remove_avahi { ensure => 'purged', } } + + +package --remove=avahi # CAUTION: This remediation script will remove avahi @@ -247740,22 +247921,6 @@ if rpm -q --quiet "avahi" ; then yum remove -y "avahi" fi - - - name: Ensure avahi is removed - package: - name: avahi - state: absent - tags: - - CCE-86512-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_avahi_removed @@ -247845,55 +248010,6 @@ is convenient but is only appropriate if the local network can be trusted. CCE-82188-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: avahi-daemon.service - enabled: false - mask: true - - name: avahi-daemon.socket - enabled: false - mask: true - - include disable_avahi-daemon - -class disable_avahi-daemon { - service {'avahi-daemon': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q avahi ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'avahi-daemon.service' -"$SYSTEMCTL_EXEC" disable 'avahi-daemon.service' -"$SYSTEMCTL_EXEC" mask 'avahi-daemon.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files avahi-daemon.socket; then - "$SYSTEMCTL_EXEC" stop 'avahi-daemon.socket' - "$SYSTEMCTL_EXEC" mask 'avahi-daemon.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'avahi-daemon.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["avahi-daemon"] - - name: Gather the package facts package_facts: manager: auto @@ -247985,6 +248101,55 @@ disabled = ["avahi-daemon"] - medium_severity - no_reboot_needed - service_avahi-daemon_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: avahi-daemon.service + enabled: false + mask: true + - name: avahi-daemon.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["avahi-daemon"] + + include disable_avahi-daemon + +class disable_avahi-daemon { + service {'avahi-daemon': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q avahi ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'avahi-daemon.service' +"$SYSTEMCTL_EXEC" disable 'avahi-daemon.service' +"$SYSTEMCTL_EXEC" mask 'avahi-daemon.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files avahi-daemon.socket; then + "$SYSTEMCTL_EXEC" stop 'avahi-daemon.socket' + "$SYSTEMCTL_EXEC" mask 'avahi-daemon.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'avahi-daemon.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248134,27 +248299,6 @@ view into some user activities. However, it should be noted that the auditing system and its audit records provide more authoritative and comprehensive records. CCE-82404-5 - -package --add=psacct - - include install_psacct - -class install_psacct { - package { 'psacct': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "psacct" ; then - yum install -y "psacct" -fi - - -[[packages]] -name = "psacct" -version = "*" - - name: Ensure psacct is installed package: name: psacct @@ -248169,6 +248313,27 @@ version = "*" - low_severity - no_reboot_needed - package_psacct_installed + + +[[packages]] +name = "psacct" +version = "*" + + include install_psacct + +class install_psacct { + package { 'psacct': + ensure => 'installed', + } +} + + +package --add=psacct + + +if ! rpm -q --quiet "psacct" ; then + yum install -y "psacct" +fi @@ -248195,8 +248360,19 @@ $ sudo yum erase abrt vulnerabilities in software executing on the system, as well as sensitive information from within a process's address space or registers. CCE-80948-3 - -package --remove=abrt + - name: Ensure abrt is removed + package: + name: abrt + state: absent + tags: + - CCE-80948-3 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_abrt_removed include remove_abrt @@ -248205,6 +248381,9 @@ class remove_abrt { ensure => 'purged', } } + + +package --remove=abrt # CAUTION: This remediation script will remove abrt @@ -248218,20 +248397,6 @@ if rpm -q --quiet "abrt" ; then yum remove -y "abrt" fi - - - name: Ensure abrt is removed - package: - name: abrt - state: absent - tags: - - CCE-80948-3 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_abrt_removed @@ -248372,31 +248537,6 @@ system and its audit records provide more authoritative and comprehensive records. CCE-82401-1 - include enable_psacct - -class enable_psacct { - service {'psacct': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'psacct.service' -"$SYSTEMCTL_EXEC" start 'psacct.service' -"$SYSTEMCTL_EXEC" enable 'psacct.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["psacct"] - - name: Enable service psacct block: @@ -248423,6 +248563,31 @@ enabled = ["psacct"] - low_severity - no_reboot_needed - service_psacct_enabled + + +[customizations.services] +enabled = ["psacct"] + + include enable_psacct + +class enable_psacct { + service {'psacct': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'psacct.service' +"$SYSTEMCTL_EXEC" start 'psacct.service' +"$SYSTEMCTL_EXEC" enable 'psacct.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248535,55 +248700,6 @@ vulnerabilities in software executing on the system, as well as sensitive information from within a process's address space or registers. CCE-80870-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: abrtd.service - enabled: false - mask: true - - name: abrtd.socket - enabled: false - mask: true - - include disable_abrtd - -class disable_abrtd { - service {'abrtd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'abrtd.service' -"$SYSTEMCTL_EXEC" disable 'abrtd.service' -"$SYSTEMCTL_EXEC" mask 'abrtd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files abrtd.socket; then - "$SYSTEMCTL_EXEC" stop 'abrtd.socket' - "$SYSTEMCTL_EXEC" mask 'abrtd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'abrtd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["abrtd"] - - name: Block Disable service abrtd block: @@ -248650,6 +248766,55 @@ disabled = ["abrtd"] - medium_severity - no_reboot_needed - service_abrtd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: abrtd.service + enabled: false + mask: true + - name: abrtd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["abrtd"] + + include disable_abrtd + +class disable_abrtd { + service {'abrtd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'abrtd.service' +"$SYSTEMCTL_EXEC" disable 'abrtd.service' +"$SYSTEMCTL_EXEC" mask 'abrtd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files abrtd.socket; then + "$SYSTEMCTL_EXEC" stop 'abrtd.socket' + "$SYSTEMCTL_EXEC" mask 'abrtd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'abrtd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248739,55 +248904,6 @@ accidental or trivially achievable denial of service situations and disabling it is appropriate. CCE-82407-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: acpid.service - enabled: false - mask: true - - name: acpid.socket - enabled: false - mask: true - - include disable_acpid - -class disable_acpid { - service {'acpid': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'acpid.service' -"$SYSTEMCTL_EXEC" disable 'acpid.service' -"$SYSTEMCTL_EXEC" mask 'acpid.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files acpid.socket; then - "$SYSTEMCTL_EXEC" stop 'acpid.socket' - "$SYSTEMCTL_EXEC" mask 'acpid.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'acpid.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["acpid"] - - name: Block Disable service acpid block: @@ -248857,6 +248973,55 @@ disabled = ["acpid"] - medium_severity - no_reboot_needed - service_acpid_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: acpid.service + enabled: false + mask: true + - name: acpid.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["acpid"] + + include disable_acpid + +class disable_acpid { + service {'acpid': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'acpid.service' +"$SYSTEMCTL_EXEC" disable 'acpid.service' +"$SYSTEMCTL_EXEC" mask 'acpid.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files acpid.socket; then + "$SYSTEMCTL_EXEC" stop 'acpid.socket' + "$SYSTEMCTL_EXEC" mask 'acpid.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'acpid.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248946,55 +249111,6 @@ fulfilling some roles a PKI infrastructure, but its functionality is not necessa for many other use cases. CCE-82452-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: certmonger.service - enabled: false - mask: true - - name: certmonger.socket - enabled: false - mask: true - - include disable_certmonger - -class disable_certmonger { - service {'certmonger': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'certmonger.service' -"$SYSTEMCTL_EXEC" disable 'certmonger.service' -"$SYSTEMCTL_EXEC" mask 'certmonger.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files certmonger.socket; then - "$SYSTEMCTL_EXEC" stop 'certmonger.socket' - "$SYSTEMCTL_EXEC" mask 'certmonger.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'certmonger.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["certmonger"] - - name: Block Disable service certmonger block: @@ -249065,23 +249181,7 @@ disabled = ["certmonger"] - no_reboot_needed - service_certmonger_disabled - - - - - - - - - Disable Cockpit Management Server - The Cockpit Management Server (cockpit) provides a web based -login and management framework. - -The cockpit service can be disabled with the following command: -$ sudo systemctl mask --now cockpit.service - Cockpit provides a form of remote login. - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -249089,47 +249189,63 @@ spec: version: 3.1.0 systemd: units: - - name: cockpit.service + - name: certmonger.service enabled: false mask: true - - name: cockpit.socket + - name: certmonger.socket enabled: false mask: true - include disable_cockpit + +[customizations.services] +disabled = ["certmonger"] + + include disable_certmonger -class disable_cockpit { - service {'cockpit': +class disable_certmonger { + service {'certmonger': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cockpit.service' -"$SYSTEMCTL_EXEC" disable 'cockpit.service' -"$SYSTEMCTL_EXEC" mask 'cockpit.service' +"$SYSTEMCTL_EXEC" stop 'certmonger.service' +"$SYSTEMCTL_EXEC" disable 'certmonger.service' +"$SYSTEMCTL_EXEC" mask 'certmonger.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cockpit.socket; then - "$SYSTEMCTL_EXEC" stop 'cockpit.socket' - "$SYSTEMCTL_EXEC" mask 'cockpit.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files certmonger.socket; then + "$SYSTEMCTL_EXEC" stop 'certmonger.socket' + "$SYSTEMCTL_EXEC" mask 'certmonger.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cockpit.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'certmonger.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["cockpit"] - + + + + + + + + + Disable Cockpit Management Server + The Cockpit Management Server (cockpit) provides a web based +login and management framework. + +The cockpit service can be disabled with the following command: +$ sudo systemctl mask --now cockpit.service + Cockpit provides a form of remote login. + - name: Block Disable service cockpit block: @@ -249187,6 +249303,55 @@ disabled = ["cockpit"] - medium_severity - no_reboot_needed - service_cockpit_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cockpit.service + enabled: false + mask: true + - name: cockpit.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cockpit"] + + include disable_cockpit + +class disable_cockpit { + service {'cockpit': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cockpit.service' +"$SYSTEMCTL_EXEC" disable 'cockpit.service' +"$SYSTEMCTL_EXEC" mask 'cockpit.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cockpit.socket; then + "$SYSTEMCTL_EXEC" stop 'cockpit.socket' + "$SYSTEMCTL_EXEC" mask 'cockpit.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cockpit.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249275,55 +249440,6 @@ but may also apply to server or desktop environments where conserving power is highly desirable or necessary. CCE-82382-3 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: cpupower.service - enabled: false - mask: true - - name: cpupower.socket - enabled: false - mask: true - - include disable_cpupower - -class disable_cpupower { - service {'cpupower': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cpupower.service' -"$SYSTEMCTL_EXEC" disable 'cpupower.service' -"$SYSTEMCTL_EXEC" mask 'cpupower.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cpupower.socket; then - "$SYSTEMCTL_EXEC" stop 'cpupower.socket' - "$SYSTEMCTL_EXEC" mask 'cpupower.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cpupower.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["cpupower"] - - name: Block Disable service cpupower block: @@ -249393,6 +249509,55 @@ disabled = ["cpupower"] - low_severity - no_reboot_needed - service_cpupower_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cpupower.service + enabled: false + mask: true + - name: cpupower.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cpupower"] + + include disable_cpupower + +class disable_cpupower { + service {'cpupower': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cpupower.service' +"$SYSTEMCTL_EXEC" disable 'cpupower.service' +"$SYSTEMCTL_EXEC" mask 'cpupower.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cpupower.socket; then + "$SYSTEMCTL_EXEC" stop 'cpupower.socket' + "$SYSTEMCTL_EXEC" mask 'cpupower.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cpupower.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249520,58 +249685,6 @@ on the target file system partition. Unless the system is used for kernel development or testing, there is little need to run the kdump service. CCE-80878-2 - -kdump --disable - - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: kdump.service - enabled: false - mask: true - - name: kdump.socket - enabled: false - mask: true - - include disable_kdump - -class disable_kdump { - service {'kdump': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'kdump.service' -"$SYSTEMCTL_EXEC" disable 'kdump.service' -"$SYSTEMCTL_EXEC" mask 'kdump.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files kdump.socket; then - "$SYSTEMCTL_EXEC" stop 'kdump.socket' - "$SYSTEMCTL_EXEC" mask 'kdump.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'kdump.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["kdump"] - - name: Block Disable service kdump block: @@ -249644,6 +249757,58 @@ disabled = ["kdump"] - medium_severity - no_reboot_needed - service_kdump_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: kdump.service + enabled: false + mask: true + - name: kdump.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["kdump"] + + include disable_kdump + +class disable_kdump { + service {'kdump': + enable => false, + ensure => 'stopped', + } +} + + +kdump --disable + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'kdump.service' +"$SYSTEMCTL_EXEC" disable 'kdump.service' +"$SYSTEMCTL_EXEC" mask 'kdump.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files kdump.socket; then + "$SYSTEMCTL_EXEC" stop 'kdump.socket' + "$SYSTEMCTL_EXEC" mask 'kdump.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'kdump.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249730,55 +249895,6 @@ The mdmonitor service can be disabled with the following there is no need to run this service. CCE-82386-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: mdmonitor.service - enabled: false - mask: true - - name: mdmonitor.socket - enabled: false - mask: true - - include disable_mdmonitor - -class disable_mdmonitor { - service {'mdmonitor': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'mdmonitor.service' -"$SYSTEMCTL_EXEC" disable 'mdmonitor.service' -"$SYSTEMCTL_EXEC" mask 'mdmonitor.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files mdmonitor.socket; then - "$SYSTEMCTL_EXEC" stop 'mdmonitor.socket' - "$SYSTEMCTL_EXEC" mask 'mdmonitor.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'mdmonitor.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["mdmonitor"] - - name: Block Disable service mdmonitor block: @@ -249848,6 +249964,55 @@ disabled = ["mdmonitor"] - low_severity - no_reboot_needed - service_mdmonitor_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: mdmonitor.service + enabled: false + mask: true + - name: mdmonitor.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["mdmonitor"] + + include disable_mdmonitor + +class disable_mdmonitor { + service {'mdmonitor': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'mdmonitor.service' +"$SYSTEMCTL_EXEC" disable 'mdmonitor.service' +"$SYSTEMCTL_EXEC" mask 'mdmonitor.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files mdmonitor.socket; then + "$SYSTEMCTL_EXEC" stop 'mdmonitor.socket' + "$SYSTEMCTL_EXEC" mask 'mdmonitor.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'mdmonitor.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249960,55 +250125,6 @@ The netconsole service can be disabled with the following kernel panics, which is not common. CCE-82455-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: netconsole.service - enabled: false - mask: true - - name: netconsole.socket - enabled: false - mask: true - - include disable_netconsole - -class disable_netconsole { - service {'netconsole': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'netconsole.service' -"$SYSTEMCTL_EXEC" disable 'netconsole.service' -"$SYSTEMCTL_EXEC" mask 'netconsole.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files netconsole.socket; then - "$SYSTEMCTL_EXEC" stop 'netconsole.socket' - "$SYSTEMCTL_EXEC" mask 'netconsole.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'netconsole.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["netconsole"] - - name: Block Disable service netconsole block: @@ -250078,6 +250194,55 @@ disabled = ["netconsole"] - low_severity - no_reboot_needed - service_netconsole_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: netconsole.service + enabled: false + mask: true + - name: netconsole.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["netconsole"] + + include disable_netconsole + +class disable_netconsole { + service {'netconsole': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'netconsole.service' +"$SYSTEMCTL_EXEC" disable 'netconsole.service' +"$SYSTEMCTL_EXEC" mask 'netconsole.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files netconsole.socket; then + "$SYSTEMCTL_EXEC" stop 'netconsole.socket' + "$SYSTEMCTL_EXEC" mask 'netconsole.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'netconsole.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250193,55 +250358,6 @@ reboots. In any event, the functionality of the ntpdate service is now available in the ntpd program and should be considered deprecated. CCE-80879-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: ntpdate.service - enabled: false - mask: true - - name: ntpdate.socket - enabled: false - mask: true - - include disable_ntpdate - -class disable_ntpdate { - service {'ntpdate': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ntpdate.service' -"$SYSTEMCTL_EXEC" disable 'ntpdate.service' -"$SYSTEMCTL_EXEC" mask 'ntpdate.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ntpdate.socket; then - "$SYSTEMCTL_EXEC" stop 'ntpdate.socket' - "$SYSTEMCTL_EXEC" mask 'ntpdate.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ntpdate.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["ntpdate"] - - name: Block Disable service ntpdate block: @@ -250311,6 +250427,55 @@ disabled = ["ntpdate"] - low_severity - no_reboot_needed - service_ntpdate_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: ntpdate.service + enabled: false + mask: true + - name: ntpdate.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["ntpdate"] + + include disable_ntpdate + +class disable_ntpdate { + service {'ntpdate': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'ntpdate.service' +"$SYSTEMCTL_EXEC" disable 'ntpdate.service' +"$SYSTEMCTL_EXEC" mask 'ntpdate.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files ntpdate.socket; then + "$SYSTEMCTL_EXEC" stop 'ntpdate.socket' + "$SYSTEMCTL_EXEC" mask 'ntpdate.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'ntpdate.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250402,55 +250567,6 @@ tasks by privileged programs, on behalf of unprivileged ones, has traditionally been a source of privilege escalation security issues. CCE-80880-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: oddjobd.service - enabled: false - mask: true - - name: oddjobd.socket - enabled: false - mask: true - - include disable_oddjobd - -class disable_oddjobd { - service {'oddjobd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'oddjobd.service' -"$SYSTEMCTL_EXEC" disable 'oddjobd.service' -"$SYSTEMCTL_EXEC" mask 'oddjobd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files oddjobd.socket; then - "$SYSTEMCTL_EXEC" stop 'oddjobd.socket' - "$SYSTEMCTL_EXEC" mask 'oddjobd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'oddjobd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["oddjobd"] - - name: Block Disable service oddjobd block: @@ -250520,6 +250636,55 @@ disabled = ["oddjobd"] - medium_severity - no_reboot_needed - service_oddjobd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: oddjobd.service + enabled: false + mask: true + - name: oddjobd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["oddjobd"] + + include disable_oddjobd + +class disable_oddjobd { + service {'oddjobd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'oddjobd.service' +"$SYSTEMCTL_EXEC" disable 'oddjobd.service' +"$SYSTEMCTL_EXEC" mask 'oddjobd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files oddjobd.socket; then + "$SYSTEMCTL_EXEC" stop 'oddjobd.socket' + "$SYSTEMCTL_EXEC" mask 'oddjobd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'oddjobd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250631,55 +250796,6 @@ preventing conflicting usage of ports in the reserved port range, but it can be disabled if not needed. CCE-82390-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: portreserve.service - enabled: false - mask: true - - name: portreserve.socket - enabled: false - mask: true - - include disable_portreserve - -class disable_portreserve { - service {'portreserve': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'portreserve.service' -"$SYSTEMCTL_EXEC" disable 'portreserve.service' -"$SYSTEMCTL_EXEC" mask 'portreserve.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files portreserve.socket; then - "$SYSTEMCTL_EXEC" stop 'portreserve.socket' - "$SYSTEMCTL_EXEC" mask 'portreserve.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'portreserve.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["portreserve"] - - name: Block Disable service portreserve block: @@ -250749,6 +250865,55 @@ disabled = ["portreserve"] - low_severity - no_reboot_needed - service_portreserve_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: portreserve.service + enabled: false + mask: true + - name: portreserve.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["portreserve"] + + include disable_portreserve + +class disable_portreserve { + service {'portreserve': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'portreserve.service' +"$SYSTEMCTL_EXEC" disable 'portreserve.service' +"$SYSTEMCTL_EXEC" mask 'portreserve.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files portreserve.socket; then + "$SYSTEMCTL_EXEC" stop 'portreserve.socket' + "$SYSTEMCTL_EXEC" mask 'portreserve.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'portreserve.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250864,55 +251029,6 @@ the system is not intended to receive AMQP traffic, then the qpidd CCE-80882-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: qpidd.service - enabled: false - mask: true - - name: qpidd.socket - enabled: false - mask: true - - include disable_qpidd - -class disable_qpidd { - service {'qpidd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'qpidd.service' -"$SYSTEMCTL_EXEC" disable 'qpidd.service' -"$SYSTEMCTL_EXEC" mask 'qpidd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files qpidd.socket; then - "$SYSTEMCTL_EXEC" stop 'qpidd.socket' - "$SYSTEMCTL_EXEC" mask 'qpidd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'qpidd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["qpidd"] - - name: Block Disable service qpidd block: @@ -250982,6 +251098,55 @@ disabled = ["qpidd"] - low_severity - no_reboot_needed - service_qpidd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: qpidd.service + enabled: false + mask: true + - name: qpidd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["qpidd"] + + include disable_qpidd + +class disable_qpidd { + service {'qpidd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'qpidd.service' +"$SYSTEMCTL_EXEC" disable 'qpidd.service' +"$SYSTEMCTL_EXEC" mask 'qpidd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files qpidd.socket; then + "$SYSTEMCTL_EXEC" stop 'qpidd.socket' + "$SYSTEMCTL_EXEC" mask 'qpidd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'qpidd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251074,55 +251239,6 @@ disk quota violation is not desired then there is no need to run this service. CCE-82406-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: quota_nld.service - enabled: false - mask: true - - name: quota_nld.socket - enabled: false - mask: true - - include disable_quota_nld - -class disable_quota_nld { - service {'quota_nld': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'quota_nld.service' -"$SYSTEMCTL_EXEC" disable 'quota_nld.service' -"$SYSTEMCTL_EXEC" mask 'quota_nld.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files quota_nld.socket; then - "$SYSTEMCTL_EXEC" stop 'quota_nld.socket' - "$SYSTEMCTL_EXEC" mask 'quota_nld.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'quota_nld.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["quota_nld"] - - name: Block Disable service quota_nld block: @@ -251192,6 +251308,55 @@ disabled = ["quota_nld"] - low_severity - no_reboot_needed - service_quota_nld_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: quota_nld.service + enabled: false + mask: true + - name: quota_nld.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["quota_nld"] + + include disable_quota_nld + +class disable_quota_nld { + service {'quota_nld': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'quota_nld.service' +"$SYSTEMCTL_EXEC" disable 'quota_nld.service' +"$SYSTEMCTL_EXEC" mask 'quota_nld.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files quota_nld.socket; then + "$SYSTEMCTL_EXEC" stop 'quota_nld.socket' + "$SYSTEMCTL_EXEC" mask 'quota_nld.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'quota_nld.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251348,55 +251513,6 @@ some special-purpose systems often use DHCP (instead of IRDP) to retrieve dynamic network configuration information. CCE-80883-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rdisc.service - enabled: false - mask: true - - name: rdisc.socket - enabled: false - mask: true - - include disable_rdisc - -class disable_rdisc { - service {'rdisc': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rdisc.service' -"$SYSTEMCTL_EXEC" disable 'rdisc.service' -"$SYSTEMCTL_EXEC" mask 'rdisc.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rdisc.socket; then - "$SYSTEMCTL_EXEC" stop 'rdisc.socket' - "$SYSTEMCTL_EXEC" mask 'rdisc.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rdisc.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rdisc"] - - name: Block Disable service rdisc block: @@ -251469,6 +251585,55 @@ disabled = ["rdisc"] - medium_severity - no_reboot_needed - service_rdisc_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rdisc.service + enabled: false + mask: true + - name: rdisc.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rdisc"] + + include disable_rdisc + +class disable_rdisc { + service {'rdisc': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rdisc.service' +"$SYSTEMCTL_EXEC" disable 'rdisc.service' +"$SYSTEMCTL_EXEC" mask 'rdisc.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rdisc.socket; then + "$SYSTEMCTL_EXEC" stop 'rdisc.socket' + "$SYSTEMCTL_EXEC" mask 'rdisc.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rdisc.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251584,55 +251749,6 @@ desirable for some environments. However, if the system is being managed by RHN RHN Satellite Server the rhnsd daemon can remain on. CCE-82405-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rhnsd.service - enabled: false - mask: true - - name: rhnsd.socket - enabled: false - mask: true - - include disable_rhnsd - -class disable_rhnsd { - service {'rhnsd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rhnsd.service' -"$SYSTEMCTL_EXEC" disable 'rhnsd.service' -"$SYSTEMCTL_EXEC" mask 'rhnsd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rhnsd.socket; then - "$SYSTEMCTL_EXEC" stop 'rhnsd.socket' - "$SYSTEMCTL_EXEC" mask 'rhnsd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rhnsd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rhnsd"] - - name: Block Disable service rhnsd block: @@ -251702,6 +251818,55 @@ disabled = ["rhnsd"] - low_severity - no_reboot_needed - service_rhnsd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rhnsd.service + enabled: false + mask: true + - name: rhnsd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rhnsd"] + + include disable_rhnsd + +class disable_rhnsd { + service {'rhnsd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rhnsd.service' +"$SYSTEMCTL_EXEC" disable 'rhnsd.service' +"$SYSTEMCTL_EXEC" mask 'rhnsd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rhnsd.socket; then + "$SYSTEMCTL_EXEC" stop 'rhnsd.socket' + "$SYSTEMCTL_EXEC" mask 'rhnsd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rhnsd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251792,55 +251957,6 @@ expected to require remote changes to their subscription status, it is unnecessary and can be disabled. CCE-82387-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rhsmcertd.service - enabled: false - mask: true - - name: rhsmcertd.socket - enabled: false - mask: true - - include disable_rhsmcertd - -class disable_rhsmcertd { - service {'rhsmcertd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rhsmcertd.service' -"$SYSTEMCTL_EXEC" disable 'rhsmcertd.service' -"$SYSTEMCTL_EXEC" mask 'rhsmcertd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rhsmcertd.socket; then - "$SYSTEMCTL_EXEC" stop 'rhsmcertd.socket' - "$SYSTEMCTL_EXEC" mask 'rhsmcertd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rhsmcertd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rhsmcertd"] - - name: Block Disable service rhsmcertd block: @@ -251910,6 +252026,55 @@ disabled = ["rhsmcertd"] - low_severity - no_reboot_needed - service_rhsmcertd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rhsmcertd.service + enabled: false + mask: true + - name: rhsmcertd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rhsmcertd"] + + include disable_rhsmcertd + +class disable_rhsmcertd { + service {'rhsmcertd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rhsmcertd.service' +"$SYSTEMCTL_EXEC" disable 'rhsmcertd.service' +"$SYSTEMCTL_EXEC" mask 'rhsmcertd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rhsmcertd.socket; then + "$SYSTEMCTL_EXEC" stop 'rhsmcertd.socket' + "$SYSTEMCTL_EXEC" mask 'rhsmcertd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rhsmcertd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252024,55 +252189,6 @@ use Kerberos and LDAP. For others, however, in which only local files may be consulted, it is not necessary and should be disabled. CCE-82389-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: saslauthd.service - enabled: false - mask: true - - name: saslauthd.socket - enabled: false - mask: true - - include disable_saslauthd - -class disable_saslauthd { - service {'saslauthd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'saslauthd.service' -"$SYSTEMCTL_EXEC" disable 'saslauthd.service' -"$SYSTEMCTL_EXEC" mask 'saslauthd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files saslauthd.socket; then - "$SYSTEMCTL_EXEC" stop 'saslauthd.socket' - "$SYSTEMCTL_EXEC" mask 'saslauthd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'saslauthd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["saslauthd"] - - name: Block Disable service saslauthd block: @@ -252142,6 +252258,55 @@ disabled = ["saslauthd"] - low_severity - no_reboot_needed - service_saslauthd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: saslauthd.service + enabled: false + mask: true + - name: saslauthd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["saslauthd"] + + include disable_saslauthd + +class disable_saslauthd { + service {'saslauthd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'saslauthd.service' +"$SYSTEMCTL_EXEC" disable 'saslauthd.service' +"$SYSTEMCTL_EXEC" mask 'saslauthd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files saslauthd.socket; then + "$SYSTEMCTL_EXEC" stop 'saslauthd.socket' + "$SYSTEMCTL_EXEC" mask 'saslauthd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'saslauthd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252232,55 +252397,6 @@ insight into system operation, through the lens of providing only essential syst this service should be disabled. CCE-82388-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: sysstat.service - enabled: false - mask: true - - name: sysstat.socket - enabled: false - mask: true - - include disable_sysstat - -class disable_sysstat { - service {'sysstat': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'sysstat.service' -"$SYSTEMCTL_EXEC" disable 'sysstat.service' -"$SYSTEMCTL_EXEC" mask 'sysstat.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files sysstat.socket; then - "$SYSTEMCTL_EXEC" stop 'sysstat.socket' - "$SYSTEMCTL_EXEC" mask 'sysstat.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'sysstat.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["sysstat"] - - name: Block Disable service sysstat block: @@ -252350,6 +252466,55 @@ disabled = ["sysstat"] - low_severity - no_reboot_needed - service_sysstat_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: sysstat.service + enabled: false + mask: true + - name: sysstat.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["sysstat"] + + include disable_sysstat + +class disable_sysstat { + service {'sysstat': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'sysstat.service' +"$SYSTEMCTL_EXEC" disable 'sysstat.service' +"$SYSTEMCTL_EXEC" mask 'sysstat.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files sysstat.socket; then + "$SYSTEMCTL_EXEC" stop 'sysstat.socket' + "$SYSTEMCTL_EXEC" mask 'sysstat.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'sysstat.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252443,8 +252608,24 @@ configured defensively. PR.IP-1 PR.PT-3 The cron service allow periodic job execution, needed for almost all administrative tasks and services (software update, log rotating, etc.). Access to cron service should be restricted to administrative accounts only. - -package --add=cron + - name: Ensure cron is installed + package: + name: cron + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_cron_installed + + +[[packages]] +name = "cron" +version = "*" include install_cron @@ -252453,6 +252634,9 @@ class install_cron { ensure => 'installed', } } + + +package --add=cron # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -252464,25 +252648,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "cron" -version = "*" - - - name: Ensure cron is installed - package: - name: cron - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_cron_installed @@ -252573,31 +252738,6 @@ The cron service can be enabled with the following comman 2.2.6 Due to its usage for maintenance and security-supporting tasks, enabling the cron daemon is essential. - include enable_cron - -class enable_cron { - service {'cron': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'cron.service' -"$SYSTEMCTL_EXEC" start 'cron.service' -"$SYSTEMCTL_EXEC" enable 'cron.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["cron"] - - name: Enable service cron block: @@ -252623,6 +252763,31 @@ enabled = ["cron"] - medium_severity - no_reboot_needed - service_cron_enabled + + +[customizations.services] +enabled = ["cron"] + + include enable_cron + +class enable_cron { + service {'cron': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'cron.service' +"$SYSTEMCTL_EXEC" start 'cron.service' +"$SYSTEMCTL_EXEC" enable 'cron.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252710,35 +252875,10 @@ The crond service can be enabled with the following comma CM-6(a) PR.IP-1 PR.PT-3 - 5.1.1 + 4.1.1.1 Due to its usage for maintenance and security-supporting tasks, enabling the cron daemon is essential. CCE-80875-8 - include enable_crond - -class enable_crond { - service {'crond': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'crond.service' -"$SYSTEMCTL_EXEC" start 'crond.service' -"$SYSTEMCTL_EXEC" enable 'crond.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["crond"] - - name: Enable service crond block: @@ -252764,6 +252904,31 @@ enabled = ["crond"] - medium_severity - no_reboot_needed - service_crond_enabled + + +[customizations.services] +enabled = ["crond"] + + include enable_crond + +class enable_crond { + service {'crond': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'crond.service' +"$SYSTEMCTL_EXEC" start 'crond.service' +"$SYSTEMCTL_EXEC" enable 'crond.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252856,55 +253021,6 @@ accountability. Furthermore, the need to schedule tasks with atbatch is not common. CCE-80871-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: atd.service - enabled: false - mask: true - - name: atd.socket - enabled: false - mask: true - - include disable_atd - -class disable_atd { - service {'atd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'atd.service' -"$SYSTEMCTL_EXEC" disable 'atd.service' -"$SYSTEMCTL_EXEC" mask 'atd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files atd.socket; then - "$SYSTEMCTL_EXEC" stop 'atd.socket' - "$SYSTEMCTL_EXEC" mask 'atd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'atd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["atd"] - - name: Block Disable service atd block: @@ -252974,6 +253090,55 @@ disabled = ["atd"] - medium_severity - no_reboot_needed - service_atd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: atd.service + enabled: false + mask: true + - name: atd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["atd"] + + include disable_atd + +class disable_atd { + service {'atd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'atd.service' +"$SYSTEMCTL_EXEC" disable 'atd.service' +"$SYSTEMCTL_EXEC" mask 'atd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files atd.socket; then + "$SYSTEMCTL_EXEC" stop 'atd.socket' + "$SYSTEMCTL_EXEC" mask 'atd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'atd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253114,20 +253279,11 @@ To properly set the group owner of /etc/cron.d, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82268-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.d/ file: path: /etc/cron.d/ @@ -253145,6 +253301,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253202,20 +253367,11 @@ To properly set the group owner of /etc/cron.daily, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82234-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.daily/ file: path: /etc/cron.daily/ @@ -253233,6 +253389,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253290,20 +253455,11 @@ To properly set the group owner of /etc/cron.hourly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82227-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.hourly/ file: path: /etc/cron.hourly/ @@ -253321,6 +253477,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253378,20 +253543,11 @@ To properly set the group owner of /etc/cron.monthly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82256-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.monthly/ file: path: /etc/cron.monthly/ @@ -253409,6 +253565,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253466,20 +253631,11 @@ To properly set the group owner of /etc/cron.weekly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82244-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.weekly/ file: path: /etc/cron.weekly/ @@ -253497,6 +253653,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253554,20 +253719,11 @@ To properly set the group owner of /etc/crontab, run the PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82223-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -253603,6 +253759,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253660,20 +253825,11 @@ To properly set the owner of /etc/cron.d, run the command PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82272-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.d/ file: path: /etc/cron.d/ @@ -253691,6 +253847,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253748,20 +253913,11 @@ To properly set the owner of /etc/cron.daily, run the com PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82237-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.daily/ file: path: /etc/cron.daily/ @@ -253779,6 +253935,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253836,20 +254001,11 @@ To properly set the owner of /etc/cron.hourly, run the co PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82209-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.hourly/ file: path: /etc/cron.hourly/ @@ -253867,6 +254023,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253924,20 +254089,11 @@ To properly set the owner of /etc/cron.monthly, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82260-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.monthly/ file: path: /etc/cron.monthly/ @@ -253955,6 +254111,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254012,20 +254177,11 @@ To properly set the owner of /etc/cron.weekly, run the co PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82247-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.weekly/ file: path: /etc/cron.weekly/ @@ -254043,6 +254199,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254100,20 +254265,11 @@ To properly set the owner of /etc/crontab, run the comman PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82224-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -254149,6 +254305,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254206,20 +254371,11 @@ To properly set the permissions of /etc/cron.d, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82277-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.d/ file(s) command: 'find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' register: files_found @@ -254258,6 +254414,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254315,20 +254480,11 @@ To properly set the permissions of /etc/cron.daily, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82240-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.daily/ file(s) command: 'find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' register: files_found @@ -254367,6 +254523,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254424,20 +254589,11 @@ To properly set the permissions of /etc/cron.hourly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82230-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.hourly/ file(s) command: 'find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254477,6 +254633,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254534,20 +254699,11 @@ To properly set the permissions of /etc/cron.monthly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82263-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.monthly/ file(s) command: 'find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254587,6 +254743,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254644,20 +254809,11 @@ To properly set the permissions of /etc/cron.weekly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82253-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.weekly/ file(s) command: 'find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254697,6 +254853,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254754,20 +254919,11 @@ To properly set the permissions of /etc/crontab, run the PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82206-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -254803,6 +254959,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254834,21 +254999,10 @@ the at command to create at jobs. The file /etc/at.deny should not exist. Use /etc/at.allow instead. 2.2.6 - 5.1.9 + 4.1.2.1 Access to at should be restricted. It is easier to manage an allow list than a deny list. CCE-86945-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [[ -f /etc/at.deny ]]; then - rm /etc/at.deny - fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Remove /etc/at.deny file: path: /etc/at.deny @@ -254863,6 +255017,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [[ -f /etc/at.deny ]]; then + rm /etc/at.deny + fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254875,23 +255040,12 @@ fi Ensure that /etc/cron.allow exists The file /etc/cron.allow should exist and should be used instead of /etc/cron.deny. - 5.1.8 + 4.1.1.8 Access to crontab should be restricted. It is easier to manage an allow list than a deny list. Therefore, /etc/cron.allow needs to be created and used instead of /etc/cron.deny. Regardless of the existence of any of these files, the root administrative user is always allowed to setup a crontab. CCE-86184-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -touch /etc/cron.allow - chown 0 /etc/cron.allow - chmod 0600 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Add empty /etc/cron.allow file: path: /etc/cron.allow @@ -254907,6 +255061,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +touch /etc/cron.allow + chown 0 /etc/cron.allow + chmod 0600 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254920,21 +255085,10 @@ fi The file /etc/cron.deny should not exist. Use /etc/cron.allow instead. 2.2.6 - 5.1.8 + 4.1.1.8 Access to cron should be restricted. It is easier to manage an allow list than a deny list. CCE-86849-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [[ -f /etc/cron.deny ]]; then - rm /etc/cron.deny - fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Remove /etc/cron.deny file: path: /etc/cron.deny @@ -254949,6 +255103,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [[ -f /etc/cron.deny ]]; then + rm /etc/cron.deny + fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254964,19 +255129,10 @@ fi To properly set the group owner of /etc/at.allow, run the command: $ sudo chgrp root /etc/at.allow 2.2.6 - 5.1.9 + 4.1.2.1 If the owner of the at.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-87102-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/at.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/at.allow stat: path: /etc/at.allow @@ -255008,6 +255164,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/at.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255067,19 +255232,10 @@ To properly set the group owner of /etc/cron.allow, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the owner of the cron.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86829-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255115,6 +255271,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255173,19 +255338,10 @@ To properly set the owner of /etc/cron.allow, run the com PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the owner of the cron.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86843-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255219,6 +255375,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255236,19 +255401,10 @@ or more restrictive. To properly set the permissions of /etc/at.allow, run the command: $ sudo chmod 0600 /etc/at.allow 2.2.6 - 5.1.9 + 4.1.2.1 If the permissions of the at.allow file are not set to 0600 or more restrictive, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86903-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/at.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/at.allow stat: path: /etc/at.allow @@ -255280,6 +255436,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/at.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255298,19 +255463,10 @@ To properly set the permissions of /etc/cron.allow, run t $ sudo chmod 0600 /etc/cron.allow 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the permissions of the cron.allow file are not set to 0600 or more restrictive, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86876-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255342,6 +255498,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255453,8 +255618,20 @@ confidentiality in network exchange, usage as uncontrolled communication channel telnet allows clear text communications, and does not protect any data transmission between client and server. Any confidential data can be listened and no integrity checking is made. - -package --remove=inetutils-telnetd + - name: Ensure inetutils-telnetd is removed + package: + name: inetutils-telnetd + state: absent + tags: + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_inetutils-telnetd_removed include remove_inetutils-telnetd @@ -255463,6 +255640,9 @@ class remove_inetutils-telnetd { ensure => 'purged', } } + + +package --remove=inetutils-telnetd # CAUTION: This remediation script will remove inetutils-telnetd @@ -255476,21 +255656,6 @@ if rpm -q --quiet "inetutils-telnetd" ; then yum remove -y "inetutils-telnetd" fi - - - name: Ensure inetutils-telnetd is removed - package: - name: inetutils-telnetd - state: absent - tags: - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_inetutils-telnetd_removed @@ -255501,8 +255666,17 @@ fi The support for Yellowpages should not be installed unless it is required. NIS is the historical SUN service for central account management, more and more replaced by LDAP. NIS does not support efficiently security constraints, ACL, etc. and should not be used. - -package --remove=nis + - name: Ensure nis is removed + package: + name: nis + state: absent + tags: + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_nis_removed include remove_nis @@ -255511,6 +255685,9 @@ class remove_nis { ensure => 'purged', } } + + +package --remove=nis # CAUTION: This remediation script will remove nis @@ -255524,18 +255701,6 @@ if rpm -q --quiet "nis" ; then yum remove -y "nis" fi - - - name: Ensure nis is removed - package: - name: nis - state: absent - tags: - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_nis_removed @@ -255545,8 +255710,17 @@ fi Uninstall the ntpdate package ntpdate is a historical ntp synchronization client for unixes. It sould be uninstalled. ntpdate is an old not security-compliant ntp client. It should be replaced by modern ntp clients such as ntpd, able to use cryptographic mechanisms integrated in NTP. - -package --remove=ntpdate + - name: Ensure ntpdate is removed + package: + name: ntpdate + state: absent + tags: + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_ntpdate_removed include remove_ntpdate @@ -255555,6 +255729,9 @@ class remove_ntpdate { ensure => 'purged', } } + + +package --remove=ntpdate # CAUTION: This remediation script will remove ntpdate @@ -255568,18 +255745,6 @@ if rpm -q --quiet "ntpdate" ; then yum remove -y "ntpdate" fi - - - name: Ensure ntpdate is removed - package: - name: ntpdate - state: absent - tags: - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_ntpdate_removed @@ -255681,8 +255846,20 @@ fi PR.PT-4 telnet, even with ssl support, should not be installed. When remote shell is required, up-to-date ssh daemon can be used. - -package --remove=telnetd-ssl + - name: Ensure telnetd-ssl is removed + package: + name: telnetd-ssl + state: absent + tags: + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnetd-ssl_removed include remove_telnetd-ssl @@ -255691,6 +255868,9 @@ class remove_telnetd-ssl { ensure => 'purged', } } + + +package --remove=telnetd-ssl # CAUTION: This remediation script will remove telnetd-ssl @@ -255704,21 +255884,6 @@ if rpm -q --quiet "telnetd-ssl" ; then yum remove -y "telnetd-ssl" fi - - - name: Ensure telnetd-ssl is removed - package: - name: telnetd-ssl - state: absent - tags: - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnetd-ssl_removed @@ -255823,8 +255988,21 @@ fi any data transmission between client and server. Any confidential data can be listened and no integrity checking is made.' CCE-83302-0 - -package --remove=telnetd + - name: Ensure telnetd is removed + package: + name: telnetd + state: absent + tags: + - CCE-83302-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnetd_removed include remove_telnetd @@ -255833,6 +256011,9 @@ class remove_telnetd { ensure => 'purged', } } + + +package --remove=telnetd # CAUTION: This remediation script will remove telnetd @@ -255846,22 +256027,6 @@ if rpm -q --quiet "telnetd" ; then yum remove -y "telnetd" fi - - - name: Ensure telnetd is removed - package: - name: telnetd - state: absent - tags: - - CCE-83302-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnetd_removed @@ -256537,8 +256702,22 @@ $ sudo yum erase dhcp-server Removing the DHCP server ensures that it cannot be easily or accidentally reactivated and disrupt network operation. CCE-83385-5 - -package --remove=dhcp-server + - name: Ensure dhcp-server is removed + package: + name: dhcp-server + state: absent + tags: + - CCE-83385-5 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dhcp_removed include remove_dhcp-server @@ -256547,6 +256726,9 @@ class remove_dhcp-server { ensure => 'purged', } } + + +package --remove=dhcp-server # CAUTION: This remediation script will remove dhcp-server @@ -256560,23 +256742,6 @@ if rpm -q --quiet "dhcp-server" ; then yum remove -y "dhcp-server" fi - - - name: Ensure dhcp-server is removed - package: - name: dhcp-server - state: absent - tags: - - CCE-83385-5 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dhcp_removed @@ -256666,6 +256831,76 @@ to clients, interfering with the operation of a legitimate site DHCP server if there is one. CCE-82864-0 + - name: Block Disable service dhcpd + block: + + - name: Disable service dhcpd + block: + + - name: Disable service dhcpd + systemd: + name: dhcpd.service + enabled: 'no' + state: stopped + masked: 'yes' + rescue: + + - name: Intentionally ignored previous 'Disable service dhcpd' failure, service + was already disabled + meta: noop + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + +- name: Unit Socket Exists - dhcpd.socket + command: systemctl -q list-unit-files dhcpd.socket + register: socket_file_exists + changed_when: false + failed_when: socket_file_exists.rc not in [0, 1] + check_mode: false + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + +- name: Disable socket dhcpd + systemd: + name: dhcpd.socket + enabled: 'no' + state: stopped + masked: 'yes' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - socket_file_exists.stdout_lines is search("dhcpd.socket",multiline=True) + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -256680,6 +256915,10 @@ spec: - name: dhcpd.socket enabled: false mask: true + + +[customizations.services] +disabled = ["dhcpd"] include disable_dhcpd @@ -256710,80 +256949,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -disabled = ["dhcpd"] - - - name: Block Disable service dhcpd - block: - - - name: Disable service dhcpd - block: - - - name: Disable service dhcpd - systemd: - name: dhcpd.service - enabled: 'no' - state: stopped - masked: 'yes' - rescue: - - - name: Intentionally ignored previous 'Disable service dhcpd' failure, service - was already disabled - meta: noop - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled - -- name: Unit Socket Exists - dhcpd.socket - command: systemctl -q list-unit-files dhcpd.socket - register: socket_file_exists - changed_when: false - failed_when: socket_file_exists.rc not in [0, 1] - check_mode: false - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled - -- name: Disable socket dhcpd - systemd: - name: dhcpd.socket - enabled: 'no' - state: stopped - masked: 'yes' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - socket_file_exists.stdout_lines is search("dhcpd.socket",multiline=True) - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled @@ -256886,8 +257051,21 @@ $ sudo yum erase bind If there is no need to make DNS server software available, removing it provides a safeguard against its activation. CCE-82408-6 - -package --remove=bind + - name: Ensure bind is removed + package: + name: bind + state: absent + tags: + - CCE-82408-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_bind_removed include remove_bind @@ -256896,6 +257074,9 @@ class remove_bind { ensure => 'purged', } } + + +package --remove=bind # CAUTION: This remediation script will remove bind @@ -256909,22 +257090,6 @@ if rpm -q --quiet "bind" ; then yum remove -y "bind" fi - - - name: Ensure bind is removed - package: - name: bind - state: absent - tags: - - CCE-82408-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_bind_removed @@ -257011,55 +257176,6 @@ The named service can be disabled with the following comm implementation flaws and should be disabled if possible. CCE-82409-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: named.service - enabled: false - mask: true - - name: named.socket - enabled: false - mask: true - - include disable_named - -class disable_named { - service {'named': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'named.service' -"$SYSTEMCTL_EXEC" disable 'named.service' -"$SYSTEMCTL_EXEC" mask 'named.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files named.socket; then - "$SYSTEMCTL_EXEC" stop 'named.socket' - "$SYSTEMCTL_EXEC" mask 'named.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'named.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["named"] - - name: Block Disable service named block: @@ -257129,6 +257245,55 @@ disabled = ["named"] - medium_severity - no_reboot_needed - service_named_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: named.service + enabled: false + mask: true + - name: named.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["named"] + + include disable_named + +class disable_named { + service {'named': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'named.service' +"$SYSTEMCTL_EXEC" disable 'named.service' +"$SYSTEMCTL_EXEC" mask 'named.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files named.socket; then + "$SYSTEMCTL_EXEC" stop 'named.socket' + "$SYSTEMCTL_EXEC" mask 'named.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'named.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257430,8 +257595,27 @@ $ sudo yum install fapolicyd fapolicyd (File Access Policy Daemon) implements application whitelisting to decide file access rights. CCE-82191-8 - -package --add=fapolicyd + - name: Ensure fapolicyd is installed + package: + name: fapolicyd + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82191-8 + - DISA-STIG-RHEL-08-040135 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-4(22) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_fapolicyd_installed + + +[[packages]] +name = "fapolicyd" +version = "*" include install_fapolicyd @@ -257440,6 +257624,9 @@ class install_fapolicyd { ensure => 'installed', } } + + +package --add=fapolicyd # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -257451,28 +257638,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "fapolicyd" -version = "*" - - - name: Ensure fapolicyd is installed - package: - name: fapolicyd - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82191-8 - - DISA-STIG-RHEL-08-040135 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-4(22) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_fapolicyd_installed @@ -257500,31 +257665,6 @@ The fapolicyd service can be enabled with the following c The fapolicyd service (File Access Policy Daemon) implements application whitelisting to decide file access rights. CCE-82249-4 - include enable_fapolicyd - -class enable_fapolicyd { - service {'fapolicyd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'fapolicyd.service' -"$SYSTEMCTL_EXEC" start 'fapolicyd.service' -"$SYSTEMCTL_EXEC" enable 'fapolicyd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["fapolicyd"] - - name: Enable service fapolicyd block: @@ -257552,6 +257692,31 @@ enabled = ["fapolicyd"] - medium_severity - no_reboot_needed - service_fapolicyd_enabled + + +[customizations.services] +enabled = ["fapolicyd"] + + include enable_fapolicyd + +class enable_fapolicyd { + service {'fapolicyd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'fapolicyd.service' +"$SYSTEMCTL_EXEC" start 'fapolicyd.service' +"$SYSTEMCTL_EXEC" enable 'fapolicyd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257579,38 +257744,6 @@ Proceed with caution with enforcing the use of this daemon. Improper configuration may render the system non-functional. The "fapolicyd" API is not namespace aware and can cause issues when launching or running containers. CCE-86478-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat > /etc/fapolicyd/rules.d/99-deny-everything.rules << EOF -# Red Hat KCS 7003854 (https://access.redhat.com/solutions/7003854) -deny perm=any all : all -EOF - -chmod 644 /etc/fapolicyd/rules.d/99-deny-everything.rules -chgrp fapolicyd /etc/fapolicyd/rules.d/99-deny-everything.rules - -if [ -e "/etc/fapolicyd/fapolicyd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*permissive\s*=\s*/Id" "/etc/fapolicyd/fapolicyd.conf" -else - touch "/etc/fapolicyd/fapolicyd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/fapolicyd/fapolicyd.conf" - -cp "/etc/fapolicyd/fapolicyd.conf" "/etc/fapolicyd/fapolicyd.conf.bak" -# Insert at the end of the file -printf '%s\n' "permissive = 0" >> "/etc/fapolicyd/fapolicyd.conf" -# Clean up after ourselves. -rm "/etc/fapolicyd/fapolicyd.conf.bak" - -systemctl restart fapolicyd - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. - Ensure a Final Rule Denying Everything @@ -257681,6 +257814,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat > /etc/fapolicyd/rules.d/99-deny-everything.rules << EOF +# Red Hat KCS 7003854 (https://access.redhat.com/solutions/7003854) +deny perm=any all : all +EOF + +chmod 644 /etc/fapolicyd/rules.d/99-deny-everything.rules +chgrp fapolicyd /etc/fapolicyd/rules.d/99-deny-everything.rules + +if [ -e "/etc/fapolicyd/fapolicyd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*permissive\s*=\s*/Id" "/etc/fapolicyd/fapolicyd.conf" +else + touch "/etc/fapolicyd/fapolicyd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/fapolicyd/fapolicyd.conf" + +cp "/etc/fapolicyd/fapolicyd.conf" "/etc/fapolicyd/fapolicyd.conf.bak" +# Insert at the end of the file +printf '%s\n' "permissive = 0" >> "/etc/fapolicyd/fapolicyd.conf" +# Clean up after ourselves. +rm "/etc/fapolicyd/fapolicyd.conf.bak" + +systemctl restart fapolicyd + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257731,8 +257896,19 @@ is recommended SFTP be used if file transfer is required. Unless there is a need to run the system as a FTP server (for example, to allow anonymous downloads), it is recommended that the package be removed to reduce the potential attack surface. CCE-90745-1 - -package --remove=ftp + - name: Ensure ftp is removed + package: + name: ftp + state: absent + tags: + - CCE-90745-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_ftp_removed include remove_ftp @@ -257741,6 +257917,9 @@ class remove_ftp { ensure => 'purged', } } + + +package --remove=ftp # CAUTION: This remediation script will remove ftp @@ -257754,20 +257933,6 @@ if rpm -q --quiet "ftp" ; then yum remove -y "ftp" fi - - - name: Ensure ftp is removed - package: - name: ftp - state: absent - tags: - - CCE-90745-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_ftp_removed @@ -257866,8 +258031,26 @@ possible. Removing the vsftpd package decreases the risk of its accidental activation. CCE-82414-4 - -package --remove=vsftpd + - name: Ensure vsftpd is removed + package: + name: vsftpd + state: absent + tags: + - CCE-82414-4 + - DISA-STIG-RHEL-08-040360 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-CM-7.1(ii) + - NIST-800-53-IA-5(1)(c) + - NIST-800-53-IA-5(1).1(v) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_vsftpd_removed include remove_vsftpd @@ -257876,6 +258059,9 @@ class remove_vsftpd { ensure => 'purged', } } + + +package --remove=vsftpd # CAUTION: This remediation script will remove vsftpd @@ -257889,27 +258075,6 @@ if rpm -q --quiet "vsftpd" ; then yum remove -y "vsftpd" fi - - - name: Ensure vsftpd is removed - package: - name: vsftpd - state: absent - tags: - - CCE-82414-4 - - DISA-STIG-RHEL-08-040360 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-CM-7.1(ii) - - NIST-800-53-IA-5(1)(c) - - NIST-800-53-IA-5(1).1(v) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_vsftpd_removed @@ -257998,55 +258163,6 @@ Furthermore, the FTP protocol is unencrypted and creates a risk of compromising sensitive information. CCE-82413-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: vsftpd.service - enabled: false - mask: true - - name: vsftpd.socket - enabled: false - mask: true - - include disable_vsftpd - -class disable_vsftpd { - service {'vsftpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'vsftpd.service' -"$SYSTEMCTL_EXEC" disable 'vsftpd.service' -"$SYSTEMCTL_EXEC" mask 'vsftpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files vsftpd.socket; then - "$SYSTEMCTL_EXEC" stop 'vsftpd.socket' - "$SYSTEMCTL_EXEC" mask 'vsftpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'vsftpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["vsftpd"] - - name: Block Disable service vsftpd block: @@ -258116,6 +258232,55 @@ disabled = ["vsftpd"] - medium_severity - no_reboot_needed - service_vsftpd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: vsftpd.service + enabled: false + mask: true + - name: vsftpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["vsftpd"] + + include disable_vsftpd + +class disable_vsftpd { + service {'vsftpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'vsftpd.service' +"$SYSTEMCTL_EXEC" disable 'vsftpd.service' +"$SYSTEMCTL_EXEC" mask 'vsftpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files vsftpd.socket; then + "$SYSTEMCTL_EXEC" stop 'vsftpd.socket' + "$SYSTEMCTL_EXEC" mask 'vsftpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'vsftpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -258410,27 +258575,6 @@ $ sudo yum install vsftpd Red Hat Enterprise Linux to distributing vsftpd. For security and for consistency with future Red Hat releases, the use of vsftpd is recommended. CCE-82411-0 - -package --add=vsftpd - - include install_vsftpd - -class install_vsftpd { - package { 'vsftpd': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "vsftpd" ; then - yum install -y "vsftpd" -fi - - -[[packages]] -name = "vsftpd" -version = "*" - - name: Ensure vsftpd is installed package: name: vsftpd @@ -258444,6 +258588,27 @@ version = "*" - low_severity - no_reboot_needed - package_vsftpd_installed + + +[[packages]] +name = "vsftpd" +version = "*" + + include install_vsftpd + +class install_vsftpd { + package { 'vsftpd': + ensure => 'installed', + } +} + + +package --add=vsftpd + + +if ! rpm -q --quiet "vsftpd" ; then + yum install -y "vsftpd" +fi @@ -258545,8 +258710,21 @@ $ sudo yum erase httpd If there is no need to make the web server software available, removing it provides a safeguard against its activation. CCE-85970-2 - -package --remove=httpd + - name: Ensure httpd is removed + package: + name: httpd + state: absent + tags: + - CCE-85970-2 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_httpd_removed + - unknown_severity include remove_httpd @@ -258555,6 +258733,9 @@ class remove_httpd { ensure => 'purged', } } + + +package --remove=httpd # CAUTION: This remediation script will remove httpd @@ -258568,22 +258749,6 @@ if rpm -q --quiet "httpd" ; then yum remove -y "httpd" fi - - - name: Ensure httpd is removed - package: - name: httpd - state: absent - tags: - - CCE-85970-2 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_httpd_removed - - unknown_severity @@ -258669,55 +258834,6 @@ The httpd service can be disabled with the following comm of attack, and should be disabled if not needed. CCE-82761-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: httpd.service - enabled: false - mask: true - - name: httpd.socket - enabled: false - mask: true - - include disable_httpd - -class disable_httpd { - service {'httpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'httpd.service' -"$SYSTEMCTL_EXEC" disable 'httpd.service' -"$SYSTEMCTL_EXEC" mask 'httpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files httpd.socket; then - "$SYSTEMCTL_EXEC" stop 'httpd.socket' - "$SYSTEMCTL_EXEC" mask 'httpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'httpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["httpd"] - - name: Block Disable service httpd block: @@ -258787,6 +258903,55 @@ disabled = ["httpd"] - no_reboot_needed - service_httpd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: httpd.service + enabled: false + mask: true + - name: httpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["httpd"] + + include disable_httpd + +class disable_httpd { + service {'httpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'httpd.service' +"$SYSTEMCTL_EXEC" disable 'httpd.service' +"$SYSTEMCTL_EXEC" mask 'httpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files httpd.socket; then + "$SYSTEMCTL_EXEC" stop 'httpd.socket' + "$SYSTEMCTL_EXEC" mask 'httpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'httpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -258872,8 +259037,21 @@ $ sudo yum erase nginx If there is no need to make the web server software available, removing it provides a safeguard against its activation. CCE-88034-4 - -package --remove=nginx + - name: Ensure nginx is removed + package: + name: nginx + state: absent + tags: + - CCE-88034-4 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_nginx_removed + - unknown_severity include remove_nginx @@ -258882,6 +259060,9 @@ class remove_nginx { ensure => 'purged', } } + + +package --remove=nginx # CAUTION: This remediation script will remove nginx @@ -258895,22 +259076,6 @@ if rpm -q --quiet "nginx" ; then yum remove -y "nginx" fi - - - name: Ensure nginx is removed - package: - name: nginx - state: absent - tags: - - CCE-88034-4 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_nginx_removed - - unknown_severity @@ -259437,13 +259602,6 @@ these files. PR.PT-3 Access to the web server's configuration files may allow an unauthorized user or attacker to access information about the web server or to alter the server's configuration files. - - - - - -find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/httpd/conf.d/ file(s) command: find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*$" @@ -259481,6 +259639,13 @@ find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex - low_disruption - no_reboot_needed - unknown_severity + + + + + + +find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -259562,13 +259727,6 @@ find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex PR.PT-3 Access to the web server's configuration files may allow an unauthorized user or attacker to access information about the web server or to alter the server's configuration files. - - - - - -find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/httpd/conf/ file(s) command: find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*$" @@ -259606,6 +259764,13 @@ find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^ - low_disruption - no_reboot_needed - unknown_severity + + + + + + +find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -260712,8 +260877,18 @@ $ sudo yum erase cyrus-imapd If there is no need to make the cyrus-imapd software available, removing it provides a safeguard against its activation. CCE-88119-3 - -package --remove=cyrus-imapd + - name: Ensure cyrus-imapd is removed + package: + name: cyrus-imapd + state: absent + tags: + - CCE-88119-3 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_cyrus-imapd_removed + - unknown_severity include remove_cyrus-imapd @@ -260722,6 +260897,9 @@ class remove_cyrus-imapd { ensure => 'purged', } } + + +package --remove=cyrus-imapd # CAUTION: This remediation script will remove cyrus-imapd @@ -260735,19 +260913,6 @@ if rpm -q --quiet "cyrus-imapd" ; then yum remove -y "cyrus-imapd" fi - - - name: Ensure cyrus-imapd is removed - package: - name: cyrus-imapd - state: absent - tags: - - CCE-88119-3 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_cyrus-imapd_removed - - unknown_severity @@ -260771,8 +260936,18 @@ $ sudo yum erase dovecot If there is no need to make the Dovecot software available, removing it provides a safeguard against its activation. CCE-85976-9 - -package --remove=dovecot + - name: Ensure dovecot is removed + package: + name: dovecot + state: absent + tags: + - CCE-85976-9 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_dovecot_removed + - unknown_severity include remove_dovecot @@ -260781,6 +260956,9 @@ class remove_dovecot { ensure => 'purged', } } + + +package --remove=dovecot # CAUTION: This remediation script will remove dovecot @@ -260794,19 +260972,6 @@ if rpm -q --quiet "dovecot" ; then yum remove -y "dovecot" fi - - - name: Ensure dovecot is removed - package: - name: dovecot - state: absent - tags: - - CCE-85976-9 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_dovecot_removed - - unknown_severity @@ -260825,55 +260990,6 @@ The dovecot service can be disabled with the following co avenue of attack, and should be disabled if not needed. CCE-82760-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: dovecot.service - enabled: false - mask: true - - name: dovecot.socket - enabled: false - mask: true - - include disable_dovecot - -class disable_dovecot { - service {'dovecot': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'dovecot.service' -"$SYSTEMCTL_EXEC" disable 'dovecot.service' -"$SYSTEMCTL_EXEC" mask 'dovecot.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files dovecot.socket; then - "$SYSTEMCTL_EXEC" stop 'dovecot.socket' - "$SYSTEMCTL_EXEC" mask 'dovecot.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'dovecot.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["dovecot"] - - name: Block Disable service dovecot block: @@ -260934,6 +261050,55 @@ disabled = ["dovecot"] - no_reboot_needed - service_dovecot_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: dovecot.service + enabled: false + mask: true + - name: dovecot.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["dovecot"] + + include disable_dovecot + +class disable_dovecot { + service {'dovecot': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'dovecot.service' +"$SYSTEMCTL_EXEC" disable 'dovecot.service' +"$SYSTEMCTL_EXEC" mask 'dovecot.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files dovecot.socket; then + "$SYSTEMCTL_EXEC" stop 'dovecot.socket' + "$SYSTEMCTL_EXEC" mask 'dovecot.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'dovecot.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -260974,8 +261139,22 @@ surface of the system. While this software is clearly essential on an KDC server, it is not necessary on typical desktop or workstation systems. CCE-85887-8 - -package --remove=krb5-server + - name: Ensure krb5-server is removed + package: + name: krb5-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-85887-8 + - DISA-STIG-RHEL-08-010163 + - NIST-800-53-IA-7 + - NIST-800-53-IA-7.1 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_krb5-server_removed include remove_krb5-server @@ -260984,6 +261163,9 @@ class remove_krb5-server { ensure => 'purged', } } + + +package --remove=krb5-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -261003,23 +261185,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure krb5-server is removed - package: - name: krb5-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85887-8 - - DISA-STIG-RHEL-08-010163 - - NIST-800-53-IA-7 - - NIST-800-53-IA-7.1 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_krb5-server_removed @@ -261045,15 +261210,6 @@ remove the Kerberos keytab files, especially The key derivation function (KDF) in Kerberos is not FIPS compatible. CCE-82175-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -rm -f /etc/*.keytab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find keytab files find: paths: /etc/ @@ -261085,6 +261241,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +rm -f /etc/*.keytab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -261181,8 +261346,21 @@ intended for use as an LDAP Server it should be removed. surface of the system. While this software is clearly essential on an LDAP server, it is not necessary on typical desktop or workstation systems. CCE-82728-7 - -package --remove=389-ds-base + - name: Ensure 389-ds-base is removed + package: + name: 389-ds-base + state: absent + tags: + - CCE-82728-7 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_389-ds-base_removed include remove_389-ds-base @@ -261191,6 +261369,9 @@ class remove_389-ds-base { ensure => 'purged', } } + + +package --remove=389-ds-base # CAUTION: This remediation script will remove 389-ds-base @@ -261204,22 +261385,6 @@ if rpm -q --quiet "389-ds-base" ; then yum remove -y "389-ds-base" fi - - - name: Ensure 389-ds-base is removed - package: - name: 389-ds-base - state: absent - tags: - - CCE-82728-7 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_389-ds-base_removed @@ -261253,8 +261418,18 @@ $ sudo yum erase openldap-clients 2.3.2 If the system does not need to act as an LDAP client, it is recommended that the software is removed to reduce the potential attack surface. CCE-82885-5 - -package --remove=openldap-clients + - name: Ensure openldap-clients is removed + package: + name: openldap-clients + state: absent + tags: + - CCE-82885-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_openldap-clients_removed include remove_openldap-clients @@ -261263,6 +261438,9 @@ class remove_openldap-clients { ensure => 'purged', } } + + +package --remove=openldap-clients # CAUTION: This remediation script will remove openldap-clients @@ -261276,19 +261454,6 @@ if rpm -q --quiet "openldap-clients" ; then yum remove -y "openldap-clients" fi - - - name: Ensure openldap-clients is removed - package: - name: openldap-clients - state: absent - tags: - - CCE-82885-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_openldap-clients_removed @@ -261755,8 +261920,21 @@ intended for use as an LDAP Server it should be removed. surface of the system. While this software is clearly essential on an LDAP server, it is not necessary on typical desktop or workstation systems. CCE-82415-1 - -package --remove=openldap-servers + - name: Ensure openldap-servers is removed + package: + name: openldap-servers + state: absent + tags: + - CCE-82415-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_openldap-servers_removed include remove_openldap-servers @@ -261765,6 +261943,9 @@ class remove_openldap-servers { ensure => 'purged', } } + + +package --remove=openldap-servers # CAUTION: This remediation script will remove openldap-servers @@ -261778,22 +261959,6 @@ if rpm -q --quiet "openldap-servers" ; then yum remove -y "openldap-servers" fi - - - name: Ensure openldap-servers is removed - package: - name: openldap-servers - state: absent - tags: - - CCE-82415-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_openldap-servers_removed @@ -261809,55 +261974,6 @@ fi disabled to reduce the potential attack surface. CCE-87262-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: slapd.service - enabled: false - mask: true - - name: slapd.socket - enabled: false - mask: true - - include disable_slapd - -class disable_slapd { - service {'slapd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'slapd.service' -"$SYSTEMCTL_EXEC" disable 'slapd.service' -"$SYSTEMCTL_EXEC" mask 'slapd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files slapd.socket; then - "$SYSTEMCTL_EXEC" stop 'slapd.socket' - "$SYSTEMCTL_EXEC" mask 'slapd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'slapd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["slapd"] - - name: Block Disable service slapd block: @@ -261918,6 +262034,55 @@ disabled = ["slapd"] - medium_severity - no_reboot_needed - service_slapd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: slapd.service + enabled: false + mask: true + - name: slapd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["slapd"] + + include disable_slapd + +class disable_slapd { + service {'slapd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'slapd.service' +"$SYSTEMCTL_EXEC" disable 'slapd.service' +"$SYSTEMCTL_EXEC" mask 'slapd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files slapd.socket; then + "$SYSTEMCTL_EXEC" stop 'slapd.socket' + "$SYSTEMCTL_EXEC" mask 'slapd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'slapd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -261993,8 +262158,26 @@ $ sudo yum install mailx Emails can be used to notify designated personnel about important system events such as failures or warnings. CCE-87036-0 - -package --add=mailx + - name: Ensure mailx is installed + package: + name: mailx + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-87036-0 + - DISA-STIG-RHEL-08-010358 + - NIST-800-53-CM-3(5) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_mailx_installed + + +[[packages]] +name = "mailx" +version = "*" include install_mailx @@ -262003,6 +262186,9 @@ class install_mailx { ensure => 'installed', } } + + +package --add=mailx # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262014,27 +262200,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "mailx" -version = "*" - - - name: Ensure mailx is installed - package: - name: mailx - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-87036-0 - - DISA-STIG-RHEL-08-010358 - - NIST-800-53-CM-3(5) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_mailx_installed @@ -262055,8 +262220,25 @@ $ sudo yum install postfix Emails can be used to notify designated personnel about important system events such as failures or warnings. CCE-85983-5 - -package --add=postfix + - name: Ensure postfix is installed + package: + name: postfix + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-85983-5 + - DISA-STIG-RHEL-08-030030 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_postfix_installed + + +[[packages]] +name = "postfix" +version = "*" include install_postfix @@ -262065,6 +262247,9 @@ class install_postfix { ensure => 'installed', } } + + +package --add=postfix # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262076,26 +262261,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "postfix" -version = "*" - - - name: Ensure postfix is installed - package: - name: postfix - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85983-5 - - DISA-STIG-RHEL-08-030030 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_postfix_installed @@ -262188,8 +262353,23 @@ $ sudo yum erase sendmail its design prevents it from being effectively contained by SELinux. Postfix should be used instead. CCE-81039-0 - -package --remove=sendmail + - name: Ensure sendmail is removed + package: + name: sendmail + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81039-0 + - DISA-STIG-RHEL-08-040002 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_sendmail_removed include remove_sendmail @@ -262198,6 +262378,9 @@ class remove_sendmail { ensure => 'purged', } } + + +package --remove=sendmail # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262217,24 +262400,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure sendmail is removed - package: - name: sendmail - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81039-0 - - DISA-STIG-RHEL-08-040002 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_sendmail_removed @@ -262254,31 +262419,6 @@ The postfix service can be enabled with the following com $ sudo systemctl enable postfix.service Local mail delivery is essential to some system maintenance and notification tasks. - include enable_postfix - -class enable_postfix { - service {'postfix': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'postfix.service' -"$SYSTEMCTL_EXEC" start 'postfix.service' -"$SYSTEMCTL_EXEC" enable 'postfix.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["postfix"] - - name: Enable service postfix block: @@ -262302,6 +262442,31 @@ enabled = ["postfix"] - no_reboot_needed - service_postfix_enabled - unknown_severity + + +[customizations.services] +enabled = ["postfix"] + + include enable_postfix + +class enable_postfix { + service {'postfix': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'postfix.service' +"$SYSTEMCTL_EXEC" start 'postfix.service' +"$SYSTEMCTL_EXEC" enable 'postfix.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262370,42 +262535,6 @@ $ sudo newaliases notify system administrators of active or impending issues. These messages must be forwarded to at least one monitored email address. CCE-82381-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_postfix_root_mail_alias='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^root") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s: %s" "$stripped_key" "$var_postfix_root_mail_alias" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^root\\>" "/etc/aliases"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^root\\>.*/$escaped_formatted_output/gi" "/etc/aliases" -else - if [[ -s "/etc/aliases" ]] && [[ -n "$(tail -c 1 -- "/etc/aliases" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/aliases" - fi - cce="CCE-82381-5" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/aliases" >> "/etc/aliases" - printf '%s\n' "$formatted_output" >> "/etc/aliases" -fi - -if [ -f /usr/bin/newaliases ]; then - newaliases -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_postfix_root_mail_alias # promote to variable set_fact: var_postfix_root_mail_alias: !!str @@ -262460,6 +262589,42 @@ fi - medium_severity - no_reboot_needed - postfix_client_configure_mail_alias + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_postfix_root_mail_alias='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^root") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s: %s" "$stripped_key" "$var_postfix_root_mail_alias" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^root\\>" "/etc/aliases"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^root\\>.*/$escaped_formatted_output/gi" "/etc/aliases" +else + if [[ -s "/etc/aliases" ]] && [[ -n "$(tail -c 1 -- "/etc/aliases" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/aliases" + fi + cce="CCE-82381-5" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/aliases" >> "/etc/aliases" + printf '%s\n' "$formatted_output" >> "/etc/aliases" +fi + +if [ -f /usr/bin/newaliases ]; then + newaliases +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262490,32 +262655,6 @@ affected. Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. CCE-89063-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/aliases" ] ; then - - LC_ALL=C sed -i "/^\s*postmaster\s*:\s*/Id" "/etc/aliases" -else - touch "/etc/aliases" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/aliases" - -cp "/etc/aliases" "/etc/aliases.bak" -# Insert at the end of the file -printf '%s\n' "postmaster: root" >> "/etc/aliases" -# Clean up after ourselves. -rm "/etc/aliases.bak" - -if [ -f /usr/bin/newaliases ]; then - newaliases -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Configure System to Forward All Mail From Postmaster to The Root Account block: @@ -262591,6 +262730,32 @@ fi - medium_severity - no_reboot_needed - postfix_client_configure_mail_alias_postmaster + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/aliases" ] ; then + + LC_ALL=C sed -i "/^\s*postmaster\s*:\s*/Id" "/etc/aliases" +else + touch "/etc/aliases" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/aliases" + +cp "/etc/aliases" "/etc/aliases.bak" +# Insert at the end of the file +printf '%s\n' "postmaster: root" >> "/etc/aliases" +# Clean up after ourselves. +rm "/etc/aliases.bak" + +if [ -f /usr/bin/newaliases ]; then + newaliases +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262694,33 +262859,6 @@ may help prevent spam or viruses from being delivered. and not from the network, which protects it from network attack. CCE-82174-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q postfix; }; then - -var_postfix_inet_interfaces='' - - -if [ -e "/etc/postfix/main.cf" ] ; then - - LC_ALL=C sed -i "/^\s*inet_interfaces\s\+=\s\+/Id" "/etc/postfix/main.cf" -else - touch "/etc/postfix/main.cf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/postfix/main.cf" - -cp "/etc/postfix/main.cf" "/etc/postfix/main.cf.bak" -# Insert at the end of the file -printf '%s\n' "inet_interfaces=$var_postfix_inet_interfaces" >> "/etc/postfix/main.cf" -# Clean up after ourselves. -rm "/etc/postfix/main.cf.bak" - -systemctl restart postfix - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_postfix_inet_interfaces # promote to variable set_fact: var_postfix_inet_interfaces: !!str @@ -262770,6 +262908,33 @@ fi - no_reboot_needed - postfix_network_listening_disabled - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q postfix; }; then + +var_postfix_inet_interfaces='' + + +if [ -e "/etc/postfix/main.cf" ] ; then + + LC_ALL=C sed -i "/^\s*inet_interfaces\s\+=\s\+/Id" "/etc/postfix/main.cf" +else + touch "/etc/postfix/main.cf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/postfix/main.cf" + +cp "/etc/postfix/main.cf" "/etc/postfix/main.cf.bak" +# Insert at the end of the file +printf '%s\n' "inet_interfaces=$var_postfix_inet_interfaces" >> "/etc/postfix/main.cf" +# Clean up after ourselves. +rm "/etc/postfix/main.cf.bak" + +systemctl restart postfix + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262911,19 +263076,6 @@ to the local network with the following command: host as a mail relay for the purpose of sending spam or other unauthorized activity. CCE-84054-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q postfix; then - -if ! grep -q ^smtpd_client_restrictions /etc/postfix/main.cf; then - echo "smtpd_client_restrictions = permit_mynetworks,reject" >> /etc/postfix/main.cf -else - sed -i "s/^smtpd_client_restrictions.*/smtpd_client_restrictions = permit_mynetworks,reject/g" /etc/postfix/main.cf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -262977,6 +263129,19 @@ fi - no_reboot_needed - postfix_prevent_unrestricted_relay - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q postfix; then + +if ! grep -q ^smtpd_client_restrictions /etc/postfix/main.cf; then + echo "smtpd_client_restrictions = permit_mynetworks,reject" >> /etc/postfix/main.cf +else + sed -i "s/^smtpd_client_restrictions.*/smtpd_client_restrictions = permit_mynetworks,reject/g" /etc/postfix/main.cf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -263075,8 +263240,18 @@ daemon on a remote host for information about the Network File System (NFS) serv remote host. For example, showmount can display the clients which are mounted on that host. CCE-82932-5 - -package --remove=nfs-utils + - name: Ensure nfs-utils is removed + package: + name: nfs-utils + state: absent + tags: + - CCE-82932-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_nfs-utils_removed include remove_nfs-utils @@ -263085,6 +263260,9 @@ class remove_nfs-utils { ensure => 'purged', } } + + +package --remove=nfs-utils # CAUTION: This remediation script will remove nfs-utils @@ -263098,19 +263276,6 @@ if rpm -q --quiet "nfs-utils" ; then yum remove -y "nfs-utils" fi - - - name: Ensure nfs-utils is removed - package: - name: nfs-utils - state: absent - tags: - - CCE-82932-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_nfs-utils_removed @@ -263145,6 +263310,64 @@ and against flaws in the netfs script itself. The netfs service can be disabled with the following command: $ sudo systemctl mask --now netfs.service + - name: Block Disable service netfs + block: + + - name: Disable service netfs + block: + + - name: Disable service netfs + systemd: + name: netfs.service + enabled: 'no' + state: stopped + masked: 'yes' + rescue: + + - name: Intentionally ignored previous 'Disable service netfs' failure, service + was already disabled + meta: noop + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + +- name: Unit Socket Exists - netfs.socket + command: systemctl -q list-unit-files netfs.socket + register: socket_file_exists + changed_when: false + failed_when: socket_file_exists.rc not in [0, 1] + check_mode: false + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + +- name: Disable socket netfs + systemd: + name: netfs.socket + enabled: 'no' + state: stopped + masked: 'yes' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - socket_file_exists.stdout_lines is search("netfs.socket",multiline=True) + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -263159,6 +263382,10 @@ spec: - name: netfs.socket enabled: false mask: true + + +[customizations.services] +disabled = ["netfs"] include disable_netfs @@ -263189,68 +263416,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -disabled = ["netfs"] - - - name: Block Disable service netfs - block: - - - name: Disable service netfs - block: - - - name: Disable service netfs - systemd: - name: netfs.service - enabled: 'no' - state: stopped - masked: 'yes' - rescue: - - - name: Intentionally ignored previous 'Disable service netfs' failure, service - was already disabled - meta: noop - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity - -- name: Unit Socket Exists - netfs.socket - command: systemctl -q list-unit-files netfs.socket - register: socket_file_exists - changed_when: false - failed_when: socket_file_exists.rc not in [0, 1] - check_mode: false - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity - -- name: Disable socket netfs - systemd: - name: netfs.socket - enabled: 'no' - state: stopped - masked: 'yes' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - socket_file_exists.stdout_lines is search("netfs.socket",multiline=True) - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity @@ -263280,8 +263445,19 @@ $ sudo yum erase rpcbind If the system does not require rpc based services, it is recommended that rpcbind be disabled to reduce the attack surface. CCE-86645-9 - -package --remove=rpcbind + - name: Ensure rpcbind is removed + package: + name: rpcbind + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86645-9 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_rpcbind_removed include remove_rpcbind @@ -263290,6 +263466,9 @@ class remove_rpcbind { ensure => 'purged', } } + + +package --remove=rpcbind # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -263309,20 +263488,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure rpcbind is removed - package: - name: rpcbind - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86645-9 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_rpcbind_removed @@ -263341,55 +263506,6 @@ this service should be disabled. The nfslock service can be disabled with the following command: $ sudo systemctl mask --now nfslock.service - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nfslock.service - enabled: false - mask: true - - name: nfslock.socket - enabled: false - mask: true - - include disable_nfslock - -class disable_nfslock { - service {'nfslock': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nfslock.service' -"$SYSTEMCTL_EXEC" disable 'nfslock.service' -"$SYSTEMCTL_EXEC" mask 'nfslock.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nfslock.socket; then - "$SYSTEMCTL_EXEC" stop 'nfslock.socket' - "$SYSTEMCTL_EXEC" mask 'nfslock.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nfslock.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nfslock"] - - name: Block Disable service nfslock block: @@ -263448,27 +263564,7 @@ disabled = ["nfslock"] - service_nfslock_disabled - unknown_severity - - - - - - Disable rpcbind Service - The rpcbind utility maps RPC services to the ports on which they listen. -RPC processes notify rpcbind when they start, registering the ports they -are listening on and the RPC program numbers they expect to serve. The -rpcbind service redirects the client to the proper port number so it can -communicate with the requested service. If the system does not require RPC -(such as for NFS servers) then this service should be disabled. - -The rpcbind service can be disabled with the following command: -$ sudo systemctl mask --now rpcbind.service - 2.2.4 - 2.2.12 - If the system does not require rpc based services, it is recommended that -rpcbind be disabled to reduce the attack surface. - CCE-82858-2 - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263476,47 +263572,67 @@ spec: version: 3.1.0 systemd: units: - - name: rpcbind.service + - name: nfslock.service enabled: false mask: true - - name: rpcbind.socket + - name: nfslock.socket enabled: false mask: true - include disable_rpcbind + +[customizations.services] +disabled = ["nfslock"] + + include disable_nfslock -class disable_rpcbind { - service {'rpcbind': +class disable_nfslock { + service {'nfslock': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcbind.service' -"$SYSTEMCTL_EXEC" disable 'rpcbind.service' -"$SYSTEMCTL_EXEC" mask 'rpcbind.service' +"$SYSTEMCTL_EXEC" stop 'nfslock.service' +"$SYSTEMCTL_EXEC" disable 'nfslock.service' +"$SYSTEMCTL_EXEC" mask 'nfslock.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcbind.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcbind.socket' - "$SYSTEMCTL_EXEC" mask 'rpcbind.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files nfslock.socket; then + "$SYSTEMCTL_EXEC" stop 'nfslock.socket' + "$SYSTEMCTL_EXEC" mask 'nfslock.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcbind.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'nfslock.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcbind"] - + + + + + + Disable rpcbind Service + The rpcbind utility maps RPC services to the ports on which they listen. +RPC processes notify rpcbind when they start, registering the ports they +are listening on and the RPC program numbers they expect to serve. The +rpcbind service redirects the client to the proper port number so it can +communicate with the requested service. If the system does not require RPC +(such as for NFS servers) then this service should be disabled. + +The rpcbind service can be disabled with the following command: +$ sudo systemctl mask --now rpcbind.service + 2.2.4 + 2.2.12 + If the system does not require rpc based services, it is recommended that +rpcbind be disabled to reduce the attack surface. + CCE-82858-2 - name: Block Disable service rpcbind block: @@ -263581,21 +263697,7 @@ disabled = ["rpcbind"] - no_reboot_needed - service_rpcbind_disabled - - - - - - Disable Secure RPC Client Service (rpcgssd) - The rpcgssd service manages RPCSEC GSS contexts required to secure protocols -that use RPC (most often Kerberos and NFS). The rpcgssd service is the -client-side of RPCSEC GSS. If the system does not require secure RPC then this -service should be disabled. - -The rpcgssd service can be disabled with the following command: -$ sudo systemctl mask --now rpcgssd.service - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263603,47 +263705,61 @@ spec: version: 3.1.0 systemd: units: - - name: rpcgssd.service + - name: rpcbind.service enabled: false mask: true - - name: rpcgssd.socket + - name: rpcbind.socket enabled: false mask: true - include disable_rpcgssd + +[customizations.services] +disabled = ["rpcbind"] + + include disable_rpcbind -class disable_rpcgssd { - service {'rpcgssd': +class disable_rpcbind { + service {'rpcbind': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcgssd.service' -"$SYSTEMCTL_EXEC" disable 'rpcgssd.service' -"$SYSTEMCTL_EXEC" mask 'rpcgssd.service' +"$SYSTEMCTL_EXEC" stop 'rpcbind.service' +"$SYSTEMCTL_EXEC" disable 'rpcbind.service' +"$SYSTEMCTL_EXEC" mask 'rpcbind.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcgssd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcgssd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcgssd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcbind.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcbind.socket' + "$SYSTEMCTL_EXEC" mask 'rpcbind.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcgssd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'rpcbind.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcgssd"] - + + + + + + Disable Secure RPC Client Service (rpcgssd) + The rpcgssd service manages RPCSEC GSS contexts required to secure protocols +that use RPC (most often Kerberos and NFS). The rpcgssd service is the +client-side of RPCSEC GSS. If the system does not require secure RPC then this +service should be disabled. + +The rpcgssd service can be disabled with the following command: +$ sudo systemctl mask --now rpcgssd.service + - name: Block Disable service rpcgssd block: @@ -263702,20 +263818,7 @@ disabled = ["rpcgssd"] - service_rpcgssd_disabled - unknown_severity - - - - - - Disable RPC ID Mapping Service (rpcidmapd) - The rpcidmapd service is used to map user names and groups to UID -and GID numbers on NFSv4 mounts. If NFS is not in use on the local system then -this service should be disabled. - -The rpcidmapd service can be disabled with the following command: -$ sudo systemctl mask --now rpcidmapd.service - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263723,47 +263826,60 @@ spec: version: 3.1.0 systemd: units: - - name: rpcidmapd.service + - name: rpcgssd.service enabled: false mask: true - - name: rpcidmapd.socket + - name: rpcgssd.socket enabled: false mask: true - include disable_rpcidmapd + +[customizations.services] +disabled = ["rpcgssd"] + + include disable_rpcgssd -class disable_rpcidmapd { - service {'rpcidmapd': +class disable_rpcgssd { + service {'rpcgssd': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcidmapd.service' -"$SYSTEMCTL_EXEC" disable 'rpcidmapd.service' -"$SYSTEMCTL_EXEC" mask 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" stop 'rpcgssd.service' +"$SYSTEMCTL_EXEC" disable 'rpcgssd.service' +"$SYSTEMCTL_EXEC" mask 'rpcgssd.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcidmapd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcidmapd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcidmapd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcgssd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcgssd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcgssd.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcidmapd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'rpcgssd.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcidmapd"] - + + + + + + Disable RPC ID Mapping Service (rpcidmapd) + The rpcidmapd service is used to map user names and groups to UID +and GID numbers on NFSv4 mounts. If NFS is not in use on the local system then +this service should be disabled. + +The rpcidmapd service can be disabled with the following command: +$ sudo systemctl mask --now rpcidmapd.service + - name: Block Disable service rpcidmapd block: @@ -263821,6 +263937,55 @@ disabled = ["rpcidmapd"] - no_reboot_needed - service_rpcidmapd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rpcidmapd.service + enabled: false + mask: true + - name: rpcidmapd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rpcidmapd"] + + include disable_rpcidmapd + +class disable_rpcidmapd { + service {'rpcidmapd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" disable 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" mask 'rpcidmapd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcidmapd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcidmapd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcidmapd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rpcidmapd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -263999,55 +264164,6 @@ The nfs-server service can be disabled with the following Unnecessary services should be disabled to decrease the attack surface of the system. CCE-82762-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nfs-server.service - enabled: false - mask: true - - name: nfs-server.socket - enabled: false - mask: true - - include disable_nfs-server - -class disable_nfs-server { - service {'nfs-server': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nfs-server.service' -"$SYSTEMCTL_EXEC" disable 'nfs-server.service' -"$SYSTEMCTL_EXEC" mask 'nfs-server.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nfs-server.socket; then - "$SYSTEMCTL_EXEC" stop 'nfs-server.socket' - "$SYSTEMCTL_EXEC" mask 'nfs-server.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nfs-server.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nfs-server"] - - name: Block Disable service nfs-server block: @@ -264118,25 +264234,7 @@ disabled = ["nfs-server"] - service_nfs_disabled - unknown_severity - - - - - - - - - Disable Secure RPC Server Service (rpcsvcgssd) - The rpcsvcgssd service manages RPCSEC GSS contexts required to -secure protocols that use RPC (most often Kerberos and NFS). The rpcsvcgssd -service is the server-side of RPCSEC GSS. If the system does not require secure -RPC then this service should be disabled. - -The rpcsvcgssd service can be disabled with the following command: -$ sudo systemctl mask --now rpcsvcgssd.service - Unnecessary services should be disabled to decrease the attack surface of the system. - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -264144,47 +264242,65 @@ spec: version: 3.1.0 systemd: units: - - name: rpcsvcgssd.service + - name: nfs-server.service enabled: false mask: true - - name: rpcsvcgssd.socket + - name: nfs-server.socket enabled: false mask: true - include disable_rpcsvcgssd + +[customizations.services] +disabled = ["nfs-server"] + + include disable_nfs-server -class disable_rpcsvcgssd { - service {'rpcsvcgssd': +class disable_nfs-server { + service {'nfs-server': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.service' -"$SYSTEMCTL_EXEC" disable 'rpcsvcgssd.service' -"$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" stop 'nfs-server.service' +"$SYSTEMCTL_EXEC" disable 'nfs-server.service' +"$SYSTEMCTL_EXEC" mask 'nfs-server.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcsvcgssd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files nfs-server.socket; then + "$SYSTEMCTL_EXEC" stop 'nfs-server.socket' + "$SYSTEMCTL_EXEC" mask 'nfs-server.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcsvcgssd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'nfs-server.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcsvcgssd"] - + + + + + + + + + Disable Secure RPC Server Service (rpcsvcgssd) + The rpcsvcgssd service manages RPCSEC GSS contexts required to +secure protocols that use RPC (most often Kerberos and NFS). The rpcsvcgssd +service is the server-side of RPCSEC GSS. If the system does not require secure +RPC then this service should be disabled. + +The rpcsvcgssd service can be disabled with the following command: +$ sudo systemctl mask --now rpcsvcgssd.service + Unnecessary services should be disabled to decrease the attack surface of the system. + - name: Block Disable service rpcsvcgssd block: @@ -264242,6 +264358,55 @@ disabled = ["rpcsvcgssd"] - no_reboot_needed - service_rpcsvcgssd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rpcsvcgssd.service + enabled: false + mask: true + - name: rpcsvcgssd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rpcsvcgssd"] + + include disable_rpcsvcgssd + +class disable_rpcsvcgssd { + service {'rpcsvcgssd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" disable 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcsvcgssd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rpcsvcgssd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264343,40 +264508,6 @@ any NFS mounts. requests from the remote user. The userid and groupid could mistakenly or maliciously be set incorrectly. The AUTH_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|sec=krb5:krb5i:krb5p)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}sec=krb5:krb5i:krb5p 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "sec=krb5:krb5i:krb5p"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,sec=krb5:krb5i:krb5p|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have sec=krb5:krb5i:krb5p command: findmnt --fstab --types nfs,nfs4 -O nosec=krb5:krb5i:krb5p -n -P register: points_register @@ -264424,6 +264555,40 @@ fi - medium_severity - mount_option_krb_sec_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|sec=krb5:krb5i:krb5p)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}sec=krb5:krb5i:krb5p 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "sec=krb5:krb5i:krb5p"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,sec=krb5:krb5i:krb5p|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264520,40 +264685,6 @@ any NFS mounts. Legitimate device files should only exist in the /dev directory. NFS mounts should not present device files to users. CCE-84052-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have nodev command: findmnt --fstab --types nfs,nfs4 -O nonodev -n -P register: points_register @@ -264595,6 +264726,40 @@ fi - medium_severity - mount_option_nodev_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264660,40 +264825,6 @@ for mounting any file system not containing approved binary files as they may be files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access. CCE-84050-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have noexec command: findmnt --fstab --types nfs,nfs4 -O nonoexec -n -P register: points_register @@ -264739,6 +264870,40 @@ fi - medium_severity - mount_option_noexec_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264801,40 +264966,6 @@ any NFS mounts. NFS mounts should not present suid binaries to users. Only vendor-supplied suid executables should be installed to their default location on the local filesystem. CCE-84053-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have nosuid command: findmnt --fstab --types nfs,nfs4 -O nonosuid -n -P register: points_register @@ -264878,6 +265009,40 @@ fi - medium_severity - mount_option_nosuid_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265076,21 +265241,6 @@ requests from the remote user. The userid and groupid could mistakenly or malici incorrectly. The AUTH_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request. CCE-80924-4 - -nfs_exports=() -readarray -t nfs_exports < <(grep -E "^/.*[[:space:]]+ .*\(.*\)[[:space:]]*$" /etc/exports | awk '{print $2}') - -for nfs_export in "${nfs_exports[@]}" -do - correct_export="" - if [ "$(grep -c "sec=" <<<"$nfs_export")" -eq 0 ]; then - correct_export="$(echo $nfs_export|sed -e 's/).*$/,sec=krb5\:krb5i\:krb5p)/')" - else - correct_export="$(echo $nfs_export|sed -e 's/sec=[^\,\)]*/sec=krb5\:krb5i\:krb5p/')" - fi - sed -i "s|$nfs_export|$correct_export|g" /etc/exports -done - - name: Drop any security clause for every export replace: path: /etc/exports @@ -265132,6 +265282,21 @@ done - medium_severity - no_reboot_needed - use_kerberos_security_all_exports + + +nfs_exports=() +readarray -t nfs_exports < <(grep -E "^/.*[[:space:]]+ .*\(.*\)[[:space:]]*$" /etc/exports | awk '{print $2}') + +for nfs_export in "${nfs_exports[@]}" +do + correct_export="" + if [ "$(grep -c "sec=" <<<"$nfs_export")" -eq 0 ]; then + correct_export="$(echo $nfs_export|sed -e 's/).*$/,sec=krb5\:krb5i\:krb5p)/')" + else + correct_export="$(echo $nfs_export|sed -e 's/sec=[^\,\)]*/sec=krb5\:krb5i\:krb5p/')" + fi + sed -i "s|$nfs_export|$correct_export|g" /etc/exports +done @@ -265298,8 +265463,26 @@ Kerberos and also ensures log files have consistent time records across the ente which aids in forensic investigations. CCE-82874-9 - -package --add=chrony + - name: Ensure chrony is installed + package: + name: chrony + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82874-9 + - PCI-DSS-Req-10.4 + - PCI-DSSv4-10.6.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_chrony_installed + + +[[packages]] +name = "chrony" +version = "*" include install_chrony @@ -265308,6 +265491,9 @@ class install_chrony { ensure => 'installed', } } + + +package --add=chrony # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -265319,27 +265505,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "chrony" -version = "*" - - - name: Ensure chrony is installed - package: - name: chrony - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82874-9 - - PCI-DSS-Req-10.4 - - PCI-DSSv4-10.6.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_chrony_installed @@ -265385,8 +265550,25 @@ version = "*" PR.PT-1 Req-10.4 Time synchronization (using NTP) is required by almost all network and administrative tasks (syslog, cryptographic based services (authentication, etc.), etc.). Ntpd is regulary maintained and updated, supporting security features such as RFC 5906. - -package --add=ntp + - name: Ensure ntp is installed + package: + name: ntp + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4 + - enable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_ntp_installed + + +[[packages]] +name = "ntp" +version = "*" include install_ntp @@ -265395,6 +265577,9 @@ class install_ntp { ensure => 'installed', } } + + +package --add=ntp # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -265406,26 +265591,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "ntp" -version = "*" - - - name: Ensure ntp is installed - package: - name: ntp - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4 - - enable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_ntp_installed @@ -265453,31 +265618,6 @@ This recommendation only applies if chrony is in use on the system. CCE-82875-6 - include enable_chronyd - -class enable_chronyd { - service {'chronyd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'chronyd.service' -"$SYSTEMCTL_EXEC" start 'chronyd.service' -"$SYSTEMCTL_EXEC" enable 'chronyd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["chronyd"] - - name: Gather the package facts package_facts: manager: auto @@ -265516,6 +265656,31 @@ enabled = ["chronyd"] - medium_severity - no_reboot_needed - service_chronyd_enabled + + +[customizations.services] +enabled = ["chronyd"] + + include enable_chronyd + +class enable_chronyd { + service {'chronyd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'chronyd.service' +"$SYSTEMCTL_EXEC" start 'chronyd.service' +"$SYSTEMCTL_EXEC" enable 'chronyd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265601,47 +265766,6 @@ The chronyd and ntpd NTP daemons o functionality of ntpdate, which is now deprecated. CCE-80874-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if rpm --quiet -q "chrony" ; then - if ! /usr/sbin/pidof ntpd ; then - /usr/bin/systemctl enable "chronyd" - /usr/bin/systemctl start "chronyd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "chronyd"; then - /usr/bin/systemctl reset-failed "chronyd" - fi - fi -elif rpm --quiet -q "ntp" ; then - /usr/bin/systemctl enable "ntpd" - /usr/bin/systemctl start "ntpd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "ntpd"; then - /usr/bin/systemctl reset-failed "ntpd" - fi -else - if ! rpm -q --quiet "chrony" ; then - yum install -y "chrony" - fi - /usr/bin/systemctl enable "chronyd" - /usr/bin/systemctl start "chronyd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "chronyd"; then - /usr/bin/systemctl reset-failed "chronyd" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -265726,6 +265850,47 @@ fi - medium_severity - no_reboot_needed - service_chronyd_or_ntpd_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if rpm --quiet -q "chrony" ; then + if ! /usr/sbin/pidof ntpd ; then + /usr/bin/systemctl enable "chronyd" + /usr/bin/systemctl start "chronyd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "chronyd"; then + /usr/bin/systemctl reset-failed "chronyd" + fi + fi +elif rpm --quiet -q "ntp" ; then + /usr/bin/systemctl enable "ntpd" + /usr/bin/systemctl start "ntpd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "ntpd"; then + /usr/bin/systemctl reset-failed "ntpd" + fi +else + if ! rpm -q --quiet "chrony" ; then + yum install -y "chrony" + fi + /usr/bin/systemctl enable "chronyd" + /usr/bin/systemctl start "chronyd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "chronyd"; then + /usr/bin/systemctl reset-failed "chronyd" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265785,31 +265950,6 @@ logs and auditing possible security breaches. The NTP daemon offers all of the functionality of ntpdate, which is now deprecated. - include enable_ntp - -class enable_ntp { - service {'ntp': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ntp.service' -"$SYSTEMCTL_EXEC" start 'ntp.service' -"$SYSTEMCTL_EXEC" enable 'ntp.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ntp"] - - name: Gather the package facts package_facts: manager: auto @@ -265854,6 +265994,31 @@ enabled = ["ntp"] - low_disruption - no_reboot_needed - service_ntp_enabled + + +[customizations.services] +enabled = ["ntp"] + + include enable_ntp + +class enable_ntp { + service {'ntp': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ntp.service' +"$SYSTEMCTL_EXEC" start 'ntp.service' +"$SYSTEMCTL_EXEC" enable 'ntp.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265912,31 +266077,6 @@ The NTP daemon offers all of the functionality of ntpdate deprecated. CCE-86486-8 - include enable_ntpd - -class enable_ntpd { - service {'ntpd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ntpd.service' -"$SYSTEMCTL_EXEC" start 'ntpd.service' -"$SYSTEMCTL_EXEC" enable 'ntpd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ntpd"] - - name: Gather the package facts package_facts: manager: auto @@ -265983,6 +266123,31 @@ enabled = ["ntpd"] - medium_severity - no_reboot_needed - service_ntpd_enabled + + +[customizations.services] +enabled = ["ntpd"] + + include enable_ntpd + +class enable_ntpd { + service {'ntpd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ntpd.service' +"$SYSTEMCTL_EXEC" start 'ntpd.service' +"$SYSTEMCTL_EXEC" enable 'ntpd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266009,6 +266174,47 @@ Operating systems are capable of providing a wide variety of functions and servi To support the requirements and principles of least functionality, the operating system must support the organizational requirements, providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues. CCE-82988-7 + - name: Disable chrony daemon from acting as server + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/chrony.conf + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/chrony.conf + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + line: port 0 + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82988-7 + - DISA-STIG-RHEL-08-030741 + - NIST-800-53-AU-12(1) + - NIST-800-53-AU-8(1) + - chronyd_client_only + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -266063,14 +266269,37 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable chrony daemon from acting as server + + + + + + + + + Disable network management of chrony daemon + The cmdport option in /etc/chrony.conf can be set to +0 to stop chrony daemon from listening on the UDP port 323 +for management connections made by chronyc. + CCI-000381 + CM-7(1) + FMT_SMF_EXT.1 + SRG-OS-000096-GPOS-00050 + SRG-OS-000095-GPOS-00049 + RHEL-08-030742 + SV-230486r928593_rule + Minimizing the exposure of the server functionality of the chrony +daemon diminishes the attack surface. + + CCE-82840-0 + - name: Disable network management of chrony daemon block: - name: Check for duplicate values lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ + regexp: ^\s*cmdport\s+ state: absent check_mode: true changed_when: false @@ -266080,7 +266309,7 @@ fi lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ + regexp: ^\s*cmdport\s+ state: absent when: dupes.found is defined and dupes.found > 1 @@ -266088,45 +266317,21 @@ fi lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ - line: port 0 + regexp: ^\s*cmdport\s+ + line: cmdport 0 state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82988-7 - - DISA-STIG-RHEL-08-030741 - - NIST-800-53-AU-12(1) - - NIST-800-53-AU-8(1) - - chronyd_client_only + - CCE-82840-0 + - DISA-STIG-RHEL-08-030742 + - NIST-800-53-CM-7(1) + - chronyd_no_chronyc_network - low_complexity - low_disruption - low_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Disable network management of chrony daemon - The cmdport option in /etc/chrony.conf can be set to -0 to stop chrony daemon from listening on the UDP port 323 -for management connections made by chronyc. - CCI-000381 - CM-7(1) - FMT_SMF_EXT.1 - SRG-OS-000096-GPOS-00050 - SRG-OS-000095-GPOS-00049 - RHEL-08-030742 - SV-230486r928593_rule - Minimizing the exposure of the server functionality of the chrony -daemon diminishes the attack surface. - - CCE-82840-0 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -266180,46 +266385,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable network management of chrony daemon - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/chrony.conf - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/chrony.conf - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - line: cmdport 0 - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82840-0 - - DISA-STIG-RHEL-08-030742 - - NIST-800-53-CM-7(1) - - chronyd_no_chronyc_network - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - restrict_strategy @@ -266284,70 +266449,6 @@ Synchronizing internal information system clocks provides uniformity of time sta Organizations should consider endpoints that may not have regular access to the authoritative time server (e.g., mobile, teleworking, and tactical endpoints). CCE-84059-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} - mode: 420 - overwrite: true - path: /etc/chrony.conf - - contents: - source: data:, - mode: 420 - overwrite: true - path: /etc/chrony.d/.mco-keep - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} - mode: 420 - overwrite: true - path: /etc/chrony.d/ntp-server.conf - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( rpm --quiet -q chrony || rpm --quiet -q ntp ); }; then - -var_time_service_set_maxpoll='' - - - - -pof="/usr/sbin/pidof" - - -CONFIG_FILES="/etc/ntp.conf" -$pof ntpd || { - CHRONY_NAME=/etc/chrony.conf - CHRONY_PATH=${CHRONY_NAME%%.*} - CONFIG_FILES=$(find ${CHRONY_PATH}.* -type f -name '*.conf') -} - -# get list of ntp files - -for config_file in $CONFIG_FILES; do - # Set maxpoll values to var_time_service_set_maxpoll - sed -i "s/^\(\(server\|pool\|peer\).*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \3/" "$config_file" -done - - - - -for config_file in $CONFIG_FILES; do - # Add maxpoll to server, pool or peer entries without maxpoll - grep "^\(server\|pool\|peer\)" "$config_file" | grep -v maxpoll | while read -r line ; do - sed -i "s/$line/& maxpoll $var_time_service_set_maxpoll/" "$config_file" - done -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -266540,6 +266641,70 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} + mode: 420 + overwrite: true + path: /etc/chrony.conf + - contents: + source: data:, + mode: 420 + overwrite: true + path: /etc/chrony.d/.mco-keep + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} + mode: 420 + overwrite: true + path: /etc/chrony.d/ntp-server.conf + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( rpm --quiet -q chrony || rpm --quiet -q ntp ); }; then + +var_time_service_set_maxpoll='' + + + + +pof="/usr/sbin/pidof" + + +CONFIG_FILES="/etc/ntp.conf" +$pof ntpd || { + CHRONY_NAME=/etc/chrony.conf + CHRONY_PATH=${CHRONY_NAME%%.*} + CONFIG_FILES=$(find ${CHRONY_PATH}.* -type f -name '*.conf') +} + +# get list of ntp files + +for config_file in $CONFIG_FILES; do + # Set maxpoll values to var_time_service_set_maxpoll + sed -i "s/^\(\(server\|pool\|peer\).*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \3/" "$config_file" +done + + + + +for config_file in $CONFIG_FILES; do + # Add maxpoll to server, pool or peer entries without maxpoll + grep "^\(server\|pool\|peer\)" "$config_file" | grep -v maxpoll | while read -r line ; do + sed -i "s/$line/& maxpoll $var_time_service_set_maxpoll/" "$config_file" + done +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266612,54 +266777,6 @@ unavailable. This is typical for a system acting as an NTP server for other systems. CCE-80764-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} - mode: 420 - overwrite: true - path: /etc/chrony.conf - - contents: - source: data:, - mode: 420 - overwrite: true - path: /etc/chrony.d/.mco-keep - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} - mode: 420 - overwrite: true - path: /etc/chrony.d/ntp-server.conf - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_multiple_time_servers='' - - -config_file="/etc/ntp.conf" -/usr/sbin/pidof ntpd || config_file="/etc/chrony.conf" - -if ! [ "$(grep -c '^server' "$config_file")" -gt 1 ] ; then - if ! grep -q '#[[:space:]]*server' "$config_file" ; then - for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do - printf '\nserver %s' "$server" >> "$config_file" - done - else - sed -i 's/#[ \t]*server/server/g' "$config_file" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_multiple_time_servers # promote to variable set_fact: var_multiple_time_servers: !!str @@ -266753,6 +266870,54 @@ fi - low_disruption - medium_severity - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} + mode: 420 + overwrite: true + path: /etc/chrony.conf + - contents: + source: data:, + mode: 420 + overwrite: true + path: /etc/chrony.d/.mco-keep + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} + mode: 420 + overwrite: true + path: /etc/chrony.d/ntp-server.conf + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_multiple_time_servers='' + + +config_file="/etc/ntp.conf" +/usr/sbin/pidof ntpd || config_file="/etc/chrony.conf" + +if ! [ "$(grep -c '^server' "$config_file")" -gt 1 ] ; then + if ! grep -q '#[[:space:]]*server' "$config_file" ; then + for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do + printf '\nserver %s' "$server" >> "$config_file" + done + else + sed -i 's/#[ \t]*server/server/g' "$config_file" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266897,27 +267062,6 @@ This recommendation only applies if chrony is in use on the system. CCE-82879-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then - # trying to solve cases where the parameter after OPTIONS - #may or may not be enclosed in quotes - sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1\2/' /etc/sysconfig/chronyd -fi - -if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then - # trying to solve cases where the parameter after OPTIONS - #may or may not be enclosed in quotes - sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1 -u chrony\2/' /etc/sysconfig/chronyd -else - echo 'OPTIONS="-u chrony"' >> /etc/sysconfig/chronyd -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -266968,6 +267112,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then + # trying to solve cases where the parameter after OPTIONS + #may or may not be enclosed in quotes + sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1\2/' /etc/sysconfig/chronyd +fi + +if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then + # trying to solve cases where the parameter after OPTIONS + #may or may not be enclosed in quotes + sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1 -u chrony\2/' /etc/sysconfig/chronyd +else + echo 'OPTIONS="-u chrony"' >> /etc/sysconfig/chronyd +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267021,28 +267186,6 @@ Multiple servers may be configured. synchronization is working properly. CCE-82873-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -var_multiple_time_servers='' - - -config_file="/etc/chrony.conf" - -if ! grep -q '^[[:space:]]*\(server\|pool\)[[:space:]]\+[[:graph:]]\+' "$config_file" ; then - if ! grep -q '#[[:space:]]*server' "$config_file" ; then - for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do - printf '\nserver %s' "$server" >> "$config_file" - done - else - sed -i 's/#[ \t]*server/server/g' "$config_file" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -267109,6 +267252,28 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +var_multiple_time_servers='' + + +config_file="/etc/chrony.conf" + +if ! grep -q '^[[:space:]]*\(server\|pool\)[[:space:]]\+[[:graph:]]\+' "$config_file" ; then + if ! grep -q '#[[:space:]]*server' "$config_file" ; then + for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do + printf '\nserver %s' "$server" >> "$config_file" + done + else + sed -i 's/#[ \t]*server/server/g' "$config_file" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267251,8 +267416,18 @@ $ sudo yum erase rsync-daemon The rsyncd service presents a security risk as it uses unencrypted protocols for communication. CCE-86335-7 - -package --remove=rsync-daemon + - name: Ensure rsync-daemon is removed + package: + name: rsync-daemon + state: absent + tags: + - CCE-86335-7 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsync_removed include remove_rsync-daemon @@ -267261,6 +267436,9 @@ class remove_rsync-daemon { ensure => 'purged', } } + + +package --remove=rsync-daemon # CAUTION: This remediation script will remove rsync-daemon @@ -267274,19 +267452,6 @@ if rpm -q --quiet "rsync-daemon" ; then yum remove -y "rsync-daemon" fi - - - name: Ensure rsync-daemon is removed - package: - name: rsync-daemon - state: absent - tags: - - CCE-86335-7 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsync_removed @@ -267306,55 +267471,6 @@ The rsyncd service can be disabled with the following com communication. CCE-83335-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rsyncd.service - enabled: false - mask: true - - name: rsyncd.socket - enabled: false - mask: true - - include disable_rsyncd - -class disable_rsyncd { - service {'rsyncd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rsyncd.service' -"$SYSTEMCTL_EXEC" disable 'rsyncd.service' -"$SYSTEMCTL_EXEC" mask 'rsyncd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rsyncd.socket; then - "$SYSTEMCTL_EXEC" stop 'rsyncd.socket' - "$SYSTEMCTL_EXEC" mask 'rsyncd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rsyncd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rsyncd"] - - name: Block Disable service rsyncd block: @@ -267418,6 +267534,55 @@ disabled = ["rsyncd"] - medium_severity - no_reboot_needed - service_rsyncd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rsyncd.service + enabled: false + mask: true + - name: rsyncd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rsyncd"] + + include disable_rsyncd + +class disable_rsyncd { + service {'rsyncd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rsyncd.service' +"$SYSTEMCTL_EXEC" disable 'rsyncd.service' +"$SYSTEMCTL_EXEC" mask 'rsyncd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rsyncd.socket; then + "$SYSTEMCTL_EXEC" stop 'rsyncd.socket' + "$SYSTEMCTL_EXEC" mask 'rsyncd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rsyncd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267542,8 +267707,23 @@ $ sudo yum erase xinetd Removing the xinetd package decreases the risk of the xinetd service's accidental (or intentional) activation. CCE-80850-1 - -package --remove=xinetd + - name: Ensure xinetd is removed + package: + name: xinetd + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80850-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_xinetd_removed include remove_xinetd @@ -267552,6 +267732,9 @@ class remove_xinetd { ensure => 'purged', } } + + +package --remove=xinetd # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -267571,24 +267754,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure xinetd is removed - package: - name: xinetd - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80850-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_xinetd_removed @@ -267707,55 +267872,6 @@ it ensures that these uncommon services are not running, and also prevents attacks against xinetd itself. CCE-80888-1 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: xinetd.service - enabled: false - mask: true - - name: xinetd.socket - enabled: false - mask: true - - include disable_xinetd - -class disable_xinetd { - service {'xinetd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'xinetd.service' -"$SYSTEMCTL_EXEC" disable 'xinetd.service' -"$SYSTEMCTL_EXEC" mask 'xinetd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files xinetd.socket; then - "$SYSTEMCTL_EXEC" stop 'xinetd.socket' - "$SYSTEMCTL_EXEC" mask 'xinetd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'xinetd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["xinetd"] - - name: Block Disable service xinetd block: @@ -267828,6 +267944,55 @@ disabled = ["xinetd"] - medium_severity - no_reboot_needed - service_xinetd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: xinetd.service + enabled: false + mask: true + - name: xinetd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["xinetd"] + + include disable_xinetd + +class disable_xinetd { + service {'xinetd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'xinetd.service' +"$SYSTEMCTL_EXEC" disable 'xinetd.service' +"$SYSTEMCTL_EXEC" mask 'xinetd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files xinetd.socket; then + "$SYSTEMCTL_EXEC" stop 'xinetd.socket' + "$SYSTEMCTL_EXEC" mask 'xinetd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'xinetd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267866,8 +268031,19 @@ NIS maps. NIS generally has been replaced by such protocols as Lightweight Directory Access Protocol (LDAP). It is recommended that the service be removed. CCE-82181-9 - -package --remove=ypbind + - name: Ensure ypbind is removed + package: + name: ypbind + state: absent + tags: + - CCE-82181-9 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_ypbind_removed + - unknown_severity include remove_ypbind @@ -267876,6 +268052,9 @@ class remove_ypbind { ensure => 'purged', } } + + +package --remove=ypbind # CAUTION: This remediation script will remove ypbind @@ -267889,20 +268068,6 @@ if rpm -q --quiet "ypbind" ; then yum remove -y "ypbind" fi - - - name: Ensure ypbind is removed - package: - name: ypbind - state: absent - tags: - - CCE-82181-9 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_ypbind_removed - - unknown_severity @@ -268026,8 +268191,24 @@ remote session. Removing the ypserv package decreases the risk of the accidental (or intentional) activation of NIS or NIS+ services. CCE-82432-6 - -package --remove=ypserv + - name: Ensure ypserv is removed + package: + name: ypserv + state: absent + tags: + - CCE-82432-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-IA-5(1)(c) + - PCI-DSS-Req-2.2.2 + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_ypserv_removed include remove_ypserv @@ -268036,6 +268217,9 @@ class remove_ypserv { ensure => 'purged', } } + + +package --remove=ypserv # CAUTION: This remediation script will remove ypserv @@ -268049,25 +268233,6 @@ if rpm -q --quiet "ypserv" ; then yum remove -y "ypserv" fi - - - name: Ensure ypserv is removed - package: - name: ypserv - state: absent - tags: - - CCE-82432-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-IA-5(1)(c) - - PCI-DSS-Req-2.2.2 - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_ypserv_removed @@ -268186,55 +268351,6 @@ as a client in a NIS or NIS+ domain. This service should be disabled unless in use. CCE-82433-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: ypbind.service - enabled: false - mask: true - - name: ypbind.socket - enabled: false - mask: true - - include disable_ypbind - -class disable_ypbind { - service {'ypbind': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ypbind.service' -"$SYSTEMCTL_EXEC" disable 'ypbind.service' -"$SYSTEMCTL_EXEC" mask 'ypbind.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ypbind.socket; then - "$SYSTEMCTL_EXEC" stop 'ypbind.socket' - "$SYSTEMCTL_EXEC" mask 'ypbind.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ypbind.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["ypbind"] - - name: Block Disable service ypbind block: @@ -268308,27 +268424,7 @@ disabled = ["ypbind"] - no_reboot_needed - service_ypbind_disabled - - - - - - - - - Disable ypserv Service - The ypserv service, which allows the system to act as a client in -a NIS or NIS+ domain, should be disabled. - -The ypserv service can be disabled with the following command: -$ sudo systemctl mask --now ypserv.service - 2.2.10 - Disabling the ypserv service ensures the system is not acting -as a client in a NIS or NIS+ domain. This service should be disabled -unless in use. - - CCE-86121-1 - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -268336,47 +268432,67 @@ spec: version: 3.1.0 systemd: units: - - name: ypserv.service + - name: ypbind.service enabled: false mask: true - - name: ypserv.socket + - name: ypbind.socket enabled: false mask: true - include disable_ypserv + +[customizations.services] +disabled = ["ypbind"] + + include disable_ypbind -class disable_ypserv { - service {'ypserv': +class disable_ypbind { + service {'ypbind': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ypserv.service' -"$SYSTEMCTL_EXEC" disable 'ypserv.service' -"$SYSTEMCTL_EXEC" mask 'ypserv.service' +"$SYSTEMCTL_EXEC" stop 'ypbind.service' +"$SYSTEMCTL_EXEC" disable 'ypbind.service' +"$SYSTEMCTL_EXEC" mask 'ypbind.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ypserv.socket; then - "$SYSTEMCTL_EXEC" stop 'ypserv.socket' - "$SYSTEMCTL_EXEC" mask 'ypserv.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files ypbind.socket; then + "$SYSTEMCTL_EXEC" stop 'ypbind.socket' + "$SYSTEMCTL_EXEC" mask 'ypbind.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ypserv.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'ypbind.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["ypserv"] - + + + + + + + + + Disable ypserv Service + The ypserv service, which allows the system to act as a client in +a NIS or NIS+ domain, should be disabled. + +The ypserv service can be disabled with the following command: +$ sudo systemctl mask --now ypserv.service + 2.2.10 + Disabling the ypserv service ensures the system is not acting +as a client in a NIS or NIS+ domain. This service should be disabled +unless in use. + + CCE-86121-1 - name: Block Disable service ypserv block: @@ -268437,6 +268553,55 @@ disabled = ["ypserv"] - medium_severity - no_reboot_needed - service_ypserv_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: ypserv.service + enabled: false + mask: true + - name: ypserv.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["ypserv"] + + include disable_ypserv + +class disable_ypserv { + service {'ypserv': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'ypserv.service' +"$SYSTEMCTL_EXEC" disable 'ypserv.service' +"$SYSTEMCTL_EXEC" mask 'ypserv.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files ypserv.socket; then + "$SYSTEMCTL_EXEC" stop 'ypserv.socket' + "$SYSTEMCTL_EXEC" mask 'ypserv.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'ypserv.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -268567,8 +268732,24 @@ could be compromised. The rsh-server package provides sev network services. Removing it decreases the risk of those services' accidental (or intentional) activation. CCE-82184-3 - -package --remove=rsh-server + - name: Ensure rsh-server is removed + package: + name: rsh-server + state: absent + tags: + - CCE-82184-3 + - DISA-STIG-RHEL-08-040010 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-IA-5(1)(c) + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_rsh-server_removed include remove_rsh-server @@ -268577,6 +268758,9 @@ class remove_rsh-server { ensure => 'purged', } } + + +package --remove=rsh-server # CAUTION: This remediation script will remove rsh-server @@ -268590,25 +268774,6 @@ if rpm -q --quiet "rsh-server" ; then yum remove -y "rsh-server" fi - - - name: Ensure rsh-server is removed - package: - name: rsh-server - state: absent - tags: - - CCE-82184-3 - - DISA-STIG-RHEL-08-040010 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-IA-5(1)(c) - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_rsh-server_removed @@ -268648,8 +268813,20 @@ their credentials. Note that removing the rsh package rem the clients for rsh,rcp, and rlogin. CCE-82183-5 - -package --remove=rsh + - name: Ensure rsh is removed + package: + name: rsh + state: absent + tags: + - CCE-82183-5 + - NIST-800-171-3.1.13 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_rsh_removed + - unknown_severity include remove_rsh @@ -268658,6 +268835,9 @@ class remove_rsh { ensure => 'purged', } } + + +package --remove=rsh # CAUTION: This remediation script will remove rsh @@ -268671,21 +268851,6 @@ if rpm -q --quiet "rsh" ; then yum remove -y "rsh" fi - - - name: Ensure rsh is removed - package: - name: rsh - state: absent - tags: - - CCE-82183-5 - - NIST-800-171-3.1.13 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_rsh_removed - - unknown_severity @@ -268809,55 +268974,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-80884-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rexec.service - enabled: false - mask: true - - name: rexec.socket - enabled: false - mask: true - - include disable_rexec - -class disable_rexec { - service {'rexec': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rexec.service' -"$SYSTEMCTL_EXEC" disable 'rexec.service' -"$SYSTEMCTL_EXEC" mask 'rexec.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rexec.socket; then - "$SYSTEMCTL_EXEC" stop 'rexec.socket' - "$SYSTEMCTL_EXEC" mask 'rexec.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rexec.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rexec"] - - name: Block Disable service rexec block: @@ -268936,6 +269052,55 @@ disabled = ["rexec"] - low_disruption - no_reboot_needed - service_rexec_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rexec.service + enabled: false + mask: true + - name: rexec.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rexec"] + + include disable_rexec + +class disable_rexec { + service {'rexec': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rexec.service' +"$SYSTEMCTL_EXEC" disable 'rexec.service' +"$SYSTEMCTL_EXEC" mask 'rexec.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rexec.socket; then + "$SYSTEMCTL_EXEC" stop 'rexec.socket' + "$SYSTEMCTL_EXEC" mask 'rexec.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rexec.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269081,55 +269246,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-80885-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rlogin.service - enabled: false - mask: true - - name: rlogin.socket - enabled: false - mask: true - - include disable_rlogin - -class disable_rlogin { - service {'rlogin': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rlogin.service' -"$SYSTEMCTL_EXEC" disable 'rlogin.service' -"$SYSTEMCTL_EXEC" mask 'rlogin.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rlogin.socket; then - "$SYSTEMCTL_EXEC" stop 'rlogin.socket' - "$SYSTEMCTL_EXEC" mask 'rlogin.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rlogin.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rlogin"] - - name: Block Disable service rlogin block: @@ -269208,6 +269324,55 @@ disabled = ["rlogin"] - low_disruption - no_reboot_needed - service_rlogin_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rlogin.service + enabled: false + mask: true + - name: rlogin.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rlogin"] + + include disable_rlogin + +class disable_rlogin { + service {'rlogin': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rlogin.service' +"$SYSTEMCTL_EXEC" disable 'rlogin.service' +"$SYSTEMCTL_EXEC" mask 'rlogin.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rlogin.socket; then + "$SYSTEMCTL_EXEC" stop 'rlogin.socket' + "$SYSTEMCTL_EXEC" mask 'rlogin.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rlogin.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269354,55 +269519,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-82431-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rsh.service - enabled: false - mask: true - - name: rsh.socket - enabled: false - mask: true - - include disable_rsh - -class disable_rsh { - service {'rsh': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rsh.service' -"$SYSTEMCTL_EXEC" disable 'rsh.service' -"$SYSTEMCTL_EXEC" mask 'rsh.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rsh.socket; then - "$SYSTEMCTL_EXEC" stop 'rsh.socket' - "$SYSTEMCTL_EXEC" mask 'rsh.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rsh.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rsh"] - - name: Block Disable service rsh block: @@ -269481,6 +269597,55 @@ disabled = ["rsh"] - low_disruption - no_reboot_needed - service_rsh_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rsh.service + enabled: false + mask: true + - name: rsh.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rsh"] + + include disable_rsh + +class disable_rsh { + service {'rsh': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rsh.service' +"$SYSTEMCTL_EXEC" disable 'rsh.service' +"$SYSTEMCTL_EXEC" mask 'rsh.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rsh.socket; then + "$SYSTEMCTL_EXEC" stop 'rsh.socket' + "$SYSTEMCTL_EXEC" mask 'rsh.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rsh.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269503,16 +269668,6 @@ Host-based authentication is not sufficient for preventing unauthorized access t as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication. CCE-84055-3 - -# Identify local mounts -MOUNT_LIST=$(df --local | awk '{ print $6 }') - -# Find file on each listed mount point -for cur_mount in ${MOUNT_LIST} -do - find ${cur_mount} -xdev -type f -name "shosts.equiv" -exec rm -f {} \; -done - - name: Remove Host-Based Authentication Files - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -269681,6 +269836,16 @@ done - no_host_based_files - no_reboot_needed - restrict_strategy + + +# Identify local mounts +MOUNT_LIST=$(df --local | awk '{ print $6 }') + +# Find file on each listed mount point +for cur_mount in ${MOUNT_LIST} +do + find ${cur_mount} -xdev -type f -name "shosts.equiv" -exec rm -f {} \; +done @@ -269801,17 +269966,6 @@ through PAM. Trust files are convenient, but when used in conjunction with the R-services, they can allow unauthenticated access to a system. CCE-80842-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q rsh-server; then - -find /root -xdev -type f -name ".rhosts" -exec rm -f {} \; -find /home -maxdepth 2 -xdev -type f -name ".rhosts" -exec rm -f {} \; -rm -f /etc/hosts.equiv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -269887,6 +270041,17 @@ fi - no_reboot_needed - no_rsh_trust_files - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q rsh-server; then + +find /root -xdev -type f -name ".rhosts" -exec rm -f {} \; +find /home -maxdepth 2 -xdev -type f -name ".rhosts" -exec rm -f {} \; +rm -f /etc/hosts.equiv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269912,16 +270077,6 @@ sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication. CCE-84056-1 - -# Identify local mounts -MOUNT_LIST=$(df --local | awk '{ print $6 }') - -# Find file on each listed mount point -for cur_mount in ${MOUNT_LIST} -do - find ${cur_mount} -xdev -type f -name ".shosts" -exec rm -f {} \; -done - - name: Remove User Host-Based Authentication Files - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -270090,6 +270245,16 @@ done - no_reboot_needed - no_user_host_based_files - restrict_strategy + + +# Identify local mounts +MOUNT_LIST=$(df --local | awk '{ print $6 }') + +# Find file on each listed mount point +for cur_mount in ${MOUNT_LIST} +do + find ${cur_mount} -xdev -type f -name ".shosts" -exec rm -f {} \; +done @@ -270119,8 +270284,19 @@ across systems through a terminal session. for communications. Removing the talk-server package decreases the risk of the accidental (or intentional) activation of talk services. CCE-82180-1 - -package --remove=talk-server + - name: Ensure talk-server is removed + package: + name: talk-server + state: absent + tags: + - CCE-82180-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_talk-server_removed include remove_talk-server @@ -270129,6 +270305,9 @@ class remove_talk-server { ensure => 'purged', } } + + +package --remove=talk-server # CAUTION: This remediation script will remove talk-server @@ -270142,20 +270321,6 @@ if rpm -q --quiet "talk-server" ; then yum remove -y "talk-server" fi - - - name: Ensure talk-server is removed - package: - name: talk-server - state: absent - tags: - - CCE-82180-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_talk-server_removed @@ -270186,8 +270351,19 @@ $ sudo yum erase talk for communications. Removing the talk package decreases the risk of the accidental (or intentional) activation of talk client program. CCE-80848-5 - -package --remove=talk + - name: Ensure talk is removed + package: + name: talk + state: absent + tags: + - CCE-80848-5 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_talk_removed include remove_talk @@ -270196,6 +270372,9 @@ class remove_talk { ensure => 'purged', } } + + +package --remove=talk # CAUTION: This remediation script will remove talk @@ -270209,20 +270388,6 @@ if rpm -q --quiet "talk" ; then yum remove -y "talk" fi - - - name: Ensure talk is removed - package: - name: talk - state: absent - tags: - - CCE-80848-5 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_talk_removed @@ -270361,8 +270526,24 @@ privileged user password could be compromised. Removing the telnet-server package decreases the risk of the telnet service's accidental (or intentional) activation. CCE-82182-7 - -package --remove=telnet-server + - name: Ensure telnet-server is removed + package: + name: telnet-server + state: absent + tags: + - CCE-82182-7 + - DISA-STIG-RHEL-08-040000 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSS-Req-2.2.2 + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnet-server_removed include remove_telnet-server @@ -270371,6 +270552,9 @@ class remove_telnet-server { ensure => 'purged', } } + + +package --remove=telnet-server # CAUTION: This remediation script will remove telnet-server @@ -270384,25 +270568,6 @@ if rpm -q --quiet "telnet-server" ; then yum remove -y "telnet-server" fi - - - name: Ensure telnet-server is removed - package: - name: telnet-server - state: absent - tags: - - CCE-82182-7 - - DISA-STIG-RHEL-08-040000 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSS-Req-2.2.2 - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnet-server_removed @@ -270436,8 +270601,20 @@ of an unencrypted transmission medium could allow an unauthorized user to steal credentials. The ssh package provides an encrypted session and stronger security and is included in Red Hat Enterprise Linux 8. CCE-80849-3 - -package --remove=telnet + - name: Ensure telnet is removed + package: + name: telnet + state: absent + tags: + - CCE-80849-3 + - NIST-800-171-3.1.13 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_telnet_removed include remove_telnet @@ -270446,6 +270623,9 @@ class remove_telnet { ensure => 'purged', } } + + +package --remove=telnet # CAUTION: This remediation script will remove telnet @@ -270459,21 +270639,6 @@ if rpm -q --quiet "telnet" ; then yum remove -y "telnet" fi - - - name: Ensure telnet is removed - package: - name: telnet - state: absent - tags: - - CCE-80849-3 - - NIST-800-171-3.1.13 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_telnet_removed @@ -270619,55 +270784,6 @@ can be stolen by eavesdroppers on the network. The telnet protocol is also subje man-in-the-middle attacks. CCE-80887-3 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: telnet.service - enabled: false - mask: true - - name: telnet.socket - enabled: false - mask: true - - include disable_telnet - -class disable_telnet { - service {'telnet': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q telnet-server ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'telnet.service' -"$SYSTEMCTL_EXEC" disable 'telnet.service' -"$SYSTEMCTL_EXEC" mask 'telnet.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files telnet.socket; then - "$SYSTEMCTL_EXEC" stop 'telnet.socket' - "$SYSTEMCTL_EXEC" mask 'telnet.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'telnet.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["telnet"] - - name: Gather the package facts package_facts: manager: auto @@ -270767,6 +270883,55 @@ disabled = ["telnet"] - low_disruption - no_reboot_needed - service_telnet_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: telnet.service + enabled: false + mask: true + - name: telnet.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["telnet"] + + include disable_telnet + +class disable_telnet { + service {'telnet': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q telnet-server ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'telnet.service' +"$SYSTEMCTL_EXEC" disable 'telnet.service' +"$SYSTEMCTL_EXEC" mask 'telnet.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files telnet.socket; then + "$SYSTEMCTL_EXEC" stop 'telnet.socket' + "$SYSTEMCTL_EXEC" mask 'telnet.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'telnet.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -270903,8 +271068,23 @@ configurations), its use must be documented with the Information Systems Securty Manager (ISSM), restricted to only authorized personnel, and have access control rules established. CCE-82436-7 - -package --remove=tftp-server + - name: Ensure tftp-server is removed + package: + name: tftp-server + state: absent + tags: + - CCE-82436-7 + - DISA-STIG-RHEL-08-040190 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_tftp-server_removed include remove_tftp-server @@ -270913,6 +271093,9 @@ class remove_tftp-server { ensure => 'purged', } } + + +package --remove=tftp-server # CAUTION: This remediation script will remove tftp-server @@ -270926,24 +271109,6 @@ if rpm -q --quiet "tftp-server" ; then yum remove -y "tftp-server" fi - - - name: Ensure tftp-server is removed - package: - name: tftp-server - state: absent - tags: - - CCE-82436-7 - - DISA-STIG-RHEL-08-040190 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_tftp-server_removed @@ -270965,8 +271130,19 @@ TFTP does not support authentication and can be easily hacked. The package for TFTP (such as a boot server). In that case, use extreme caution when configuring the services. CCE-83590-0 - -package --remove=tftp + - name: Ensure tftp is removed + package: + name: tftp + state: absent + tags: + - CCE-83590-0 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_tftp_removed include remove_tftp @@ -270975,6 +271151,9 @@ class remove_tftp { ensure => 'purged', } } + + +package --remove=tftp # CAUTION: This remediation script will remove tftp @@ -270988,20 +271167,6 @@ if rpm -q --quiet "tftp" ; then yum remove -y "tftp" fi - - - name: Ensure tftp is removed - package: - name: tftp - state: absent - tags: - - CCE-83590-0 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_tftp_removed @@ -271112,55 +271277,6 @@ The tftp service can be disabled with the following comma as a TFTP server, which does not provide encryption or authentication. CCE-82435-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: tftp.service - enabled: false - mask: true - - name: tftp.socket - enabled: false - mask: true - - include disable_tftp - -class disable_tftp { - service {'tftp': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'tftp.service' -"$SYSTEMCTL_EXEC" disable 'tftp.service' -"$SYSTEMCTL_EXEC" mask 'tftp.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files tftp.socket; then - "$SYSTEMCTL_EXEC" stop 'tftp.socket' - "$SYSTEMCTL_EXEC" mask 'tftp.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'tftp.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["tftp"] - - name: Block Disable service tftp block: @@ -271230,6 +271346,55 @@ disabled = ["tftp"] - low_disruption - no_reboot_needed - service_tftp_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: tftp.service + enabled: false + mask: true + - name: tftp.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["tftp"] + + include disable_tftp + +class disable_tftp { + service {'tftp': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'tftp.service' +"$SYSTEMCTL_EXEC" disable 'tftp.service' +"$SYSTEMCTL_EXEC" mask 'tftp.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files tftp.socket; then + "$SYSTEMCTL_EXEC" stop 'tftp.socket' + "$SYSTEMCTL_EXEC" mask 'tftp.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'tftp.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -271373,22 +271538,6 @@ given directory. Serving files from an intentionally-specified directory reduces the risk of sharing files which should remain private. CCE-82434-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q tftp-server; then - -var_tftpd_secure_directory='' - - -if grep -q 'server_args' /etc/xinetd.d/tftp; then - sed -i -E "s;^([[:blank:]]*server_args[[:blank:]]+=[[:blank:]]+.*?)(-s[[:blank:]]+[[:graph:]]+)*(.*)$;\1 -s $var_tftpd_secure_directory \3;" /etc/xinetd.d/tftp -else - echo "server_args = -s $var_tftpd_secure_directory" >> /etc/xinetd.d/tftp -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -271474,6 +271623,22 @@ fi - medium_severity - no_reboot_needed - tftpd_uses_secure_mode + + # Remediation is applicable only in certain platforms +if rpm --quiet -q tftp-server; then + +var_tftpd_secure_directory='' + + +if grep -q 'server_args' /etc/xinetd.d/tftp; then + sed -i -E "s;^([[:blank:]]*server_args[[:blank:]]+=[[:blank:]]+.*?)(-s[[:blank:]]+[[:graph:]]+)*(.*)$;\1 -s $var_tftpd_secure_directory \3;" /etc/xinetd.d/tftp +else + echo "server_args = -s $var_tftpd_secure_directory" >> /etc/xinetd.d/tftp +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -271572,8 +271737,21 @@ $ sudo yum erase cups If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be removed to reduce the potential attack surface. CCE-86299-5 - -package --remove=cups + - name: Ensure cups is removed + package: + name: cups + state: absent + tags: + - CCE-86299-5 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_cups_removed + - unknown_severity include remove_cups @@ -271582,6 +271760,9 @@ class remove_cups { ensure => 'purged', } } + + +package --remove=cups # CAUTION: This remediation script will remove cups @@ -271595,22 +271776,6 @@ if rpm -q --quiet "cups" ; then yum remove -y "cups" fi - - - name: Ensure cups is removed - package: - name: cups - state: absent - tags: - - CCE-86299-5 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_cups_removed - - unknown_severity @@ -271695,55 +271860,6 @@ The cups service can be disabled with the following comma Turn off unneeded services to reduce attack surface. CCE-82861-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: cups.service - enabled: false - mask: true - - name: cups.socket - enabled: false - mask: true - - include disable_cups - -class disable_cups { - service {'cups': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cups.service' -"$SYSTEMCTL_EXEC" disable 'cups.service' -"$SYSTEMCTL_EXEC" mask 'cups.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cups.socket; then - "$SYSTEMCTL_EXEC" stop 'cups.socket' - "$SYSTEMCTL_EXEC" mask 'cups.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cups.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["cups"] - - name: Block Disable service cups block: @@ -271813,6 +271929,55 @@ disabled = ["cups"] - no_reboot_needed - service_cups_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cups.service + enabled: false + mask: true + - name: cups.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cups"] + + include disable_cups + +class disable_cups { + service {'cups': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cups.service' +"$SYSTEMCTL_EXEC" disable 'cups.service' +"$SYSTEMCTL_EXEC" mask 'cups.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cups.socket; then + "$SYSTEMCTL_EXEC" stop 'cups.socket' + "$SYSTEMCTL_EXEC" mask 'cups.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cups.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272027,8 +272192,18 @@ and removed. If there is no need to make the proxy server software available, removing it provides a safeguard against its activation. CCE-82189-2 - -package --remove=squid + - name: Ensure squid is removed + package: + name: squid + state: absent + tags: + - CCE-82189-2 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_squid_removed + - unknown_severity include remove_squid @@ -272037,6 +272212,9 @@ class remove_squid { ensure => 'purged', } } + + +package --remove=squid # CAUTION: This remediation script will remove squid @@ -272050,19 +272228,6 @@ if rpm -q --quiet "squid" ; then yum remove -y "squid" fi - - - name: Ensure squid is removed - package: - name: squid - state: absent - tags: - - CCE-82189-2 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_squid_removed - - unknown_severity @@ -272081,55 +272246,6 @@ The squid service can be disabled with the following comm of attack, and should be removed if not needed. CCE-82190-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: squid.service - enabled: false - mask: true - - name: squid.socket - enabled: false - mask: true - - include disable_squid - -class disable_squid { - service {'squid': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q squid ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'squid.service' -"$SYSTEMCTL_EXEC" disable 'squid.service' -"$SYSTEMCTL_EXEC" mask 'squid.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files squid.socket; then - "$SYSTEMCTL_EXEC" stop 'squid.socket' - "$SYSTEMCTL_EXEC" mask 'squid.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'squid.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["squid"] - - name: Gather the package facts package_facts: manager: auto @@ -272205,6 +272321,55 @@ disabled = ["squid"] - no_reboot_needed - service_squid_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: squid.service + enabled: false + mask: true + - name: squid.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["squid"] + + include disable_squid + +class disable_squid { + service {'squid': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q squid ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'squid.service' +"$SYSTEMCTL_EXEC" disable 'squid.service' +"$SYSTEMCTL_EXEC" mask 'squid.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files squid.socket; then + "$SYSTEMCTL_EXEC" stop 'squid.socket' + "$SYSTEMCTL_EXEC" mask 'squid.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'squid.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272236,8 +272401,18 @@ intended for use as a RADIUS Server it should be removed. CCE-82752-7 - -package --remove=freeradius + - name: Ensure freeradius is removed + package: + name: freeradius + state: absent + tags: + - CCE-82752-7 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_freeradius_removed include remove_freeradius @@ -272246,6 +272421,9 @@ class remove_freeradius { ensure => 'purged', } } + + +package --remove=freeradius # CAUTION: This remediation script will remove freeradius @@ -272259,19 +272437,6 @@ if rpm -q --quiet "freeradius" ; then yum remove -y "freeradius" fi - - - name: Ensure freeradius is removed - package: - name: freeradius - state: absent - tags: - - CCE-82752-7 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_freeradius_removed @@ -272303,31 +272468,6 @@ Consequently, the rngd service can't be started in FIPS mode. CCE-82831-9 - include enable_rngd - -class enable_rngd { - service {'rngd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.3"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'rngd.service' -"$SYSTEMCTL_EXEC" start 'rngd.service' -"$SYSTEMCTL_EXEC" enable 'rngd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["rngd"] - - name: Enable service rngd block: @@ -272356,6 +272496,31 @@ enabled = ["rngd"] - low_severity - no_reboot_needed - service_rngd_enabled + + +[customizations.services] +enabled = ["rngd"] + + include enable_rngd + +class enable_rngd { + service {'rngd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.3"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'rngd.service' +"$SYSTEMCTL_EXEC" start 'rngd.service' +"$SYSTEMCTL_EXEC" enable 'rngd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272414,8 +272579,21 @@ information may be unnecessarily transmitted across the network. If there is no need to make the router software available, removing it provides a safeguard against its activation. CCE-82187-6 - -package --remove=quagga + - name: Ensure quagga is removed + package: + name: quagga + state: absent + tags: + - CCE-82187-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_quagga_removed include remove_quagga @@ -272424,6 +272602,9 @@ class remove_quagga { ensure => 'purged', } } + + +package --remove=quagga # CAUTION: This remediation script will remove quagga @@ -272437,22 +272618,6 @@ if rpm -q --quiet "quagga" ; then yum remove -y "quagga" fi - - - name: Ensure quagga is removed - package: - name: quagga - state: absent - tags: - - CCE-82187-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_quagga_removed @@ -272502,55 +272667,6 @@ required, system network information may be unnecessarily transmitted across the network. CCE-80889-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: zebra.service - enabled: false - mask: true - - name: zebra.socket - enabled: false - mask: true - - include disable_zebra - -class disable_zebra { - service {'zebra': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'zebra.service' -"$SYSTEMCTL_EXEC" disable 'zebra.service' -"$SYSTEMCTL_EXEC" mask 'zebra.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files zebra.socket; then - "$SYSTEMCTL_EXEC" stop 'zebra.socket' - "$SYSTEMCTL_EXEC" mask 'zebra.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'zebra.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["zebra"] - - name: Block Disable service zebra block: @@ -272620,6 +272736,55 @@ disabled = ["zebra"] - medium_severity - no_reboot_needed - service_zebra_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: zebra.service + enabled: false + mask: true + - name: zebra.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["zebra"] + + include disable_zebra + +class disable_zebra { + service {'zebra': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'zebra.service' +"$SYSTEMCTL_EXEC" disable 'zebra.service' +"$SYSTEMCTL_EXEC" mask 'zebra.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files zebra.socket; then + "$SYSTEMCTL_EXEC" stop 'zebra.socket' + "$SYSTEMCTL_EXEC" mask 'zebra.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'zebra.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272659,8 +272824,22 @@ The samba-common package can be installed with the follow $ sudo yum install samba-common If the samba-common package is not installed, samba cannot be configured. - -package --add=samba-common + - name: Ensure samba-common is installed + package: + name: samba-common + state: present + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_samba-common_installed + + +[[packages]] +name = "samba-common" +version = "*" include install_samba-common @@ -272669,28 +272848,14 @@ class install_samba-common { ensure => 'installed', } } + + +package --add=samba-common if ! rpm -q --quiet "samba-common" ; then yum install -y "samba-common" fi - - -[[packages]] -name = "samba-common" -version = "*" - - - name: Ensure samba-common is installed - package: - name: samba-common - state: present - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_samba-common_installed @@ -272731,20 +272896,6 @@ only communicate with servers that support packet signing.Packet signing can prevent man-in-the-middle attacks which modify SMB packets in transit. - ###################################################################### -#By Luke "Brisk-OH" Brisk -#luke.brisk@boeing.com or luke.brisk@gmail.com -###################################################################### - -CLIENTSIGNING=$( grep -ic 'client signing' /etc/samba/smb.conf ) - -if [ "$CLIENTSIGNING" -eq 0 ]; then - # Add to global section - sed -i 's/\[global\]/\[global\]\n\n\tclient signing = mandatory/g' /etc/samba/smb.conf -else - sed -i 's/[[:blank:]]*client[[:blank:]]signing[[:blank:]]*=[[:blank:]]*no/ client signing = mandatory/g' /etc/samba/smb.conf -fi - - name: Check if /etc/samba/smb.conf exists stat: path: /etc/samba/smb.conf @@ -272772,6 +272923,20 @@ fi - no_reboot_needed - require_smb_client_signing - unknown_severity + + ###################################################################### +#By Luke "Brisk-OH" Brisk +#luke.brisk@boeing.com or luke.brisk@gmail.com +###################################################################### + +CLIENTSIGNING=$( grep -ic 'client signing' /etc/samba/smb.conf ) + +if [ "$CLIENTSIGNING" -eq 0 ]; then + # Add to global section + sed -i 's/\[global\]/\[global\]\n\n\tclient signing = mandatory/g' /etc/samba/smb.conf +else + sed -i 's/[[:blank:]]*client[[:blank:]]signing[[:blank:]]*=[[:blank:]]*no/ client signing = mandatory/g' /etc/samba/smb.conf +fi @@ -272857,8 +273022,18 @@ sharing functionality. If there is no need to make the Samba software available, removing it provides a safeguard against its activation. CCE-85978-5 - -package --remove=samba + - name: Ensure samba is removed + package: + name: samba + state: absent + tags: + - CCE-85978-5 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_samba_removed + - unknown_severity include remove_samba @@ -272867,6 +273042,9 @@ class remove_samba { ensure => 'purged', } } + + +package --remove=samba # CAUTION: This remediation script will remove samba @@ -272880,19 +273058,6 @@ if rpm -q --quiet "samba" ; then yum remove -y "samba" fi - - - name: Ensure samba is removed - package: - name: samba - state: absent - tags: - - CCE-85978-5 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_samba_removed - - unknown_severity @@ -272912,55 +273077,6 @@ The smb service can be disabled with the following comman should be disabled if not needed. CCE-82759-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: smb.service - enabled: false - mask: true - - name: smb.socket - enabled: false - mask: true - - include disable_smb - -class disable_smb { - service {'smb': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'smb.service' -"$SYSTEMCTL_EXEC" disable 'smb.service' -"$SYSTEMCTL_EXEC" mask 'smb.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files smb.socket; then - "$SYSTEMCTL_EXEC" stop 'smb.socket' - "$SYSTEMCTL_EXEC" mask 'smb.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'smb.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["smb"] - - name: Block Disable service smb block: @@ -273021,6 +273137,55 @@ disabled = ["smb"] - low_severity - no_reboot_needed - service_smb_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: smb.service + enabled: false + mask: true + - name: smb.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["smb"] + + include disable_smb + +class disable_smb { + service {'smb': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'smb.service' +"$SYSTEMCTL_EXEC" disable 'smb.service' +"$SYSTEMCTL_EXEC" mask 'smb.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files smb.socket; then + "$SYSTEMCTL_EXEC" stop 'smb.socket' + "$SYSTEMCTL_EXEC" mask 'smb.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'smb.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273057,8 +273222,19 @@ $ sudo yum erase net-snmp removing the package provides a safeguard against its activation. CCE-85980-1 - -package --remove=net-snmp + - name: Ensure net-snmp is removed + package: + name: net-snmp + state: absent + tags: + - CCE-85980-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_net-snmp_removed + - unknown_severity include remove_net-snmp @@ -273067,6 +273243,9 @@ class remove_net-snmp { ensure => 'purged', } } + + +package --remove=net-snmp # CAUTION: This remediation script will remove net-snmp @@ -273080,20 +273259,6 @@ if rpm -q --quiet "net-snmp" ; then yum remove -y "net-snmp" fi - - - name: Ensure net-snmp is removed - package: - name: net-snmp - state: absent - tags: - - CCE-85980-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_net-snmp_removed - - unknown_severity @@ -273113,55 +273278,6 @@ The snmpd service can be disabled with the following comm should be disabled if not needed. CCE-82758-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: snmpd.service - enabled: false - mask: true - - name: snmpd.socket - enabled: false - mask: true - - include disable_snmpd - -class disable_snmpd { - service {'snmpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q net-snmp ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'snmpd.service' -"$SYSTEMCTL_EXEC" disable 'snmpd.service' -"$SYSTEMCTL_EXEC" mask 'snmpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files snmpd.socket; then - "$SYSTEMCTL_EXEC" stop 'snmpd.socket' - "$SYSTEMCTL_EXEC" mask 'snmpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'snmpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["snmpd"] - - name: Gather the package facts package_facts: manager: auto @@ -273237,6 +273353,55 @@ disabled = ["snmpd"] - low_severity - no_reboot_needed - service_snmpd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: snmpd.service + enabled: false + mask: true + - name: snmpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["snmpd"] + + include disable_snmpd + +class disable_snmpd { + service {'snmpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q net-snmp ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'snmpd.service' +"$SYSTEMCTL_EXEC" disable 'snmpd.service' +"$SYSTEMCTL_EXEC" mask 'snmpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files snmpd.socket; then + "$SYSTEMCTL_EXEC" stop 'snmpd.socket' + "$SYSTEMCTL_EXEC" mask 'snmpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'snmpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273354,27 +273519,6 @@ default authenticators, then anyone can gather data about the system and the net and use the information to potentially compromise the integrity of the system and network(s). - # Remediation is applicable only in certain platforms -if rpm --quiet -q net-snmp; then - -var_snmpd_ro_string='' -var_snmpd_rw_string='' - - -# remediate read-only community string -if grep -q 'public' /etc/snmp/snmpd.conf; then - sed -i "s/public/$var_snmpd_ro_string/" /etc/snmp/snmpd.conf -fi - -# remediate read-write community string -if grep -q 'private' /etc/snmp/snmpd.conf; then - sed -i "s/private/$var_snmpd_rw_string/" /etc/snmp/snmpd.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -273444,6 +273588,27 @@ fi - medium_disruption - no_reboot_needed - snmpd_not_default_password + + # Remediation is applicable only in certain platforms +if rpm --quiet -q net-snmp; then + +var_snmpd_ro_string='' +var_snmpd_rw_string='' + + +# remediate read-only community string +if grep -q 'public' /etc/snmp/snmpd.conf; then + sed -i "s/public/$var_snmpd_ro_string/" /etc/snmp/snmpd.conf +fi + +# remediate read-write community string +if grep -q 'private' /etc/snmp/snmpd.conf; then + sed -i "s/private/$var_snmpd_rw_string/" /etc/snmp/snmpd.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273505,6 +273670,7 @@ Its server program is called sshd and provided by the RPM aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr + -3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr @@ -273567,17 +273733,19 @@ A value of 2 indicates that OpenSSH server package is required by the policy.ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256 + -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 - SSH Strong KEX by FIPS + SSH Strong MACs by FIPS Specify the FIPS approved MACs (Message Authentication Code) algorithms that are used for data integrity protection by the SSH server. hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 + -hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-sha1-96,umac-64@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 @@ -273616,8 +273784,24 @@ $ sudo yum install openssh-clients This package includes utilities to make encrypted connections and transfer files securely to SSH servers. CCE-82722-0 - -package --add=openssh-clients + - name: Ensure openssh-clients is installed + package: + name: openssh-clients + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82722-0 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-clients_installed + + +[[packages]] +name = "openssh-clients" +version = "*" include install_openssh-clients @@ -273626,6 +273810,9 @@ class install_openssh-clients { ensure => 'installed', } } + + +package --add=openssh-clients # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273637,25 +273824,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssh-clients" -version = "*" - - - name: Ensure openssh-clients is installed - package: - name: openssh-clients - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82722-0 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-clients_installed @@ -273727,8 +273895,26 @@ $ sudo yum install openssh-server integrity may be compromised because unprotected communications can be intercepted and either read or altered. CCE-83303-8 - -package --add=openssh-server + - name: Ensure openssh-server is installed + package: + name: openssh-server + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83303-8 + - DISA-STIG-RHEL-08-040159 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-server_installed + + +[[packages]] +name = "openssh-server" +version = "*" include install_openssh-server @@ -273737,6 +273923,9 @@ class install_openssh-server { ensure => 'installed', } } + + +package --add=openssh-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273748,27 +273937,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssh-server" -version = "*" - - - name: Ensure openssh-server is installed - package: - name: openssh-server - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83303-8 - - DISA-STIG-RHEL-08-040159 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-server_installed @@ -273786,8 +273954,18 @@ $ sudo yum erase openssh-server Without protection of the transmitted information, confidentiality, and integrity may be compromised because unprotected communications can be intercepted and either read or altered. - -package --remove=openssh-server + - name: Ensure openssh-server is removed + package: + name: openssh-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-server_removed include remove_openssh-server @@ -273796,6 +273974,9 @@ class remove_openssh-server { ensure => 'purged', } } + + +package --remove=openssh-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273815,19 +273996,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure openssh-server is removed - package: - name: openssh-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-server_removed @@ -273909,31 +274077,6 @@ mobile devices, notebook computers, printers, copiers, scanners, etc). Communica outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. CCE-82426-8 - include enable_sshd - -class enable_sshd { - service {'sshd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'sshd.service' -"$SYSTEMCTL_EXEC" start 'sshd.service' -"$SYSTEMCTL_EXEC" enable 'sshd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["sshd"] - - name: Enable service sshd block: @@ -273968,6 +274111,31 @@ enabled = ["sshd"] - medium_severity - no_reboot_needed - service_sshd_enabled + + +[customizations.services] +enabled = ["sshd"] + + include enable_sshd + +class enable_sshd { + service {'sshd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'sshd.service' +"$SYSTEMCTL_EXEC" start 'sshd.service' +"$SYSTEMCTL_EXEC" enable 'sshd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273988,55 +274156,6 @@ remote access. SRG-APP-000185-CTR-000490 SRG-APP-000141-CTR-000315 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: sshd.service - enabled: false - mask: true - - name: sshd.socket - enabled: false - mask: true - - include disable_sshd - -class disable_sshd { - service {'sshd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'sshd.service' -"$SYSTEMCTL_EXEC" disable 'sshd.service' -"$SYSTEMCTL_EXEC" mask 'sshd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files sshd.socket; then - "$SYSTEMCTL_EXEC" stop 'sshd.socket' - "$SYSTEMCTL_EXEC" mask 'sshd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'sshd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["sshd"] - - name: Block Disable service sshd block: @@ -274100,6 +274219,55 @@ disabled = ["sshd"] - low_disruption - no_reboot_needed - service_sshd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: sshd.service + enabled: false + mask: true + - name: sshd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["sshd"] + + include disable_sshd + +class disable_sshd { + service {'sshd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'sshd.service' +"$SYSTEMCTL_EXEC" disable 'sshd.service' +"$SYSTEMCTL_EXEC" mask 'sshd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files sshd.socket; then + "$SYSTEMCTL_EXEC" stop 'sshd.socket' + "$SYSTEMCTL_EXEC" mask 'sshd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'sshd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274166,21 +274334,12 @@ To properly set the group owner of /etc/ssh/sshd_config, PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82901-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274216,6 +274375,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274228,18 +274396,9 @@ fi Verify Group Ownership on SSH Server Private *_key Key Files SSH server private keys, files that match the /etc/ssh/*_key glob, must be group-owned by ssh_keys group. - 5.2.2 + 4.2.2 If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-86126-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex '^.*_key$' -exec chgrp ssh_keys {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*_key$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex "^.*_key$" register: files_found @@ -274272,6 +274431,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex '^.*_key$' -exec chgrp ssh_keys {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274284,19 +274452,10 @@ fi Verify Group Ownership on SSH Server Public *.pub Key Files SSH server public keys, files that match the /etc/ssh/*.pub glob, must be group-owned by root group. - 5.2.3 + 4.2.3 If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-86133-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.pub$' -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*\.pub$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex "^.*\.pub$" register: files_found @@ -274329,6 +274488,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.pub$' -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274395,21 +274563,12 @@ To properly set the owner of /etc/ssh/sshd_config, run th PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82898-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274445,6 +274604,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274457,18 +274625,9 @@ fi Verify Ownership on SSH Server Private *_key Key Files SSH server private keys, files that match the /etc/ssh/*_key glob, must be owned by root user. - 5.2.2 + 4.2.2 If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-86118-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*_key$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*_key$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex "^.*_key$" register: files_found @@ -274501,6 +274660,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*_key$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274513,19 +274681,10 @@ fi Verify Ownership on SSH Server Public *.pub Key Files SSH server public keys, files that match the /etc/ssh/*.pub glob, must be owned by root user. - 5.2.3 + 4.2.3 If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-86129-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.pub$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*\.pub$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex "^.*\.pub$" register: files_found @@ -274558,6 +274717,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.pub$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274625,21 +274793,12 @@ To properly set the permissions of /etc/ssh/sshd_config, PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82894-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274677,6 +274836,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274750,40 +274918,11 @@ If they are owned by the root user, but by a dedicated gr 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-010490 - 5.2.2 + 4.2.2 SV-230287r880714_rule If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-82424-3 - include ssh_private_key_perms - -class ssh_private_key_perms { - exec { 'sshd_priv_key': - command => "chmod 0640 /etc/ssh/*_key", - path => '/bin:/usr/bin' - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -for keyfile in /etc/ssh/*_key; do - test -f "$keyfile" || continue - if test root:root = "$(stat -c "%U:%G" "$keyfile")"; then - - chmod u-xs,g-xwrs,o-xwrt "$keyfile" - - elif test root:ssh_keys = "$(stat -c "%U:%G" "$keyfile")"; then - chmod u-xs,g-xws,o-xwrt "$keyfile" - else - echo "Key-like file '$keyfile' is owned by an unexpected user:group combination" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find root:root-owned keys ansible.builtin.command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$" -type f -group root -perm /u+xs,g+xwrs,o+xwrt @@ -274883,6 +275022,35 @@ fi - low_disruption - medium_severity - no_reboot_needed + + include ssh_private_key_perms + +class ssh_private_key_perms { + exec { 'sshd_priv_key': + command => "chmod 0640 /etc/ssh/*_key", + path => '/bin:/usr/bin' + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +for keyfile in /etc/ssh/*_key; do + test -f "$keyfile" || continue + if test root:root = "$(stat -c "%U:%G" "$keyfile")"; then + + chmod u-xs,g-xwrs,o-xwrt "$keyfile" + + elif test root:ssh_keys = "$(stat -c "%U:%G" "$keyfile")"; then + chmod u-xs,g-xws,o-xwrt "$keyfile" + else + echo "Key-like file '$keyfile' is owned by an unexpected user:group combination" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274953,29 +275121,11 @@ fi 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-010480 - 5.2.3 + 4.2.3 SV-230286r627750_rule If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-82428-4 - include ssh_public_key_perms - -class ssh_public_key_perms { - exec { 'sshd_pub_key': - command => "chmod 0644 /etc/ssh/*.pub", - path => '/bin:/usr/bin' - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex '^.*\.pub$' -exec chmod u-xs,g-xws,o-xwt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) command: find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex "^.*\.pub$" register: files_found @@ -275024,6 +275174,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + include ssh_public_key_perms + +class ssh_public_key_perms { + exec { 'sshd_pub_key': + command => "chmod 0644 /etc/ssh/*.pub", + path => '/bin:/usr/bin' + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex '^.*\.pub$' -exec chmod u-xs,g-xws,o-xwt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275094,45 +275262,6 @@ processed before 02-rekey-limit.conf containing definitio time-based limit, effects of potential attacks against encryption keys are limited. CCE-82880-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_ssh_client_rekey_limit_size='' -var_ssh_client_rekey_limit_time='' - - -main_config="/etc/ssh/ssh_config" -include_directory="/etc/ssh/ssh_config.d" - -if grep -q '^[\s]*RekeyLimit.*$' "$main_config"; then - sed -i '/^[\s]*RekeyLimit.*/d' "$main_config" -fi - -for file in "$include_directory"/*.conf; do - if grep -q '^[\s]*RekeyLimit.*$' "$file"; then - sed -i '/^[\s]*RekeyLimit.*/d' "$file" - fi -done - -if [ -e "/etc/ssh/ssh_config.d/02-rekey-limit.conf" ] ; then - - LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/d" "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -else - touch "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/ssh_config.d/02-rekey-limit.conf" - -cp "/etc/ssh/ssh_config.d/02-rekey-limit.conf" "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" -# Insert at the end of the file -printf '%s\n' "RekeyLimit $var_ssh_client_rekey_limit_size $var_ssh_client_rekey_limit_time" >> "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -# Clean up after ourselves. -rm "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_ssh_client_rekey_limit_size # promote to variable set_fact: var_ssh_client_rekey_limit_size: !!str @@ -275211,6 +275340,45 @@ fi - medium_severity - no_reboot_needed - ssh_client_rekey_limit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_ssh_client_rekey_limit_size='' +var_ssh_client_rekey_limit_time='' + + +main_config="/etc/ssh/ssh_config" +include_directory="/etc/ssh/ssh_config.d" + +if grep -q '^[\s]*RekeyLimit.*$' "$main_config"; then + sed -i '/^[\s]*RekeyLimit.*/d' "$main_config" +fi + +for file in "$include_directory"/*.conf; do + if grep -q '^[\s]*RekeyLimit.*$' "$file"; then + sed -i '/^[\s]*RekeyLimit.*/d' "$file" + fi +done + +if [ -e "/etc/ssh/ssh_config.d/02-rekey-limit.conf" ] ; then + + LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/d" "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +else + touch "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/ssh_config.d/02-rekey-limit.conf" + +cp "/etc/ssh/ssh_config.d/02-rekey-limit.conf" "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" +# Insert at the end of the file +printf '%s\n' "RekeyLimit $var_ssh_client_rekey_limit_size $var_ssh_client_rekey_limit_time" >> "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +# Clean up after ourselves. +rm "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275236,19 +275404,6 @@ Randomness is needed to generate considerably more secure data-encryption keys. in encryption algorithms, and high-quality entropy eliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-83349-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# put line into the file -echo "setenv SSH_USE_STRONG_RNG 32" > /etc/profile.d/cc-ssh-strong-rng.csh - -# remove eventual override in /etc/profile -sed -i '/^[[:space:]]*setenv[[:space:]]\+SSH_USE_STRONG_RNG.*$/d' /etc/profile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure that correct variable is exported in /etc/profile.d/cc-ssh-strong-rng.csh lineinfile: path: /etc/profile.d/cc-ssh-strong-rng.csh @@ -275280,6 +275435,19 @@ fi - medium_severity - no_reboot_needed - ssh_client_use_strong_rng_csh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# put line into the file +echo "setenv SSH_USE_STRONG_RNG 32" > /etc/profile.d/cc-ssh-strong-rng.csh + +# remove eventual override in /etc/profile +sed -i '/^[[:space:]]*setenv[[:space:]]\+SSH_USE_STRONG_RNG.*$/d' /etc/profile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275303,19 +275471,6 @@ Randomness is needed to generate considerably more secure data-encryption keys. in encryption algorithms, and high-quality entropy eliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-83346-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# put line into the file -echo "export SSH_USE_STRONG_RNG=32" > /etc/profile.d/cc-ssh-strong-rng.sh - -# remove eventual override in /etc/profile -sed -i '/^[[:space:]]*export[[:space:]]\+SSH_USE_STRONG_RNG=.*$/d' /etc/profile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure that correct variable is exported in /etc/profile.d/cc-ssh-strong-rng.sh lineinfile: path: /etc/profile.d/cc-ssh-strong-rng.sh @@ -275347,6 +275502,19 @@ fi - medium_severity - no_reboot_needed - ssh_client_use_strong_rng_sh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# put line into the file +echo "export SSH_USE_STRONG_RNG=32" > /etc/profile.d/cc-ssh-strong-rng.sh + +# remove eventual override in /etc/profile +sed -i '/^[[:space:]]*export[[:space:]]\+SSH_USE_STRONG_RNG=.*$/d' /etc/profile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275547,29 +275715,6 @@ value of 0 in is reached. CCE-83405-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveCountMax 0" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set SSH Client Alive Count Max to zero block: @@ -275617,6 +275762,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_keepalive_0 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveCountMax 0" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275747,38 +275915,12 @@ a keep alive message. SRG-OS-000163-GPOS-00072 SRG-OS-000279-GPOS-00109 RHEL-08-010200 - 5.2.20 + 4.2.7 SV-230244r917867_rule This ensures a user login will be terminated as soon as the ClientAliveInterval is reached. CCE-80907-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_set_keepalive='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveCountMax $var_sshd_set_keepalive" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_set_keepalive # promote to variable set_fact: var_sshd_set_keepalive: !!str @@ -275834,6 +275976,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_keepalive + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_keepalive='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveCountMax $var_sshd_set_keepalive" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275967,7 +276135,7 @@ configuring ClientAliveCountMax in the SSH service configuration.SRG-OS-000279-GPOS-00109 SRG-OS-000395-GPOS-00175 RHEL-08-010201 - 5.2.20 + 4.2.7 SV-244525r917886_rule Terminating an idle ssh session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session @@ -275975,32 +276143,6 @@ enabled on the console or console port that has been let unattended. CCE-80906-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.5"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then - -sshd_idle_timeout_value='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveInterval\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveInterval $sshd_idle_timeout_value" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value sshd_idle_timeout_value # promote to variable set_fact: sshd_idle_timeout_value: !!str @@ -276061,6 +276203,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_idle_timeout + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.5"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then + +sshd_idle_timeout_value='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveInterval\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveInterval $sshd_idle_timeout_value" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276211,48 +276379,10 @@ following line in FIA_UAU.1 8.3.1 SRG-OS-000480-GPOS-00229 - 5.2.8 + 4.2.9 SSH trust relationships mean a compromise on one host can allow an attacker to move trivially to other hosts. CCE-80786-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.103%202018%2F04%2F09%2020%3A41%3A22%20tj%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0ARekeyLimit%20512M%201h%0A%0A%23%20System-wide%20Crypto%20policy%3A%0A%23%20This%20system%20is%20following%20system-wide%20crypto%20policy.%20The%20changes%20to%0A%23%20Ciphers%2C%20MACs%2C%20KexAlgoritms%20and%20GSSAPIKexAlgorithsm%20will%20not%20have%20any%0A%23%20effect%20here.%20They%20will%20be%20overridden%20by%20command-line%20options%20passed%20on%0A%23%20the%20server%20start%20up.%0A%23%20To%20opt%20out%2C%20uncomment%20a%20line%20with%20redefinition%20of%20%20CRYPTO_POLICY%3D%0A%23%20variable%20in%20%20%2Fetc%2Fsysconfig%2Fsshd%20%20to%20overwrite%20the%20policy.%0A%23%20For%20more%20information%2C%20see%20manual%20page%20for%20update-crypto-policies%288%29.%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0ASyslogFacility%20AUTHPRIV%0A%23LogLevel%20INFO%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0APermitRootLogin%20no%0AStrictModes%20yes%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0APubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0AHostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0AIgnoreUserKnownHosts%20yes%0A%23%20Don%27t%20read%20the%20user%27s%20~%2F.rhosts%20and%20~%2F.shosts%20files%0AIgnoreRhosts%20yes%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0APermitEmptyPasswords%20no%0APasswordAuthentication%20no%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23ChallengeResponseAuthentication%20yes%0AChallengeResponseAuthentication%20no%0A%0A%23%20Kerberos%20options%0AKerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0AGSSAPIAuthentication%20no%0AGSSAPICleanupCredentials%20no%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20ChallengeResponseAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20ChallengeResponseAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20without-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20ChallengeResponseAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20Fedora%20and%20may%20cause%20several%0A%23%20problems.%0AUsePAM%20yes%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0AX11Forwarding%20yes%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%0A%23%20It%20is%20recommended%20to%20use%20pam_motd%20in%20%2Fetc%2Fpam.d%2Fsshd%20instead%20of%20PrintMotd%2C%0A%23%20as%20it%20is%20more%20configurable%20and%20versatile%20than%20the%20built-in%20version.%0APrintMotd%20no%0A%0APrintLastLog%20yes%0A%23TCPKeepAlive%20yes%0APermitUserEnvironment%20no%0ACompression%20no%0AClientAliveInterval%20600%0AClientAliveCountMax%200%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0ABanner%20%2Fetc%2Fissue%0A%0A%23%20Accept%20locale-related%20environment%20variables%0AAcceptEnv%20LANG%20LC_CTYPE%20LC_NUMERIC%20LC_TIME%20LC_COLLATE%20LC_MONETARY%20LC_MESSAGES%0AAcceptEnv%20LC_PAPER%20LC_NAME%20LC_ADDRESS%20LC_TELEPHONE%20LC_MEASUREMENT%0AAcceptEnv%20LC_IDENTIFICATION%20LC_ALL%20LANGUAGE%0AAcceptEnv%20XMODIFIERS%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A%0AUsePrivilegeSeparation%20sandbox - mode: 0600 - path: /etc/ssh/sshd_config - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*HostbasedAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "HostbasedAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable Host-Based Authentication block: @@ -276300,6 +276430,44 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.103%202018%2F04%2F09%2020%3A41%3A22%20tj%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0ARekeyLimit%20512M%201h%0A%0A%23%20System-wide%20Crypto%20policy%3A%0A%23%20This%20system%20is%20following%20system-wide%20crypto%20policy.%20The%20changes%20to%0A%23%20Ciphers%2C%20MACs%2C%20KexAlgoritms%20and%20GSSAPIKexAlgorithsm%20will%20not%20have%20any%0A%23%20effect%20here.%20They%20will%20be%20overridden%20by%20command-line%20options%20passed%20on%0A%23%20the%20server%20start%20up.%0A%23%20To%20opt%20out%2C%20uncomment%20a%20line%20with%20redefinition%20of%20%20CRYPTO_POLICY%3D%0A%23%20variable%20in%20%20%2Fetc%2Fsysconfig%2Fsshd%20%20to%20overwrite%20the%20policy.%0A%23%20For%20more%20information%2C%20see%20manual%20page%20for%20update-crypto-policies%288%29.%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0ASyslogFacility%20AUTHPRIV%0A%23LogLevel%20INFO%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0APermitRootLogin%20no%0AStrictModes%20yes%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0APubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0AHostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0AIgnoreUserKnownHosts%20yes%0A%23%20Don%27t%20read%20the%20user%27s%20~%2F.rhosts%20and%20~%2F.shosts%20files%0AIgnoreRhosts%20yes%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0APermitEmptyPasswords%20no%0APasswordAuthentication%20no%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23ChallengeResponseAuthentication%20yes%0AChallengeResponseAuthentication%20no%0A%0A%23%20Kerberos%20options%0AKerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0AGSSAPIAuthentication%20no%0AGSSAPICleanupCredentials%20no%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20ChallengeResponseAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20ChallengeResponseAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20without-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20ChallengeResponseAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20Fedora%20and%20may%20cause%20several%0A%23%20problems.%0AUsePAM%20yes%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0AX11Forwarding%20yes%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%0A%23%20It%20is%20recommended%20to%20use%20pam_motd%20in%20%2Fetc%2Fpam.d%2Fsshd%20instead%20of%20PrintMotd%2C%0A%23%20as%20it%20is%20more%20configurable%20and%20versatile%20than%20the%20built-in%20version.%0APrintMotd%20no%0A%0APrintLastLog%20yes%0A%23TCPKeepAlive%20yes%0APermitUserEnvironment%20no%0ACompression%20no%0AClientAliveInterval%20600%0AClientAliveCountMax%200%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0ABanner%20%2Fetc%2Fissue%0A%0A%23%20Accept%20locale-related%20environment%20variables%0AAcceptEnv%20LANG%20LC_CTYPE%20LC_NUMERIC%20LC_TIME%20LC_COLLATE%20LC_MONETARY%20LC_MESSAGES%0AAcceptEnv%20LC_PAPER%20LC_NAME%20LC_ADDRESS%20LC_TELEPHONE%20LC_MEASUREMENT%0AAcceptEnv%20LC_IDENTIFICATION%20LC_ALL%20LANGUAGE%0AAcceptEnv%20XMODIFIERS%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A%0AUsePrivilegeSeparation%20sandbox + mode: 0600 + path: /etc/ssh/sshd_config + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*HostbasedAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "HostbasedAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276344,54 +276512,6 @@ properly configured. will allow remote access through the SSH port. CCE-80820-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "firewalld" ; then - yum install -y "firewalld" -fi -if ! rpm -q --quiet "NetworkManager" ; then - yum install -y "NetworkManager" -fi -firewalld_sshd_zone='' - - -if systemctl is-active NetworkManager && systemctl is-active firewalld; then - # First make sure the SSH service is enabled in run-time for the proper zone. - # This is to avoid connection issues when new interfaces are addeded to this zone. - firewall-cmd --zone="$firewalld_sshd_zone" --add-service=ssh - - # This will collect all NetworkManager connections names - readarray -t nm_connections < <(nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }') - # If the connection is not yet assigned to a firewalld zone, assign it to the proper zone. - # This will not change connections which are already assigned to any firewalld zone. - for connection in "${nm_connections[@]}"; do - current_zone=$(nmcli -f connection.zone connection show "$connection" | awk '{ print $2}') - if [ $current_zone = "--" ]; then - nmcli connection modify "$connection" connection.zone $firewalld_sshd_zone - fi - done - systemctl restart NetworkManager - - # Active zones are zones with at least one interface assigned to it. - # It is possible that traffic is comming by any active interface and consequently any - # active zone. So, this make sure all active zones are permanently allowing SSH service. - readarray -t firewalld_active_zones < <(firewall-cmd --get-active-zones | grep -v interfaces) - for zone in "${firewalld_active_zones[@]}"; do - firewall-cmd --permanent --zone="$zone" --add-service=ssh - done - firewall-cmd --reload -else - echo " - firewalld and NetworkManager services are not active. Remediation aborted! - This remediation could not be applied because it depends on firewalld and NetworkManager services running. - The service is not started by this remediation in order to prevent connection issues." -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value firewalld_sshd_zone # promote to variable set_fact: firewalld_sshd_zone: !!str @@ -276551,6 +276671,54 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "firewalld" ; then + yum install -y "firewalld" +fi +if ! rpm -q --quiet "NetworkManager" ; then + yum install -y "NetworkManager" +fi +firewalld_sshd_zone='' + + +if systemctl is-active NetworkManager && systemctl is-active firewalld; then + # First make sure the SSH service is enabled in run-time for the proper zone. + # This is to avoid connection issues when new interfaces are addeded to this zone. + firewall-cmd --zone="$firewalld_sshd_zone" --add-service=ssh + + # This will collect all NetworkManager connections names + readarray -t nm_connections < <(nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }') + # If the connection is not yet assigned to a firewalld zone, assign it to the proper zone. + # This will not change connections which are already assigned to any firewalld zone. + for connection in "${nm_connections[@]}"; do + current_zone=$(nmcli -f connection.zone connection show "$connection" | awk '{ print $2}') + if [ $current_zone = "--" ]; then + nmcli connection modify "$connection" connection.zone $firewalld_sshd_zone + fi + done + systemctl restart NetworkManager + + # Active zones are zones with at least one interface assigned to it. + # It is possible that traffic is comming by any active interface and consequently any + # active zone. So, this make sure all active zones are permanently allowing SSH service. + readarray -t firewalld_active_zones < <(firewall-cmd --get-active-zones | grep -v interfaces) + for zone in "${firewalld_active_zones[@]}"; do + firewall-cmd --permanent --zone="$zone" --add-service=ssh + done + firewall-cmd --reload +else + echo " + firewalld and NetworkManager services are not active. Remediation aborted! + This remediation could not be applied because it depends on firewalld and NetworkManager services running. + The service is not started by this remediation in order to prevent connection issues." +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276674,35 +276842,6 @@ supported is version 2, and line Protocol 2 in has many well-known vulnerability exploits. Exploits of the SSH daemon could provide immediate root access to the system. CCE-80894-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^Protocol") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "2" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^Protocol\\>" "/etc/ssh/sshd_config"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^Protocol\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" -else - if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" - fi - cce="CCE-80894-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" - printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow Only SSH Protocol 2 block: @@ -276751,6 +276890,35 @@ fi - no_reboot_needed - restrict_strategy - sshd_allow_only_protocol2 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^Protocol") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "2" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^Protocol\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^Protocol\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-80894-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276803,33 +276971,6 @@ a user has successfully authenticated, add or correct the following line in the vulnerabilities in the compression software could result in compromise of the system from an unauthenticated connection, potentially with root privileges. CCE-80895-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_disable_compression='' - - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Compression\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Compression $var_sshd_disable_compression" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_disable_compression # promote to variable set_fact: var_sshd_disable_compression: !!str @@ -276880,6 +277021,33 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_compression + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_disable_compression='' + + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Compression\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Compression $var_sshd_disable_compression" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277032,12 +277200,62 @@ should prevent users from being able to assign themselves empty passwords.SRG-OS-000480-GPOS-00229 SRG-OS-000480-GPOS-00227 RHEL-08-020330 - 5.2.9 + 4.2.18 SV-230380r858715_rule Configuring this setting for the SSH daemon provides additional assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80896-4 + - name: Disable SSH Access via Empty Passwords + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + line: PermitEmptyPasswords no + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80896-4 + - CJIS-5.5.6 + - DISA-STIG-RHEL-08-020330 + - NIST-800-171-3.1.1 + - NIST-800-171-3.1.5 + - NIST-800-53-AC-17(a) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSS-Req-2.2.4 + - PCI-DSSv4-2.2.6 + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - restrict_strategy + - sshd_disable_empty_passwords + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -277060,56 +277278,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable SSH Access via Empty Passwords - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - line: PermitEmptyPasswords no - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80896-4 - - CJIS-5.5.6 - - DISA-STIG-RHEL-08-020330 - - NIST-800-171-3.1.1 - - NIST-800-171-3.1.5 - - NIST-800-53-AC-17(a) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSS-Req-2.2.4 - - PCI-DSSv4-2.2.6 - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - restrict_strategy - - sshd_disable_empty_passwords @@ -277180,29 +277348,6 @@ To explicitly disable GSSAPI authentication, add or correct the following line i applications. Allowing GSSAPI authentication through SSH exposes the system's GSSAPI to remote hosts, increasing the attack surface of the system. CCE-80897-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "GSSAPIAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable GSSAPI Authentication block: @@ -277248,6 +277393,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_gssapi_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "GSSAPIAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277330,29 +277498,6 @@ is enabled through SSH, the SSH daemon provides a means of access to the system's Kerberos implementation. Configuring these settings for the SSH daemon provides additional assurance that remote logon via SSH will not use unused methods of authentication, even in the event of misconfiguration elsewhere. CCE-80898-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*KerberosAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "KerberosAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable Kerberos Authentication block: @@ -277398,6 +277543,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_kerb_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*KerberosAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "KerberosAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277421,29 +277589,6 @@ correct the following line in applications. Allowing PubkeyAuthentication authentication through SSH allows users to generate their own authentication tokens, increasing the attack surface of the system. CCE-82345-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PubkeyAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable PubkeyAuthentication Authentication block: @@ -277483,6 +277628,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_pubkey_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PubkeyAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277599,33 +277767,10 @@ To explicitly disable support for .rhosts files, add or correct the following li FIA_UAU.1 2.2.6 SRG-OS-000480-GPOS-00227 - 5.2.11 + 4.2.10 SSH trust relationships mean a compromise on one host can allow an attacker to move trivially to other hosts. CCE-80899-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*IgnoreRhosts\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "IgnoreRhosts yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for .rhosts Files block: @@ -277672,6 +277817,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_rhosts + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*IgnoreRhosts\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "IgnoreRhosts yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277728,35 +277896,6 @@ necessary. assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80900-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^RhostsRSAAuthentication") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "no" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^RhostsRSAAuthentication\\>" "/etc/ssh/sshd_config"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^RhostsRSAAuthentication\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" -else - if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" - fi - cce="CCE-80900-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" - printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for Rhosts RSA Authentication block: @@ -277801,6 +277940,35 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_rhosts_rsa + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^RhostsRSAAuthentication") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "no" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^RhostsRSAAuthentication\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^RhostsRSAAuthentication\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-80900-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277964,7 +278132,7 @@ RHV hosts require root access to be managed by RHV Manager. SRG-APP-000148-CTR-000335 SRG-APP-000190-CTR-000500 RHEL-08-010550 - 5.2.7 + 4.2.19 SV-230296r858711_rule Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging directly on as root. @@ -277973,29 +278141,6 @@ accountability of actions performed on the system and also helps to minimize direct attack attempts on root's password. CCE-80901-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitRootLogin no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Root Login block: @@ -278048,6 +278193,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_root_login + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PermitRootLogin no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278075,29 +278243,6 @@ see CCE-27100-7, CCE-27445-6, CCE-80901-2, and similar. Even though the communications channel may be encrypted, an additional layer of security is gained by preventing use of a password. This also helps to minimize direct attack attempts on root's password. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitRootLogin prohibit-password" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH root Login with a Password (Insecure) block: @@ -278137,33 +278282,12 @@ fi - restrict_strategy - sshd_disable_root_password_login - - - - - - - - - - Disable SSH TCP Forwarding - The AllowTcpForwarding parameter specifies whether TCP forwarding is permitted. -To disable TCP forwarding, add or correct the following line in - - -/etc/ssh/sshd_config: - -AllowTcpForwarding no - 2.2.6 - 5.2.13 - Leaving port forwarding enabled can expose the organization to security risks and back-doors. - CCE-83301-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*AllowTcpForwarding\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -278172,7 +278296,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "AllowTcpForwarding no" > "/etc/ssh/sshd_config" +printf '%s\n' "PermitRootLogin prohibit-password" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -278181,6 +278305,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable SSH TCP Forwarding + The AllowTcpForwarding parameter specifies whether TCP forwarding is permitted. +To disable TCP forwarding, add or correct the following line in + + +/etc/ssh/sshd_config: + +AllowTcpForwarding no + 2.2.6 + Leaving port forwarding enabled can expose the organization to security risks and back-doors. + CCE-83301-2 - name: Disable SSH TCP Forwarding block: @@ -278221,6 +278365,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_tcp_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*AllowTcpForwarding\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "AllowTcpForwarding no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278278,29 +278445,6 @@ To ensure this behavior is disabled, add or correct the following line in assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80902-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*IgnoreUserKnownHosts\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "IgnoreUserKnownHosts yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for User Known Hosts block: @@ -278346,6 +278490,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_user_known_hosts + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*IgnoreUserKnownHosts\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "IgnoreUserKnownHosts yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278376,7 +278543,6 @@ To explicitly disable X11 Forwarding, add or correct the following line in 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-040340 - 5.2.12 SV-230555r858721_rule Disable X11 forwarding unless there is an operational requirement to use X11 applications directly. There is a small risk that the remote X11 servers of @@ -278384,6 +278550,49 @@ users who are logged in via SSH with X11 forwarding could be compromised by other users on the X11 server. Note that even if X11 forwarding is disabled, users can always install their own forwarders. CCE-83360-8 + - name: Disable X11 Forwarding + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + line: X11Forwarding no + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83360-8 + - DISA-STIG-RHEL-08-040340 + - NIST-800-53-CM-6(b) + - PCI-DSSv4-2.2.6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_disable_x11_forwarding + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -278406,49 +278615,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable X11 Forwarding - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - line: X11Forwarding no - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83360-8 - - DISA-STIG-RHEL-08-040340 - - NIST-800-53-CM-6(b) - - PCI-DSSv4-2.2.6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sshd_disable_x11_forwarding @@ -278505,34 +278671,11 @@ To explicitly disable Environment options, add or correct the following 2.2.6 SRG-OS-000480-GPOS-00229 RHEL-08-010830 - 5.2.10 + 4.2.20 SV-230330r877377_rule SSH environment options potentially allow users to bypass access restriction in some configurations. CCE-80903-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitUserEnvironment\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitUserEnvironment no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Do Not Allow SSH Environment Options block: @@ -278581,6 +278724,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_do_not_permit_user_env + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PermitUserEnvironment\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PermitUserEnvironment no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278608,29 +278774,6 @@ Kerberos implementations may be subject to exploitation. For enterprises, Kerberos is often enabled and used with GSSAPI for centralized user account management which may necessitate enabling of GSSAPI functionality in SSH. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "GSSAPIAuthentication yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable GSSAPI Authentication block: @@ -278669,6 +278812,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_gssapi_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "GSSAPIAuthentication yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278694,35 +278860,12 @@ To enable PAM authentication, add or correct the following line in CCI-000877 2.2.6 SRG-OS-000125-GPOS-00065 - 5.2.6 + 4.2.21 When UsePAM is set to yes, PAM runs through account and session types properly. This is important if you want to restrict access to services based off of IP, time or other factors of the account. Additionally, you can make sure users inherit certain environment variables on login or disallow access to the server. CCE-86721-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*UsePAM\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "UsePAM yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable PAM block: @@ -278763,6 +278906,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_pam + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*UsePAM\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "UsePAM yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278800,29 +278966,6 @@ A privileged account is defined as an information system account with authorizations of a privileged user. The DoD CAC with DoD-approved PKI is an example of multifactor authentication. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PubkeyAuthentication yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable Public Key Authentication block: @@ -278861,6 +279004,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_pubkey_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PubkeyAuthentication yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278951,6 +279117,51 @@ To explicitly enable StrictModes in SSH, add or correct t If other users have access to modify user-specific SSH configuration files, they may be able to log into the system as another user. CCE-80904-6 + - name: Enable Use of Strict Mode Checking + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + line: StrictModes yes + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80904-6 + - DISA-STIG-RHEL-08-010500 + - NIST-800-171-3.1.12 + - NIST-800-53-AC-17(a) + - NIST-800-53-AC-6 + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_enable_strictmodes + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -278973,51 +279184,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Enable Use of Strict Mode Checking - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - line: StrictModes yes - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80904-6 - - DISA-STIG-RHEL-08-010500 - - NIST-800-171-3.1.12 - - NIST-800-53-AC-17(a) - - NIST-800-53-AC-6 - - NIST-800-53-CM-6(a) - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sshd_enable_strictmodes @@ -279098,29 +279264,6 @@ facilitates possible legal action against attackers. Alternatively, systems whose ownership should not be obvious should ensure usage of a banner that does not provide easy attribution. CCE-80905-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Banner /etc/issue" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Warning Banner block: @@ -279168,6 +279311,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_warning_banner + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Banner /etc/issue" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279235,35 +279401,12 @@ appropriate system-wide warning banner. FTA_TAB.1 SRG-OS-000023-GPOS-00006 SRG-OS-000228-GPOS-00088 - 5.2.15 + 4.2.5 The warning message reinforces policy awareness during the logon process and facilitates possible legal action against attackers. Alternatively, systems whose ownership should not be obvious should ensure usage of a banner that does not provide easy attribution. CCE-87978-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Banner /etc/issue.net" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Warning Banner block: @@ -279309,6 +279452,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_warning_banner_net + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Banner /etc/issue.net" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279376,29 +279542,6 @@ To enable X11 Forwarding, add or correct the following line in Non-encrypted X displays allow an attacker to capture keystrokes and to execute commands remotely. CCE-82421-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*X11Forwarding\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "X11Forwarding yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable Encrypted X11 Forwarding block: @@ -279442,6 +279585,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_x11_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*X11Forwarding\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "X11Forwarding yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279559,7 +279725,7 @@ recommended that at least one of the following options be leveraged: PR.PT-3 Req-2.2.4 2.2.6 - 5.2.4 + 4.2.4 Specifying which accounts are allowed SSH access into the system reduces the possibility of unauthorized access to the system. CCE-82422-7 @@ -279622,29 +279788,6 @@ To explicitly enable LastLog in SSH, add or correct the following line in Providing users feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use. CCE-82281-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PrintLastLog\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PrintLastLog yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Print Last Log block: @@ -279687,6 +279830,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_print_last_log + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PrintLastLog\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PrintLastLog yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279718,35 +279884,6 @@ To decrease the default limits, add or correct the following line in time-based limit, effects of potential attacks against encryption keys are limited. CCE-82177-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_rekey_limit_size='' -var_rekey_limit_time='' - - - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "RekeyLimit $var_rekey_limit_size $var_rekey_limit_time" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_rekey_limit_size # promote to variable set_fact: var_rekey_limit_size: !!str @@ -279799,37 +279936,18 @@ fi - no_reboot_needed - sshd_rekey_limit - - - - - - - - - - - - Ensure SSH LoginGraceTime is configured - The LoginGraceTime parameter to the SSH server specifies the time allowed for successful authentication to -the SSH server. The longer the Grace period is the more open unauthenticated connections -can exist. Like other session controls in this session the Grace Period should be limited to -appropriate limits to ensure the service is available for needed access. - 2.2.6 - 5.2.19 - Setting the LoginGraceTime parameter to a low number will minimize the risk of successful -brute force attacks to the SSH server. It will also limit the number of concurrent -unauthenticated connections. - CCE-86551-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -var_sshd_set_login_grace_time='' +var_rekey_limit_size='' +var_rekey_limit_time='' + + if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*LoginGraceTime\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -279838,7 +279956,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "LoginGraceTime $var_sshd_set_login_grace_time" > "/etc/ssh/sshd_config" +printf '%s\n' "RekeyLimit $var_rekey_limit_size $var_rekey_limit_time" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -279847,6 +279965,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + + Ensure SSH LoginGraceTime is configured + The LoginGraceTime parameter to the SSH server specifies the time allowed for successful authentication to +the SSH server. The longer the Grace period is the more open unauthenticated connections +can exist. Like other session controls in this session the Grace Period should be limited to +appropriate limits to ensure the service is available for needed access. + 2.2.6 + 4.2.12 + Setting the LoginGraceTime parameter to a low number will minimize the risk of successful +brute force attacks to the SSH server. It will also limit the number of concurrent +unauthenticated connections. + CCE-86551-9 - name: XCCDF Value var_sshd_set_login_grace_time # promote to variable set_fact: var_sshd_set_login_grace_time: !!str @@ -279893,6 +280033,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_login_grace_time + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_login_grace_time='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LoginGraceTime\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LoginGraceTime $var_sshd_set_login_grace_time" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279918,7 +280084,7 @@ To explicitly specify the log level in SSH, add or correct the following line in LogLevel INFO AC-17(a) CM-6(a) - 5.2.5 + 4.2.13 SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically not recommended other than strictly for debugging SSH communications since it provides so much data that it is difficult to identify important security information. INFO level is the @@ -279926,29 +280092,6 @@ basic level that only records login activity of SSH users. In many situations, s Response, it is important to determine when a particular user was active on a system. The logout record can eliminate those users who disconnected, which helps narrow the field. CCE-82282-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "LogLevel INFO" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set LogLevel to INFO block: @@ -279990,6 +280133,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_loglevel_info + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LogLevel INFO" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280017,7 +280183,7 @@ SSH, add or correct the following line in Req-2.2.4 2.2.6 SRG-OS-000032-GPOS-00013 - 5.2.5 + 4.2.13 SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically not recommended other than strictly for debugging SSH communications since it provides so much data that it is difficult to identify important security information. INFO or @@ -280026,29 +280192,6 @@ situations, such as Incident Response, it is important to determine when a parti on a system. The logout record can eliminate those users who disconnected, which helps narrow the field. CCE-82420-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "LogLevel VERBOSE" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set SSH Daemon LogLevel to VERBOSE block: @@ -280093,6 +280236,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_loglevel_verbose + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LogLevel VERBOSE" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280123,36 +280289,10 @@ to set MaxAUthTries edit /etc/ssh/sshd_config as follows: 1560 1561 2.2.6 - 5.2.16 + 4.2.15 Setting the MaxAuthTries parameter to a low number will minimize the risk of successful brute force attacks to the SSH server. CCE-83500-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -sshd_max_auth_tries_value='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*MaxAuthTries\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "MaxAuthTries $sshd_max_auth_tries_value" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value sshd_max_auth_tries_value # promote to variable set_fact: sshd_max_auth_tries_value: !!str @@ -280200,35 +280340,15 @@ fi - restrict_strategy - sshd_set_max_auth_tries - - - - - - - - - - - Set SSH MaxSessions limit - The MaxSessions parameter specifies the maximum number of open sessions permitted -from a given connection. To set MaxSessions edit -/etc/ssh/sshd_config as follows: MaxSessions - 2.2.6 - 5.2.18 - To protect a system from denial of service due to a large number of concurrent -sessions, use the rate limiting function of MaxSessions to protect availability -of sshd logins and prevent overwhelming the daemon. - CCE-83357-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -var_sshd_max_sessions='' +sshd_max_auth_tries_value='' if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*MaxSessions\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*MaxAuthTries\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -280237,7 +280357,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "MaxSessions $var_sshd_max_sessions" > "/etc/ssh/sshd_config" +printf '%s\n' "MaxAuthTries $sshd_max_auth_tries_value" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -280246,6 +280366,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Set SSH MaxSessions limit + The MaxSessions parameter specifies the maximum number of open sessions permitted +from a given connection. To set MaxSessions edit +/etc/ssh/sshd_config as follows: MaxSessions + 2.2.6 + 4.2.16 + To protect a system from denial of service due to a large number of concurrent +sessions, use the rate limiting function of MaxSessions to protect availability +of sshd logins and prevent overwhelming the daemon. + CCE-83357-4 - name: XCCDF Value var_sshd_max_sessions # promote to variable set_fact: var_sshd_max_sessions: !!str @@ -280292,6 +280432,32 @@ fi - medium_severity - no_reboot_needed - sshd_set_max_sessions + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_max_sessions='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*MaxSessions\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "MaxSessions $var_sshd_max_sessions" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280314,37 +280480,11 @@ line in the CIS recommends a MaxStartups value of '10:30:60', or more restrictive where dictated by site policy. 2.2.6 - 5.2.17 + 4.2.17 To protect a system from denial of service due to a large number of pending authentication connection attempts, use the rate limiting function of MaxStartups to protect availability of sshd logins and prevent overwhelming the daemon. CCE-90718-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_set_maxstartups='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*MaxStartups\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "MaxStartups $var_sshd_set_maxstartups" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_set_maxstartups # promote to variable set_fact: var_sshd_set_maxstartups: !!str @@ -280391,6 +280531,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_maxstartups + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_maxstartups='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*MaxStartups\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "MaxStartups $var_sshd_set_maxstartups" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280593,6 +280759,7 @@ submits to this process. SRG-OS-000250-GPOS-00093 SRG-OS-000393-GPOS-00173 SRG-OS-000394-GPOS-00174 + 4.2.6 Unapproved mechanisms that are used for authentication to the cryptographic module are not verified and therefore cannot be relied upon to provide confidentiality or integrity, and system data may be compromised. @@ -280867,6 +281034,56 @@ SSH, add or correct the following line in the /etc/ssh/sshd_config CCE-80908-7 + - name: XCCDF Value var_sshd_priv_separation # promote to variable + set_fact: + var_sshd_priv_separation: !!str + tags: + - always + +- name: Enable Use of Privilege Separation + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + line: UsePrivilegeSeparation {{ var_sshd_priv_separation }} + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80908-7 + - NIST-800-171-3.1.12 + - NIST-800-53-AC-17(a) + - NIST-800-53-AC-6 + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_use_priv_separation + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -280893,20 +281110,43 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: XCCDF Value var_sshd_priv_separation # promote to variable + + + + + + + + + + + Use Only Strong Key Exchange algorithms + Limit the Key Exchange to strong algorithms. +The following line in /etc/ssh/sshd_config demonstrates use +of those: +KexAlgorithms + Req-2.3 + 2.2.7 + 4.2.11 + Key exchange is any method in cryptography by which cryptographic keys are exchanged +between two parties, allowing use of a cryptographic algorithm. If the sender and receiver +wish to exchange encrypted messages, each must be equipped to encrypt messages to be +sent and decrypt messages received + CCE-86518-8 + - name: XCCDF Value sshd_strong_kex # promote to variable set_fact: - var_sshd_priv_separation: !!str + sshd_strong_kex: !!str tags: - always -- name: Enable Use of Privilege Separation +- name: Use Only Strong Key Exchange algorithms block: - name: Check for duplicate values lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ + regexp: (?i)^\s*KexAlgorithms\s+ state: absent check_mode: true changed_when: false @@ -280916,7 +281156,7 @@ fi lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ + regexp: (?i)^\s*KexAlgorithms\s+ state: absent when: dupes.found is defined and dupes.found > 1 @@ -280924,32 +281164,156 @@ fi lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ - line: UsePrivilegeSeparation {{ var_sshd_priv_separation }} + regexp: (?i)^\s*KexAlgorithms\s+ + line: KexAlgorithms {{ sshd_strong_kex }} state: present insertbefore: BOF validate: /usr/sbin/sshd -t -f %s when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80908-7 - - NIST-800-171-3.1.12 - - NIST-800-53-AC-17(a) - - NIST-800-53-AC-6 - - NIST-800-53-CM-6(a) + - CCE-86518-8 + - PCI-DSS-Req-2.3 + - PCI-DSSv4-2.2.7 - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - sshd_use_priv_separation + - sshd_use_strong_kex + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sshd_strong_kex='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*KexAlgorithms\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "KexAlgorithms $sshd_strong_kex" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi - + - + - + + + + + Use Only Strong MACs + Limit the MACs to strong hash algorithms. +The following line in /etc/ssh/sshd_config demonstrates use +of those MACs: +MACs + 4.2.14 + MD5 and 96-bit MAC algorithms are considered weak and have been shown to increase +exploitability in SSH downgrade attacks. Weak algorithms continue to have a great deal of +attention as a weak spot that can be exploited with expanded computing power. An +attacker that breaks the algorithm could take advantage of a MiTM position to decrypt the +SSH tunnel and capture credentials and information + CCE-86504-8 + - name: XCCDF Value sshd_strong_macs # promote to variable + set_fact: + sshd_strong_macs: !!str + tags: + - always + +- name: Use Only Strong MACs + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + line: MACs {{ sshd_strong_macs }} + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86504-8 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_use_strong_macs + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sshd_strong_macs='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^MACs") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$sshd_strong_macs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^MACs\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^MACs\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-86504-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + @@ -280971,37 +281335,6 @@ plaintext padding and initialization vectors in encryption algorithms, and high- entropy elliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-82462-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/sysconfig/sshd" ] ; then - - LC_ALL=C sed -i "/^\s*SSH_USE_STRONG_RNG\s*=\s*/d" "/etc/sysconfig/sshd" -else - touch "/etc/sysconfig/sshd" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sysconfig/sshd" - -cp "/etc/sysconfig/sshd" "/etc/sysconfig/sshd.bak" -# Insert before the line matching the regex '^#\s*SSH_USE_STRONG_RNG'. -line_number="$(LC_ALL=C grep -n "^#\s*SSH_USE_STRONG_RNG" "/etc/sysconfig/sshd.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^#\s*SSH_USE_STRONG_RNG', insert at - # the end of the file. - printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" -else - head -n "$(( line_number - 1 ))" "/etc/sysconfig/sshd.bak" > "/etc/sysconfig/sshd" - printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" - tail -n "+$(( line_number ))" "/etc/sysconfig/sshd.bak" >> "/etc/sysconfig/sshd" -fi -# Clean up after ourselves. -rm "/etc/sysconfig/sshd.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Setting unquoted shell-style assignment of 'SSH_USE_STRONG_RNG' to '32' in '/etc/sysconfig/sshd' block: @@ -281043,6 +281376,37 @@ fi - no_reboot_needed - restrict_strategy - sshd_use_strong_rng + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/sysconfig/sshd" ] ; then + + LC_ALL=C sed -i "/^\s*SSH_USE_STRONG_RNG\s*=\s*/d" "/etc/sysconfig/sshd" +else + touch "/etc/sysconfig/sshd" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sysconfig/sshd" + +cp "/etc/sysconfig/sshd" "/etc/sysconfig/sshd.bak" +# Insert before the line matching the regex '^#\s*SSH_USE_STRONG_RNG'. +line_number="$(LC_ALL=C grep -n "^#\s*SSH_USE_STRONG_RNG" "/etc/sysconfig/sshd.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^#\s*SSH_USE_STRONG_RNG', insert at + # the end of the file. + printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" +else + head -n "$(( line_number - 1 ))" "/etc/sysconfig/sshd.bak" > "/etc/sysconfig/sshd" + printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" + tail -n "+$(( line_number ))" "/etc/sysconfig/sshd.bak" >> "/etc/sysconfig/sshd" +fi +# Clean up after ourselves. +rm "/etc/sysconfig/sshd.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281078,29 +281442,6 @@ loopback address and sets the hostname part of the DISPLAY CCE-84058-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*X11UseLocalhost\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "X11UseLocalhost yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Prevent remote hosts from connecting to the proxy display block: @@ -281142,6 +281483,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_x11_use_localhost + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*X11UseLocalhost\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "X11UseLocalhost yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281220,33 +281584,6 @@ $ sudo yum install sssd-ipa sssd-ipa provides the IPA back end that the SSSD can utilize to fetch identity data from and authenticate against an IPA server. CCE-82994-5 - -package --add=sssd-ipa - - include install_sssd-ipa - -class install_sssd-ipa { - package { 'sssd-ipa': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -if ! rpm -q --quiet "sssd-ipa" ; then - yum install -y "sssd-ipa" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "sssd-ipa" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -281272,6 +281609,33 @@ version = "*" - medium_severity - no_reboot_needed - package_sssd-ipa_installed + + +[[packages]] +name = "sssd-ipa" +version = "*" + + include install_sssd-ipa + +class install_sssd-ipa { + package { 'sssd-ipa': + ensure => 'installed', + } +} + + +package --add=sssd-ipa + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +if ! rpm -q --quiet "sssd-ipa" ; then + yum install -y "sssd-ipa" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281337,33 +281701,6 @@ $ sudo yum install sssd PR.AC-7 CCE-82444-1 - -package --add=sssd - - include install_sssd - -class install_sssd { - package { 'sssd': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -if ! rpm -q --quiet "sssd" ; then - yum install -y "sssd" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "sssd" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -281391,6 +281728,33 @@ version = "*" - medium_severity - no_reboot_needed - package_sssd_installed + + +[[packages]] +name = "sssd" +version = "*" + + include install_sssd + +class install_sssd { + package { 'sssd': + ensure => 'installed', + } +} + + +package --add=sssd + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +if ! rpm -q --quiet "sssd" ; then + yum install -y "sssd" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281458,31 +281822,6 @@ The sssd service can be enabled with the following comman CCE-82440-9 - include enable_sssd - -class enable_sssd { - service {'sssd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'sssd.service' -"$SYSTEMCTL_EXEC" start 'sssd.service' -"$SYSTEMCTL_EXEC" enable 'sssd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["sssd"] - - name: Gather the package facts package_facts: manager: auto @@ -281525,6 +281864,31 @@ enabled = ["sssd"] - medium_severity - no_reboot_needed - service_sssd_enabled + + +[customizations.services] +enabled = ["sssd"] + + include enable_sssd + +class enable_sssd { + service {'sssd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'sssd.service' +"$SYSTEMCTL_EXEC" start 'sssd.service' +"$SYSTEMCTL_EXEC" enable 'sssd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281549,52 +281913,6 @@ multifactor solutions are checked via Online Certificate Status Protocol (OCSP). Ensuring that multifactor solutions certificates are checked via Online Certificate Status Protocol (OCSP) ensures the security of the system. CCE-86120-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -var_sssd_certificate_verification_digest_function='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -MAIN_CONF="/etc/sssd/conf.d/certificate_verification.conf" - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[sssd\]([^\n\[]*\n+)+?[[:space:]]*certificate_verification" "$f"; then - sed -i "s/certificate_verification[^(\n)]*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[sssd\]" "$f"; then - sed -i "/[[:space:]]*\[sssd\]/a certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[sssd]\ncertificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -281671,6 +281989,52 @@ fi - medium_severity - no_reboot_needed - sssd_certificate_verification + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +var_sssd_certificate_verification_digest_function='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +MAIN_CONF="/etc/sssd/conf.d/certificate_verification.conf" + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[sssd\]([^\n\[]*\n+)+?[[:space:]]*certificate_verification" "$f"; then + sed -i "s/certificate_verification[^(\n)]*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[sssd\]" "$f"; then + sed -i "/[[:space:]]*\[sssd\]/a certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[sssd]\ncertificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281885,7 +282249,7 @@ include the "allow_missing_name" option, like in the following example: SRG-OS-000107-GPOS-00054 SRG-OS-000108-GPOS-00055 RHEL-08-020250 - SV-230372r627750_rule + SV-230372r942945_rule Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the @@ -281898,89 +282262,6 @@ as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80909-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*pam_cert_auth" "$f"; then - sed -i "s/pam_cert_auth[^(\n)]*/pam_cert_auth = True/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[pam\]" "$f"; then - sed -i "/[[:space:]]*\[pam\]/a pam_cert_auth = True" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[pam]\npam_cert_auth = True" >> "$file" -fi - -umask $OLD_UMASK - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect enable-feature with-smartcard - - authselect apply-changes -b -else - if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*' "/etc/pam.d/smartcard-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/smartcard-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"sufficient"' \2/' "/etc/pam.d/smartcard-auth" - else - echo 'auth '"sufficient"' pam_sss.so' >> "/etc/pam.d/smartcard-auth" - fi - fi - # Check the option - if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*\sallow_missing_name\b' "/etc/pam.d/smartcard-auth"; then - sed -i -E --follow-symlinks '/\s*auth\s+'"sufficient"'\s+pam_sss.so.*/ s/$/ allow_missing_name/' "/etc/pam.d/smartcard-auth" - fi - if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*' "/etc/pam.d/system-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' \2/' "/etc/pam.d/system-auth" - else - echo 'auth '"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' pam_sss.so' >> "/etc/pam.d/system-auth" - fi - fi - # Check the option - if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*\stry_cert_auth\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks '/\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so.*/ s/$/ try_cert_auth/' "/etc/pam.d/system-auth" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282333,6 +282614,89 @@ fi - medium_severity - no_reboot_needed - sssd_enable_smartcards + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*pam_cert_auth" "$f"; then + sed -i "s/pam_cert_auth[^(\n)]*/pam_cert_auth = True/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[pam\]" "$f"; then + sed -i "/[[:space:]]*\[pam\]/a pam_cert_auth = True" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[pam]\npam_cert_auth = True" >> "$file" +fi + +umask $OLD_UMASK + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect enable-feature with-smartcard + + authselect apply-changes -b +else + if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*' "/etc/pam.d/smartcard-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/smartcard-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"sufficient"' \2/' "/etc/pam.d/smartcard-auth" + else + echo 'auth '"sufficient"' pam_sss.so' >> "/etc/pam.d/smartcard-auth" + fi + fi + # Check the option + if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*\sallow_missing_name\b' "/etc/pam.d/smartcard-auth"; then + sed -i -E --follow-symlinks '/\s*auth\s+'"sufficient"'\s+pam_sss.so.*/ s/$/ allow_missing_name/' "/etc/pam.d/smartcard-auth" + fi + if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*' "/etc/pam.d/system-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' \2/' "/etc/pam.d/system-auth" + else + echo 'auth '"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' pam_sss.so' >> "/etc/pam.d/system-auth" + fi + fi + # Check the option + if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*\stry_cert_auth\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks '/\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so.*/ s/$/ try_cert_auth/' "/etc/pam.d/system-auth" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282441,50 +282805,6 @@ memcache_timeout = CCE-80910-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_sssd_memcache_timeout='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[nss\]([^\n\[]*\n+)+?[[:space:]]*memcache_timeout" "$f"; then - sed -i "s/memcache_timeout[^(\n)]*/memcache_timeout = $var_sssd_memcache_timeout/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[nss\]" "$f"; then - sed -i "/[[:space:]]*\[nss\]/a memcache_timeout = $var_sssd_memcache_timeout" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[nss]\nmemcache_timeout = $var_sssd_memcache_timeout" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282576,6 +282896,50 @@ fi - no_reboot_needed - sssd_memcache_timeout - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_sssd_memcache_timeout='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[nss\]([^\n\[]*\n+)+?[[:space:]]*memcache_timeout" "$f"; then + sed -i "s/memcache_timeout[^(\n)]*/memcache_timeout = $var_sssd_memcache_timeout/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[nss\]" "$f"; then + sed -i "/[[:space:]]*\[nss\]/a memcache_timeout = $var_sssd_memcache_timeout" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[nss]\nmemcache_timeout = $var_sssd_memcache_timeout" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282655,52 +283019,11 @@ offline_credentials_expiration = 1 PR.AC-7 SRG-OS-000383-GPOS-00166 RHEL-08-020290 - SV-230376r854036_rule + SV-230376r942948_rule If cached authentication information is out-of-date, the validity of the authentication information may be questionable. CCE-82460-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*offline_credentials_expiration" "$f"; then - sed -i "s/offline_credentials_expiration[^(\n)]*/offline_credentials_expiration = 1/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[pam\]" "$f"; then - sed -i "/[[:space:]]*\[pam\]/a offline_credentials_expiration = 1" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[pam]\noffline_credentials_expiration = 1" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282791,6 +283114,47 @@ fi - medium_severity - no_reboot_needed - sssd_offline_cred_expiration + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*offline_credentials_expiration" "$f"; then + sed -i "s/offline_credentials_expiration[^(\n)]*/offline_credentials_expiration = 1/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[pam\]" "$f"; then + sed -i "/[[:space:]]*\[pam\]/a offline_credentials_expiration = 1" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[pam]\noffline_credentials_expiration = 1" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282923,50 +283287,6 @@ ssh_known_hosts_timeout = CCE-82442-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_sssd_ssh_known_hosts_timeout='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[ssh\]([^\n\[]*\n+)+?[[:space:]]*ssh_known_hosts_timeout" "$f"; then - sed -i "s/ssh_known_hosts_timeout[^(\n)]*/ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[ssh\]" "$f"; then - sed -i "/[[:space:]]*\[ssh\]/a ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[ssh]\nssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283058,6 +283378,50 @@ fi - no_reboot_needed - sssd_ssh_known_hosts_timeout - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_sssd_ssh_known_hosts_timeout='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[ssh\]([^\n\[]*\n+)+?[[:space:]]*ssh_known_hosts_timeout" "$f"; then + sed -i "s/ssh_known_hosts_timeout[^(\n)]*/ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[ssh\]" "$f"; then + sed -i "/[[:space:]]*\[ssh\]/a ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[ssh]\nssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283090,6 +283454,7 @@ integrity of LDAP remote access sessions. By setting the ldap_tls_cacert option in /etc/sssd/sssd.conf to point to the path for the X.509 certificates used for peer authentication. ldap_tls_cacert /path/to/tls/ca.cert + A remediation is not provided for this rule as each system has unique requirements. CCI-001453 SC-12(3) CM-6(a) @@ -283129,40 +283494,6 @@ to verify the hash information while maintaining the confidentiality of the key used to generate the hash. CCE-82456-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then - -var_sssd_ldap_tls_ca_dir='' - - -SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_cacertdir' -AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' -DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" - -# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_tls_cacertdir in sssd.conf, if it exists, set to '$var_sssd_ldap_tls_ca_dir' -# if ldap_tls_cacertdir isn't here, add it -# if [domain/..] doesn't exist, add it here for default domain -if grep -qvzosP $AD_REGEX $SSSD_CONF; then - if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - - sed -i "s#ldap_tls_cacertdir[^(\n)]*#ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir#" $SSSD_CONF - elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" $SSSD_CONF - else - if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" >> $SSSD_CONF - else - echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 - fi - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283281,49 +283612,30 @@ fi - sssd_ldap_configure_tls_ca_dir - unknown_strategy - - - - - - - - - - Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server - Configure SSSD to demand a valid certificate from the server to -protect the integrity of LDAP remote access sessions by setting -the ldap_tls_reqcert option in /etc/sssd/sssd.conf -to demand. - CCI-001453 - SC-12(3) - CM-6(a) - SRG-OS-000250-GPOS-00093 - Without a valid certificate presented to the LDAP client backend, the identity of a -server can be forged compromising LDAP remote access sessions. - - CCE-84062-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then +var_sssd_ldap_tls_ca_dir='' + + SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_reqcert' +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_cacertdir' AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" # Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_tls_reqcert in sssd.conf, if it exists, set to 'demand' -# if ldap_tls_reqcert isn't here, add it +# Try to find [domain/..] and ldap_tls_cacertdir in sssd.conf, if it exists, set to '$var_sssd_ldap_tls_ca_dir' +# if ldap_tls_cacertdir isn't here, add it # if [domain/..] doesn't exist, add it here for default domain if grep -qvzosP $AD_REGEX $SSSD_CONF; then if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - sed -i "s#ldap_tls_reqcert[^(\n)]*#ldap_tls_reqcert = demand#" $SSSD_CONF + sed -i "s#ldap_tls_cacertdir[^(\n)]*#ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir#" $SSSD_CONF elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_tls_reqcert = demand" $SSSD_CONF + sed -i "/$DOMAIN_REGEX/a ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" $SSSD_CONF else if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_tls_reqcert = demand" >> $SSSD_CONF + echo -e "[domain/default]\nldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" >> $SSSD_CONF else echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 fi @@ -283334,6 +283646,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server + Configure SSSD to demand a valid certificate from the server to +protect the integrity of LDAP remote access sessions by setting +the ldap_tls_reqcert option in /etc/sssd/sssd.conf +to demand. + CCI-001453 + SC-12(3) + CM-6(a) + SRG-OS-000250-GPOS-00093 + Without a valid certificate presented to the LDAP client backend, the identity of a +server can be forged compromising LDAP remote access sessions. + + CCE-84062-9 - name: Gather the package facts package_facts: manager: auto @@ -283446,6 +283780,37 @@ fi - no_reboot_needed - sssd_ldap_configure_tls_reqcert - unknown_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then + +SSSD_CONF="/etc/sssd/sssd.conf" +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_reqcert' +AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' +DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" + +# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. +# Try to find [domain/..] and ldap_tls_reqcert in sssd.conf, if it exists, set to 'demand' +# if ldap_tls_reqcert isn't here, add it +# if [domain/..] doesn't exist, add it here for default domain +if grep -qvzosP $AD_REGEX $SSSD_CONF; then + if grep -qzosP $LDAP_REGEX $SSSD_CONF; then + + sed -i "s#ldap_tls_reqcert[^(\n)]*#ldap_tls_reqcert = demand#" $SSSD_CONF + elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then + sed -i "/$DOMAIN_REGEX/a ldap_tls_reqcert = demand" $SSSD_CONF + else + if test -f "$SSSD_CONF"; then + echo -e "[domain/default]\nldap_tls_reqcert = demand" >> $SSSD_CONF + else + echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 + fi + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283563,37 +283928,6 @@ whether to use TLS or not. If not specified it will default to no. It should be set to start_tls rather than doing LDAP over SSL. CCE-82437-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then - -SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_id_use_start_tls' -AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' -DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" - -# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_id_use_start_tls in sssd.conf, if it exists, set to 'true' -# if ldap_id_use_start_tls isn't here, add it -# if [domain/..] doesn't exist, add it here for default domain -if grep -qvzosP $AD_REGEX $SSSD_CONF; then - if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - - sed -i "s#ldap_id_use_start_tls[^(\n)]*#ldap_id_use_start_tls = true#" $SSSD_CONF - elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_id_use_start_tls = true" $SSSD_CONF - else - if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_id_use_start_tls = true" >> $SSSD_CONF - else - echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 - fi - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283711,6 +284045,37 @@ fi - no_reboot_needed - sssd_ldap_start_tls - unknown_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then + +SSSD_CONF="/etc/sssd/sssd.conf" +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_id_use_start_tls' +AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' +DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" + +# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. +# Try to find [domain/..] and ldap_id_use_start_tls in sssd.conf, if it exists, set to 'true' +# if ldap_id_use_start_tls isn't here, add it +# if [domain/..] doesn't exist, add it here for default domain +if grep -qvzosP $AD_REGEX $SSSD_CONF; then + if grep -qzosP $LDAP_REGEX $SSSD_CONF; then + + sed -i "s#ldap_id_use_start_tls[^(\n)]*#ldap_id_use_start_tls = true#" $SSSD_CONF + elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then + sed -i "/$DOMAIN_REGEX/a ldap_id_use_start_tls = true" $SSSD_CONF + else + if test -f "$SSSD_CONF"; then + echo -e "[domain/default]\nldap_id_use_start_tls = true" >> $SSSD_CONF + else + echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 + fi + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283742,8 +284107,23 @@ $ sudo yum install usbguard against rogue USB devices by implementing basic whitelisting/blacklisting capabilities based on USB device attributes. CCE-82959-8 - -package --add=usbguard + - name: Ensure usbguard is installed + package: + name: usbguard + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82959-8 + - DISA-STIG-RHEL-08-040139 + - NIST-800-53-CM-8(3) + - NIST-800-53-IA-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_usbguard_installed --- apiVersion: machineconfiguration.openshift.io/v1 @@ -283754,6 +284134,11 @@ spec: version: 3.1.0 extensions: - usbguard + + +[[packages]] +name = "usbguard" +version = "*" include install_usbguard @@ -283762,6 +284147,9 @@ class install_usbguard { ensure => 'installed', } } + + +package --add=usbguard # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then @@ -283773,29 +284161,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "usbguard" -version = "*" - - - name: Ensure usbguard is installed - package: - name: usbguard - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82959-8 - - DISA-STIG-RHEL-08-040139 - - NIST-800-53-CM-8(3) - - NIST-800-53-IA-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_usbguard_installed @@ -283822,6 +284187,35 @@ The usbguard service can be enabled with the following co The usbguard service must be running in order to enforce the USB device authorization policy for all USB devices. CCE-82853-3 + - name: Enable service usbguard + block: + + - name: Gather the package facts + package_facts: + manager: auto + + - name: Enable service usbguard + systemd: + name: usbguard + enabled: 'yes' + state: started + masked: 'no' + when: + - '"usbguard" in ansible_facts.packages' + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82853-3 + - DISA-STIG-RHEL-08-040141 + - NIST-800-53-CM-8(3)(a) + - NIST-800-53-IA-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_usbguard_enabled + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -283836,6 +284230,10 @@ spec: units: - name: usbguard.service enabled: true + + +[customizations.services] +enabled = ["usbguard"] include enable_usbguard @@ -283857,39 +284255,6 @@ SYSTEMCTL_EXEC='/usr/bin/systemctl' else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -enabled = ["usbguard"] - - - name: Enable service usbguard - block: - - - name: Gather the package facts - package_facts: - manager: auto - - - name: Enable service usbguard - systemd: - name: usbguard - enabled: 'yes' - state: started - masked: 'no' - when: - - '"usbguard" in ansible_facts.packages' - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82853-3 - - DISA-STIG-RHEL-08-040141 - - NIST-800-53-CM-8(3)(a) - - NIST-800-53-IA-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_usbguard_enabled @@ -283980,18 +284345,6 @@ to /etc/usbguard/rules.conf. Without allowing Human Interface Devices, it might not be possible to interact with the system. CCE-82274-2 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -# path of file with Usbguard rules -rulesfile="/etc/usbguard/rules.conf" - -echo "allow with-interface match-all { 03:*:* }" >> $rulesfile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow HID devices lineinfile: path: /etc/usbguard/rules.conf @@ -284008,6 +284361,18 @@ fi - medium_severity - no_reboot_needed - usbguard_allow_hid + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +# path of file with Usbguard rules +rulesfile="/etc/usbguard/rules.conf" + +echo "allow with-interface match-all { 03:*:* }" >> $rulesfile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284032,6 +284397,25 @@ to /etc/usbguard/rules.conf. to interact with the system. Without allowing hubs, it might not be possible to use any USB devices on the system. CCE-82368-2 + - name: Allow HID devices and hubs + lineinfile: + path: /etc/usbguard/rules.conf + create: true + line: allow with-interface match-all { 03:*:* 09:00:* } + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82368-2 + - NIST-800-53-CM-8(3) + - NIST-800-53-IA-3 + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - usbguard_allow_hid_and_hub + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -284058,25 +284442,6 @@ echo "allow with-interface match-all { 03:*:* 09:00:* }" >> /etc/usbguard/ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Allow HID devices and hubs - lineinfile: - path: /etc/usbguard/rules.conf - create: true - line: allow with-interface match-all { 03:*:* 09:00:* } - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82368-2 - - NIST-800-53-CM-8(3) - - NIST-800-53-IA-3 - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - usbguard_allow_hid_and_hub @@ -284097,15 +284462,6 @@ to /etc/usbguard/rules.conf. Without allowing hubs, it might not be possible to use any USB devices on the system. CCE-82273-4 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -echo "allow with-interface match-all { 09:00:* }" >> /etc/usbguard/rules.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow hubs lineinfile: path: /etc/usbguard/rules.conf @@ -284122,6 +284478,15 @@ fi - medium_severity - no_reboot_needed - usbguard_allow_hub + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +echo "allow with-interface match-all { 09:00:* }" >> /etc/usbguard/rules.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284147,36 +284512,6 @@ devices. The usbguard must be configured to allow connected USB devices to work properly, avoiding the system to become inaccessible. CCE-83774-0 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -if rpm --quiet -q usbguard -then - USBGUARD_CONF=/etc/usbguard/rules.conf - if [ ! -f "$USBGUARD_CONF" ] || [ ! -s "$USBGUARD_CONF" ]; then - usbguard generate-policy > $USBGUARD_CONF - if [ ! -s "$USBGUARD_CONF" ]; then - # make sure OVAL check doesn't fail on systems where - # generate-policy doesn't find any USB devices (for - # example a system might not have a USB bus) - echo "# No USB devices found" > $USBGUARD_CONF - fi - # make sure it has correct permissions - chmod 600 $USBGUARD_CONF - - SYSTEMCTL_EXEC='/usr/bin/systemctl' - "$SYSTEMCTL_EXEC" unmask 'usbguard.service' - "$SYSTEMCTL_EXEC" restart 'usbguard.service' - "$SYSTEMCTL_EXEC" enable 'usbguard.service' - fi -else - echo "USBGuard is not installed. No remediation was applied!" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -284244,6 +284579,36 @@ fi - medium_severity - no_reboot_needed - usbguard_generate_policy + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +if rpm --quiet -q usbguard +then + USBGUARD_CONF=/etc/usbguard/rules.conf + if [ ! -f "$USBGUARD_CONF" ] || [ ! -s "$USBGUARD_CONF" ]; then + usbguard generate-policy > $USBGUARD_CONF + if [ ! -s "$USBGUARD_CONF" ]; then + # make sure OVAL check doesn't fail on systems where + # generate-policy doesn't find any USB devices (for + # example a system might not have a USB bus) + echo "# No USB devices found" > $USBGUARD_CONF + fi + # make sure it has correct permissions + chmod 600 $USBGUARD_CONF + + SYSTEMCTL_EXEC='/usr/bin/systemctl' + "$SYSTEMCTL_EXEC" unmask 'usbguard.service' + "$SYSTEMCTL_EXEC" restart 'usbguard.service' + "$SYSTEMCTL_EXEC" enable 'usbguard.service' + fi +else + echo "USBGuard is not installed. No remediation was applied!" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284315,8 +284680,21 @@ continuing installation. Unnecessary service packages must not be installed to decrease the attack surface of the system. X windows has a long history of security vulnerabilities and should not be installed unless approved and documented. CCE-82757-6 - -package --remove=xorg-x11-server-common + - name: Ensure xorg-x11-server-common is removed + package: + name: xorg-x11-server-common + state: absent + tags: + - CCE-82757-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_xorg-x11-server-common_removed include remove_xorg-x11-server-common @@ -284325,6 +284703,9 @@ class remove_xorg-x11-server-common { ensure => 'purged', } } + + +package --remove=xorg-x11-server-common # CAUTION: This remediation script will remove xorg-x11-server-common @@ -284338,22 +284719,6 @@ if rpm -q --quiet "xorg-x11-server-common" ; then yum remove -y "xorg-x11-server-common" fi - - - name: Ensure xorg-x11-server-common is removed - package: - name: xorg-x11-server-common - state: absent - tags: - - CCE-82757-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_xorg-x11-server-common_removed @@ -284391,6 +284756,25 @@ X11 graphic libraries are dependency of OpenStack Cinderlib storage provider. CCE-83411-9 + - name: Ensure xorg packages are removed + package: + name: + - xorg-x11-server-Xorg + - xorg-x11-server-common + - xorg-x11-server-utils + - xorg-x11-server-Xwayland + state: absent + tags: + - CCE-83411-9 + - DISA-STIG-RHEL-08-040320 + - NIST-800-53-CM-6(b) + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + - xwindows_remove_packages + package --remove=xorg-x11-server-Xorg --remove=xorg-x11-server-common --remove=xorg-x11-server-utils --remove=xorg-x11-server-Xwayland @@ -284418,25 +284802,6 @@ if rpm -q --quiet "xorg-x11-server-Xwayland" ; then yum remove -y "xorg-x11-server-Xwayland" fi - - - name: Ensure xorg packages are removed - package: - name: - - xorg-x11-server-Xorg - - xorg-x11-server-common - - xorg-x11-server-utils - - xorg-x11-server-Xwayland - state: absent - tags: - - CCE-83411-9 - - DISA-STIG-RHEL-08-040320 - - NIST-800-53-CM-6(b) - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - - xwindows_remove_packages @@ -284497,15 +284862,6 @@ long history of security vulnerabilities and should not be used unless approved and documented. CCE-83380-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -systemctl set-default multi-user.target - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Switch to multi-user runlevel file: src: /usr/lib/systemd/system/multi-user.target @@ -284525,6 +284881,15 @@ fi - reboot_required - restrict_strategy - xwindows_runlevel_target + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +systemctl set-default multi-user.target + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284656,13 +285021,13 @@ which the system will be deployed as closely as possible. - + OVALFileLinker from SCAP Security Guide ssg: [0, 1, 72], python: 3.10.12 5.11 - 2024-01-25T00:06:33 + 2024-01-26T00:06:41 @@ -285820,6 +286185,52 @@ which the system will be deployed as closely as possible. + + + Use Only Strong Key Exchange algorithms + + Red Hat Enterprise Linux 8 + + + + Limit the Key Exchange Algorithms to those which are FIPS-approved. + + + + + + + + + + + + + + + + Use Only Strong MACs + + Red Hat Enterprise Linux 8 + + + + Ensure only strong MAC algorithms are used + + + + + + + + + + + + + + + Certificate status checking in SSSD @@ -287346,6 +287757,20 @@ which the system will be deployed as closely as possible. + + + Ensure Authentication Required for Single User Mode + + Red Hat Enterprise Linux 8 + + + + Ensure root password is configured + + + + + Direct root Logins Not Allowed @@ -291257,6 +291682,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + AIDE should be configured to use the FIPS 140-2 cryptographic hashes. @@ -295963,6 +296389,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ is group owned by 0. @@ -296402,6 +296829,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ is owned by 0. @@ -296499,6 +296927,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ has mode 0640. If the target file or directory has an extended ACL, then it will fail the mode check. @@ -312568,6 +312997,14 @@ which the system will be deployed as closely as possible. + + + + + + + + @@ -313271,6 +313708,9 @@ which the system will be deployed as closely as possible. + + + @@ -323238,6 +323678,22 @@ which the system will be deployed as closely as possible.^[ \t]*(?i)UsePrivilegeSeparation(?-i)[ \t]+(.+?)[ \t]*(?:$|#) 1 + + oval:ssg-var_sshd_config_kex:var:1 + + + /etc/ssh/sshd_config + ^[\s]*(?i)KexAlgorithms(?-i)[\s]+([\w,-@]+)+[\s]*(?:#.*)?$ + 1 + + + oval:ssg-var_sshd_config_strong_macs:var:1 + + + /etc/ssh/sshd_config + ^[\s]*(?i)MACs(?-i)[\s]+([\w,-@]+)+[\s]*(?:#.*)?$ + 1 + ^/etc/sssd/(sssd|conf\.d/.*)\.conf$ ^[\s]*\[sssd](?:[^\n\[]*\n+)+?[\s]*certificate_verification\s*=\s*ocsp_dgst\s*=\s*(\w+)$ @@ -323269,12 +323725,12 @@ which the system will be deployed as closely as possible.1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[pam](?:[^\n\[]*\n+)+?[\s]*offline_credentials_expiration[\s]*=[\s]*1\s*(?:#.*)?$ 1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*cache_credentials\s*=\s*(\w+)\s*(?:#.*)?$ 1 @@ -323294,12 +323750,12 @@ which the system will be deployed as closely as possible.1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[domain\/[^]]*]([^\n\[\]]*\n+)+?[\s]*ldap_tls_reqcert[ \t]*=[ \t]*((?i)demand)[ \t]*$ 1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[domain\/[^]]*]([^\n\[\]]*\n+)+?[\s]*ldap_id_use_start_tls[ \t]*=[ \t]*((?i)true)[ \t]*$ 1 @@ -324130,6 +324586,11 @@ which the system will be deployed as closely as possible. 1 + + /etc/shadow + ^root:\$(y|[0-9].+)\$.*$ + 1 + /etc/securetty ^.*$ @@ -339629,6 +340090,12 @@ which the system will be deployed as closely as possible. + + + + + + @@ -345754,6 +346221,28 @@ which the system will be deployed as closely as possible. + + + + + + + + + + + + + + + + + + + + + + @@ -350297,7447 +350786,7460 @@ which the system will be deployed as closely as possible. - + build_shorthand.py from SCAP Security Guide ssg: 0.1.72 2.0 - 2024-01-25T00:06:33 + 2024-01-26T00:06:41 - - Disable Power Settings in GNOME3 + + Verify Permissions on cron.d - ocil:ssg-dconf_gnome_disable_power_settings_action:testaction:1 + ocil:ssg-file_permissions_cron_d_action:testaction:1 - - Disable the httpd_serve_cobbler_files SELinux Boolean + + Install dnf-automatic Package - ocil:ssg-sebool_httpd_serve_cobbler_files_action:testaction:1 + ocil:ssg-package_dnf-automatic_installed_action:testaction:1 - - Set SSH Client Alive Interval + + Configure auditing of successful permission changes - ocil:ssg-sshd_set_idle_timeout_action:testaction:1 + ocil:ssg-audit_perm_change_success_action:testaction:1 - - Enable the LDAP Client For Use in Authconfig + + Disable the mozilla_plugin_use_bluejeans SELinux Boolean - ocil:ssg-enable_ldap_client_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_bluejeans_action:testaction:1 - - Extend Audit Backlog Limit for the Audit Daemon in zIPL + + Disable the authlogin_radius SELinux Boolean - ocil:ssg-zipl_audit_backlog_limit_argument_action:testaction:1 + ocil:ssg-sebool_authlogin_radius_action:testaction:1 - - Disallow Configuration to Bypass Password Requirements for Privilege Escalation + + Verify nftables Service is Enabled - ocil:ssg-disallow_bypass_password_sudo_action:testaction:1 + ocil:ssg-service_nftables_enabled_action:testaction:1 - - Disable the puppetagent_manage_all_files SELinux Boolean + + Verify that System Executables Have Restrictive Permissions - ocil:ssg-sebool_puppetagent_manage_all_files_action:testaction:1 + ocil:ssg-file_permissions_binary_dirs_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - postqueue + + Add noexec Option to Removable Media Partitions - ocil:ssg-audit_rules_privileged_commands_postqueue_action:testaction:1 + ocil:ssg-mount_option_noexec_removable_partitions_action:testaction:1 - - Disable the httpd_verify_dns SELinux Boolean + + Configure the confidence in TPM for entropy - ocil:ssg-sebool_httpd_verify_dns_action:testaction:1 + ocil:ssg-grub2_rng_core_default_quality_argument_action:testaction:1 - - Force initialization of variables containing userspace addresses + + Disable the xguest_mount_media SELinux Boolean - ocil:ssg-kernel_config_gcc_plugin_structleak_action:testaction:1 + ocil:ssg-sebool_xguest_mount_media_action:testaction:1 - - Verify User Who Owns group File + + Install the Asset Configuration Compliance Module (ACCM) - ocil:ssg-file_owner_etc_group_action:testaction:1 + ocil:ssg-install_mcafee_hbss_accm_action:testaction:1 - - Disable the httpd_tmp_exec SELinux Boolean + + Uninstall talk Package - ocil:ssg-sebool_httpd_tmp_exec_action:testaction:1 + ocil:ssg-package_talk_removed_action:testaction:1 - - Uninstall gssproxy Package + + Disable the openvpn_run_unconfined SELinux Boolean - ocil:ssg-package_gssproxy_removed_action:testaction:1 + ocil:ssg-sebool_openvpn_run_unconfined_action:testaction:1 - - Install rng-tools Package + + Set SSH Client Alive Interval - ocil:ssg-package_rng-tools_installed_action:testaction:1 + ocil:ssg-sshd_set_idle_timeout_action:testaction:1 - - Verify Permissions on /var/log/messages File + + Enable Kernel Parameter to Ignore Bogus ICMP Error Responses on IPv4 Interfaces - ocil:ssg-file_permissions_var_log_messages_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_icmp_ignore_bogus_error_responses_action:testaction:1 - - Configure auditd Disk Full Action when Disk Space Is Full + + Enable checks on linked list manipulation - ocil:ssg-auditd_data_disk_full_action_action:testaction:1 + ocil:ssg-kernel_config_debug_list_action:testaction:1 - - Disable the domain_kernel_load_modules SELinux Boolean + + Ensure Users Cannot Change GNOME3 Screensaver Idle Activation - ocil:ssg-sebool_domain_kernel_load_modules_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_activation_locked_action:testaction:1 - - Disable the cluster_use_execmem SELinux Boolean + + Verify User Who Owns Backup passwd File - ocil:ssg-sebool_cluster_use_execmem_action:testaction:1 + ocil:ssg-file_owner_backup_etc_passwd_action:testaction:1 - - Specify module signing key to use + + Disable Kernel Image Loading - ocil:ssg-kernel_config_module_sig_key_action:testaction:1 + ocil:ssg-sysctl_kernel_kexec_load_disabled_action:testaction:1 - - Specify a Remote NTP Server + + Uninstall abrt-cli Package - ocil:ssg-chronyd_or_ntpd_specify_remote_server_action:testaction:1 + ocil:ssg-package_abrt-cli_removed_action:testaction:1 - - Restrict unprivileged access to the kernel syslog + + Disable the git_system_use_nfs SELinux Boolean - ocil:ssg-kernel_config_security_dmesg_restrict_action:testaction:1 + ocil:ssg-sebool_git_system_use_nfs_action:testaction:1 - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default + + Disable the xdm_sysadm_login SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_pinfo_action:testaction:1 + ocil:ssg-sebool_xdm_sysadm_login_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/shadow + + Record Unsuccessful Ownership Changes to Files - fchownat - ocil:ssg-no_legacy_plus_entries_etc_shadow_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchownat_action:testaction:1 - - IOMMU configuration directive + + Disallow magic SysRq key - ocil:ssg-grub2_enable_iommu_force_action:testaction:1 + ocil:ssg-sysctl_kernel_sysrq_action:testaction:1 - - Disable the rsync_export_all_ro SELinux Boolean + + Disable SSH Support for User Known Hosts - ocil:ssg-sebool_rsync_export_all_ro_action:testaction:1 + ocil:ssg-sshd_disable_user_known_hosts_action:testaction:1 - - Configure auditd admin_space_left Action on Low Disk Space + + Disable Cyrus SASL Authentication Daemon (saslauthd) - ocil:ssg-auditd_data_retention_admin_space_left_action_action:testaction:1 + ocil:ssg-service_saslauthd_disabled_action:testaction:1 - - Configure Multiple DNS Servers in /etc/resolv.conf + + Ensure Rsyslog Authenticates Off-Loaded Audit Records - ocil:ssg-network_configure_name_resolution_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdriverauthmode_action:testaction:1 - - Disable the virt_sandbox_use_netlink SELinux Boolean + + Disable the ftpd_connect_db SELinux Boolean - ocil:ssg-sebool_virt_sandbox_use_netlink_action:testaction:1 + ocil:ssg-sebool_ftpd_connect_db_action:testaction:1 - - Disable the httpd_can_network_connect_db SELinux Boolean + + Disable GDM Automatic Login - ocil:ssg-sebool_httpd_can_network_connect_db_action:testaction:1 + ocil:ssg-gnome_gdm_disable_automatic_login_action:testaction:1 - - Uninstall abrt-plugin-sosreport Package + + Disable Kernel iwlwifi Module - ocil:ssg-package_abrt-plugin-sosreport_removed_action:testaction:1 + ocil:ssg-kernel_module_iwlwifi_disabled_action:testaction:1 - - Ensure sudo passwd_timeout is appropriate - sudo passwd_timeout + + Set Password Minimum Length in login.defs - ocil:ssg-sudo_add_passwd_timeout_action:testaction:1 + ocil:ssg-accounts_password_minlen_login_defs_action:testaction:1 - - Disable SSH Root Login + + Ensure All Accounts on the System Have Unique Names - ocil:ssg-sshd_disable_root_login_action:testaction:1 + ocil:ssg-account_unique_name_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Unloading - create_module + + Configure the gluster_export_all_rw SELinux Boolean - ocil:ssg-audit_rules_kernel_module_loading_create_action:testaction:1 + ocil:ssg-sebool_gluster_export_all_rw_action:testaction:1 - - Disable CAN Support + + Enable use of Berkeley Packet Filter with seccomp - ocil:ssg-kernel_module_can_disabled_action:testaction:1 + ocil:ssg-kernel_config_seccomp_filter_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd + + Enable log_config_module For HTTPD Logging - ocil:ssg-audit_rules_etc_passwd_open_by_handle_at_action:testaction:1 + ocil:ssg-httpd_enable_log_config_action:testaction:1 - - Backup interactive scripts on the production web server are prohibited + + Verify Group Who Owns SSH Server config file - ocil:ssg-httpd_remove_backups_action:testaction:1 + ocil:ssg-file_groupowner_sshd_config_action:testaction:1 - - Disable the logwatch_can_network_connect_mail SELinux Boolean + + Add noexec Option to /var/tmp - ocil:ssg-sebool_logwatch_can_network_connect_mail_action:testaction:1 + ocil:ssg-mount_option_var_tmp_noexec_action:testaction:1 - - Install OpenSSH client software + + Disallow kernel profiling by unprivileged users - ocil:ssg-package_openssh-clients_installed_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_event_paranoid_action:testaction:1 - - Ensure SELinux is Not Disabled + + Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces - ocil:ssg-selinux_not_disabled_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_route_localnet_action:testaction:1 - - Disable the uvcvideo module + + Do not allow ACPI methods to be inserted/replaced at run time - ocil:ssg-kernel_module_uvcvideo_disabled_action:testaction:1 + ocil:ssg-kernel_config_acpi_custom_method_action:testaction:1 - - Disable rexec Service + + Configure SSSD LDAP Backend Client CA Certificate - ocil:ssg-service_rexec_disabled_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_ca_action:testaction:1 - - Enable Smartcards in SSSD + + Set PAM''s Password Hashing Algorithm - password-auth - ocil:ssg-sssd_enable_smartcards_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_passwordauth_action:testaction:1 - - Disable Kernel Parameter for Accepting Secure ICMP Redirects on all IPv4 Interfaces + + Configure auditing of unsuccessful file modifications - ocil:ssg-sysctl_net_ipv4_conf_all_secure_redirects_action:testaction:1 + ocil:ssg-audit_modify_failed_action:testaction:1 - - Assign Expiration Date to Temporary Accounts + + Verify Permissions on group File - ocil:ssg-account_temp_expire_date_action:testaction:1 + ocil:ssg-file_permissions_etc_group_action:testaction:1 - - Harden SSHD Crypto Policy + + Set Permissions on the /etc/httpd/conf/ Directory - ocil:ssg-harden_sshd_crypto_policy_action:testaction:1 + ocil:ssg-dir_perms_etc_httpd_conf_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchmodat + + Verify /boot/efi/EFI/redhat/user.cfg User Ownership - ocil:ssg-audit_rules_dac_modification_fchmodat_action:testaction:1 + ocil:ssg-file_owner_efi_user_cfg_action:testaction:1 - - Verify Permissions on /etc/cron.allow file + + Configure basic parameters of Audit system - ocil:ssg-file_permissions_cron_allow_action:testaction:1 + ocil:ssg-audit_basic_configuration_action:testaction:1 - - Disable the irssi_use_full_network SELinux Boolean + + Ensure All Accounts on the System Have Unique User IDs - ocil:ssg-sebool_irssi_use_full_network_action:testaction:1 + ocil:ssg-account_unique_id_action:testaction:1 - - Disable the httpd_run_stickshift SELinux Boolean + + Ensure All World-Writable Directories Are Group Owned by a System Account - ocil:ssg-sebool_httpd_run_stickshift_action:testaction:1 + ocil:ssg-dir_perms_world_writable_system_owned_group_action:testaction:1 - - Create Warning Banners for All FTP Users + + Install iptables Package - ocil:ssg-ftp_present_banner_action:testaction:1 + ocil:ssg-package_iptables_installed_action:testaction:1 - - Disable network management of chrony daemon + + Disable the antivirus_use_jit SELinux Boolean - ocil:ssg-chronyd_no_chronyc_network_action:testaction:1 + ocil:ssg-sebool_antivirus_use_jit_action:testaction:1 - - Verify permissions on System Login Banner + + Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config - ocil:ssg-file_permissions_etc_issue_action:testaction:1 + ocil:ssg-harden_sshd_macs_opensshserver_conf_crypto_policy_action:testaction:1 - - Configure a Sufficiently Large Partition for Audit Logs + + Disable the use_lpd_server SELinux Boolean - ocil:ssg-auditd_audispd_configure_sufficiently_large_partition_action:testaction:1 + ocil:ssg-sebool_use_lpd_server_action:testaction:1 - - Configure the root Account for Failed Password Attempts + + Install rng-tools Package - ocil:ssg-accounts_passwords_pam_faillock_deny_root_action:testaction:1 + ocil:ssg-package_rng-tools_installed_action:testaction:1 - - Disable the ssh_sysadm_login SELinux Boolean + + Enable SLUB/SLAB allocator poisoning in zIPL - ocil:ssg-sebool_ssh_sysadm_login_action:testaction:1 + ocil:ssg-zipl_slub_debug_argument_action:testaction:1 - - Disable the fcron_crond SELinux Boolean + + Explicit arguments in sudo specifications - ocil:ssg-sebool_fcron_crond_action:testaction:1 + ocil:ssg-sudoers_explicit_command_args_action:testaction:1 - - Disable graphical user interface + + Disable Portreserve (portreserve) - ocil:ssg-xwindows_remove_packages_action:testaction:1 + ocil:ssg-service_portreserve_disabled_action:testaction:1 - - Disable the tftp_home_dir SELinux Boolean + + Disable Kernel mac80211 Module - ocil:ssg-sebool_tftp_home_dir_action:testaction:1 + ocil:ssg-kernel_module_mac80211_disabled_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - lremovexattr + + Install the ntp service - ocil:ssg-audit_rules_unsuccessful_file_modification_lremovexattr_action:testaction:1 + ocil:ssg-package_ntp_installed_action:testaction:1 - - Disable Kernel Parameter for IP Forwarding on IPv4 Interfaces + + Authorize Human Interface Devices in USBGuard daemon - ocil:ssg-sysctl_net_ipv4_ip_forward_action:testaction:1 + ocil:ssg-usbguard_allow_hid_action:testaction:1 - - Set Kernel Parameter to Increase Local Port Range + + System Audit Logs Must Be Owned By Root - ocil:ssg-sysctl_net_ipv4_ip_local_port_range_action:testaction:1 + ocil:ssg-file_ownership_var_log_audit_stig_action:testaction:1 - - Enable the antivirus_can_scan_system SELinux Boolean + + Enable the selinuxuser_ping SELinux Boolean - ocil:ssg-sebool_antivirus_can_scan_system_action:testaction:1 + ocil:ssg-sebool_selinuxuser_ping_action:testaction:1 - - Add nodev Option to /var/tmp + + Ensure /tmp Located On Separate Partition - ocil:ssg-mount_option_var_tmp_nodev_action:testaction:1 + ocil:ssg-partition_for_tmp_action:testaction:1 - - Ensure the Default C Shell Umask is Set Correctly + + Ensure SELinux is Not Disabled - ocil:ssg-accounts_umask_etc_csh_cshrc_action:testaction:1 + ocil:ssg-selinux_not_disabled_action:testaction:1 - - Disable Accepting Router Advertisements on all IPv6 Interfaces by Default + + Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_trunc_write_action:testaction:1 - - Restrict Web Browser Use for Administrative Accounts + + Record Unsuccessful Access Attempts to Files - creat - ocil:ssg-no_root_webbrowsing_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_creat_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - fchownat + + Ensure sudo Ignores Commands In Current Dir - sudo ignore_dot - ocil:ssg-audit_rules_unsuccessful_file_modification_fchownat_action:testaction:1 + ocil:ssg-sudo_add_ignore_dot_action:testaction:1 - - Verify No netrc Files Exist + + Disable the httpd_use_gpg SELinux Boolean - ocil:ssg-no_netrc_files_action:testaction:1 + ocil:ssg-sebool_httpd_use_gpg_action:testaction:1 - - Install pam_pwquality Package + + Ensure No Daemons are Unconfined by SELinux - ocil:ssg-package_pam_pwquality_installed_action:testaction:1 + ocil:ssg-selinux_confinement_of_daemons_action:testaction:1 - - Kernel panic on oops + + Uninstall rsync Package - ocil:ssg-sysctl_kernel_panic_on_oops_action:testaction:1 + ocil:ssg-package_rsync_removed_action:testaction:1 - - Configure auditing of successful file modifications + + Disable SSH Support for Rhosts RSA Authentication - ocil:ssg-audit_modify_success_action:testaction:1 + ocil:ssg-sshd_disable_rhosts_rsa_action:testaction:1 - - Ensure All Groups on the System Have Unique Group Names + + Disable kernel support for MISC binaries - ocil:ssg-group_unique_name_action:testaction:1 + ocil:ssg-kernel_config_binfmt_misc_action:testaction:1 - - Verify permissions on System Login Banner for Remote Connections + + Uninstall talk-server Package - ocil:ssg-file_permissions_etc_issue_net_action:testaction:1 + ocil:ssg-package_talk-server_removed_action:testaction:1 - - Disable the LDT (local descriptor table) + + Disable All GNOME3 Thumbnailers - ocil:ssg-kernel_config_modify_ldt_syscall_action:testaction:1 + ocil:ssg-dconf_gnome_disable_thumbnailers_action:testaction:1 - - Uninstall abrt-plugin-logger Package + + Disable the virt_sandbox_use_all_caps SELinux Boolean - ocil:ssg-package_abrt-plugin-logger_removed_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_all_caps_action:testaction:1 - - Ensure zIPL bootmap is up to date + + Disable X11 Forwarding - ocil:ssg-zipl_bootmap_is_up_to_date_action:testaction:1 + ocil:ssg-sshd_disable_x11_forwarding_action:testaction:1 - - Record Successful Creation Attempts to Files - openat O_CREAT + + Disable the dhcpc_exec_iptables SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_openat_o_creat_action:testaction:1 + ocil:ssg-sebool_dhcpc_exec_iptables_action:testaction:1 - - Record Successful Creation Attempts to Files - openat O_TRUNC_WRITE + + Ensure System is Not Acting as a Network Sniffer - ocil:ssg-audit_rules_successful_file_modification_openat_o_trunc_write_action:testaction:1 + ocil:ssg-network_sniffer_disabled_action:testaction:1 - - Configure the polyinstantiation_enabled SELinux Boolean + + Verify Permissions on Backup passwd File - ocil:ssg-sebool_polyinstantiation_enabled_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_passwd_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Special Characters + + Enable PAM - ocil:ssg-accounts_password_pam_ocredit_action:testaction:1 + ocil:ssg-sshd_enable_pam_action:testaction:1 - - Disable the use_nfs_home_dirs SELinux Boolean + + Disable rsh Service - ocil:ssg-sebool_use_nfs_home_dirs_action:testaction:1 + ocil:ssg-service_rsh_disabled_action:testaction:1 - - Disable the rsync_client SELinux Boolean + + Disable the cups_execmem SELinux Boolean - ocil:ssg-sebool_rsync_client_action:testaction:1 + ocil:ssg-sebool_cups_execmem_action:testaction:1 - - Verify Group Who Owns shadow File + + Enable authselect - ocil:ssg-file_groupowner_etc_shadow_action:testaction:1 + ocil:ssg-enable_authselect_action:testaction:1 - - Configure audit according to OSPP requirements + + The operating system must restrict privilege elevation to authorized personnel - ocil:ssg-audit_rules_for_ospp_action:testaction:1 + ocil:ssg-sudo_restrict_privilege_elevation_to_authorized_action:testaction:1 - - Ensure only owner and members of group owner of /usr/bin/sudo can execute it + + Record Events that Modify the System's Discretionary Access Controls - umount - ocil:ssg-sudo_restrict_others_executable_permission_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_umount_action:testaction:1 - - Install the cron service + + Disable storing core dumps - ocil:ssg-package_cron_installed_action:testaction:1 + ocil:ssg-sysctl_kernel_core_pattern_action:testaction:1 - - Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces + + Disable x86 vsyscall emulation - ocil:ssg-sysctl_net_ipv4_conf_all_shared_media_action:testaction:1 + ocil:ssg-kernel_config_x86_vsyscall_emulation_action:testaction:1 - - Kernel panic timeout + + Disable Accepting ICMP Redirects for All IPv6 Interfaces - ocil:ssg-kernel_config_panic_timeout_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_redirects_action:testaction:1 - - Boot Loader Is Not Installed On Removeable Media + + Enable SSH Warning Banner - ocil:ssg-grub2_no_removeable_media_action:testaction:1 + ocil:ssg-sshd_enable_warning_banner_net_action:testaction:1 - - Add nosuid Option to /opt + + Disable Kernel Parameter for Accepting Secure ICMP Redirects on all IPv4 Interfaces - ocil:ssg-mount_option_opt_nosuid_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_secure_redirects_action:testaction:1 - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default + + Disable DHCP Client in ifcfg - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_action:testaction:1 + ocil:ssg-sysconfig_networking_bootproto_ifcfg_action:testaction:1 - - Disable the squid_connect_any SELinux Boolean + + Verify that audit tools Have Mode 0755 or less - ocil:ssg-sebool_squid_connect_any_action:testaction:1 + ocil:ssg-file_permissions_audit_binaries_action:testaction:1 - - Remove Rsh Trust Files + + Disable support for /proc/kkcore - ocil:ssg-no_rsh_trust_files_action:testaction:1 + ocil:ssg-kernel_config_proc_kcore_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading and Unloading + + Limit the Number of Concurrent Login Sessions Allowed Per User - ocil:ssg-audit_rules_kernel_module_loading_action:testaction:1 + ocil:ssg-accounts_max_concurrent_login_sessions_action:testaction:1 - - Harden slab freelist metadata + + Require modules to be validly signed - ocil:ssg-kernel_config_slab_freelist_hardened_action:testaction:1 + ocil:ssg-kernel_config_module_sig_force_action:testaction:1 - - Disable the httpd_use_sasl SELinux Boolean + + Force initialization of variables containing userspace addresses - ocil:ssg-sebool_httpd_use_sasl_action:testaction:1 + ocil:ssg-kernel_config_gcc_plugin_structleak_action:testaction:1 - - Configure SSSD LDAP Backend Client CA Certificate + + Disable the httpd_tmp_exec SELinux Boolean - ocil:ssg-sssd_ldap_configure_tls_ca_action:testaction:1 + ocil:ssg-sebool_httpd_tmp_exec_action:testaction:1 - - Ensure Rsyslog Authenticates Off-Loaded Audit Records + + Disable Automatic Bug Reporting Tool (abrtd) - ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdriverauthmode_action:testaction:1 + ocil:ssg-service_abrtd_disabled_action:testaction:1 - - Ensure gpgcheck Enabled for Repository Metadata + + Disable the nfsd_anon_write SELinux Boolean - ocil:ssg-ensure_gpgcheck_repo_metadata_action:testaction:1 + ocil:ssg-sebool_nfsd_anon_write_action:testaction:1 - - Disable Accepting Packets Routed Between Local Interfaces + + Configure SSH Server to Use FIPS 140-2 Validated Ciphers: opensshserver.config - ocil:ssg-sysctl_net_ipv4_conf_all_accept_local_action:testaction:1 + ocil:ssg-harden_sshd_ciphers_opensshserver_conf_crypto_policy_action:testaction:1 - - Record Successful Permission Changes to Files - lsetxattr + + Configure auditing of successful ownership changes - ocil:ssg-audit_rules_successful_file_modification_lsetxattr_action:testaction:1 + ocil:ssg-audit_owner_change_success_action:testaction:1 - - Disable the unprivuser_use_svirt SELinux Boolean + + Installation of a compiler on production web server is prohibited - ocil:ssg-sebool_unprivuser_use_svirt_action:testaction:1 + ocil:ssg-httpd_no_compilers_in_prod_action:testaction:1 - - Generate some entropy during boot and runtime + + Set Password Warning Age - ocil:ssg-kernel_config_gcc_plugin_latent_entropy_action:testaction:1 + ocil:ssg-accounts_password_warn_age_login_defs_action:testaction:1 - - Disable GNOME3 Automount Opening + + Use Only FIPS 140-2 Validated Ciphers - ocil:ssg-dconf_gnome_disable_automount_open_action:testaction:1 + ocil:ssg-sshd_use_approved_ciphers_action:testaction:1 - - Disable the use_samba_home_dirs SELinux Boolean + + Configure AIDE to Verify Access Control Lists (ACLs) - ocil:ssg-sebool_use_samba_home_dirs_action:testaction:1 + ocil:ssg-aide_verify_acls_action:testaction:1 - - Restrict Exposed Kernel Pointer Addresses Access + + Verify Group Who Owns cron.d - ocil:ssg-sysctl_kernel_kptr_restrict_action:testaction:1 + ocil:ssg-file_groupowner_cron_d_action:testaction:1 - - Disable the mpd_use_cifs SELinux Boolean + + Disable the secure_mode_policyload SELinux Boolean - ocil:ssg-sebool_mpd_use_cifs_action:testaction:1 + ocil:ssg-sebool_secure_mode_policyload_action:testaction:1 - - Require Credential Prompting for Remote Access in GNOME3 + + Enable the postfix_local_write_mail_spool SELinux Boolean - ocil:ssg-dconf_gnome_remote_access_credential_prompt_action:testaction:1 + ocil:ssg-sebool_postfix_local_write_mail_spool_action:testaction:1 - - Add noexec Option to /var + + Disable the sanlock_use_nfs SELinux Boolean - ocil:ssg-mount_option_var_noexec_action:testaction:1 + ocil:ssg-sebool_sanlock_use_nfs_action:testaction:1 - - Ensure users' .netrc Files are not group or world accessible + + Ensure PAM Displays Last Logon/Access Notification - ocil:ssg-accounts_users_netrc_file_permissions_action:testaction:1 + ocil:ssg-display_login_attempts_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - at + + Mount Remote Filesystems with noexec - ocil:ssg-audit_rules_privileged_commands_at_action:testaction:1 + ocil:ssg-mount_option_noexec_remote_filesystems_action:testaction:1 - - Ensure /srv Located On Separate Partition + + Ensure All SGID Executables Are Authorized - ocil:ssg-partition_for_srv_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_sgid_action:testaction:1 - - Configure Error Log Format + + Disable the samba_share_fusefs SELinux Boolean - ocil:ssg-httpd_configure_log_format_action:testaction:1 + ocil:ssg-sebool_samba_share_fusefs_action:testaction:1 - - Enable the login_console_enabled SELinux Boolean + + Audit Configuration Files Must Be Owned By Root - ocil:ssg-sebool_login_console_enabled_action:testaction:1 + ocil:ssg-file_ownership_audit_configuration_action:testaction:1 - - Add grpquota Option to /home + + Enable Randomized Layout of Virtual Address Space - ocil:ssg-mount_option_home_grpquota_action:testaction:1 + ocil:ssg-sysctl_kernel_randomize_va_space_action:testaction:1 - - Record Successful Creation Attempts to Files - open O_TRUNC_WRITE + + Install the Samba Common Package - ocil:ssg-audit_rules_successful_file_modification_open_o_trunc_write_action:testaction:1 + ocil:ssg-package_samba-common_installed_action:testaction:1 - - Verify No .forward Files Exist + + Ensure All Groups on the System Have Unique Group ID - ocil:ssg-no_forward_files_action:testaction:1 + ocil:ssg-group_unique_id_action:testaction:1 - - Disable Squid + + Ensure auditd Collects System Administrator Actions - ocil:ssg-service_squid_disabled_action:testaction:1 + ocil:ssg-audit_rules_sysadmin_actions_action:testaction:1 - - Verify Permissions on passwd File + + Disable Kerberos Authentication - ocil:ssg-file_permissions_etc_passwd_action:testaction:1 + ocil:ssg-sshd_disable_kerb_auth_action:testaction:1 - - Verify that Interactive Boot is Disabled + + Verify Group Who Owns Backup gshadow File - ocil:ssg-grub2_disable_interactive_boot_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_gshadow_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv6 Interfaces + + System Audit Logs Must Be Owned By Root - ocil:ssg-sysctl_net_ipv6_conf_all_accept_source_route_action:testaction:1 + ocil:ssg-file_ownership_var_log_audit_action:testaction:1 - - Set Interval For Counting Failed Password Attempts + + Disable the mcelog_client SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_interval_action:testaction:1 + ocil:ssg-sebool_mcelog_client_action:testaction:1 - - Remove the kernel mapping in user mode + + Ensure that /etc/cron.deny does not exist - ocil:ssg-kernel_config_page_table_isolation_action:testaction:1 + ocil:ssg-file_cron_deny_not_exist_action:testaction:1 - - Prevent Unrestricted Mail Relaying + + Configure auditing of successful file accesses - ocil:ssg-postfix_prevent_unrestricted_relay_action:testaction:1 + ocil:ssg-audit_access_success_action:testaction:1 - - Modify the System Login Banner for Remote Connections + + Ensure auditd Collects Information on the Use of Privileged Commands - passwd - ocil:ssg-banner_etc_issue_net_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_passwd_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - poweroff + + Verify User Who Owns passwd File - ocil:ssg-audit_privileged_commands_poweroff_action:testaction:1 + ocil:ssg-file_owner_etc_passwd_action:testaction:1 - - Configure the tmux Lock Command + + Disable the git_cgi_use_nfs SELinux Boolean - ocil:ssg-configure_tmux_lock_command_action:testaction:1 + ocil:ssg-sebool_git_cgi_use_nfs_action:testaction:1 - - System Audit Logs Must Be Owned By Root + + Disable the samba_export_all_ro SELinux Boolean - ocil:ssg-file_ownership_var_log_audit_stig_action:testaction:1 + ocil:ssg-sebool_samba_export_all_ro_action:testaction:1 - - Disable the httpd_dontaudit_search_dirs SELinux Boolean + + Verify Permissions on cron.monthly - ocil:ssg-sebool_httpd_dontaudit_search_dirs_action:testaction:1 + ocil:ssg-file_permissions_cron_monthly_action:testaction:1 - - Configure basic parameters of Audit system + + Configure The Number of Allowed Simultaneous Requests - ocil:ssg-audit_basic_configuration_action:testaction:1 + ocil:ssg-httpd_configure_max_keepalive_requests_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - lsetxattr + + Install iptables-services Package - ocil:ssg-audit_rules_unsuccessful_file_modification_lsetxattr_action:testaction:1 + ocil:ssg-package_iptables-services_installed_action:testaction:1 - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default + + Disable the httpd_use_cifs SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_defrtr_action:testaction:1 + ocil:ssg-sebool_httpd_use_cifs_action:testaction:1 - - Enable systemd-journald Service + + Record Events that Modify User/Group Information - /etc/security/opasswd - ocil:ssg-service_systemd-journald_enabled_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_opasswd_action:testaction:1 - - Record Attempts to perform maintenance activities + + Ensure PAM Enforces Password Requirements - Enforce for Local Accounts Only - ocil:ssg-audit_sudo_log_events_action:testaction:1 + ocil:ssg-accounts_password_pam_enforce_local_action:testaction:1 - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces + + Add nosuid Option to /srv - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_pinfo_action:testaction:1 + ocil:ssg-mount_option_srv_nosuid_action:testaction:1 - - Disable the httpd_run_ipa SELinux Boolean + + Disable rexec Service - ocil:ssg-sebool_httpd_run_ipa_action:testaction:1 + ocil:ssg-service_rexec_disabled_action:testaction:1 - - Install systemd-journal-remote Package + + Appropriate Action Must be Setup When the Internal Audit Event Queue is Full - ocil:ssg-package_systemd-journal-remote_installed_action:testaction:1 + ocil:ssg-auditd_overflow_action_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - open_by_handle_at O_TRUNC_WRITE + + Verify Permissions on SSH Server config file - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 + ocil:ssg-file_permissions_sshd_config_action:testaction:1 - - Install subscription-manager Package + + Disable debug-shell SystemD Service - ocil:ssg-package_subscription-manager_installed_action:testaction:1 + ocil:ssg-service_debug-shell_disabled_action:testaction:1 - - Ensure auditd Collects System Administrator Actions + + Record Successful Creation Attempts to Files - open O_TRUNC_WRITE - ocil:ssg-audit_rules_sysadmin_actions_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_o_trunc_write_action:testaction:1 - - Enable Dracut FIPS Module + + Ensure auditd Collects Information on Kernel Module Loading - init_module - ocil:ssg-enable_dracut_fips_module_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_init_action:testaction:1 - - Enable the Hardware RNG Entropy Gatherer Service + + Enable ExecShield via sysctl - ocil:ssg-service_rngd_enabled_action:testaction:1 + ocil:ssg-sysctl_kernel_exec_shield_action:testaction:1 - - Disable the virt_use_comm SELinux Boolean + + Verify that Shared Library Files Have Restrictive Permissions - ocil:ssg-sebool_virt_use_comm_action:testaction:1 + ocil:ssg-file_permissions_library_dirs_action:testaction:1 - - Disable the icecast_use_any_tcp_ports SELinux Boolean + + Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces - ocil:ssg-sebool_icecast_use_any_tcp_ports_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_forwarding_action:testaction:1 - - Disable the prosody_bind_http_port SELinux Boolean + + Disable the nagios_run_pnp4nagios SELinux Boolean - ocil:ssg-sebool_prosody_bind_http_port_action:testaction:1 + ocil:ssg-sebool_nagios_run_pnp4nagios_action:testaction:1 - - Install AIDE + + Configure the deny_execmem SELinux Boolean - ocil:ssg-package_aide_installed_action:testaction:1 + ocil:ssg-sebool_deny_execmem_action:testaction:1 - - Disable the virt_transition_userdomain SELinux Boolean + + Configure session renegotiation for SSH client - ocil:ssg-sebool_virt_transition_userdomain_action:testaction:1 + ocil:ssg-ssh_client_rekey_limit_action:testaction:1 - - Enable Kernel Parameter to Ignore Bogus ICMP Error Responses on IPv4 Interfaces + + Verify Group Who Owns passwd File - ocil:ssg-sysctl_net_ipv4_icmp_ignore_bogus_error_responses_action:testaction:1 + ocil:ssg-file_groupowner_etc_passwd_action:testaction:1 - - Disable the gitosis_can_sendmail SELinux Boolean + + Verify /boot/grub2/grub.cfg User Ownership - ocil:ssg-sebool_gitosis_can_sendmail_action:testaction:1 + ocil:ssg-file_owner_grub2_cfg_action:testaction:1 - - Record Any Attempts to Run semanage + + Disable Avahi Server Software - ocil:ssg-audit_rules_execution_semanage_action:testaction:1 + ocil:ssg-service_avahi-daemon_disabled_action:testaction:1 - - Configure auditing of unsuccessful ownership changes + + Install fapolicyd Package - ocil:ssg-audit_owner_change_failed_action:testaction:1 + ocil:ssg-package_fapolicyd_installed_action:testaction:1 - - Ensure Log Files Are Owned By Appropriate User + + Disable Modprobe Loading of USB Storage Driver - ocil:ssg-rsyslog_files_ownership_action:testaction:1 + ocil:ssg-kernel_module_usb-storage_disabled_action:testaction:1 - - Perform full reference count validation + + Specify a Remote NTP Server - ocil:ssg-kernel_config_refcount_full_action:testaction:1 + ocil:ssg-ntpd_specify_remote_server_action:testaction:1 - - Uninstall nfs-utils Package + + Disable IPv6 Addressing on All IPv6 Interfaces - ocil:ssg-package_nfs-utils_removed_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_disable_ipv6_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newgrp + + All Interactive Users Home Directories Must Exist - ocil:ssg-audit_rules_privileged_commands_newgrp_action:testaction:1 + ocil:ssg-accounts_user_interactive_home_directory_exists_action:testaction:1 - - Record Attempts to Alter Time Through clock_settime + + Verify User Who Owns /etc/cron.allow file - ocil:ssg-audit_rules_time_clock_settime_action:testaction:1 + ocil:ssg-file_owner_cron_allow_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - setxattr + + Set number of records to cause an explicit flush to audit logs - ocil:ssg-audit_rules_dac_modification_setxattr_action:testaction:1 + ocil:ssg-auditd_freq_action:testaction:1 - - Verify Owner on cron.hourly + + Use Only FIPS 140-2 Validated Key Exchange Algorithms - ocil:ssg-file_owner_cron_hourly_action:testaction:1 + ocil:ssg-sshd_use_approved_kex_ordered_stig_action:testaction:1 - - Ensure /dev/shm is configured + + Verify nftables Service is Disabled - ocil:ssg-partition_for_dev_shm_action:testaction:1 + ocil:ssg-service_nftables_disabled_action:testaction:1 - - Enable automatic signing of all modules + + Disable CAN Support - ocil:ssg-kernel_config_module_sig_all_action:testaction:1 + ocil:ssg-kernel_module_can_disabled_action:testaction:1 - - Disable the selinuxuser_mysql_connect_enabled SELinux Boolean + + Record Events that Modify the System's Discretionary Access Controls - setxattr - ocil:ssg-sebool_selinuxuser_mysql_connect_enabled_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_setxattr_action:testaction:1 - - Disable the xdm_bind_vnc_tcp_port SELinux Boolean + + Limit Password Reuse: system-auth - ocil:ssg-sebool_xdm_bind_vnc_tcp_port_action:testaction:1 + ocil:ssg-accounts_password_pam_pwhistory_remember_system_auth_action:testaction:1 - - Enable Yama support + + Disable the IPv6 protocol - ocil:ssg-kernel_config_security_yama_action:testaction:1 + ocil:ssg-kernel_config_ipv6_action:testaction:1 - - Ensure nss-tools is installed + + Disable the pppd_can_insmod SELinux Boolean - ocil:ssg-package_nss-tools_installed_action:testaction:1 + ocil:ssg-sebool_pppd_can_insmod_action:testaction:1 - - Disable the ftpd_anon_write SELinux Boolean + + All Interactive User Home Directories Must Have mode 0750 Or Less Permissive - ocil:ssg-sebool_ftpd_anon_write_action:testaction:1 + ocil:ssg-file_permissions_home_directories_action:testaction:1 - - Unmap kernel when running in userspace (aka KAISER) + + Enable syslog-ng Service - ocil:ssg-kernel_config_unmap_kernel_at_el0_action:testaction:1 + ocil:ssg-service_syslogng_enabled_action:testaction:1 - - Disable the logging_syslogd_run_nagios_plugins SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap - ocil:ssg-sebool_logging_syslogd_run_nagios_plugins_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newuidmap_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow + + Enable the domain_fd_use SELinux Boolean - ocil:ssg-audit_rules_etc_gshadow_open_by_handle_at_action:testaction:1 + ocil:ssg-sebool_domain_fd_use_action:testaction:1 - - Remove telnet Clients + + Disable storing core dump - ocil:ssg-package_telnet_removed_action:testaction:1 + ocil:ssg-coredump_disable_storage_action:testaction:1 - - Disable the mock_enable_homedirs SELinux Boolean + + Disable Bluetooth Kernel Module - ocil:ssg-sebool_mock_enable_homedirs_action:testaction:1 + ocil:ssg-kernel_module_bluetooth_disabled_action:testaction:1 - - Ensure that Users Path Contains Only Local Directories + + Public web server resources must not be shared with private assets - ocil:ssg-accounts_user_home_paths_only_action:testaction:1 + ocil:ssg-httpd_public_resources_not_shared_action:testaction:1 - - Explicit arguments in sudo specifications + + Disable the samba_enable_home_dirs SELinux Boolean - ocil:ssg-sudoers_explicit_command_args_action:testaction:1 + ocil:ssg-sebool_samba_enable_home_dirs_action:testaction:1 - - All Interactive Users Must Have A Home Directory Defined + + Disable Accepting ICMP Redirects for All IPv4 Interfaces - ocil:ssg-accounts_user_interactive_home_directory_defined_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_redirects_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - chage + + Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap - ocil:ssg-audit_rules_privileged_commands_chage_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newgidmap_action:testaction:1 - - Disable IA32 emulation + + Disable the httpd_serve_cobbler_files SELinux Boolean - ocil:ssg-kernel_config_ia32_emulation_action:testaction:1 + ocil:ssg-sebool_httpd_serve_cobbler_files_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - fchown + + Uninstall setroubleshoot-server Package - ocil:ssg-audit_rules_unsuccessful_file_modification_fchown_action:testaction:1 + ocil:ssg-package_setroubleshoot-server_removed_action:testaction:1 - - Disable the cobbler_use_cifs SELinux Boolean + + System Audit Directories Must Be Group Owned By Root - ocil:ssg-sebool_cobbler_use_cifs_action:testaction:1 + ocil:ssg-directory_group_ownership_var_log_audit_action:testaction:1 - - Verify Permissions on Backup group File + + Record Unsuccessful Ownership Changes to Files - chown - ocil:ssg-file_permissions_backup_etc_group_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_chown_action:testaction:1 - - Disable Network Router Discovery Daemon (rdisc) + + Disable the polipo_use_cifs SELinux Boolean - ocil:ssg-service_rdisc_disabled_action:testaction:1 + ocil:ssg-sebool_polipo_use_cifs_action:testaction:1 - - Limit Password Reuse: system-auth + + Install policycoreutils-python-utils package - ocil:ssg-accounts_password_pam_pwhistory_remember_system_auth_action:testaction:1 + ocil:ssg-package_policycoreutils-python-utils_installed_action:testaction:1 - - Disable the httpd_can_connect_mythtv SELinux Boolean + + Disable Quagga Service - ocil:ssg-sebool_httpd_can_connect_mythtv_action:testaction:1 + ocil:ssg-service_zebra_disabled_action:testaction:1 - - Disable legacy (BSD) PTY support + + Disable the glance_use_execmem SELinux Boolean - ocil:ssg-kernel_config_legacy_ptys_action:testaction:1 + ocil:ssg-sebool_glance_use_execmem_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg User Ownership + + Ensure Red Hat GPG Key Installed - ocil:ssg-file_owner_efi_grub2_cfg_action:testaction:1 + ocil:ssg-ensure_redhat_gpgkey_installed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - umount + + Harden OpenSSL Crypto Policy - ocil:ssg-audit_rules_privileged_commands_umount_action:testaction:1 + ocil:ssg-harden_openssl_crypto_policy_action:testaction:1 - - Disable the use_ecryptfs_home_dirs SELinux Boolean + + Configure Denying Router Solicitations on All IPv6 Interfaces By Default - ocil:ssg-sebool_use_ecryptfs_home_dirs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_router_solicitations_action:testaction:1 - - Configure auditd flush priority + + Ensure SELinux Not Disabled in /etc/default/grub - ocil:ssg-auditd_data_retention_flush_action:testaction:1 + ocil:ssg-grub2_enable_selinux_action:testaction:1 - - Ensure that Root's Path Does Not Include World or Group-Writable Directories + + Ensure /dev/shm is configured - ocil:ssg-accounts_root_path_dirs_no_write_action:testaction:1 + ocil:ssg-partition_for_dev_shm_action:testaction:1 - - Support session locking with tmux (not enforcing) + + Ensure all users last password change date is in the past - ocil:ssg-configure_bashrc_tmux_action:testaction:1 + ocil:ssg-accounts_password_last_change_is_in_past_action:testaction:1 - - Modify the System Login Banner + + Install vim Package - ocil:ssg-banner_etc_issue_action:testaction:1 + ocil:ssg-package_vim_installed_action:testaction:1 - - Ensure All User Initialization Files Have Mode 0740 Or Less Permissive + + Disable the authlogin_yubikey SELinux Boolean - ocil:ssg-file_permission_user_init_files_action:testaction:1 + ocil:ssg-sebool_authlogin_yubikey_action:testaction:1 - - Disable GNOME3 Automounting + + Ensure PAM Enforces Password Requirements - Minimum Uppercase Characters - ocil:ssg-dconf_gnome_disable_automount_action:testaction:1 + ocil:ssg-accounts_password_pam_ucredit_action:testaction:1 - - Configure auditd space_left on Low Disk Space + + Disable the selinuxuser_use_ssh_chroot SELinux Boolean - ocil:ssg-auditd_data_retention_space_left_action:testaction:1 + ocil:ssg-sebool_selinuxuser_use_ssh_chroot_action:testaction:1 - - Configure TLS for rsyslog remote logging + + Ensure Logrotate Runs Periodically - ocil:ssg-rsyslog_remote_tls_action:testaction:1 + ocil:ssg-ensure_logrotate_activated_action:testaction:1 - - Randomize slab freelist + + Configure the polyinstantiation_enabled SELinux Boolean - ocil:ssg-kernel_config_slab_freelist_random_action:testaction:1 + ocil:ssg-sebool_polyinstantiation_enabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - usermod + + Disable the CUPS Service - ocil:ssg-audit_rules_privileged_commands_usermod_action:testaction:1 + ocil:ssg-service_cups_disabled_action:testaction:1 - - Disable the httpd_setrlimit SELinux Boolean + + Configure System to Forward All Mail From Postmaster to The Root Account - ocil:ssg-sebool_httpd_setrlimit_action:testaction:1 + ocil:ssg-postfix_client_configure_mail_alias_postmaster_action:testaction:1 - - Disable named Service + + Disable the httpd_verify_dns SELinux Boolean - ocil:ssg-service_named_disabled_action:testaction:1 + ocil:ssg-sebool_httpd_verify_dns_action:testaction:1 - - Disable WIFI Network Connection Creation in GNOME3 + + Record Events that Modify the System's Discretionary Access Controls - lremovexattr - ocil:ssg-dconf_gnome_disable_wifi_create_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lremovexattr_action:testaction:1 - - Public web server resources must not be shared with private assets + + Disable the httpd_run_ipa SELinux Boolean - ocil:ssg-httpd_public_resources_not_shared_action:testaction:1 + ocil:ssg-sebool_httpd_run_ipa_action:testaction:1 - - Only the VDSM User Can Use sudo NOPASSWD + + Configure SELinux Policy - ocil:ssg-sudo_vdsm_nopasswd_action:testaction:1 + ocil:ssg-selinux_policytype_action:testaction:1 - - Only Authorized Local User Accounts Exist on Operating System + + Configure Backups of User Data - ocil:ssg-accounts_authorized_local_users_action:testaction:1 + ocil:ssg-configure_user_data_backups_action:testaction:1 - - Record attempts to alter time through adjtimex + + Set configuration for IPv6 loopback traffic - ocil:ssg-audit_rules_time_adjtimex_action:testaction:1 + ocil:ssg-set_ipv6_loopback_traffic_action:testaction:1 - - Uninstall httpd Package + + The Installed Operating System Is FIPS 140-2 Certified - ocil:ssg-package_httpd_removed_action:testaction:1 + ocil:ssg-installed_OS_is_FIPS_certified_action:testaction:1 - - Verify Permissions on cron.d + + Uninstall abrt-plugin-logger Package - ocil:ssg-file_permissions_cron_d_action:testaction:1 + ocil:ssg-package_abrt-plugin-logger_removed_action:testaction:1 - - Disable SSH TCP Forwarding + + Disable Network File System (nfs) - ocil:ssg-sshd_disable_tcp_forwarding_action:testaction:1 + ocil:ssg-service_nfs_disabled_action:testaction:1 - - Audit Tools Must Have a Mode of 0755 or Less Permissive + + Disable the httpd_can_network_memcache SELinux Boolean - ocil:ssg-file_audit_tools_permissions_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_memcache_action:testaction:1 - - Shutdown System When Auditing Failures Occur + + Disable the httpd_can_connect_zabbix SELinux Boolean - ocil:ssg-audit_rules_system_shutdown_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_zabbix_action:testaction:1 - - Disable rlogin Service + + Verify User Who Owns gshadow File - ocil:ssg-service_rlogin_disabled_action:testaction:1 + ocil:ssg-file_owner_etc_gshadow_action:testaction:1 - - Disable the cups_execmem SELinux Boolean + + Add hidepid Option to /proc - ocil:ssg-sebool_cups_execmem_action:testaction:1 + ocil:ssg-mount_option_proc_hidepid_action:testaction:1 - - Enable the secadm_exec_content SELinux Boolean + + Enable poison of pages after freeing - ocil:ssg-sebool_secadm_exec_content_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fsetxattr + + Verify Group Ownership on SSH Server Public *.pub Key Files - ocil:ssg-audit_rules_unsuccessful_file_modification_fsetxattr_action:testaction:1 + ocil:ssg-file_groupownership_sshd_pub_key_action:testaction:1 - - Set Interactive Session Timeout + + Ensure auditd Collects Information on the Use of Privileged Commands - ocil:ssg-accounts_tmout_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_action:testaction:1 - - Verify that System Executables Have Restrictive Permissions + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default - ocil:ssg-file_permissions_binary_dirs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_max_addresses_action:testaction:1 - - Install libcap-ng-utils Package + + Disable LDAP Server (slapd) - ocil:ssg-package_libcap-ng-utils_installed_action:testaction:1 + ocil:ssg-service_slapd_disabled_action:testaction:1 - - Disable the mozilla_plugin_use_bluejeans SELinux Boolean + + Set Lockout Time for Failed Password Attempts - ocil:ssg-sebool_mozilla_plugin_use_bluejeans_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_unlock_time_action:testaction:1 - - Disable the polipo_use_nfs SELinux Boolean + + Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces - ocil:ssg-sebool_polipo_use_nfs_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_rp_filter_action:testaction:1 - - Disable IPv6 Addressing on All IPv6 Interfaces + + Remove telnet Clients - ocil:ssg-sysctl_net_ipv6_conf_all_disable_ipv6_action:testaction:1 + ocil:ssg-package_telnet_removed_action:testaction:1 - - Disable the authlogin_yubikey SELinux Boolean + + Install audispd-plugins Package - ocil:ssg-sebool_authlogin_yubikey_action:testaction:1 + ocil:ssg-package_audispd-plugins_installed_action:testaction:1 - - Uninstall python3-abrt-addon Package + + Disable the postgresql_selinux_transmit_client_label SELinux Boolean - ocil:ssg-package_python3-abrt-addon_removed_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_transmit_client_label_action:testaction:1 - - Ensure SMEP is not disabled during boot + + Disable Full User Name on Splash Shield - ocil:ssg-grub2_nosmep_argument_absent_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_user_info_action:testaction:1 - - Disable the tmpreaper_use_samba SELinux Boolean + + Add nodev Option to /var - ocil:ssg-sebool_tmpreaper_use_samba_action:testaction:1 + ocil:ssg-mount_option_var_nodev_action:testaction:1 - - Install rear Package + + An SELinux Context must be configured for the pam_faillock.so records directory - ocil:ssg-package_rear_installed_action:testaction:1 + ocil:ssg-account_password_selinux_faillock_dir_action:testaction:1 - - Disable the httpd_manage_ipa SELinux Boolean + + Audit Configuration Files Must Be Owned By Group root - ocil:ssg-sebool_httpd_manage_ipa_action:testaction:1 + ocil:ssg-file_groupownership_audit_configuration_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf.modules.d/ + + Enable HTTPD System Logging - ocil:ssg-file_permissions_httpd_server_modules_files_action:testaction:1 + ocil:ssg-httpd_enable_system_logging_action:testaction:1 - - Ensure No Device Files are Unlabeled by SELinux + + Enforce pam_faillock for Local Accounts Only - ocil:ssg-selinux_all_devicefiles_labeled_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_enforce_local_action:testaction:1 - - Verify Owner on cron.daily + + Disable the polipo_session_users SELinux Boolean - ocil:ssg-file_owner_cron_daily_action:testaction:1 + ocil:ssg-sebool_polipo_session_users_action:testaction:1 - - Direct root Logins Not Allowed + + Verify Permissions on /var/log/messages File - ocil:ssg-no_direct_root_logins_action:testaction:1 + ocil:ssg-file_permissions_var_log_messages_action:testaction:1 - - Harden memory copies between kernel and userspace + + Disable the samba_share_nfs SELinux Boolean - ocil:ssg-kernel_config_hardened_usercopy_action:testaction:1 + ocil:ssg-sebool_samba_share_nfs_action:testaction:1 - - Disable the daemons_use_tty SELinux Boolean + + Verify /boot/efi/EFI/redhat/user.cfg Permissions - ocil:ssg-sebool_daemons_use_tty_action:testaction:1 + ocil:ssg-file_permissions_efi_user_cfg_action:testaction:1 - - Mount Remote Filesystems with noexec + + Ensure Users Cannot Change GNOME3 Screensaver Settings - ocil:ssg-mount_option_noexec_remote_filesystems_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_user_locks_action:testaction:1 - - Uninstall abrt-addon-kerneloops Package + + Record Attempts to Alter Time Through clock_settime - ocil:ssg-package_abrt-addon-kerneloops_removed_action:testaction:1 + ocil:ssg-audit_rules_time_clock_settime_action:testaction:1 - - Add nosuid Option to /var/log/audit + + Verify Permissions on /etc/audit/auditd.conf - ocil:ssg-mount_option_var_log_audit_nosuid_action:testaction:1 + ocil:ssg-file_permissions_etc_audit_auditd_action:testaction:1 - - Configure CA certificate for rsyslog remote logging + + Ensure the Default Umask is Set Correctly in login.defs - ocil:ssg-rsyslog_remote_tls_cacert_action:testaction:1 + ocil:ssg-accounts_umask_etc_login_defs_action:testaction:1 - - Disable All GNOME3 Thumbnailers + + Disable the sge_use_nfs SELinux Boolean - ocil:ssg-dconf_gnome_disable_thumbnailers_action:testaction:1 + ocil:ssg-sebool_sge_use_nfs_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg Permissions + + Disable the daemons_use_tcp_wrapper SELinux Boolean - ocil:ssg-file_permissions_efi_grub2_cfg_action:testaction:1 + ocil:ssg-sebool_daemons_use_tcp_wrapper_action:testaction:1 - - Uninstall abrt-addon-ccpp Package + + Enable page allocator poisoning in zIPL - ocil:ssg-package_abrt-addon-ccpp_removed_action:testaction:1 + ocil:ssg-zipl_page_poison_argument_action:testaction:1 - - Disable the ksmtuned_use_nfs SELinux Boolean + + Use Only Strong MACs - ocil:ssg-sebool_ksmtuned_use_nfs_action:testaction:1 + ocil:ssg-sshd_use_strong_macs_action:testaction:1 - - Verify Group Who Owns cron.daily + + Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv4 Interfaces - ocil:ssg-file_groupowner_cron_daily_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_accept_redirects_action:testaction:1 - - Ensure All Files Are Owned by a Group + + Lock Accounts After Failed Password Attempts - ocil:ssg-file_permissions_ungroupowned_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_deny_action:testaction:1 - - Verify Group Who Owns passwd File + + Perform general configuration of Audit for OSPP - ocil:ssg-file_groupowner_etc_passwd_action:testaction:1 + ocil:ssg-audit_ospp_general_action:testaction:1 - - Record Successful Access Attempts to Files - truncate + + Disable the haproxy_connect_any SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_truncate_action:testaction:1 + ocil:ssg-sebool_haproxy_connect_any_action:testaction:1 - - Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server + + Record Successful Permission Changes to Files - fchmodat - ocil:ssg-sssd_ldap_configure_tls_reqcert_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchmodat_action:testaction:1 - - Configure Accepting Router Advertisements on All IPv6 Interfaces + + Ensure remote access methods are monitored in Rsyslog - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_action:testaction:1 + ocil:ssg-rsyslog_remote_access_monitoring_action:testaction:1 - - Scan All Uploaded Content for Malicious Software + + Make the kernel text and rodata read-only - ocil:ssg-httpd_antivirus_scan_uploads_action:testaction:1 + ocil:ssg-kernel_config_strict_kernel_rwx_action:testaction:1 - - Disable the selinuxuser_udp_server SELinux Boolean + + Enable the nfs_export_all_rw SELinux Boolean - ocil:ssg-sebool_selinuxuser_udp_server_action:testaction:1 + ocil:ssg-sebool_nfs_export_all_rw_action:testaction:1 - - Configure SSSD's Memory Cache to Expire + + Install binutils Package - ocil:ssg-sssd_memcache_timeout_action:testaction:1 + ocil:ssg-package_binutils_installed_action:testaction:1 - - Ensure '/etc/system-fips' exists + + Verify that Interactive Boot is Disabled - ocil:ssg-etc_system_fips_exists_action:testaction:1 + ocil:ssg-grub2_disable_interactive_boot_action:testaction:1 - - Install iptables Package + + Ensure rsyncd service is disabled - ocil:ssg-package_iptables_installed_action:testaction:1 + ocil:ssg-service_rsyncd_disabled_action:testaction:1 - - Deactivate Wireless Network Interfaces + + Ensure invoking users password for privilege escalation when using sudo - ocil:ssg-wireless_disable_interfaces_action:testaction:1 + ocil:ssg-sudoers_validate_passwd_action:testaction:1 - - Configure auditd to use audispd's syslog plugin + + Add nodev Option to /var/log/audit - ocil:ssg-auditd_audispd_syslog_plugin_activated_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_nodev_action:testaction:1 - - Write Audit Logs to the Disk + + Remove Host-Based Authentication Files - ocil:ssg-auditd_write_logs_action:testaction:1 + ocil:ssg-no_host_based_files_action:testaction:1 - - Ensure /tmp Located On Separate Partition + + The Postfix package is installed - ocil:ssg-partition_for_tmp_action:testaction:1 + ocil:ssg-package_postfix_installed_action:testaction:1 - - Prevent non-Privileged Users from Modifying Network Interfaces using nmcli + + Uninstall cyrus-imapd Package - ocil:ssg-network_nmcli_permissions_action:testaction:1 + ocil:ssg-package_cyrus-imapd_removed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - open_by_handle_at + + Uninstall squid Package - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_action:testaction:1 + ocil:ssg-package_squid_removed_action:testaction:1 - - Disallow magic SysRq key + + Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv4 Interfaces - ocil:ssg-sysctl_kernel_sysrq_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_source_route_action:testaction:1 - - Install McAfee Virus Scanning Software + + Configure BIND to use System Crypto Policy - ocil:ssg-install_mcafee_antivirus_action:testaction:1 + ocil:ssg-configure_bind_crypto_policy_action:testaction:1 - - Enable the nscd_use_shm SELinux Boolean + + Verify Permissions on /etc/at.allow file - ocil:ssg-sebool_nscd_use_shm_action:testaction:1 + ocil:ssg-file_permissions_at_allow_action:testaction:1 - - Disable the mozilla_plugin_can_network_connect SELinux Boolean + + Force frequent session key renegotiation - ocil:ssg-sebool_mozilla_plugin_can_network_connect_action:testaction:1 + ocil:ssg-sshd_rekey_limit_action:testaction:1 - - Disable IPv6 Networking Support Automatic Loading + + Require Authentication for Emergency Systemd Target - ocil:ssg-kernel_module_ipv6_option_disabled_action:testaction:1 + ocil:ssg-require_emergency_target_auth_action:testaction:1 - - Disable User Administration in GNOME3 + + Enable the GNOME3 Login Smartcard Authentication - ocil:ssg-dconf_gnome_disable_user_admin_action:testaction:1 + ocil:ssg-dconf_gnome_enable_smartcard_auth_action:testaction:1 - - Install iptables-services Package + + Enable the user_exec_content SELinux Boolean - ocil:ssg-package_iptables-services_installed_action:testaction:1 + ocil:ssg-sebool_user_exec_content_action:testaction:1 - - Enable Randomized Layout of Virtual Address Space + + Restrict Exposed Kernel Pointer Addresses Access - ocil:ssg-sysctl_kernel_randomize_va_space_action:testaction:1 + ocil:ssg-sysctl_kernel_kptr_restrict_action:testaction:1 - - Configure dnf-automatic to Install Only Security Updates + + Verify Group Who Owns cron.hourly - ocil:ssg-dnf-automatic_security_updates_only_action:testaction:1 + ocil:ssg-file_groupowner_cron_hourly_action:testaction:1 - - Verify /boot/grub2/user.cfg Permissions + + Record Successful Permission Changes to Files - lremovexattr - ocil:ssg-file_permissions_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lremovexattr_action:testaction:1 - - Disable the sanlock_use_samba SELinux Boolean + + Ensure Users Re-Authenticate for Privilege Escalation - sudo - ocil:ssg-sebool_sanlock_use_samba_action:testaction:1 + ocil:ssg-sudo_require_authentication_action:testaction:1 - - Verify Group Who Owns Backup group File + + Verify Permissions on cron.daily - ocil:ssg-file_groupowner_backup_etc_group_action:testaction:1 + ocil:ssg-file_permissions_cron_daily_action:testaction:1 - - Uninstall abrt-cli Package + + Disable the tftp_anon_write SELinux Boolean - ocil:ssg-package_abrt-cli_removed_action:testaction:1 + ocil:ssg-sebool_tftp_anon_write_action:testaction:1 - - Specify UID and GID for Anonymous NFS Connections + + Disable the zebra_write_config SELinux Boolean - ocil:ssg-nfs_no_anonymous_action:testaction:1 + ocil:ssg-sebool_zebra_write_config_action:testaction:1 - - Disable the boinc_execmem SELinux Boolean + + Disable IPv6 Networking Support Automatic Loading - ocil:ssg-sebool_boinc_execmem_action:testaction:1 + ocil:ssg-kernel_module_ipv6_option_disabled_action:testaction:1 - - Enable TCP/IP syncookie support + + Disable the pppd_for_user SELinux Boolean - ocil:ssg-kernel_config_syn_cookies_action:testaction:1 + ocil:ssg-sebool_pppd_for_user_action:testaction:1 - - Disable the spamassassin_can_network SELinux Boolean + + Enable the mount_anyfile SELinux Boolean - ocil:ssg-sebool_spamassassin_can_network_action:testaction:1 + ocil:ssg-sebool_mount_anyfile_action:testaction:1 - - Ensure /var/tmp Located On Separate Partition + + Record Events that Modify User/Group Information via openat syscall - /etc/gshadow - ocil:ssg-partition_for_var_tmp_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_openat_action:testaction:1 - - All User Files and Directories In The Home Directory Must Have Mode 0750 Or Less Permissive + + Shutdown System When Auditing Failures Occur - ocil:ssg-accounts_users_home_files_permissions_action:testaction:1 + ocil:ssg-audit_rules_system_shutdown_action:testaction:1 - - Configure Backups of User Data + + Set Boot Loader Password in grub2 - ocil:ssg-configure_user_data_backups_action:testaction:1 + ocil:ssg-grub2_password_action:testaction:1 - - Force opensc To Use Defined Smart Card Driver + + Verify that All World-Writable Directories Have Sticky Bits Set - ocil:ssg-force_opensc_card_drivers_action:testaction:1 + ocil:ssg-dir_perms_world_writable_sticky_bits_action:testaction:1 - - Ensure /home Located On Separate Partition + + Randomize the address of the kernel image (KASLR) - ocil:ssg-partition_for_home_action:testaction:1 + ocil:ssg-kernel_config_randomize_base_action:testaction:1 - - Record Successful Access Attempts to Files - open + + Disable the tor_can_network_relay SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_open_action:testaction:1 + ocil:ssg-sebool_tor_can_network_relay_action:testaction:1 - - Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments + + Ensure auditd Collects Information on the Use of Privileged Commands - crontab - ocil:ssg-sysctl_net_ipv4_tcp_invalid_ratelimit_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_crontab_action:testaction:1 - - Record Events When Executables Are Run As Another User + + Verify Group Who Owns /etc/cron.allow file - ocil:ssg-audit_rules_suid_auid_privilege_function_action:testaction:1 + ocil:ssg-file_groupowner_cron_allow_action:testaction:1 - - Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean + + Ensure All Files Are Owned by a User - ocil:ssg-sebool_telepathy_tcp_connect_generic_network_ports_action:testaction:1 + ocil:ssg-no_files_unowned_by_user_action:testaction:1 - - Disable the httpd_can_network_relay SELinux Boolean + + Ensure Users Cannot Change GNOME3 Session Idle Settings - ocil:ssg-sebool_httpd_can_network_relay_action:testaction:1 + ocil:ssg-dconf_gnome_session_idle_user_locks_action:testaction:1 - - Add nodev Option to /var/log + + Disable the mcelog_foreground SELinux Boolean - ocil:ssg-mount_option_var_log_nodev_action:testaction:1 + ocil:ssg-sebool_mcelog_foreground_action:testaction:1 - - Disable X Windows Startup By Setting Default Target + + Disable the mplayer_execstack SELinux Boolean - ocil:ssg-xwindows_runlevel_target_action:testaction:1 + ocil:ssg-sebool_mplayer_execstack_action:testaction:1 - - Verify that Shared Library Directories Have Restrictive Permissions + + Add noexec Option to /boot - ocil:ssg-dir_permissions_library_dirs_action:testaction:1 + ocil:ssg-mount_option_boot_noexec_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lchown + + Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces - ocil:ssg-audit_rules_dac_modification_lchown_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_shared_media_action:testaction:1 - - Verify User Who Owns Backup group File + + Disable the pcp_read_generic_logs SELinux Boolean - ocil:ssg-file_owner_backup_etc_group_action:testaction:1 + ocil:ssg-sebool_pcp_read_generic_logs_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - renameat + + Disable the selinuxuser_rw_noexattrfile SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_renameat_action:testaction:1 + ocil:ssg-sebool_selinuxuser_rw_noexattrfile_action:testaction:1 - - Disable debug-shell SystemD Service + + Disable the rsync_full_access SELinux Boolean - ocil:ssg-service_debug-shell_disabled_action:testaction:1 + ocil:ssg-sebool_rsync_full_access_action:testaction:1 - - Uninstall ypserv Package + + Install usbguard Package - ocil:ssg-package_ypserv_removed_action:testaction:1 + ocil:ssg-package_usbguard_installed_action:testaction:1 - - Disable the virt_sandbox_use_sys_admin SELinux Boolean + + Ensure Rsyslog Encrypts Off-Loaded Audit Records - ocil:ssg-sebool_virt_sandbox_use_sys_admin_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_defaultnetstreamdriver_action:testaction:1 - - Disable the xguest_mount_media SELinux Boolean + + Disable the ssh_chroot_rw_homedirs SELinux Boolean - ocil:ssg-sebool_xguest_mount_media_action:testaction:1 + ocil:ssg-sebool_ssh_chroot_rw_homedirs_action:testaction:1 - - Disable the polipo_use_cifs SELinux Boolean + + Enable Kernel Page-Table Isolation (KPTI) - ocil:ssg-sebool_polipo_use_cifs_action:testaction:1 + ocil:ssg-grub2_pti_argument_action:testaction:1 - - Verify that local System.map file (if exists) is readable only by root + + Record Events that Modify User/Group Information - ocil:ssg-file_permissions_systemmap_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_action:testaction:1 - - Enable the SSSD Service + + Direct root Logins Not Allowed - ocil:ssg-service_sssd_enabled_action:testaction:1 + ocil:ssg-no_direct_root_logins_action:testaction:1 - - Disable vsyscall emulation + + Restrict unprivileged access to the kernel syslog - ocil:ssg-kernel_config_legacy_vsyscall_emulate_action:testaction:1 + ocil:ssg-kernel_config_security_dmesg_restrict_action:testaction:1 - - Install Smart Card Packages For Multifactor Authentication + + Enable the unconfined_login SELinux Boolean - ocil:ssg-install_smartcard_packages_action:testaction:1 + ocil:ssg-sebool_unconfined_login_action:testaction:1 - - Disable the daemons_enable_cluster_mode SELinux Boolean + + Verify Group Who Owns /var/log Directory - ocil:ssg-sebool_daemons_enable_cluster_mode_action:testaction:1 + ocil:ssg-file_groupowner_var_log_action:testaction:1 - - Disable the antivirus_use_jit SELinux Boolean + + Disable the samba_export_all_rw SELinux Boolean - ocil:ssg-sebool_antivirus_use_jit_action:testaction:1 + ocil:ssg-sebool_samba_export_all_rw_action:testaction:1 - - Verify Permissions on crontab + + Enable the spamd_enable_home_dirs SELinux Boolean - ocil:ssg-file_permissions_crontab_action:testaction:1 + ocil:ssg-sebool_spamd_enable_home_dirs_action:testaction:1 - - Ensure Home Directories are Created for New Users + + Record Any Attempts to Run chcon - ocil:ssg-accounts_have_homedir_login_defs_action:testaction:1 + ocil:ssg-audit_rules_execution_chcon_action:testaction:1 - - Verify ownership of Message of the Day Banner + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-file_owner_etc_motd_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_action:testaction:1 - - Mount Remote Filesystems with Kerberos Security + + Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces - ocil:ssg-mount_option_krb_sec_remote_filesystems_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_rfc1337_action:testaction:1 - - Do not allow usercopy whitelist violations to fallback to object size + + Assign Expiration Date to Emergency Accounts - ocil:ssg-kernel_config_hardened_usercopy_fallback_action:testaction:1 + ocil:ssg-account_emergency_expire_date_action:testaction:1 - - Disable the pcp_read_generic_logs SELinux Boolean + + Remove User Host-Based Authentication Files - ocil:ssg-sebool_pcp_read_generic_logs_action:testaction:1 + ocil:ssg-no_user_host_based_files_action:testaction:1 - - Configure L1 Terminal Fault mitigations + + Ensure auditd Collects System Administrator Actions - /etc/sudoers - ocil:ssg-grub2_l1tf_argument_action:testaction:1 + ocil:ssg-audit_rules_sudoers_action:testaction:1 - - Enable SLUB/SLAB allocator poisoning + + Disable the git_system_enable_homedirs SELinux Boolean - ocil:ssg-grub2_slub_debug_argument_action:testaction:1 + ocil:ssg-sebool_git_system_enable_homedirs_action:testaction:1 - - Install nftables Package + + Install crypto-policies package - ocil:ssg-package_nftables_installed_action:testaction:1 + ocil:ssg-package_crypto-policies_installed_action:testaction:1 - - Ensure SELinux State is Enforcing + + Ensure /usr Located On Separate Partition - ocil:ssg-selinux_state_action:testaction:1 + ocil:ssg-partition_for_usr_action:testaction:1 - - Verify Permissions on gshadow File + + Disable RDS Support - ocil:ssg-file_permissions_etc_gshadow_action:testaction:1 + ocil:ssg-kernel_module_rds_disabled_action:testaction:1 - - Disable the Automounter + + Set Default firewalld Zone for Incoming Packets - ocil:ssg-service_autofs_disabled_action:testaction:1 + ocil:ssg-set_firewalld_default_zone_action:testaction:1 - - Disable the ftpd_use_cifs SELinux Boolean + + Configure opensc Smart Card Drivers - ocil:ssg-sebool_ftpd_use_cifs_action:testaction:1 + ocil:ssg-configure_opensc_card_drivers_action:testaction:1 - - SSH server uses strong entropy to seed + + Disable the staff_use_svirt SELinux Boolean - ocil:ssg-sshd_use_strong_rng_action:testaction:1 + ocil:ssg-sebool_staff_use_svirt_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lsetxattr + + Disable the selinuxuser_udp_server SELinux Boolean - ocil:ssg-audit_rules_dac_modification_lsetxattr_action:testaction:1 + ocil:ssg-sebool_selinuxuser_udp_server_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchownat + + The Chrony package is installed - ocil:ssg-audit_rules_dac_modification_fchownat_action:testaction:1 + ocil:ssg-package_chrony_installed_action:testaction:1 - - Configure SELinux Policy + + Configure the Use of the pam_faillock.so Module in the /etc/pam.d/system-auth File. - ocil:ssg-selinux_policytype_action:testaction:1 + ocil:ssg-account_password_pam_faillock_system_auth_action:testaction:1 - - Force kernel panic on uncorrected MCEs + + Verify Group Ownership of Message of the Day Banner - ocil:ssg-grub2_mce_argument_action:testaction:1 + ocil:ssg-file_groupowner_etc_motd_action:testaction:1 - - Set the GNOME3 Login Number of Failures + + Verify Permissions on Backup group File - ocil:ssg-dconf_gnome_login_retries_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_group_action:testaction:1 - - Configure auditing of unsuccessful permission changes + + Configure Auto Configuration on All IPv6 Interfaces - ocil:ssg-audit_perm_change_failed_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_autoconf_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/shadow + + Disable the rsync_client SELinux Boolean - ocil:ssg-audit_rules_etc_shadow_openat_action:testaction:1 + ocil:ssg-sebool_rsync_client_action:testaction:1 - - Configure System to Forward All Mail through a specific host + + Harden memory copies between kernel and userspace - ocil:ssg-postfix_client_configure_relayhost_action:testaction:1 + ocil:ssg-kernel_config_hardened_usercopy_action:testaction:1 - - Set PAM''s Password Hashing Algorithm + + Disable the racoon_read_shadow SELinux Boolean - ocil:ssg-set_password_hashing_algorithm_systemauth_action:testaction:1 + ocil:ssg-sebool_racoon_read_shadow_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - rmdir + + Write Audit Logs to the Disk - ocil:ssg-audit_rules_file_deletion_events_rmdir_action:testaction:1 + ocil:ssg-auditd_write_logs_action:testaction:1 - - Install firewalld Package + + Set existing passwords a period of inactivity before they been locked - ocil:ssg-package_firewalld_installed_action:testaction:1 + ocil:ssg-accounts_set_post_pw_existing_action:testaction:1 - - Enable seccomp to safely compute untrusted bytecode - - ocil:ssg-kernel_config_seccomp_action:testaction:1 - - - - Disable the GNOME3 Login User List + + Record Events that Modify User/Group Information via open syscall - /etc/gshadow - ocil:ssg-dconf_gnome_disable_user_list_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_open_action:testaction:1 - - Disable the sanlock_use_fusefs SELinux Boolean + + Disable the httpd_ssi_exec SELinux Boolean - ocil:ssg-sebool_sanlock_use_fusefs_action:testaction:1 + ocil:ssg-sebool_httpd_ssi_exec_action:testaction:1 - - Disable SSH Support for User Known Hosts + + Only the VDSM User Can Use sudo NOPASSWD - ocil:ssg-sshd_disable_user_known_hosts_action:testaction:1 + ocil:ssg-sudo_vdsm_nopasswd_action:testaction:1 - - Disable the dhcpc_exec_iptables SELinux Boolean + + Disable Recovery Booting - ocil:ssg-sebool_dhcpc_exec_iptables_action:testaction:1 + ocil:ssg-grub2_disable_recovery_action:testaction:1 - - Disable ATM Support + + Prevent applications from mapping low portion of virtual memory - ocil:ssg-kernel_module_atm_disabled_action:testaction:1 + ocil:ssg-sysctl_vm_mmap_min_addr_action:testaction:1 - - Configure auditd max_log_file_action Upon Reaching Maximum Log Size + + Verify Group Who Owns Backup passwd File - ocil:ssg-auditd_data_retention_max_log_file_action_stig_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_passwd_action:testaction:1 - - Disable the cobbler_use_nfs SELinux Boolean + + Disable DHCP Service - ocil:ssg-sebool_cobbler_use_nfs_action:testaction:1 + ocil:ssg-service_dhcpd_disabled_action:testaction:1 - - Record Successful Access Attempts to Files - creat + + Ensure /var/log/audit Located On Separate Partition - ocil:ssg-audit_rules_successful_file_modification_creat_action:testaction:1 + ocil:ssg-partition_for_var_log_audit_action:testaction:1 - - Disable the git_system_use_nfs SELinux Boolean + + Create Warning Banners for All FTP Users - ocil:ssg-sebool_git_system_use_nfs_action:testaction:1 + ocil:ssg-ftp_present_banner_action:testaction:1 - - Verify Permissions on cron.daily + + Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv6 Interfaces - ocil:ssg-file_permissions_cron_daily_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_source_route_action:testaction:1 - - Disable the mpd_enable_homedirs SELinux Boolean + + Set the UEFI Boot Loader Admin Username to a Non-Default Value - ocil:ssg-sebool_mpd_enable_homedirs_action:testaction:1 + ocil:ssg-grub2_uefi_admin_username_action:testaction:1 - - Disable /dev/kmem virtual device support + + The web server password(s) must be entrusted to the SA or Web Manager - ocil:ssg-kernel_config_devkmem_action:testaction:1 + ocil:ssg-httpd_entrust_passwords_action:testaction:1 - - Enable Use of Strict Mode Checking + + Add nosuid Option to /var/log - ocil:ssg-sshd_enable_strictmodes_action:testaction:1 + ocil:ssg-mount_option_var_log_nosuid_action:testaction:1 - - Use Centralized and Automated Authentication + + Disable the httpd_dontaudit_search_dirs SELinux Boolean - ocil:ssg-account_use_centralized_automated_auth_action:testaction:1 + ocil:ssg-sebool_httpd_dontaudit_search_dirs_action:testaction:1 - - Configure AIDE to Verify Access Control Lists (ACLs) + + Disable the xguest_connect_network SELinux Boolean - ocil:ssg-aide_verify_acls_action:testaction:1 + ocil:ssg-sebool_xguest_connect_network_action:testaction:1 - - Verify nftables Service is Disabled + + HTTPD Log Files Must Be Owned By Root - ocil:ssg-service_nftables_disabled_action:testaction:1 + ocil:ssg-http_configure_log_file_ownership_action:testaction:1 - - Uninstall setroubleshoot-server Package + + Record Events that Modify User/Group Information via openat syscall - /etc/shadow - ocil:ssg-package_setroubleshoot-server_removed_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_openat_action:testaction:1 - - Enable checks on credential management + + Ensure Home Directories are Created for New Users - ocil:ssg-kernel_config_debug_credentials_action:testaction:1 + ocil:ssg-accounts_have_homedir_login_defs_action:testaction:1 - - Disable the samba_create_home_dirs SELinux Boolean + + Enable the fips_mode SELinux Boolean - ocil:ssg-sebool_samba_create_home_dirs_action:testaction:1 + ocil:ssg-sebool_fips_mode_action:testaction:1 - - Disable the mcelog_server SELinux Boolean + + Verify User Who Owns /var/log/messages File - ocil:ssg-sebool_mcelog_server_action:testaction:1 + ocil:ssg-file_owner_var_log_messages_action:testaction:1 - - Disable snmpd Service + + Disable the xserver_object_manager SELinux Boolean - ocil:ssg-service_snmpd_disabled_action:testaction:1 + ocil:ssg-sebool_xserver_object_manager_action:testaction:1 - - Configure the confidence in TPM for entropy + + Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces by Default - ocil:ssg-grub2_rng_core_default_quality_argument_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_send_redirects_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/passwd + + Only Authorized Local User Accounts Exist on Operating System - ocil:ssg-audit_rules_etc_passwd_open_action:testaction:1 + ocil:ssg-accounts_authorized_local_users_action:testaction:1 - - Limit Users' SSH Access + + Enable the LDAP Client For Use in Authconfig - ocil:ssg-sshd_limit_user_access_action:testaction:1 + ocil:ssg-enable_ldap_client_action:testaction:1 - - Enable the nfs_export_all_ro SELinux Boolean + + Disable the daemons_enable_cluster_mode SELinux Boolean - ocil:ssg-sebool_nfs_export_all_ro_action:testaction:1 + ocil:ssg-sebool_daemons_enable_cluster_mode_action:testaction:1 - - Configure AIDE to Use FIPS 140-2 for Validating Hashes + + Configure Error Log Format - ocil:ssg-aide_use_fips_hashes_action:testaction:1 + ocil:ssg-httpd_configure_log_format_action:testaction:1 - - Configure tmux to lock session after inactivity + + Ignore HTTPD .htaccess Files - ocil:ssg-configure_tmux_lock_after_time_action:testaction:1 + ocil:ssg-httpd_ignore_htaccess_files_action:testaction:1 - - Use zero for poisoning instead of debugging value + + Set SSH Daemon LogLevel to VERBOSE - ocil:ssg-kernel_config_page_poisoning_zero_action:testaction:1 + ocil:ssg-sshd_set_loglevel_verbose_action:testaction:1 - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces + + Record Attempts to Alter Time Through stime - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_defrtr_action:testaction:1 + ocil:ssg-audit_rules_time_stime_action:testaction:1 - - Verify User Who Owns gshadow File + + Disable the httpd_mod_auth_pam SELinux Boolean - ocil:ssg-file_owner_etc_gshadow_action:testaction:1 + ocil:ssg-sebool_httpd_mod_auth_pam_action:testaction:1 - - Enable the File Access Policy Service + + Harden SSHD Crypto Policy - ocil:ssg-service_fapolicyd_enabled_action:testaction:1 + ocil:ssg-harden_sshd_crypto_policy_action:testaction:1 - - Disallow kernel profiling by unprivileged users + + Install rear Package - ocil:ssg-sysctl_kernel_perf_event_paranoid_action:testaction:1 + ocil:ssg-package_rear_installed_action:testaction:1 - - Audit Tools Must Be Group-owned by Root + + Uninstall abrt-addon-kerneloops Package - ocil:ssg-file_audit_tools_group_ownership_action:testaction:1 + ocil:ssg-package_abrt-addon-kerneloops_removed_action:testaction:1 - - Disable the httpd_unified SELinux Boolean + + Disable the use_fusefs_home_dirs SELinux Boolean - ocil:ssg-sebool_httpd_unified_action:testaction:1 + ocil:ssg-sebool_use_fusefs_home_dirs_action:testaction:1 - - Enable Transport Layer Security (TLS) Encryption + + Enable checks on credential management - ocil:ssg-httpd_configure_tls_action:testaction:1 + ocil:ssg-kernel_config_debug_credentials_action:testaction:1 - - Ensure Insecure File Locking is Not Allowed + + Configure the Firewalld Ports - ocil:ssg-no_insecure_locks_exports_action:testaction:1 + ocil:ssg-configure_firewalld_ports_action:testaction:1 - - Disable the conman_can_network SELinux Boolean + + Ensure All Files Are Owned by a Group - ocil:ssg-sebool_conman_can_network_action:testaction:1 + ocil:ssg-file_permissions_ungroupowned_action:testaction:1 - - Record Successful Access Attempts to Files - ftruncate + + Disable Cockpit Management Server - ocil:ssg-audit_rules_successful_file_modification_ftruncate_action:testaction:1 + ocil:ssg-service_cockpit_disabled_action:testaction:1 - - Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server + + Install OpenSSH client software - ocil:ssg-rsyslog_nolisten_action:testaction:1 + ocil:ssg-package_openssh-clients_installed_action:testaction:1 - - Add noexec Option to /var/log/audit + + Ensure debug-shell service is not enabled in zIPL - ocil:ssg-mount_option_var_log_audit_noexec_action:testaction:1 + ocil:ssg-zipl_systemd_debug-shell_argument_absent_action:testaction:1 - - Verify Permissions on shadow File + + Disable the mozilla_plugin_can_network_connect SELinux Boolean - ocil:ssg-file_permissions_etc_shadow_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_can_network_connect_action:testaction:1 - - Ensure that System Accounts Do Not Run a Shell Upon Login + + Set the GNOME3 Login Warning Banner Text - ocil:ssg-no_shelllogin_for_systemaccounts_action:testaction:1 + ocil:ssg-dconf_gnome_login_banner_text_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd + + Enable Kernel Paremeter to Log Martian Packets on all IPv4 Interfaces by Default - ocil:ssg-audit_rules_privileged_commands_gpasswd_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_log_martians_action:testaction:1 - - Disable the httpd_sys_script_anon_write SELinux Boolean + + Sign kernel modules with SHA-512 - ocil:ssg-sebool_httpd_sys_script_anon_write_action:testaction:1 + ocil:ssg-kernel_config_module_sig_sha512_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Length + + Uninstall Automatic Bug Reporting Tool (abrt) - ocil:ssg-accounts_password_pam_minlen_action:testaction:1 + ocil:ssg-package_abrt_removed_action:testaction:1 - - Configure kernel to trust the CPU random number generator + + Record Successful Ownership Changes to Files - lchown - ocil:ssg-grub2_kernel_trust_cpu_rng_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lchown_action:testaction:1 - - Disable SSH Server If Possible + + Configure auditd space_left Action on Low Disk Space - ocil:ssg-service_sshd_disabled_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_action_action:testaction:1 - - Record Any Attempts to Run seunshare + + Set Permissions on All Configuration Files Inside /etc/httpd/conf.d/ - ocil:ssg-audit_rules_execution_seunshare_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_conf_d_files_action:testaction:1 - - Enable poison without sanity check + + Require Encryption for Remote Access in GNOME3 - ocil:ssg-kernel_config_page_poisoning_no_sanity_action:testaction:1 + ocil:ssg-dconf_gnome_remote_access_encryption_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - lastlog + + Enable Kernel Parameter to Use TCP Syncookies on Network Interfaces - ocil:ssg-audit_rules_login_events_lastlog_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_syncookies_action:testaction:1 - - Configure the deny_execmem SELinux Boolean + + Verify Permissions on SSH Server Public *.pub Key Files - ocil:ssg-sebool_deny_execmem_action:testaction:1 + ocil:ssg-file_permissions_sshd_pub_key_action:testaction:1 - - Verify Permissions on cron.weekly + + Configure dnf-automatic to Install Only Security Updates - ocil:ssg-file_permissions_cron_weekly_action:testaction:1 + ocil:ssg-dnf-automatic_security_updates_only_action:testaction:1 - - Set the UEFI Boot Loader Admin Username to a Non-Default Value + + Disable the saslauthd_read_shadow SELinux Boolean - ocil:ssg-grub2_uefi_admin_username_action:testaction:1 + ocil:ssg-sebool_saslauthd_read_shadow_action:testaction:1 - - Enable the selinuxuser_ping SELinux Boolean + + Disable the boinc_execmem SELinux Boolean - ocil:ssg-sebool_selinuxuser_ping_action:testaction:1 + ocil:ssg-sebool_boinc_execmem_action:testaction:1 - - Disable Full User Name on Splash Shield + + Disable the mozilla_plugin_use_gps SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_user_info_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_gps_action:testaction:1 - - Disable the httpd_can_connect_ldap SELinux Boolean + + Certificate status checking in SSSD - ocil:ssg-sebool_httpd_can_connect_ldap_action:testaction:1 + ocil:ssg-sssd_certificate_verification_action:testaction:1 - - Prevent user from disabling the screen lock + + Uninstall rsh Package - ocil:ssg-no_tmux_in_shells_action:testaction:1 + ocil:ssg-package_rsh_removed_action:testaction:1 - - Set LogLevel to INFO + + Disable Access to Network bpf() Syscall From Unprivileged Processes - ocil:ssg-sshd_set_loglevel_info_action:testaction:1 + ocil:ssg-sysctl_kernel_unprivileged_bpf_disabled_action:testaction:1 - - Disable the neutron_can_network SELinux Boolean + + Install nftables Package - ocil:ssg-sebool_neutron_can_network_action:testaction:1 + ocil:ssg-package_nftables_installed_action:testaction:1 - - Configure Sending and Accepting Shared Media Redirects by Default + + Kernel panic on oops - ocil:ssg-sysctl_net_ipv4_conf_default_shared_media_action:testaction:1 + ocil:ssg-sysctl_kernel_panic_on_oops_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - su + + Record Unsuccessful Access Attempts to Files - ftruncate - ocil:ssg-audit_rules_privileged_commands_su_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_ftruncate_action:testaction:1 - - Ensure that User Home Directories are not Group-Writable or World-Readable + + Set SSH Client Alive Count Max to zero - ocil:ssg-file_permissions_home_dirs_action:testaction:1 + ocil:ssg-sshd_set_keepalive_0_action:testaction:1 - - Ensure a Table Exists for Nftables + + Disable the guest_exec_content SELinux Boolean - ocil:ssg-set_nftables_table_action:testaction:1 + ocil:ssg-sebool_guest_exec_content_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - umount2 + + Install libreswan Package - ocil:ssg-audit_rules_dac_modification_umount2_action:testaction:1 + ocil:ssg-package_libreswan_installed_action:testaction:1 - - Disable the privoxy_connect_any SELinux Boolean + + Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sebool_privoxy_connect_any_action:testaction:1 + ocil:ssg-sebool_polipo_session_bind_all_unreserved_ports_action:testaction:1 - - The Installed Operating System Is FIPS 140-2 Certified + + Enable cron Service - ocil:ssg-installed_OS_is_FIPS_certified_action:testaction:1 + ocil:ssg-service_crond_enabled_action:testaction:1 - - Verify firewalld Enabled + + Uninstall openldap-servers Package - ocil:ssg-service_firewalld_enabled_action:testaction:1 + ocil:ssg-package_openldap-servers_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap + + Record Any Attempts to Run setfacl - ocil:ssg-audit_rules_privileged_commands_newuidmap_action:testaction:1 + ocil:ssg-audit_rules_execution_setfacl_action:testaction:1 - - Add nodev Option to /home + + Record Attempts to Alter Logon and Logout Events - lastlog - ocil:ssg-mount_option_home_nodev_action:testaction:1 + ocil:ssg-audit_rules_login_events_lastlog_action:testaction:1 - - Account Lockouts Must Be Logged + + Configure Polyinstantiation of /var/tmp Directories - ocil:ssg-accounts_passwords_pam_faillock_audit_action:testaction:1 + ocil:ssg-accounts_polyinstantiated_var_tmp_action:testaction:1 - - All User Files and Directories In The Home Directory Must Have a Valid Owner + + A private web server must be located on a separate controlled access subnet - ocil:ssg-accounts_users_home_files_ownership_action:testaction:1 + ocil:ssg-httpd_private_server_on_separate_subnet_action:testaction:1 - - Disable the samba_portmapper SELinux Boolean + + Install the SSSD Package - ocil:ssg-sebool_samba_portmapper_action:testaction:1 + ocil:ssg-package_sssd_installed_action:testaction:1 - - Ensure rsyncd service is disabled + + Disable SSH Root Login - ocil:ssg-service_rsyncd_disabled_action:testaction:1 + ocil:ssg-sshd_disable_root_login_action:testaction:1 - - Verify Permissions on cron.monthly + + Disable the dbadm_manage_user_files SELinux Boolean - ocil:ssg-file_permissions_cron_monthly_action:testaction:1 + ocil:ssg-sebool_dbadm_manage_user_files_action:testaction:1 - - Disable ypbind Service + + Disable the rsync_anon_write SELinux Boolean - ocil:ssg-service_ypbind_disabled_action:testaction:1 + ocil:ssg-sebool_rsync_anon_write_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - removexattr + + User Initialization Files Must Not Run World-Writable Programs - ocil:ssg-audit_rules_unsuccessful_file_modification_removexattr_action:testaction:1 + ocil:ssg-accounts_user_dot_no_world_writable_programs_action:testaction:1 - - Disable the selinuxuser_share_music SELinux Boolean + + Disable the LDT (local descriptor table) - ocil:ssg-sebool_selinuxuser_share_music_action:testaction:1 + ocil:ssg-kernel_config_modify_ldt_syscall_action:testaction:1 - - Drop Gratuitious ARP frames on All IPv4 Interfaces + + Disable the fenced_can_ssh SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_drop_gratuitous_arp_action:testaction:1 + ocil:ssg-sebool_fenced_can_ssh_action:testaction:1 - - Disable the exim_manage_user_files SELinux Boolean + + Disable the mock_enable_homedirs SELinux Boolean - ocil:ssg-sebool_exim_manage_user_files_action:testaction:1 + ocil:ssg-sebool_mock_enable_homedirs_action:testaction:1 - - Disable Odd Job Daemon (oddjobd) + + Disable core dump backtraces - ocil:ssg-service_oddjobd_disabled_action:testaction:1 + ocil:ssg-coredump_disable_backtraces_action:testaction:1 - - Disable DCCP Support + + Set Existing Passwords Minimum Age - ocil:ssg-kernel_module_dccp_disabled_action:testaction:1 + ocil:ssg-accounts_password_set_min_life_existing_action:testaction:1 - - Ensure All Groups on the System Have Unique Group ID + + Set number of Password Hashing Rounds - system-auth - ocil:ssg-group_unique_id_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_rounds_system_auth_action:testaction:1 - - Disable Kernel cfg80211 Module + + Verify Permissions and Ownership of Old Passwords File - ocil:ssg-kernel_module_cfg80211_disabled_action:testaction:1 + ocil:ssg-file_etc_security_opasswd_action:testaction:1 - - Disable the httpd_can_connect_zabbix SELinux Boolean + + Disable the httpd_tty_comm SELinux Boolean - ocil:ssg-sebool_httpd_can_connect_zabbix_action:testaction:1 + ocil:ssg-sebool_httpd_tty_comm_action:testaction:1 - - Install policycoreutils Package + + Ensure /var Located On Separate Partition - ocil:ssg-package_policycoreutils_installed_action:testaction:1 + ocil:ssg-partition_for_var_action:testaction:1 - - Disable Bluetooth Kernel Module + + Disable the varnishd_connect_any SELinux Boolean - ocil:ssg-kernel_module_bluetooth_disabled_action:testaction:1 + ocil:ssg-sebool_varnishd_connect_any_action:testaction:1 - - Enable GNOME3 Screensaver Lock After Idle Period + + Verify that audit tools are owned by root - ocil:ssg-dconf_gnome_screensaver_lock_enabled_action:testaction:1 + ocil:ssg-file_ownership_audit_binaries_action:testaction:1 - - Encrypt Audit Records Sent With audispd Plugin + + Configure auditd admin_space_left Action on Low Disk Space - ocil:ssg-auditd_audispd_encrypt_sent_records_action:testaction:1 + ocil:ssg-auditd_data_retention_admin_space_left_action_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg User Ownership + + Verify Permissions on cron.hourly - ocil:ssg-file_owner_efi_user_cfg_action:testaction:1 + ocil:ssg-file_permissions_cron_hourly_action:testaction:1 - - Verify /boot/grub2/grub.cfg Group Ownership + + Ensure sudo passwd_timeout is appropriate - sudo passwd_timeout - ocil:ssg-file_groupowner_grub2_cfg_action:testaction:1 + ocil:ssg-sudo_add_passwd_timeout_action:testaction:1 - - Support session locking with tmux + + Disable Postfix Network Listening - ocil:ssg-configure_bashrc_exec_tmux_action:testaction:1 + ocil:ssg-postfix_network_listening_disabled_action:testaction:1 - - Enable the GNOME3 Screen Locking On Smartcard Removal + + Record Events that Modify User/Group Information via openat syscall - /etc/passwd - ocil:ssg-dconf_gnome_lock_screen_on_smartcard_removal_action:testaction:1 + ocil:ssg-audit_rules_etc_passwd_openat_action:testaction:1 - - Verify Any Configured IPSec Tunnel Connections + + Disable the sanlock_use_fusefs SELinux Boolean - ocil:ssg-libreswan_approved_tunnels_action:testaction:1 + ocil:ssg-sebool_sanlock_use_fusefs_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg Group Ownership + + Record Events that Modify the System's Discretionary Access Controls - fsetxattr - ocil:ssg-file_groupowner_efi_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fsetxattr_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg Permissions + + Record Unsuccessful Access Attempts to Files - truncate - ocil:ssg-file_permissions_efi_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_truncate_action:testaction:1 - - Configure Kerberos to use System Crypto Policy + + Ensure auditd Collects Information on Exporting to Media (successful) - ocil:ssg-configure_kerberos_crypto_policy_action:testaction:1 + ocil:ssg-audit_rules_media_export_action:testaction:1 - - Verify Permissions on SSH Server Public *.pub Key Files + + Remove the kernel mapping in user mode - ocil:ssg-file_permissions_sshd_pub_key_action:testaction:1 + ocil:ssg-kernel_config_page_table_isolation_action:testaction:1 - - Set Account Expiration Following Inactivity + + Verify Permissions on Backup shadow File - ocil:ssg-account_disable_post_pw_expiration_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_shadow_action:testaction:1 - - Configure auditing of successful permission changes + + Enable the GNOME3 Screen Locking On Smartcard Removal - ocil:ssg-audit_perm_change_success_action:testaction:1 + ocil:ssg-dconf_gnome_lock_screen_on_smartcard_removal_action:testaction:1 - - Disable the smbd_anon_write SELinux Boolean + + Disable the swift_can_network SELinux Boolean - ocil:ssg-sebool_smbd_anon_write_action:testaction:1 + ocil:ssg-sebool_swift_can_network_action:testaction:1 - - Verify that audit tools are owned by group root + + Remove .java And .jpp Files - ocil:ssg-file_groupownership_audit_binaries_action:testaction:1 + ocil:ssg-httpd_limit_java_files_action:testaction:1 - - Configure the httpd_enable_cgi SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_update - ocil:ssg-sebool_httpd_enable_cgi_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_unix_update_action:testaction:1 - - User a virtually-mapped stack + + Add nodev Option to Non-Root Local Partitions - ocil:ssg-kernel_config_vmap_stack_action:testaction:1 + ocil:ssg-mount_option_nodev_nonroot_local_partitions_action:testaction:1 - - Enable rsyslog Service + + Ensure PAM Enforces Password Requirements - Minimum Different Categories - ocil:ssg-service_rsyslog_enabled_action:testaction:1 + ocil:ssg-accounts_password_pam_minclass_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/shadow + + Install Virus Scanning Software - ocil:ssg-audit_rules_usergroup_modification_shadow_action:testaction:1 + ocil:ssg-install_antivirus_action:testaction:1 - - Disable SCTP Support + + Verify Owner on cron.monthly - ocil:ssg-kernel_module_sctp_disabled_action:testaction:1 + ocil:ssg-file_owner_cron_monthly_action:testaction:1 - - Disable Accepting ICMP Redirects for All IPv6 Interfaces + + Deactivate Wireless Network Interfaces - ocil:ssg-sysctl_net_ipv6_conf_all_accept_redirects_action:testaction:1 + ocil:ssg-wireless_disable_interfaces_action:testaction:1 - - Disable Advanced Configuration and Power Interface (acpid) + + Generate USBGuard Policy - ocil:ssg-service_acpid_disabled_action:testaction:1 + ocil:ssg-usbguard_generate_policy_action:testaction:1 - - Disable the secure_mode SELinux Boolean + + Audit Configuration Files Permissions are 640 or More Restrictive - ocil:ssg-sebool_secure_mode_action:testaction:1 + ocil:ssg-file_permissions_audit_configuration_action:testaction:1 - - Ensure All World-Writable Directories Are Owned by root User + + Configure file name of core dumps - ocil:ssg-dir_perms_world_writable_root_owned_action:testaction:1 + ocil:ssg-sysctl_kernel_core_uses_pid_action:testaction:1 - - Disable the zoneminder_anon_write SELinux Boolean + + Uninstall abrt-plugin-rhtsupport Package - ocil:ssg-sebool_zoneminder_anon_write_action:testaction:1 + ocil:ssg-package_abrt-plugin-rhtsupport_removed_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/shadow + + Add nodev Option to Removable Media Partitions - ocil:ssg-audit_rules_etc_shadow_open_action:testaction:1 + ocil:ssg-mount_option_nodev_removable_partitions_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/gshadow + + Set the UEFI Boot Loader Password - ocil:ssg-audit_rules_etc_gshadow_open_action:testaction:1 + ocil:ssg-grub2_uefi_password_action:testaction:1 - - Disable the virt_sandbox_use_mknod SELinux Boolean + + Modify the System Message of the Day Banner - ocil:ssg-sebool_virt_sandbox_use_mknod_action:testaction:1 + ocil:ssg-banner_etc_motd_action:testaction:1 - - Ensure Web Content Located on Separate partition + + Disable the ftpd_anon_write SELinux Boolean - ocil:ssg-partition_for_web_content_action:testaction:1 + ocil:ssg-sebool_ftpd_anon_write_action:testaction:1 - - Disable Certmonger Service (certmonger) + + Verify Group Ownership on SSH Server Private *_key Key Files - ocil:ssg-service_certmonger_disabled_action:testaction:1 + ocil:ssg-file_groupownership_sshd_private_key_action:testaction:1 - - Disable the samba_domain_controller SELinux Boolean + + Disable the piranha_lvs_can_network_connect SELinux Boolean - ocil:ssg-sebool_samba_domain_controller_action:testaction:1 + ocil:ssg-sebool_piranha_lvs_can_network_connect_action:testaction:1 - - Disable Red Hat Subscription Manager Daemon (rhsmcertd) + + Ensure auditd Collects Information on the Use of Privileged Commands - usermod - ocil:ssg-service_rhsmcertd_disabled_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_usermod_action:testaction:1 - - Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo requiretty + + Enable Process Accounting (psacct) - ocil:ssg-sudo_add_requiretty_action:testaction:1 + ocil:ssg-service_psacct_enabled_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf.d/ + + Disable Compression Or Set Compression to delayed - ocil:ssg-file_permissions_httpd_server_conf_d_files_action:testaction:1 + ocil:ssg-sshd_disable_compression_action:testaction:1 - - Install McAfee Endpoint Security for Linux (ENSL) + + Verify that System Executable Directories Have Restrictive Permissions - ocil:ssg-package_mcafeetp_installed_action:testaction:1 + ocil:ssg-dir_permissions_binary_dirs_action:testaction:1 - - Disable the lsmd_plugin_connect_any SELinux Boolean + + Ensure SELinux Not Disabled in zIPL - ocil:ssg-sebool_lsmd_plugin_connect_any_action:testaction:1 + ocil:ssg-zipl_enable_selinux_action:testaction:1 - - Disable the httpd_can_network_memcache SELinux Boolean + + Record Unsuccessful Permission Changes to Files - fremovexattr - ocil:ssg-sebool_httpd_can_network_memcache_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fremovexattr_action:testaction:1 - - Verify Group Ownership of System Login Banner for Remote Connections + + Require Re-Authentication When Using the sudo Command - ocil:ssg-file_groupowner_etc_issue_net_action:testaction:1 + ocil:ssg-sudo_require_reauthentication_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - sudo + + Ensure iptables Firewall Rules Exist for All Open Ports - ocil:ssg-audit_rules_privileged_commands_sudo_action:testaction:1 + ocil:ssg-iptables_rules_for_open_ports_action:testaction:1 - - Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean + + Remove the FreeRadius Server Package - ocil:ssg-sebool_polipo_session_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-package_freeradius_removed_action:testaction:1 - - Disable the httpd_use_cifs SELinux Boolean + + Disable the httpd_can_connect_ldap SELinux Boolean - ocil:ssg-sebool_httpd_use_cifs_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_ldap_action:testaction:1 - - Ensure SSH LoginGraceTime is configured + + Audit Tools Must Be Owned by Root - ocil:ssg-sshd_set_login_grace_time_action:testaction:1 + ocil:ssg-file_audit_tools_ownership_action:testaction:1 - - Set SSH Daemon LogLevel to VERBOSE + + Install subscription-manager Package - ocil:ssg-sshd_set_loglevel_verbose_action:testaction:1 + ocil:ssg-package_subscription-manager_installed_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words + + Support session locking with tmux - ocil:ssg-accounts_password_pam_dictcheck_action:testaction:1 + ocil:ssg-configure_bashrc_exec_tmux_action:testaction:1 - - Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean + + Unmap kernel when running in userspace (aka KAISER) - ocil:ssg-sebool_httpd_mod_auth_ntlm_winbind_action:testaction:1 + ocil:ssg-kernel_config_unmap_kernel_at_el0_action:testaction:1 - - Uninstall bind Package + + Add nosuid Option to /boot - ocil:ssg-package_bind_removed_action:testaction:1 + ocil:ssg-mount_option_boot_nosuid_action:testaction:1 - - Ensure McAfee Endpoint Security for Linux (ENSL) is running + + Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server - ocil:ssg-agent_mfetpd_running_action:testaction:1 + ocil:ssg-rsyslog_nolisten_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap + + Make the auditd Configuration Immutable - ocil:ssg-audit_rules_privileged_commands_newgidmap_action:testaction:1 + ocil:ssg-audit_rules_immutable_action:testaction:1 - - Ensure SSH MaxStartups is configured + + Disable Network Router Discovery Daemon (rdisc) - ocil:ssg-sshd_set_maxstartups_action:testaction:1 + ocil:ssg-service_rdisc_disabled_action:testaction:1 - - Configure firewall to Allow Access to the Web Server + + Disable the mozilla_plugin_use_spice SELinux Boolean - ocil:ssg-httpd_configure_firewall_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_spice_action:testaction:1 - - Ensure tftp Daemon Uses Secure Mode + + Ensure rsyslog-gnutls is installed - ocil:ssg-tftpd_uses_secure_mode_action:testaction:1 + ocil:ssg-package_rsyslog-gnutls_installed_action:testaction:1 - - Limit CPU consumption of the Perf system + + Disable Certmonger Service (certmonger) - ocil:ssg-sysctl_kernel_perf_cpu_time_max_percent_action:testaction:1 + ocil:ssg-service_certmonger_disabled_action:testaction:1 - - Add hidepid Option to /proc + + Record Events that Modify the System's Discretionary Access Controls - fremovexattr - ocil:ssg-mount_option_proc_hidepid_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fremovexattr_action:testaction:1 - - System Audit Logs Must Be Group Owned By Root + + Enable seccomp to safely compute untrusted bytecode - ocil:ssg-file_group_ownership_var_log_audit_action:testaction:1 + ocil:ssg-kernel_config_seccomp_action:testaction:1 - - Disable the xdm_write_home SELinux Boolean + + Verify ufw Enabled - ocil:ssg-sebool_xdm_write_home_action:testaction:1 + ocil:ssg-service_ufw_enabled_action:testaction:1 - - Ensure All-Squashing Disabled On All Exports + + Disable the cron_system_cronjob_use_shares SELinux Boolean - ocil:ssg-no_all_squash_exports_action:testaction:1 + ocil:ssg-sebool_cron_system_cronjob_use_shares_action:testaction:1 - - Configure SSSD LDAP Backend Client CA Certificate Location + + Configure auditd Disk Error Action on Disk Error - ocil:ssg-sssd_ldap_configure_tls_ca_dir_action:testaction:1 + ocil:ssg-auditd_data_disk_error_action_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - chsh + + Disable Dovecot Service - ocil:ssg-audit_rules_privileged_commands_chsh_action:testaction:1 + ocil:ssg-service_dovecot_disabled_action:testaction:1 - - Require modules to be validly signed + + Ensure a dedicated group owns sudo - ocil:ssg-kernel_config_module_sig_force_action:testaction:1 + ocil:ssg-sudo_dedicated_group_action:testaction:1 - - Install the psacct package + + Disable the postgresql_can_rsync SELinux Boolean - ocil:ssg-package_psacct_installed_action:testaction:1 + ocil:ssg-sebool_postgresql_can_rsync_action:testaction:1 - - Add nosuid Option to /dev/shm + + Uninstall xinetd Package - ocil:ssg-mount_option_dev_shm_nosuid_action:testaction:1 + ocil:ssg-package_xinetd_removed_action:testaction:1 - - Enable the pcscd Service + + Enable SSH Server firewalld Firewall Exception - ocil:ssg-service_pcscd_enabled_action:testaction:1 + ocil:ssg-firewalld_sshd_port_enabled_action:testaction:1 - - System Audit Logs Must Have Mode 0750 or Less Permissive + + Restrict Access to Kernel Message Buffer - ocil:ssg-directory_permissions_var_log_audit_action:testaction:1 + ocil:ssg-sysctl_kernel_dmesg_restrict_action:testaction:1 - - Verify Group Who Owns /var/log Directory + + Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - ocil:ssg-file_groupowner_var_log_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_run_nagios_plugins_action:testaction:1 - - Verify Group Who Owns cron.d + + Disable the openvpn_can_network_connect SELinux Boolean - ocil:ssg-file_groupowner_cron_d_action:testaction:1 + ocil:ssg-sebool_openvpn_can_network_connect_action:testaction:1 - - Verify Group Who Owns cron.monthly + + Disable vsyscalls in zIPL - ocil:ssg-file_groupowner_cron_monthly_action:testaction:1 + ocil:ssg-zipl_vsyscall_argument_action:testaction:1 - - Install Intrusion Detection Software + + Ensure auditd Collects Information on the Use of Privileged Commands - ssh-keysign - ocil:ssg-install_hids_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_ssh_keysign_action:testaction:1 - - Disable the tftp_anon_write SELinux Boolean + + Kernel panic timeout - ocil:ssg-sebool_tftp_anon_write_action:testaction:1 + ocil:ssg-kernel_config_panic_timeout_action:testaction:1 - - Enable different security models + + Configure GNOME3 DConf User Profile - ocil:ssg-kernel_config_security_action:testaction:1 + ocil:ssg-enable_dconf_user_profile_action:testaction:1 - - Verify Permissions and Ownership of Old Passwords File + + Enable the NTP Daemon - ocil:ssg-file_etc_security_opasswd_action:testaction:1 + ocil:ssg-service_ntpd_enabled_action:testaction:1 - - Ensure gpgcheck Enabled for All yum Package Repositories + + Disable the dbadm_read_user_files SELinux Boolean - ocil:ssg-ensure_gpgcheck_never_disabled_action:testaction:1 + ocil:ssg-sebool_dbadm_read_user_files_action:testaction:1 - - Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean + + Record Unsuccessful Permission Changes to Files - chmod - ocil:ssg-sebool_postgresql_selinux_unconfined_dbadm_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_chmod_action:testaction:1 - - Configure auditd max_log_file_action Upon Reaching Maximum Log Size + + Disable the ssh_sysadm_login SELinux Boolean - ocil:ssg-auditd_data_retention_max_log_file_action_action:testaction:1 + ocil:ssg-sebool_ssh_sysadm_login_action:testaction:1 - - Disable the xserver_object_manager SELinux Boolean + + Root Path Must Be Vendor Default - ocil:ssg-sebool_xserver_object_manager_action:testaction:1 + ocil:ssg-root_path_default_action:testaction:1 - - Verify Permissions on SSH Server Private *_key Key Files + + Disable User Administration in GNOME3 - ocil:ssg-file_permissions_sshd_private_key_action:testaction:1 + ocil:ssg-dconf_gnome_disable_user_admin_action:testaction:1 - - Ensure IPv6 is disabled through kernel boot parameter + + Verify and Correct File Permissions with RPM - ocil:ssg-grub2_ipv6_disable_argument_action:testaction:1 + ocil:ssg-rpm_verify_permissions_action:testaction:1 - - User Initialization Files Must Be Owned By the Primary User + + Backup interactive scripts on the production web server are prohibited - ocil:ssg-accounts_user_dot_user_ownership_action:testaction:1 + ocil:ssg-httpd_remove_backups_action:testaction:1 - - Disable the httpd_anon_write SELinux Boolean + + Disable the 32-bit vDSO - ocil:ssg-sebool_httpd_anon_write_action:testaction:1 + ocil:ssg-kernel_config_compat_vdso_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - creat + + Enforce Spectre v2 mitigation - ocil:ssg-audit_rules_unsuccessful_file_modification_creat_action:testaction:1 + ocil:ssg-grub2_spectre_v2_argument_action:testaction:1 - - Ignore HTTPD .htaccess Files + + Disable the named_tcp_bind_http_port SELinux Boolean - ocil:ssg-httpd_ignore_htaccess_files_action:testaction:1 + ocil:ssg-sebool_named_tcp_bind_http_port_action:testaction:1 - - Enable Kernel Parameter to Enforce DAC on Symlinks + + Don't define allowed commands in sudoers by means of exclusion - ocil:ssg-sysctl_fs_protected_symlinks_action:testaction:1 + ocil:ssg-sudoers_no_command_negation_action:testaction:1 - - Generate USBGuard Policy + + Configure a Sufficiently Large Partition for Audit Logs - ocil:ssg-usbguard_generate_policy_action:testaction:1 + ocil:ssg-auditd_audispd_configure_sufficiently_large_partition_action:testaction:1 - - Set Password Maximum Consecutive Repeating Characters + + Uninstall tuned Package - ocil:ssg-accounts_password_pam_maxrepeat_action:testaction:1 + ocil:ssg-package_tuned_removed_action:testaction:1 - - Set configuration for IPv6 loopback traffic + + Ensure SSH LoginGraceTime is configured - ocil:ssg-set_ipv6_loopback_traffic_action:testaction:1 + ocil:ssg-sshd_set_login_grace_time_action:testaction:1 - - Ensure auditd Collects System Administrator Actions - /etc/sudoers + + Disable the logwatch_can_network_connect_mail SELinux Boolean - ocil:ssg-audit_rules_sudoers_action:testaction:1 + ocil:ssg-sebool_logwatch_can_network_connect_mail_action:testaction:1 - - Enable the gssd_read_tmp SELinux Boolean + + Restrict Virtual Console Root Logins - ocil:ssg-sebool_gssd_read_tmp_action:testaction:1 + ocil:ssg-securetty_root_login_console_only_action:testaction:1 - - Configure SSSD LDAP Backend to Use TLS For All Transactions + + Disable the git_cgi_use_cifs SELinux Boolean - ocil:ssg-sssd_ldap_start_tls_action:testaction:1 + ocil:ssg-sebool_git_cgi_use_cifs_action:testaction:1 - - Ensure Logs Sent To Remote Host + + Ensure Software Patches Installed - ocil:ssg-rsyslog_remote_loghost_action:testaction:1 + ocil:ssg-security_patches_up_to_date_action:testaction:1 - - Set Password Hashing Algorithm in /etc/login.defs + + Disable the global_ssp SELinux Boolean - ocil:ssg-set_password_hashing_algorithm_logindefs_action:testaction:1 + ocil:ssg-sebool_global_ssp_action:testaction:1 - - Set Permissions on the /etc/httpd/conf/ Directory + + Ensure PAM Enforces Password Requirements - Minimum Length - ocil:ssg-dir_perms_etc_httpd_conf_action:testaction:1 + ocil:ssg-accounts_password_pam_minlen_action:testaction:1 - - Configure Logind to terminate idle sessions after certain time of inactivity + + Enable different security models - ocil:ssg-logind_session_timeout_action:testaction:1 + ocil:ssg-kernel_config_security_action:testaction:1 - - Ensure No World-Writable Files Exist + + Disable the use_samba_home_dirs SELinux Boolean - ocil:ssg-file_permissions_unauthorized_world_writable_action:testaction:1 + ocil:ssg-sebool_use_samba_home_dirs_action:testaction:1 - - Add nodev Option to /tmp + + Map System Users To The Appropriate SELinux Role - ocil:ssg-mount_option_tmp_nodev_action:testaction:1 + ocil:ssg-selinux_user_login_roles_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - removexattr + + Ensure Log Files Are Owned By Appropriate Group - ocil:ssg-audit_rules_dac_modification_removexattr_action:testaction:1 + ocil:ssg-rsyslog_files_groupownership_action:testaction:1 - - Disable the httpd_tty_comm SELinux Boolean + + Each Web Content Directory Must Contain An index.html File - ocil:ssg-sebool_httpd_tty_comm_action:testaction:1 + ocil:ssg-httpd_configure_documentroot_action:testaction:1 - - Verify Owner on SSH Server config file + + Disable the glance_api_can_network SELinux Boolean - ocil:ssg-file_owner_sshd_config_action:testaction:1 + ocil:ssg-sebool_glance_api_can_network_action:testaction:1 - - Verify Group Who Owns Backup passwd File + + Verify that local System.map file (if exists) is readable only by root - ocil:ssg-file_groupowner_backup_etc_passwd_action:testaction:1 + ocil:ssg-file_permissions_systemmap_action:testaction:1 - - Stack Protector buffer overlow detection + + Verify permissions on System Login Banner - ocil:ssg-kernel_config_stackprotector_action:testaction:1 + ocil:ssg-file_permissions_etc_issue_action:testaction:1 - - Enable the postfix_local_write_mail_spool SELinux Boolean + + Uninstall telnet-server Package - ocil:ssg-sebool_postfix_local_write_mail_spool_action:testaction:1 + ocil:ssg-package_telnet-server_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - kmod + + Disable Mounting of cramfs - ocil:ssg-audit_rules_privileged_commands_kmod_action:testaction:1 + ocil:ssg-kernel_module_cramfs_disabled_action:testaction:1 - - Set Password Warning Age + + Ensure the Default Umask is Set Correctly in /etc/profile - ocil:ssg-accounts_password_warn_age_login_defs_action:testaction:1 + ocil:ssg-accounts_umask_etc_profile_action:testaction:1 - - Uninstall net-snmp Package + + Do not allow usercopy whitelist violations to fallback to object size - ocil:ssg-package_net-snmp_removed_action:testaction:1 + ocil:ssg-kernel_config_hardened_usercopy_fallback_action:testaction:1 - - Disable the use_fusefs_home_dirs SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - userhelper - ocil:ssg-sebool_use_fusefs_home_dirs_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_userhelper_action:testaction:1 - - Enable the unconfined_chrome_sandbox_transition SELinux Boolean + + Disable the daemons_dump_core SELinux Boolean - ocil:ssg-sebool_unconfined_chrome_sandbox_transition_action:testaction:1 + ocil:ssg-sebool_daemons_dump_core_action:testaction:1 - - Disable TIPC Support + + Record Unsuccessful Access Attempts to Files - openat - ocil:ssg-kernel_module_tipc_disabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_action:testaction:1 - - Configure audispd's Plugin network_failure_action On Network Failure + + Disable Secure RPC Server Service (rpcsvcgssd) - ocil:ssg-auditd_audispd_network_failure_action_action:testaction:1 + ocil:ssg-service_rpcsvcgssd_disabled_action:testaction:1 - - Set Default iptables Policy for Forwarded Packets + + Disable network management of chrony daemon - ocil:ssg-set_iptables_default_rule_forward_action:testaction:1 + ocil:ssg-chronyd_no_chronyc_network_action:testaction:1 - - Uninstall talk Package + + Ensure gpgcheck Enabled for Local Packages - ocil:ssg-package_talk_removed_action:testaction:1 + ocil:ssg-ensure_gpgcheck_local_packages_action:testaction:1 - - Set Up a Private Namespace in PAM Configuration + + Record Unsuccessful Permission Changes to Files - lremovexattr - ocil:ssg-enable_pam_namespace_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lremovexattr_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - open O_CREAT + + Disable PubkeyAuthentication Authentication - ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_creat_action:testaction:1 + ocil:ssg-sshd_disable_pubkey_auth_action:testaction:1 - - Record Access Events to Audit Log Directory + + Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo use_pty - ocil:ssg-directory_access_var_log_audit_action:testaction:1 + ocil:ssg-sudo_add_use_pty_action:testaction:1 - - Disable Ctrl-Alt-Del Reboot Key Sequence in GNOME3 + + Disable the git_system_use_cifs SELinux Boolean - ocil:ssg-dconf_gnome_disable_ctrlaltdel_reboot_action:testaction:1 + ocil:ssg-sebool_git_system_use_cifs_action:testaction:1 - - Disable the samba_run_unconfined SELinux Boolean + + Enable the httpd_graceful_shutdown SELinux Boolean - ocil:ssg-sebool_samba_run_unconfined_action:testaction:1 + ocil:ssg-sebool_httpd_graceful_shutdown_action:testaction:1 - - Record Successful Creation Attempts to Files - open O_CREAT + + Set number of Password Hashing Rounds - password-auth - ocil:ssg-audit_rules_successful_file_modification_open_o_creat_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_rounds_password_auth_action:testaction:1 - - Disable the git_cgi_use_cifs SELinux Boolean + + Disable Host-Based Authentication - ocil:ssg-sebool_git_cgi_use_cifs_action:testaction:1 + ocil:ssg-disable_host_auth_action:testaction:1 - - Ensure logging is configured + + Ensure McAfee Endpoint Security for Linux (ENSL) is running - ocil:ssg-rsyslog_logging_configured_action:testaction:1 + ocil:ssg-agent_mfetpd_running_action:testaction:1 - - Disable the virt_rw_qemu_ga_data SELinux Boolean + + Ensure journald is configured to send logs to rsyslog - ocil:ssg-sebool_virt_rw_qemu_ga_data_action:testaction:1 + ocil:ssg-journald_forward_to_syslog_action:testaction:1 - - Configure AIDE to Verify Extended Attributes + + Disable the samba_domain_controller SELinux Boolean - ocil:ssg-aide_verify_ext_attributes_action:testaction:1 + ocil:ssg-sebool_samba_domain_controller_action:testaction:1 - - Disable the ftpd_connect_all_unreserved SELinux Boolean + + Record Unsuccessful Creation Attempts to Files - open_by_handle_at O_CREAT - ocil:ssg-sebool_ftpd_connect_all_unreserved_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_creat_action:testaction:1 - - Add noexec Option to Removable Media Partitions + + Ensure a Table Exists for Nftables - ocil:ssg-mount_option_noexec_removable_partitions_action:testaction:1 + ocil:ssg-set_nftables_table_action:testaction:1 - - Add noexec Option to /boot + + Verify Permissions on crontab - ocil:ssg-mount_option_boot_noexec_action:testaction:1 + ocil:ssg-file_permissions_crontab_action:testaction:1 - - The mailx Package Is Installed + + Enable the USBGuard Service - ocil:ssg-package_mailx_installed_action:testaction:1 + ocil:ssg-service_usbguard_enabled_action:testaction:1 - - Ensure All Files Are Owned by a User + + Disable the selinuxuser_share_music SELinux Boolean - ocil:ssg-no_files_unowned_by_user_action:testaction:1 + ocil:ssg-sebool_selinuxuser_share_music_action:testaction:1 - - Ensure PAM password complexity module is enabled in password-auth + + Record Events that Modify the System's Discretionary Access Controls - removexattr - ocil:ssg-accounts_password_pam_pwquality_password_auth_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_removexattr_action:testaction:1 - - Uninstall dovecot Package + + Ensure that System Accounts Are Locked - ocil:ssg-package_dovecot_removed_action:testaction:1 + ocil:ssg-no_password_auth_for_systemaccounts_action:testaction:1 - - Record Successful Ownership Changes to Files - lchown + + Set Interactive Session Timeout - ocil:ssg-audit_rules_successful_file_modification_lchown_action:testaction:1 + ocil:ssg-accounts_tmout_action:testaction:1 - - Remove ftp Package + + Record Successful Ownership Changes to Files - chown - ocil:ssg-package_ftp_removed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_chown_action:testaction:1 - - Record Any Attempts to Run setfacl + + Verify that System Executables Have Root Ownership - ocil:ssg-audit_rules_execution_setfacl_action:testaction:1 + ocil:ssg-file_ownership_binary_dirs_action:testaction:1 - - Disable the sge_domain_can_network_connect SELinux Boolean + + Disable the GNOME3 Login User List - ocil:ssg-sebool_sge_domain_can_network_connect_action:testaction:1 + ocil:ssg-dconf_gnome_disable_user_list_action:testaction:1 - - Uninstall cyrus-imapd Package + + Enable Public Key Authentication - ocil:ssg-package_cyrus-imapd_removed_action:testaction:1 + ocil:ssg-sshd_enable_pubkey_auth_action:testaction:1 - - Verify User Who Owns /var/log Directory + + Modify the System Login Banner - ocil:ssg-file_owner_var_log_action:testaction:1 + ocil:ssg-banner_etc_issue_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - crontab + + Ensure journald is configured to compress large log files - ocil:ssg-audit_rules_privileged_commands_crontab_action:testaction:1 + ocil:ssg-journald_compress_action:testaction:1 - - Configure Speculative Store Bypass Mitigation + + Disable the virt_use_samba SELinux Boolean - ocil:ssg-grub2_spec_store_bypass_disable_argument_action:testaction:1 + ocil:ssg-sebool_virt_use_samba_action:testaction:1 - - Disable the tor_bind_all_unreserved_ports SELinux Boolean + + Disable kernel debugfs - ocil:ssg-sebool_tor_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-kernel_config_debug_fs_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv4 Interfaces + + Verify permissions on System Login Banner for Remote Connections - ocil:ssg-sysctl_net_ipv4_conf_all_accept_source_route_action:testaction:1 + ocil:ssg-file_permissions_etc_issue_net_action:testaction:1 - - Configure SSH to use System Crypto Policy + + Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd - ocil:ssg-configure_ssh_crypto_policy_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_gpasswd_action:testaction:1 - - Install libselinux Package + + Configure Speculative Store Bypass Mitigation - ocil:ssg-package_libselinux_installed_action:testaction:1 + ocil:ssg-grub2_spec_store_bypass_disable_argument_action:testaction:1 - - Disable the pcp_bind_all_unreserved_ports SELinux Boolean + + Record Any Attempts to Run chacl - ocil:ssg-sebool_pcp_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-audit_rules_execution_chacl_action:testaction:1 - - Verify Permissions on Backup passwd File + + Ensure auditd Collects Information on the Use of Privileged Commands - umount - ocil:ssg-file_permissions_backup_etc_passwd_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_umount_action:testaction:1 - - Enable the spamd_enable_home_dirs SELinux Boolean + + Enable Use of Strict Mode Checking - ocil:ssg-sebool_spamd_enable_home_dirs_action:testaction:1 + ocil:ssg-sshd_enable_strictmodes_action:testaction:1 - - Configure OpenSSL library to use System Crypto Policy + + Enable the antivirus_can_scan_system SELinux Boolean - ocil:ssg-configure_openssl_crypto_policy_action:testaction:1 + ocil:ssg-sebool_antivirus_can_scan_system_action:testaction:1 - - Disable xinetd Service + + Record Successful Delete Attempts to Files - unlink - ocil:ssg-service_xinetd_disabled_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_unlink_action:testaction:1 - - Install usbguard Package + + Uninstall krb5-workstation Package - ocil:ssg-package_usbguard_installed_action:testaction:1 + ocil:ssg-package_krb5-workstation_removed_action:testaction:1 - - Verify User Who Owns /var/log/messages File + + Disable the httpd_can_network_connect SELinux Boolean - ocil:ssg-file_owner_var_log_messages_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_action:testaction:1 - - Add nosuid Option to /tmp + + Verify Any Configured IPSec Tunnel Connections - ocil:ssg-mount_option_tmp_nosuid_action:testaction:1 + ocil:ssg-libreswan_approved_tunnels_action:testaction:1 - - Verify /boot/grub2/user.cfg Group Ownership + + Disable System Statistics Reset Service (sysstat) - ocil:ssg-file_groupowner_user_cfg_action:testaction:1 + ocil:ssg-service_sysstat_disabled_action:testaction:1 - - Set kernel parameter 'crypto.fips_enabled' to 1 + + Ensure only owner and members of group owner of /usr/bin/sudo can execute it - ocil:ssg-sysctl_crypto_fips_enabled_action:testaction:1 + ocil:ssg-sudo_restrict_others_executable_permission_action:testaction:1 - - Do not allow ACPI methods to be inserted/replaced at run time + + Disable the httpd_can_network_connect_cobbler SELinux Boolean - ocil:ssg-kernel_config_acpi_custom_method_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_cobbler_action:testaction:1 - - Remove the X Windows Package Group + + Add noexec Option to /var/log - ocil:ssg-package_xorg-x11-server-common_removed_action:testaction:1 + ocil:ssg-mount_option_var_log_noexec_action:testaction:1 - - Disable loading and unloading of kernel modules + + Disable IA32 emulation - ocil:ssg-sysctl_kernel_modules_disabled_action:testaction:1 + ocil:ssg-kernel_config_ia32_emulation_action:testaction:1 - - Set Permissions on the /var/log/httpd/ Directory + + Add nosuid Option to /tmp - ocil:ssg-dir_perms_var_log_httpd_action:testaction:1 + ocil:ssg-mount_option_tmp_nosuid_action:testaction:1 - - Disable the virt_use_execmem SELinux Boolean + + Add nosuid Option to /var/log/audit - ocil:ssg-sebool_virt_use_execmem_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_nosuid_action:testaction:1 - - Set SSH Client Alive Count Max + + Disable the logrotate_use_nfs SELinux Boolean - ocil:ssg-sshd_set_keepalive_action:testaction:1 + ocil:ssg-sebool_logrotate_use_nfs_action:testaction:1 - - Enable log_config_module For HTTPD Logging + + Uninstall libreport-plugin-logger Package - ocil:ssg-httpd_enable_log_config_action:testaction:1 + ocil:ssg-package_libreport-plugin-logger_removed_action:testaction:1 - - The Chronyd service is enabled + + Set Permissions on All Configuration Files Inside /etc/httpd/conf/ - ocil:ssg-service_chronyd_enabled_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_conf_files_action:testaction:1 - - Ensure auditd Unauthorized Access Attempts To open_by_handle_at Are Ordered Correctly + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_rule_order_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_unix_chkpwd_action:testaction:1 - - Remove NIS Client + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group - ocil:ssg-package_ypbind_removed_action:testaction:1 + ocil:ssg-audit_rules_etc_group_open_by_handle_at_action:testaction:1 - - Disable the httpd_ssi_exec SELinux Boolean + + Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - ocil:ssg-sebool_httpd_ssi_exec_action:testaction:1 + ocil:ssg-sebool_selinuxuser_postgresql_connect_enabled_action:testaction:1 - - Emulate Privileged Access Never (PAN) + + Configure SSSD to run as user sssd - ocil:ssg-kernel_config_arm64_sw_ttbr0_pan_action:testaction:1 + ocil:ssg-sssd_run_as_sssd_user_action:testaction:1 - - Remove the Kerberos Server Package + + Ensure logging is configured - ocil:ssg-package_krb5-server_removed_action:testaction:1 + ocil:ssg-rsyslog_logging_configured_action:testaction:1 - - Disable ntpdate Service (ntpdate) + + Set Default iptables Policy for Incoming Packets - ocil:ssg-service_ntpdate_disabled_action:testaction:1 + ocil:ssg-set_iptables_default_rule_action:testaction:1 - - Disable the openvpn_enable_homedirs SELinux Boolean + + Enable Yama support - ocil:ssg-sebool_openvpn_enable_homedirs_action:testaction:1 + ocil:ssg-kernel_config_security_yama_action:testaction:1 - - Verify that system commands files are group owned by root or a system account + + Set the Boot Loader Admin Username to a Non-Default Value - ocil:ssg-file_groupownership_system_commands_dirs_action:testaction:1 + ocil:ssg-grub2_admin_username_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - renameat + + Disable the dhcpd_use_ldap SELinux Boolean - ocil:ssg-audit_rules_file_deletion_events_renameat_action:testaction:1 + ocil:ssg-sebool_dhcpd_use_ldap_action:testaction:1 - - Remove the GDM Package Group + + Ensure auditd Collects Information on the Use of Privileged Commands - chage - ocil:ssg-package_gdm_removed_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_chage_action:testaction:1 - - Mount Remote Filesystems with nodev + + Disable the wine_mmap_zero_ignore SELinux Boolean - ocil:ssg-mount_option_nodev_remote_filesystems_action:testaction:1 + ocil:ssg-sebool_wine_mmap_zero_ignore_action:testaction:1 - - Verify Owner on cron.d + + Ensure All User Initialization Files Have Mode 0740 Or Less Permissive - ocil:ssg-file_owner_cron_d_action:testaction:1 + ocil:ssg-file_permission_user_init_files_action:testaction:1 - - Verify Permissions on SSH Server config file + + Ensure users' .netrc Files are not group or world accessible - ocil:ssg-file_permissions_sshd_config_action:testaction:1 + ocil:ssg-accounts_users_netrc_file_permissions_action:testaction:1 - - Disable SSH Access via Empty Passwords + + The Installed Operating System Is Vendor Supported - ocil:ssg-sshd_disable_empty_passwords_action:testaction:1 + ocil:ssg-installed_OS_is_vendor_supported_action:testaction:1 - - Enforce usage of pam_wheel for su authentication + + Record Unsuccessful Permission Changes to Files - lsetxattr - ocil:ssg-use_pam_wheel_for_su_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lsetxattr_action:testaction:1 - - Remove User Host-Based Authentication Files + + Record Unsuccessful Ownership Changes to Files - fchown - ocil:ssg-no_user_host_based_files_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchown_action:testaction:1 - - Configure audispd Plugin To Send Logs To Remote Server + + Install McAfee Endpoint Security for Linux (ENSL) - ocil:ssg-auditd_audispd_configure_remote_server_action:testaction:1 + ocil:ssg-package_mcafeetp_installed_action:testaction:1 - - Disable the irc_use_any_tcp_ports SELinux Boolean + + Verify User Who Owns Backup gshadow File - ocil:ssg-sebool_irc_use_any_tcp_ports_action:testaction:1 + ocil:ssg-file_owner_backup_etc_gshadow_action:testaction:1 - - Configure the Firewalld Ports + + Enable Certmap in SSSD - ocil:ssg-configure_firewalld_ports_action:testaction:1 + ocil:ssg-sssd_enable_certmap_action:testaction:1 - - Configure SSH Server to Use FIPS 140-2 Validated Ciphers: opensshserver.config + + Ensure /srv Located On Separate Partition - ocil:ssg-harden_sshd_ciphers_opensshserver_conf_crypto_policy_action:testaction:1 + ocil:ssg-partition_for_srv_action:testaction:1 - - Uninstall geolite2-city Package + + Verify Group Who Owns gshadow File - ocil:ssg-package_geolite2-city_removed_action:testaction:1 + ocil:ssg-file_groupowner_etc_gshadow_action:testaction:1 - - Record Events that Modify User/Group Information + + Disable the squid_use_tproxy SELinux Boolean - ocil:ssg-audit_rules_usergroup_modification_action:testaction:1 + ocil:ssg-sebool_squid_use_tproxy_action:testaction:1 - - Configure Certificate Directives for LDAP Use of TLS + + Uninstall setroubleshoot-plugins Package - ocil:ssg-ldap_client_tls_cacertpath_action:testaction:1 + ocil:ssg-package_setroubleshoot-plugins_removed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - ftruncate + + Disable Anonymous FTP Access - ocil:ssg-audit_rules_unsuccessful_file_modification_ftruncate_action:testaction:1 + ocil:ssg-httpd_disable_anonymous_ftp_access_action:testaction:1 - - Limit Password Reuse: password-auth + + Disable vsftpd Service - ocil:ssg-accounts_password_pam_pwhistory_remember_password_auth_action:testaction:1 + ocil:ssg-service_vsftpd_disabled_action:testaction:1 - - Enable SLUB debugging support + + Set SSH authentication attempt limit - ocil:ssg-kernel_config_slub_debug_action:testaction:1 + ocil:ssg-sshd_set_max_auth_tries_action:testaction:1 - - Configure A Banner Page For Each Website + + Make the module text and rodata read-only - ocil:ssg-httpd_configure_banner_page_action:testaction:1 + ocil:ssg-kernel_config_strict_module_rwx_action:testaction:1 - - Disable Kernel mac80211 Module + + Enable the secadm_exec_content SELinux Boolean - ocil:ssg-kernel_module_mac80211_disabled_action:testaction:1 + ocil:ssg-sebool_secadm_exec_content_action:testaction:1 - - Audit Configuration Files Permissions are 640 or More Restrictive + + Add noexec Option to /var - ocil:ssg-file_permissions_audit_configuration_action:testaction:1 + ocil:ssg-mount_option_var_noexec_action:testaction:1 - - Disable the virt_use_xserver SELinux Boolean + + Verify User Who Owns /var/log Directory - ocil:ssg-sebool_virt_use_xserver_action:testaction:1 + ocil:ssg-file_owner_var_log_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Settings + + Disable the httpd_run_preupgrade SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_user_locks_action:testaction:1 + ocil:ssg-sebool_httpd_run_preupgrade_action:testaction:1 - - Record Attempts to Alter the localtime File + + Disable the xserver_execmem SELinux Boolean - ocil:ssg-audit_rules_time_watch_localtime_action:testaction:1 + ocil:ssg-sebool_xserver_execmem_action:testaction:1 - - Verify Root Has A Primary GID 0 + + System Audit Logs Must Be Group Owned By Root - ocil:ssg-accounts_root_gid_zero_action:testaction:1 + ocil:ssg-file_group_ownership_var_log_audit_action:testaction:1 - - Disable the zebra_write_config SELinux Boolean + + Uninstall httpd Package - ocil:ssg-sebool_zebra_write_config_action:testaction:1 + ocil:ssg-package_httpd_removed_action:testaction:1 - - Remove tftp Daemon + + Record Events that Modify User/Group Information - /etc/shadow - ocil:ssg-package_tftp_removed_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_shadow_action:testaction:1 - - Verify User Who Owns passwd File + + Do Not Allow SSH Environment Options - ocil:ssg-file_owner_etc_passwd_action:testaction:1 + ocil:ssg-sshd_do_not_permit_user_env_action:testaction:1 - - Disable the virt_use_fusefs SELinux Boolean + + Enable automatic signing of all modules - ocil:ssg-sebool_virt_use_fusefs_action:testaction:1 + ocil:ssg-kernel_config_module_sig_all_action:testaction:1 - - Configure SSSD to Expire Offline Credentials + + Configure maximum number of process identifiers - ocil:ssg-sssd_offline_cred_expiration_action:testaction:1 + ocil:ssg-sysctl_kernel_pid_max_action:testaction:1 - - Disable Mounting of cramfs + + Disable /dev/kmem virtual device support - ocil:ssg-kernel_module_cramfs_disabled_action:testaction:1 + ocil:ssg-kernel_config_devkmem_action:testaction:1 - - Disable the httpd_can_network_connect_cobbler SELinux Boolean + + Verify /boot/grub2/grub.cfg Group Ownership - ocil:ssg-sebool_httpd_can_network_connect_cobbler_action:testaction:1 + ocil:ssg-file_groupowner_grub2_cfg_action:testaction:1 - - Verify that audit tools are owned by root + + Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit - ocil:ssg-file_ownership_audit_binaries_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_sudoedit_action:testaction:1 - - Configure Auto Configuration on All IPv6 Interfaces By Default + + Disable the gluster_anon_write SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_autoconf_action:testaction:1 + ocil:ssg-sebool_gluster_anon_write_action:testaction:1 - - Disable the httpd_run_preupgrade SELinux Boolean + + Disable the virt_read_qemu_ga_data SELinux Boolean - ocil:ssg-sebool_httpd_run_preupgrade_action:testaction:1 + ocil:ssg-sebool_virt_read_qemu_ga_data_action:testaction:1 - - Disable the wine_mmap_zero_ignore SELinux Boolean + + Ensure auditd Collects File Deletion Events by User - unlinkat - ocil:ssg-sebool_wine_mmap_zero_ignore_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_unlinkat_action:testaction:1 - - Record Any Attempts to Run ssh-agent + + Ensure the Default Umask is Set Correctly For Interactive Users - ocil:ssg-audit_rules_privileged_commands_ssh_agent_action:testaction:1 + ocil:ssg-accounts_umask_interactive_users_action:testaction:1 - - Build and Test AIDE Database + + Install AIDE - ocil:ssg-aide_build_database_action:testaction:1 + ocil:ssg-package_aide_installed_action:testaction:1 - - Enable FIPS Mode + + Add nosuid Option to /home - ocil:ssg-enable_fips_mode_action:testaction:1 + ocil:ssg-mount_option_home_nosuid_action:testaction:1 - - Verify File Hashes with RPM + + Enable auditd Service - ocil:ssg-rpm_verify_hashes_action:testaction:1 + ocil:ssg-service_auditd_enabled_action:testaction:1 - - Uninstall Sendmail Package + + Configure CA certificate for rsyslog remote logging - ocil:ssg-package_sendmail_removed_action:testaction:1 + ocil:ssg-rsyslog_remote_tls_cacert_action:testaction:1 - - Ensure logrotate is Installed + + Install the pcsc-lite package - ocil:ssg-package_logrotate_installed_action:testaction:1 + ocil:ssg-package_pcsc-lite_installed_action:testaction:1 - - Disable the samba_load_libgfapi SELinux Boolean + + Disable the smbd_anon_write SELinux Boolean - ocil:ssg-sebool_samba_load_libgfapi_action:testaction:1 + ocil:ssg-sebool_smbd_anon_write_action:testaction:1 - - SSSD Has a Correct Trust Anchor + + Disable the git_session_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sssd_has_trust_anchor_action:testaction:1 + ocil:ssg-sebool_git_session_bind_all_unreserved_ports_action:testaction:1 - - Uninstall nginx Package + + Ensure auditd Collects Information on Kernel Module Unloading - create_module - ocil:ssg-package_nginx_removed_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_create_action:testaction:1 - - Disable the ftpd_full_access SELinux Boolean + + Ensure '/etc/system-fips' exists - ocil:ssg-sebool_ftpd_full_access_action:testaction:1 + ocil:ssg-etc_system_fips_exists_action:testaction:1 - - A private web server must be located on a separate controlled access subnet + + Install libcap-ng-utils Package - ocil:ssg-httpd_private_server_on_separate_subnet_action:testaction:1 + ocil:ssg-package_libcap-ng-utils_installed_action:testaction:1 - - Verify Owner on cron.weekly + + Use Centralized and Automated Authentication - ocil:ssg-file_owner_cron_weekly_action:testaction:1 + ocil:ssg-account_use_centralized_automated_auth_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lremovexattr + + Record Attempts to perform maintenance activities - ocil:ssg-audit_rules_dac_modification_lremovexattr_action:testaction:1 + ocil:ssg-audit_sudo_log_events_action:testaction:1 - - Record Attempts to Alter Time Through stime + + Configure Time Service Maxpoll Interval - ocil:ssg-audit_rules_time_stime_action:testaction:1 + ocil:ssg-chronyd_or_ntpd_set_maxpoll_action:testaction:1 - - Disable support for /proc/kkcore + + Ensure there are no legacy + NIS entries in /etc/passwd - ocil:ssg-kernel_config_proc_kcore_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_passwd_action:testaction:1 - - Disable SSH Support for Rhosts RSA Authentication + + Configure auditing of unsuccessful file accesses - ocil:ssg-sshd_disable_rhosts_rsa_action:testaction:1 + ocil:ssg-audit_access_failed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - truncate + + Disable the mmap_low_allowed SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_truncate_action:testaction:1 + ocil:ssg-sebool_mmap_low_allowed_action:testaction:1 - - Extend Audit Backlog Limit for the Audit Daemon + + Make sure that the dconf databases are up-to-date with regards to respective keyfiles - ocil:ssg-grub2_audit_backlog_limit_argument_action:testaction:1 + ocil:ssg-dconf_db_up_to_date_action:testaction:1 - - Avoid speculative indirect branches in kernel + + Enable cron Service - ocil:ssg-kernel_config_retpoline_action:testaction:1 + ocil:ssg-service_cron_enabled_action:testaction:1 - - Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ + + Log USBGuard daemon audit events using Linux Audit - ocil:ssg-audit_rules_sudoers_d_action:testaction:1 + ocil:ssg-configure_usbguard_auditbackend_action:testaction:1 - - Add nodev Option to Removable Media Partitions + + Enable GSSAPI Authentication - ocil:ssg-mount_option_nodev_removable_partitions_action:testaction:1 + ocil:ssg-sshd_enable_gssapi_auth_action:testaction:1 - - Disable IPv6 Addressing on IPv6 Interfaces by Default + + Build and Test AIDE Database - ocil:ssg-sysctl_net_ipv6_conf_default_disable_ipv6_action:testaction:1 + ocil:ssg-aide_build_database_action:testaction:1 - - Disable vsyscalls + + Disable the openvpn_enable_homedirs SELinux Boolean - ocil:ssg-grub2_vsyscall_argument_action:testaction:1 + ocil:ssg-sebool_openvpn_enable_homedirs_action:testaction:1 - - Enable checks on linked list manipulation + + Disable the puppetmaster_use_db SELinux Boolean - ocil:ssg-kernel_config_debug_list_action:testaction:1 + ocil:ssg-sebool_puppetmaster_use_db_action:testaction:1 - - Verify All Account Password Hashes are Shadowed + + Record Successful Creation Attempts to Files - openat O_CREAT - ocil:ssg-accounts_password_all_shadowed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_o_creat_action:testaction:1 - - Disable the ftpd_use_passive_mode SELinux Boolean + + Disable the polipo_use_nfs SELinux Boolean - ocil:ssg-sebool_ftpd_use_passive_mode_action:testaction:1 + ocil:ssg-sebool_polipo_use_nfs_action:testaction:1 - - Add usrquota Option to /home + + Account Lockouts Must Be Logged - ocil:ssg-mount_option_home_usrquota_action:testaction:1 + ocil:ssg-account_passwords_pam_faillock_audit_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow - ocil:ssg-audit_rules_etc_group_open_by_handle_at_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_open_by_handle_at_action:testaction:1 - - Disable the sanlock_use_nfs SELinux Boolean + + Uninstall pigz Package - ocil:ssg-sebool_sanlock_use_nfs_action:testaction:1 + ocil:ssg-package_pigz_removed_action:testaction:1 - - Disable the mcelog_client SELinux Boolean + + All User Files and Directories In The Home Directory Must Have Mode 0750 Or Less Permissive - ocil:ssg-sebool_mcelog_client_action:testaction:1 + ocil:ssg-accounts_users_home_files_permissions_action:testaction:1 - - Enable support for BUG() + + Ensure auditd Collects Unauthorized Access Attempts to Files (unsuccessful) - ocil:ssg-kernel_config_bug_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_action:testaction:1 - - Ensure all zIPL boot entries are BLS compliant + + Verify User Who Owns shadow File - ocil:ssg-zipl_bls_entries_only_action:testaction:1 + ocil:ssg-file_owner_etc_shadow_action:testaction:1 - - Configure auditd space_left on Low Disk Space + + Ensure PAM Enforces Password Requirements - Minimum Lowercase Characters - ocil:ssg-auditd_data_retention_space_left_percentage_action:testaction:1 + ocil:ssg-accounts_password_pam_lcredit_action:testaction:1 - - Disable the nfsd_anon_write SELinux Boolean + + Uninstall CUPS Package - ocil:ssg-sebool_nfsd_anon_write_action:testaction:1 + ocil:ssg-package_cups_removed_action:testaction:1 - - Disable the xdm_exec_bootloader SELinux Boolean + + Disable the xguest_use_bluetooth SELinux Boolean - ocil:ssg-sebool_xdm_exec_bootloader_action:testaction:1 + ocil:ssg-sebool_xguest_use_bluetooth_action:testaction:1 - - Disable Avahi Server Software + + Configure AIDE to Verify the Audit Tools - ocil:ssg-service_avahi-daemon_disabled_action:testaction:1 + ocil:ssg-aide_check_audit_tools_action:testaction:1 - - Ensure invoking users password for privilege escalation when using sudo + + Account Lockouts Must Be Logged - ocil:ssg-sudoers_validate_passwd_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_audit_action:testaction:1 - - Disable the mysql_connect_any SELinux Boolean + + All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary Group - ocil:ssg-sebool_mysql_connect_any_action:testaction:1 + ocil:ssg-accounts_users_home_files_groupownership_action:testaction:1 - - Remove the OpenSSH Server Package + + Configure the root Account for Failed Password Attempts - ocil:ssg-package_openssh-server_removed_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_deny_root_action:testaction:1 - - Uninstall vsftpd Package + + Record Unsuccessful Permission Changes to Files - fchmod - ocil:ssg-package_vsftpd_removed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchmod_action:testaction:1 - - Enable the kerberos_enabled SELinux Boolean + + Disable merging of slabs with similar size - ocil:ssg-sebool_kerberos_enabled_action:testaction:1 + ocil:ssg-grub2_slab_nomerge_argument_action:testaction:1 - - Disable the use of user namespaces + + Enable the pcscd Service - ocil:ssg-sysctl_user_max_user_namespaces_action:testaction:1 + ocil:ssg-service_pcscd_enabled_action:testaction:1 - - Ensure that System Accounts Are Locked + + Verify Owner on cron.hourly - ocil:ssg-no_password_auth_for_systemaccounts_action:testaction:1 + ocil:ssg-file_owner_cron_hourly_action:testaction:1 - - Disable the mailman_use_fusefs SELinux Boolean + + Disable IPv6 Addressing on IPv6 Interfaces by Default - ocil:ssg-sebool_mailman_use_fusefs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_disable_ipv6_action:testaction:1 - - Modify the System Message of the Day Banner + + Disable httpd Service - ocil:ssg-banner_etc_motd_action:testaction:1 + ocil:ssg-service_httpd_disabled_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - rename + + User Initialization Files Must Be Owned By the Primary User - ocil:ssg-audit_rules_file_deletion_events_rename_action:testaction:1 + ocil:ssg-accounts_user_dot_user_ownership_action:testaction:1 - - Enable the mount_anyfile SELinux Boolean + + SSSD Has a Correct Trust Anchor - ocil:ssg-sebool_mount_anyfile_action:testaction:1 + ocil:ssg-sssd_has_trust_anchor_action:testaction:1 - - Verify that System Executable Have Root Ownership + + Resolve information before writing to audit logs - ocil:ssg-dir_ownership_binary_dirs_action:testaction:1 + ocil:ssg-auditd_log_format_action:testaction:1 - - Set the UEFI Boot Loader Password + + Verify and Correct Ownership with RPM - ocil:ssg-grub2_uefi_password_action:testaction:1 + ocil:ssg-rpm_verify_ownership_action:testaction:1 - - Disable the httpd_enable_ftp_server SELinux Boolean + + Configure auditing of unsuccessful permission changes - ocil:ssg-sebool_httpd_enable_ftp_server_action:testaction:1 + ocil:ssg-audit_perm_change_failed_action:testaction:1 - - Set existing passwords a period of inactivity before they been locked + + Enable NX or XD Support in the BIOS - ocil:ssg-accounts_set_post_pw_existing_action:testaction:1 + ocil:ssg-bios_enable_execution_restrictions_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Enforce for root User + + Ensure PAM password complexity module is enabled in password-auth - ocil:ssg-accounts_password_pam_enforce_root_action:testaction:1 + ocil:ssg-accounts_password_pam_pwquality_password_auth_action:testaction:1 - - Enable the user_exec_content SELinux Boolean + + Record Events that Modify User/Group Information via openat syscall - /etc/group - ocil:ssg-sebool_user_exec_content_action:testaction:1 + ocil:ssg-audit_rules_etc_group_openat_action:testaction:1 - - All Interactive User Home Directories Must Be Group-Owned By The Primary Group + + Disable the telepathy_connect_all_ports SELinux Boolean - ocil:ssg-file_groupownership_home_directories_action:testaction:1 + ocil:ssg-sebool_telepathy_connect_all_ports_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Different Categories + + Enable Transport Layer Security (TLS) Encryption - ocil:ssg-accounts_password_pam_minclass_action:testaction:1 + ocil:ssg-httpd_configure_tls_action:testaction:1 - - Disable the global_ssp SELinux Boolean + + Disable the tor_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sebool_global_ssp_action:testaction:1 + ocil:ssg-sebool_tor_bind_all_unreserved_ports_action:testaction:1 - - Disable the ksmtuned_use_cifs SELinux Boolean + + Disable xinetd Service - ocil:ssg-sebool_ksmtuned_use_cifs_action:testaction:1 + ocil:ssg-service_xinetd_disabled_action:testaction:1 - - Record Successful Permission Changes to Files - fremovexattr + + Ensure the audit Subsystem is Installed - ocil:ssg-audit_rules_successful_file_modification_fremovexattr_action:testaction:1 + ocil:ssg-package_audit_installed_action:testaction:1 - - Enable page allocator poisoning + + Disable Ctrl-Alt-Del Reboot Activation - ocil:ssg-grub2_page_poison_argument_action:testaction:1 + ocil:ssg-disable_ctrlaltdel_reboot_action:testaction:1 - - Disable the guest_exec_content SELinux Boolean + + Ensure Chrony is only configured with the server directive - ocil:ssg-sebool_guest_exec_content_action:testaction:1 + ocil:ssg-chronyd_server_directive_action:testaction:1 - - Disable Postfix Network Listening + + Disable the glance_use_fusefs SELinux Boolean - ocil:ssg-postfix_network_listening_disabled_action:testaction:1 + ocil:ssg-sebool_glance_use_fusefs_action:testaction:1 - - Install openscap-scanner Package + + Randomize slab freelist - ocil:ssg-package_openscap-scanner_installed_action:testaction:1 + ocil:ssg-kernel_config_slab_freelist_random_action:testaction:1 - - Disable Anonymous FTP Access + + Verify the UEFI Boot Loader grub.cfg Permissions - ocil:ssg-httpd_disable_anonymous_ftp_access_action:testaction:1 + ocil:ssg-file_permissions_efi_grub2_cfg_action:testaction:1 - - Set SSH Client Alive Count Max to zero + + Record Unsuccessful Permission Changes to Files - fchmodat - ocil:ssg-sshd_set_keepalive_0_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchmodat_action:testaction:1 - - Verify Permissions on Backup gshadow File + + Enable dnf-automatic Timer - ocil:ssg-file_permissions_backup_etc_gshadow_action:testaction:1 + ocil:ssg-timer_dnf-automatic_enabled_action:testaction:1 - - Enable GSSAPI Authentication + + Ensure /boot Located On Separate Partition - ocil:ssg-sshd_enable_gssapi_auth_action:testaction:1 + ocil:ssg-partition_for_boot_action:testaction:1 - - Enable GNOME3 Login Warning Banner + + Disable Quota Netlink (quota_nld) - ocil:ssg-dconf_gnome_banner_enabled_action:testaction:1 + ocil:ssg-service_quota_nld_disabled_action:testaction:1 - - Assign Expiration Date to Emergency Accounts + + Enable the virt_sandbox_use_audit SELinux Boolean - ocil:ssg-account_emergency_expire_date_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_audit_action:testaction:1 - - Verify Group Who Owns group File + + Web Content Directories Must Not Be Shared Anonymously - ocil:ssg-file_groupowner_etc_group_action:testaction:1 + ocil:ssg-httpd_anonymous_content_sharing_action:testaction:1 - - Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean + + Virus Scanning Software Definitions Are Updated - ocil:ssg-sebool_mozilla_plugin_bind_unreserved_ports_action:testaction:1 + ocil:ssg-mcafee_antivirus_definitions_updated_action:testaction:1 - - Configure auditing of unsuccessful file accesses + + Verify Permissions on cron.weekly - ocil:ssg-audit_access_failed_action:testaction:1 + ocil:ssg-file_permissions_cron_weekly_action:testaction:1 - - Ensure gpgcheck Enabled In Main yum Configuration + + Ensure that User Home Directories are not Group-Writable or World-Readable - ocil:ssg-ensure_gpgcheck_globally_activated_action:testaction:1 + ocil:ssg-file_permissions_home_dirs_action:testaction:1 - - Disable the nis_enabled SELinux Boolean + + Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - ocil:ssg-sebool_nis_enabled_action:testaction:1 + ocil:ssg-sebool_selinuxuser_mysql_connect_enabled_action:testaction:1 - - Limit the Number of Concurrent Login Sessions Allowed Per User + + Disable the httpd_run_stickshift SELinux Boolean - ocil:ssg-accounts_max_concurrent_login_sessions_action:testaction:1 + ocil:ssg-sebool_httpd_run_stickshift_action:testaction:1 - - Enable dnf-automatic Timer + + Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate - ocil:ssg-timer_dnf-automatic_enabled_action:testaction:1 + ocil:ssg-sudo_remove_no_authenticate_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Idle Activation + + Disable the irssi_use_full_network SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_idle_activation_locked_action:testaction:1 + ocil:ssg-sebool_irssi_use_full_network_action:testaction:1 - - Verify /boot/grub2/grub.cfg User Ownership + + Verify All Account Password Hashes are Shadowed with SHA512 - ocil:ssg-file_owner_grub2_cfg_action:testaction:1 + ocil:ssg-accounts_password_all_shadowed_sha512_action:testaction:1 - - Set Default firewalld Zone for Incoming Packets + + Ensure PAM Enforces Password Requirements - Minimum Special Characters - ocil:ssg-set_firewalld_default_zone_action:testaction:1 + ocil:ssg-accounts_password_pam_ocredit_action:testaction:1 - - Ensure the Logon Failure Delay is Set Correctly in login.defs + + Ensure auditd Collects Information on the Use of Privileged Commands - at - ocil:ssg-accounts_logon_fail_delay_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_at_action:testaction:1 - - Enable Public Key Authentication + + Enable GNOME3 Login Warning Banner - ocil:ssg-sshd_enable_pubkey_auth_action:testaction:1 + ocil:ssg-dconf_gnome_banner_enabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - reboot + + Disable SSH Support for .rhosts Files - ocil:ssg-audit_privileged_commands_reboot_action:testaction:1 + ocil:ssg-sshd_disable_rhosts_action:testaction:1 - - Record Any Attempts to Run restorecon + + Enable GNOME3 Screensaver Lock After Idle Period - ocil:ssg-audit_rules_execution_restorecon_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_enabled_action:testaction:1 - - Disable the zabbix_can_network SELinux Boolean + + Configure Multiple DNS Servers in /etc/resolv.conf - ocil:ssg-sebool_zabbix_can_network_action:testaction:1 + ocil:ssg-network_configure_name_resolution_action:testaction:1 - - Verify Permissions on Backup shadow File + + Disable the ftpd_use_fusefs SELinux Boolean - ocil:ssg-file_permissions_backup_etc_shadow_action:testaction:1 + ocil:ssg-sebool_ftpd_use_fusefs_action:testaction:1 - - All GIDs referenced in /etc/passwd must be defined in /etc/group + + Disable the ksmtuned_use_cifs SELinux Boolean - ocil:ssg-gid_passwd_group_same_action:testaction:1 + ocil:ssg-sebool_ksmtuned_use_cifs_action:testaction:1 - - Root Path Must Be Vendor Default + + Disable XDMCP in GDM - ocil:ssg-root_path_default_action:testaction:1 + ocil:ssg-gnome_gdm_disable_xdmcp_action:testaction:1 - - Add nosuid Option to /home + + Verify /boot/efi/EFI/redhat/user.cfg Group Ownership - ocil:ssg-mount_option_home_nosuid_action:testaction:1 + ocil:ssg-file_groupowner_efi_user_cfg_action:testaction:1 - - Ensure rsyslog is Installed + + Disable the gluster_export_all_ro SELinux Boolean - ocil:ssg-package_rsyslog_installed_action:testaction:1 + ocil:ssg-sebool_gluster_export_all_ro_action:testaction:1 - - Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces + + Configure auditing of successful file deletions - ocil:ssg-sysctl_net_ipv4_conf_all_send_redirects_action:testaction:1 + ocil:ssg-audit_delete_success_action:testaction:1 - - Add noexec Option to /var/log + + Ensure System Log Files Have Correct Permissions - ocil:ssg-mount_option_var_log_noexec_action:testaction:1 + ocil:ssg-rsyslog_files_permissions_action:testaction:1 - - Record Successful Permission Changes to Files - removexattr + + Use zero for poisoning instead of debugging value - ocil:ssg-audit_rules_successful_file_modification_removexattr_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_zero_action:testaction:1 - - Enable the logadm_exec_content SELinux Boolean + + Set Password Hashing Algorithm in /etc/login.defs - ocil:ssg-sebool_logadm_exec_content_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_logindefs_action:testaction:1 - - Randomize the address of the kernel image (KASLR) + + Ensure /home Located On Separate Partition - ocil:ssg-kernel_config_randomize_base_action:testaction:1 + ocil:ssg-partition_for_home_action:testaction:1 - - Disable the git_cgi_use_nfs SELinux Boolean + + Verify Owner on crontab - ocil:ssg-sebool_git_cgi_use_nfs_action:testaction:1 + ocil:ssg-file_owner_crontab_action:testaction:1 - - Verify Permissions on /etc/at.allow file + + Configure SSSD to Expire SSH Known Hosts - ocil:ssg-file_permissions_at_allow_action:testaction:1 + ocil:ssg-sssd_ssh_known_hosts_timeout_action:testaction:1 - - Configure opensc Smart Card Drivers + + Record Events that Modify the System's Discretionary Access Controls - chmod - ocil:ssg-configure_opensc_card_drivers_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_chmod_action:testaction:1 - - Configure BIND to use System Crypto Policy + + Ensure Privileged Escalated Commands Cannot Execute Other Commands - sudo NOEXEC - ocil:ssg-configure_bind_crypto_policy_action:testaction:1 + ocil:ssg-sudo_add_noexec_action:testaction:1 - - Ensure All World-Writable Directories Are Group Owned by a System Account + + Set Existing Passwords Warning Age - ocil:ssg-dir_perms_world_writable_system_owned_group_action:testaction:1 + ocil:ssg-accounts_password_set_warn_age_existing_action:testaction:1 - - Disable the named_write_master_zones SELinux Boolean + + Verify ownership of Message of the Day Banner - ocil:ssg-sebool_named_write_master_zones_action:testaction:1 + ocil:ssg-file_owner_etc_motd_action:testaction:1 - - Disable the virt_use_usb SELinux Boolean + + Disable telnet Service - ocil:ssg-sebool_virt_use_usb_action:testaction:1 + ocil:ssg-service_telnet_disabled_action:testaction:1 - - Verify that Shared Library Directories Have Root Group Ownership + + Disable the Automounter - ocil:ssg-dir_group_ownership_library_dirs_action:testaction:1 + ocil:ssg-service_autofs_disabled_action:testaction:1 - - Disable storing core dumps + + Enable the mcelog_exec_scripts SELinux Boolean - ocil:ssg-sysctl_kernel_core_pattern_action:testaction:1 + ocil:ssg-sebool_mcelog_exec_scripts_action:testaction:1 - - Log USBGuard daemon audit events using Linux Audit + + Record Successful Ownership Changes to Files - fchownat - ocil:ssg-configure_usbguard_auditbackend_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchownat_action:testaction:1 - - Ensure Log Files Are Owned By Appropriate Group + + Record Successful Creation Attempts to Files - open_by_handle_at O_CREAT - ocil:ssg-rsyslog_files_groupownership_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_creat_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo + + Add nodev Option to /dev/shm - ocil:ssg-sudo_require_authentication_action:testaction:1 + ocil:ssg-mount_option_dev_shm_nodev_action:testaction:1 - - Set number of Password Hashing Rounds - password-auth + + Use Only FIPS 140-2 Validated MACs - ocil:ssg-accounts_password_pam_unix_rounds_password_auth_action:testaction:1 + ocil:ssg-sshd_use_approved_macs_action:testaction:1 - - Enable SSH Warning Banner + + Enable nails Service - ocil:ssg-sshd_enable_warning_banner_action:testaction:1 + ocil:ssg-service_nails_enabled_action:testaction:1 - - Ensure /var/log/audit Located On Separate Partition + + Verify Group Who Owns Crontab - ocil:ssg-partition_for_var_log_audit_action:testaction:1 + ocil:ssg-file_groupowner_crontab_action:testaction:1 - - Disable the kdumpgui_run_bootloader SELinux Boolean + + Disable the rsync_export_all_ro SELinux Boolean - ocil:ssg-sebool_kdumpgui_run_bootloader_action:testaction:1 + ocil:ssg-sebool_rsync_export_all_ro_action:testaction:1 - - Disable kexec system call + + Limit Users' SSH Access - ocil:ssg-kernel_config_kexec_action:testaction:1 + ocil:ssg-sshd_limit_user_access_action:testaction:1 - - Ensure the Default Bash Umask is Set Correctly + + Ensure that /etc/at.deny does not exist - ocil:ssg-accounts_umask_etc_bashrc_action:testaction:1 + ocil:ssg-file_at_deny_not_exist_action:testaction:1 - - Enable the GNOME3 Login Smartcard Authentication + + Configure System Cryptography Policy - ocil:ssg-dconf_gnome_enable_smartcard_auth_action:testaction:1 + ocil:ssg-configure_crypto_policy_action:testaction:1 - - Disable the httpd_read_user_content SELinux Boolean + + A remote time server for Chrony is configured - ocil:ssg-sebool_httpd_read_user_content_action:testaction:1 + ocil:ssg-chronyd_specify_remote_server_action:testaction:1 - - System Audit Directories Must Be Owned By Root + + All Interactive Users Must Have A Home Directory Defined - ocil:ssg-directory_ownership_var_log_audit_action:testaction:1 + ocil:ssg-accounts_user_interactive_home_directory_defined_action:testaction:1 - - Ensure sudo Runs In A Minimal Environment - sudo env_reset + + Record Events that Modify the System's Discretionary Access Controls - umount2 - ocil:ssg-sudo_add_env_reset_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_umount2_action:testaction:1 - - Ensure /boot Located On Separate Partition + + Prevent Login to Accounts With Empty Password - ocil:ssg-partition_for_boot_action:testaction:1 + ocil:ssg-no_empty_passwords_action:testaction:1 - - Verify User Who Owns /etc/cron.allow file + + Configure SSSD LDAP Backend Client CA Certificate Location - ocil:ssg-file_owner_cron_allow_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_ca_dir_action:testaction:1 - - Verify Who Owns /etc/shells File + + Disable SSH Access via Empty Passwords - ocil:ssg-file_owner_etc_shells_action:testaction:1 + ocil:ssg-sshd_disable_empty_passwords_action:testaction:1 - - Disable the dbadm_manage_user_files SELinux Boolean + + Disable the ftpd_use_cifs SELinux Boolean - ocil:ssg-sebool_dbadm_manage_user_files_action:testaction:1 + ocil:ssg-sebool_ftpd_use_cifs_action:testaction:1 - - Enable the mcelog_exec_scripts SELinux Boolean + + Disable X Windows Startup By Setting Default Target - ocil:ssg-sebool_mcelog_exec_scripts_action:testaction:1 + ocil:ssg-xwindows_runlevel_target_action:testaction:1 - - Uninstall quagga Package + + Encrypt Audit Records Sent With audispd Plugin - ocil:ssg-package_quagga_removed_action:testaction:1 + ocil:ssg-auditd_audispd_encrypt_sent_records_action:testaction:1 - - Install Virus Scanning Software + + Add nodev Option to /home - ocil:ssg-install_antivirus_action:testaction:1 + ocil:ssg-mount_option_home_nodev_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - tallylog + + Verify the system-wide library files in directories +"/lib", "/lib64", "/usr/lib/" and "/usr/lib64" are group-owned by root. - ocil:ssg-audit_rules_login_events_tallylog_action:testaction:1 + ocil:ssg-root_permissions_syslibrary_files_action:testaction:1 - - Disable the smartmon_3ware SELinux Boolean + + Record Events that Modify User/Group Information - /etc/group - ocil:ssg-sebool_smartmon_3ware_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_group_action:testaction:1 - - Configure GNOME3 DConf User Profile + + Record Unsuccessful Access Attempts to Files - open - ocil:ssg-enable_dconf_user_profile_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_action:testaction:1 - - Install the Asset Configuration Compliance Module (ACCM) + + Set GNOME3 Screensaver Lock Delay After Activation Period - ocil:ssg-install_mcafee_hbss_accm_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_delay_action:testaction:1 - - Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces + + Verify /boot/grub2/user.cfg Group Ownership - ocil:ssg-sysctl_net_ipv4_conf_all_forwarding_action:testaction:1 + ocil:ssg-file_groupowner_user_cfg_action:testaction:1 - - Require Client SMB Packet Signing, if using mount.cifs + + Disable Odd Job Daemon (oddjobd) - ocil:ssg-mount_option_smb_client_signing_action:testaction:1 + ocil:ssg-service_oddjobd_disabled_action:testaction:1 - - Set number of Password Hashing Rounds - system-auth + + Ensure LDAP client is not installed - ocil:ssg-accounts_password_pam_unix_rounds_system_auth_action:testaction:1 + ocil:ssg-package_openldap-clients_removed_action:testaction:1 - - Remove the FreeRadius Server Package + + Disable the lsmd_plugin_connect_any SELinux Boolean - ocil:ssg-package_freeradius_removed_action:testaction:1 + ocil:ssg-sebool_lsmd_plugin_connect_any_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - setxattr + + Disable the httpd_unified SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_setxattr_action:testaction:1 + ocil:ssg-sebool_httpd_unified_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - unlinkat + + Record Events When Executables Are Run As Another User - ocil:ssg-audit_rules_file_deletion_events_unlinkat_action:testaction:1 + ocil:ssg-audit_rules_suid_auid_privilege_function_action:testaction:1 - - Ensure System is Not Acting as a Network Sniffer + + Verify Only Root Has UID 0 - ocil:ssg-network_sniffer_disabled_action:testaction:1 + ocil:ssg-accounts_no_uid_except_zero_action:testaction:1 - - Disable the ssh_chroot_rw_homedirs SELinux Boolean + + Disable the polipo_connect_all_unreserved SELinux Boolean - ocil:ssg-sebool_ssh_chroot_rw_homedirs_action:testaction:1 + ocil:ssg-sebool_polipo_connect_all_unreserved_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Uppercase Characters + + Verify No .forward Files Exist - ocil:ssg-accounts_password_pam_ucredit_action:testaction:1 + ocil:ssg-no_forward_files_action:testaction:1 - - Disable the httpd_dbus_sssd SELinux Boolean + + Add usrquota Option to /home - ocil:ssg-sebool_httpd_dbus_sssd_action:testaction:1 + ocil:ssg-mount_option_home_usrquota_action:testaction:1 - - Disable vsyscalls in zIPL + + Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - ocil:ssg-zipl_vsyscall_argument_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_bind_unreserved_ports_action:testaction:1 - - Add nosuid Option to /boot + + Ensure journald is configured to write log files to persistent disk - ocil:ssg-mount_option_boot_nosuid_action:testaction:1 + ocil:ssg-journald_storage_action:testaction:1 - - Configure the secure_mode_insmod SELinux Boolean + + Prevent Unrestricted Mail Relaying - ocil:ssg-sebool_secure_mode_insmod_action:testaction:1 + ocil:ssg-postfix_prevent_unrestricted_relay_action:testaction:1 - - Record Events When Privileged Executables Are Run + + Configure low address space to protect from user allocation - ocil:ssg-audit_rules_suid_privilege_function_action:testaction:1 + ocil:ssg-kernel_config_default_mmap_min_addr_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Maximum Consecutive Repeating Characters from Same Character Class + + Ensure auditd Collects Information on the Use of Privileged Commands - sudo - ocil:ssg-accounts_password_pam_maxclassrepeat_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_sudo_action:testaction:1 - - Ensure Privileged Escalated Commands Cannot Execute Other Commands - sudo NOEXEC + + Verify Group Ownership of System Login Banner for Remote Connections - ocil:ssg-sudo_add_noexec_action:testaction:1 + ocil:ssg-file_groupowner_etc_issue_net_action:testaction:1 - - Disable the cron_can_relabel SELinux Boolean + + Verify Group Who Owns /etc/at.allow file - ocil:ssg-sebool_cron_can_relabel_action:testaction:1 + ocil:ssg-file_groupowner_at_allow_action:testaction:1 - - Set the Boot Loader Admin Username to a Non-Default Value + + Record Events that Modify the System's Discretionary Access Controls - fchownat - ocil:ssg-grub2_admin_username_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchownat_action:testaction:1 - - A public web server, if hosted on the NIPRNet, must be isolated in an accredited DoD DMZ extension + + Enable Postfix Service - ocil:ssg-httpd_nipr_accredited_dmz_action:testaction:1 + ocil:ssg-service_postfix_enabled_action:testaction:1 - - Disable the staff_use_svirt SELinux Boolean + + Disable the entropyd_use_audio SELinux Boolean - ocil:ssg-sebool_staff_use_svirt_action:testaction:1 + ocil:ssg-sebool_entropyd_use_audio_action:testaction:1 - - Configure A Valid Server Certificate + + Ensure yum Removes Previous Package Versions - ocil:ssg-httpd_configure_valid_server_cert_action:testaction:1 + ocil:ssg-clean_components_post_updating_action:testaction:1 - - Configure auditing of unsuccessful file modifications + + Ensure auditd Collects Information on the Use of Privileged Commands - kmod - ocil:ssg-audit_modify_failed_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_kmod_action:testaction:1 - - Disable acquiring, saving, and processing core dumps + + Verify User Who Owns /var/log/syslog File - ocil:ssg-service_systemd-coredump_disabled_action:testaction:1 + ocil:ssg-file_owner_var_log_syslog_action:testaction:1 - - Use Only FIPS 140-2 Validated Key Exchange Algorithms + + Record Events that Modify the System's Discretionary Access Controls - chown - ocil:ssg-sshd_use_approved_kex_ordered_stig_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_chown_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - postdrop + + Verify Who Owns /etc/shells File - ocil:ssg-audit_rules_privileged_commands_postdrop_action:testaction:1 + ocil:ssg-file_owner_etc_shells_action:testaction:1 - - Record Successful Permission Changes to Files - chmod + + Disable Kernel Parameter for IPv6 Forwarding - ocil:ssg-audit_rules_successful_file_modification_chmod_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_forwarding_action:testaction:1 - - Disable httpd Service + + Disable Printer Browsing Entirely if Possible - ocil:ssg-service_httpd_disabled_action:testaction:1 + ocil:ssg-cups_disable_browsing_action:testaction:1 - - Disable the exim_read_user_files SELinux Boolean + + Implement Blank Screensaver - ocil:ssg-sebool_exim_read_user_files_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_mode_blank_action:testaction:1 - - Make the kernel text and rodata read-only + + Disable the webadm_manage_user_files SELinux Boolean - ocil:ssg-kernel_config_strict_kernel_rwx_action:testaction:1 + ocil:ssg-sebool_webadm_manage_user_files_action:testaction:1 - - Disable the gluster_anon_write SELinux Boolean + + Enable Kernel Parameter to Log Martian Packets on all IPv4 Interfaces - ocil:ssg-sebool_gluster_anon_write_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_log_martians_action:testaction:1 - - Record Successful Permission Changes to Files - fchmodat + + Configure Sending and Accepting Shared Media Redirects by Default - ocil:ssg-audit_rules_successful_file_modification_fchmodat_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_shared_media_action:testaction:1 - - Enable Certmap in SSSD + + Disable the mpd_use_cifs SELinux Boolean - ocil:ssg-sssd_enable_certmap_action:testaction:1 + ocil:ssg-sebool_mpd_use_cifs_action:testaction:1 - - Disable the httpd_can_sendmail SELinux Boolean + + Ensure zIPL bootmap is up to date - ocil:ssg-sebool_httpd_can_sendmail_action:testaction:1 + ocil:ssg-zipl_bootmap_is_up_to_date_action:testaction:1 - - Configure SSH Client to Use FIPS 140-2 Validated Ciphers: openssh.config + + Uninstall geolite2-city Package - ocil:ssg-harden_sshd_ciphers_openssh_conf_crypto_policy_action:testaction:1 + ocil:ssg-package_geolite2-city_removed_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading - init_module + + Verify the SSH Private Key Files Have a Passcode - ocil:ssg-audit_rules_kernel_module_loading_init_action:testaction:1 + ocil:ssg-ssh_keys_passphrase_protected_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - chown + + Disable the sanlock_use_samba SELinux Boolean - ocil:ssg-audit_rules_dac_modification_chown_action:testaction:1 + ocil:ssg-sebool_sanlock_use_samba_action:testaction:1 - - Enable nails Service + + Disable the httpd_can_check_spam SELinux Boolean - ocil:ssg-service_nails_enabled_action:testaction:1 + ocil:ssg-sebool_httpd_can_check_spam_action:testaction:1 - - Verify Ownership on SSH Server Private *_key Key Files + + Disable Kernel iwlmvm Module - ocil:ssg-file_ownership_sshd_private_key_action:testaction:1 + ocil:ssg-kernel_module_iwlmvm_disabled_action:testaction:1 - - Enable logrotate Timer + + Mount Remote Filesystems with Kerberos Security - ocil:ssg-timer_logrotate_enabled_action:testaction:1 + ocil:ssg-mount_option_krb_sec_remote_filesystems_action:testaction:1 - - Configure the selinuxuser_direct_dri_enabled SELinux Boolean + + Set Interval For Counting Failed Password Attempts - ocil:ssg-sebool_selinuxuser_direct_dri_enabled_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_interval_action:testaction:1 - - Disable the fenced_can_ssh SELinux Boolean + + Ensure the Default Bash Umask is Set Correctly - ocil:ssg-sebool_fenced_can_ssh_action:testaction:1 + ocil:ssg-accounts_umask_etc_bashrc_action:testaction:1 - - Disable the gluster_export_all_ro SELinux Boolean + + Disable the abrt_handle_event SELinux Boolean - ocil:ssg-sebool_gluster_export_all_ro_action:testaction:1 + ocil:ssg-sebool_abrt_handle_event_action:testaction:1 - - Disable kernel support for MISC binaries + + Disable the selinuxuser_tcp_server SELinux Boolean - ocil:ssg-kernel_config_binfmt_misc_action:testaction:1 + ocil:ssg-sebool_selinuxuser_tcp_server_action:testaction:1 - - Set Boot Loader Password in grub2 + + Specify module signing key to use - ocil:ssg-grub2_password_action:testaction:1 + ocil:ssg-kernel_config_module_sig_key_action:testaction:1 - - Disable the httpd_use_fusefs SELinux Boolean + + Install libselinux Package - ocil:ssg-sebool_httpd_use_fusefs_action:testaction:1 + ocil:ssg-package_libselinux_installed_action:testaction:1 - - Disable the git_cgi_enable_homedirs SELinux Boolean + + Verify that System Executable Have Root Ownership - ocil:ssg-sebool_git_cgi_enable_homedirs_action:testaction:1 + ocil:ssg-dir_ownership_binary_dirs_action:testaction:1 - - Uninstall libreport-plugin-logger Package + + All User Files and Directories In The Home Directory Must Have a Valid Owner - ocil:ssg-package_libreport-plugin-logger_removed_action:testaction:1 + ocil:ssg-accounts_users_home_files_ownership_action:testaction:1 - - Require Authentication for Emergency Systemd Target + + Disable SSH Server If Possible - ocil:ssg-require_emergency_target_auth_action:testaction:1 + ocil:ssg-service_sshd_disabled_action:testaction:1 - - Disable the selinuxuser_execheap SELinux Boolean + + IOMMU configuration directive - ocil:ssg-sebool_selinuxuser_execheap_action:testaction:1 + ocil:ssg-grub2_enable_iommu_force_action:testaction:1 - - Ensure the Group Used by pam_wheel.so Module Exists on System and is Empty + + Record Successful Delete Attempts to Files - rename - ocil:ssg-ensure_pam_wheel_group_empty_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_rename_action:testaction:1 - - Disable the authlogin_radius SELinux Boolean + + Disable the daemons_use_tty SELinux Boolean - ocil:ssg-sebool_authlogin_radius_action:testaction:1 + ocil:ssg-sebool_daemons_use_tty_action:testaction:1 - - Verify that System Executables Have Root Ownership + + Uninstall geolite2-country Package - ocil:ssg-file_ownership_binary_dirs_action:testaction:1 + ocil:ssg-package_geolite2-country_removed_action:testaction:1 - - Harden OpenSSL Crypto Policy + + Restrict Web Browser Use for Administrative Accounts - ocil:ssg-harden_openssl_crypto_policy_action:testaction:1 + ocil:ssg-no_root_webbrowsing_action:testaction:1 - - Ensure iptables Firewall Rules Exist for All Open Ports + + Strong Stack Protector - ocil:ssg-iptables_rules_for_open_ports_action:testaction:1 + ocil:ssg-kernel_config_stackprotector_strong_action:testaction:1 - - Account Lockouts Must Be Logged + + Verify Group Who Owns shadow File - ocil:ssg-account_passwords_pam_faillock_audit_action:testaction:1 + ocil:ssg-file_groupowner_etc_shadow_action:testaction:1 - - Record Events that Modify the System's Network Environment + + Uninstall abrt-plugin-sosreport Package - ocil:ssg-audit_rules_networkconfig_modification_action:testaction:1 + ocil:ssg-package_abrt-plugin-sosreport_removed_action:testaction:1 - - Use Kerberos Security on All Exports + + Harden SSH client Crypto Policy - ocil:ssg-use_kerberos_security_all_exports_action:testaction:1 + ocil:ssg-harden_ssh_client_crypto_policy_action:testaction:1 - - Disable the glance_use_fusefs SELinux Boolean + + Record Events that Modify the System's Mandatory Access Controls in usr/share - ocil:ssg-sebool_glance_use_fusefs_action:testaction:1 + ocil:ssg-audit_rules_mac_modification_usr_share_action:testaction:1 - - Uninstall rsh Package + + Configure Kernel Parameter for Accepting Secure Redirects By Default - ocil:ssg-package_rsh_removed_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_secure_redirects_action:testaction:1 - - Disable the tmpreaper_use_nfs SELinux Boolean + + Generate some entropy during boot and runtime - ocil:ssg-sebool_tmpreaper_use_nfs_action:testaction:1 + ocil:ssg-kernel_config_gcc_plugin_latent_entropy_action:testaction:1 - - Disable the postgresql_can_rsync SELinux Boolean + + Disable the ksmtuned_use_nfs SELinux Boolean - ocil:ssg-sebool_postgresql_can_rsync_action:testaction:1 + ocil:ssg-sebool_ksmtuned_use_nfs_action:testaction:1 - - Record Successful Permission Changes to Files - lremovexattr + + Set GNOME3 Screensaver Inactivity Timeout - ocil:ssg-audit_rules_successful_file_modification_lremovexattr_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_delay_action:testaction:1 - - Uninstall libreport-plugin-rhtsupport Package + + Ensure Logs Sent To Remote Host - ocil:ssg-package_libreport-plugin-rhtsupport_removed_action:testaction:1 + ocil:ssg-rsyslog_remote_loghost_action:testaction:1 - - Disable Web Content Symbolic Links + + Configure the httpd_enable_cgi SELinux Boolean - ocil:ssg-httpd_disable_content_symlinks_action:testaction:1 + ocil:ssg-sebool_httpd_enable_cgi_action:testaction:1 - - Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces by Default + + Verify No netrc Files Exist - ocil:ssg-sysctl_net_ipv4_conf_default_rp_filter_action:testaction:1 + ocil:ssg-no_netrc_files_action:testaction:1 - - Perform general configuration of Audit for OSPP + + Disable tftp Service - ocil:ssg-audit_ospp_general_action:testaction:1 + ocil:ssg-service_tftp_disabled_action:testaction:1 - - Ensure that /etc/cron.deny does not exist + + Configure audispd's Plugin network_failure_action On Network Failure - ocil:ssg-file_cron_deny_not_exist_action:testaction:1 + ocil:ssg-auditd_audispd_network_failure_action_action:testaction:1 - - Ensure auditd Collects Information on Exporting to Media (successful) + + Disallow Configuration to Bypass Password Requirements for Privilege Escalation - ocil:ssg-audit_rules_media_export_action:testaction:1 + ocil:ssg-disallow_bypass_password_sudo_action:testaction:1 - - Ensure the audit Subsystem is Installed + + Configure firewall to Allow Access to the Web Server - ocil:ssg-package_audit_installed_action:testaction:1 + ocil:ssg-httpd_configure_firewall_action:testaction:1 - - Remove .java And .jpp Files + + Disable the virt_use_sanlock SELinux Boolean - ocil:ssg-httpd_limit_java_files_action:testaction:1 + ocil:ssg-sebool_virt_use_sanlock_action:testaction:1 - - Disable the xserver_execmem SELinux Boolean + + Enforce Usage of pam_wheel with Group Parameter for su Authentication - ocil:ssg-sebool_xserver_execmem_action:testaction:1 + ocil:ssg-use_pam_wheel_group_for_su_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands + + All GIDs referenced in /etc/passwd must be defined in /etc/group - ocil:ssg-audit_rules_privileged_commands_action:testaction:1 + ocil:ssg-gid_passwd_group_same_action:testaction:1 - - Set the GNOME3 Login Warning Banner Text + + Audit Tools Must Be Group-owned by Root - ocil:ssg-dconf_gnome_login_banner_text_action:testaction:1 + ocil:ssg-file_audit_tools_group_ownership_action:testaction:1 - - Add noexec Option to /tmp + + Ensure gpgcheck Enabled for Repository Metadata - ocil:ssg-mount_option_tmp_noexec_action:testaction:1 + ocil:ssg-ensure_gpgcheck_repo_metadata_action:testaction:1 - - Enable SSH Server firewalld Firewall Exception + + Record Unsuccessful Creation Attempts to Files - open O_CREAT - ocil:ssg-firewalld_sshd_port_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_creat_action:testaction:1 - - Disable the swift_can_network SELinux Boolean + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-sebool_swift_can_network_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_pinfo_action:testaction:1 - - User Initialization Files Must Not Run World-Writable Programs + + Disable SCTP Support - ocil:ssg-accounts_user_dot_no_world_writable_programs_action:testaction:1 + ocil:ssg-kernel_module_sctp_disabled_action:testaction:1 - - Enable HTTPD LogLevel + + Uninstall iprutils Package - ocil:ssg-httpd_enable_loglevel_action:testaction:1 + ocil:ssg-package_iprutils_removed_action:testaction:1 - - Uninstall openldap-servers Package + + Set Default iptables Policy for Forwarded Packets - ocil:ssg-package_openldap-servers_removed_action:testaction:1 + ocil:ssg-set_iptables_default_rule_forward_action:testaction:1 - - Ensure SELinux Not Disabled in zIPL + + Ensure auditd Collects Information on the Use of Privileged Commands - init - ocil:ssg-zipl_enable_selinux_action:testaction:1 + ocil:ssg-audit_privileged_commands_init_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fchmodat + + Install the cron service - ocil:ssg-audit_rules_unsuccessful_file_modification_fchmodat_action:testaction:1 + ocil:ssg-package_cron_installed_action:testaction:1 - - Enable the NTP Daemon + + Ensure there are no legacy + NIS entries in /etc/shadow - ocil:ssg-service_chronyd_or_ntpd_enabled_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_shadow_action:testaction:1 - - Make sure that the dconf databases are up-to-date with regards to respective keyfiles + + Enable the nfs_export_all_ro SELinux Boolean - ocil:ssg-dconf_db_up_to_date_action:testaction:1 + ocil:ssg-sebool_nfs_export_all_ro_action:testaction:1 - - Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv6 Interfaces + + Disable mutable hooks - ocil:ssg-sysctl_net_ipv6_conf_default_accept_redirects_action:testaction:1 + ocil:ssg-kernel_config_security_writable_hooks_action:testaction:1 - - Configure the httpd_builtin_scripting SELinux Boolean + + Record Successful Access Attempts to Files - truncate - ocil:ssg-sebool_httpd_builtin_scripting_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_truncate_action:testaction:1 - - Record Successful Access Attempts to Files - open_by_handle_at + + Disable Ctrl-Alt-Del Reboot Key Sequence in GNOME3 - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_action:testaction:1 + ocil:ssg-dconf_gnome_disable_ctrlaltdel_reboot_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - lchown + + Uninstall vsftpd Package - ocil:ssg-audit_rules_unsuccessful_file_modification_lchown_action:testaction:1 + ocil:ssg-package_vsftpd_removed_action:testaction:1 - - Disable Printer Browsing Entirely if Possible + + Disable acquiring, saving, and processing core dumps - ocil:ssg-cups_disable_browsing_action:testaction:1 + ocil:ssg-service_systemd-coredump_disabled_action:testaction:1 - - Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces + + Configure TLS for rsyslog remote logging - ocil:ssg-sysctl_net_ipv4_tcp_rfc1337_action:testaction:1 + ocil:ssg-rsyslog_remote_tls_action:testaction:1 - - Enable Auditing for Processes Which Start Prior to the Audit Daemon + + Disable the httpd_manage_ipa SELinux Boolean - ocil:ssg-grub2_audit_argument_action:testaction:1 + ocil:ssg-sebool_httpd_manage_ipa_action:testaction:1 - - Disable Core Dumps for SUID programs + + Verify Group Who Owns /var/log/syslog File - ocil:ssg-sysctl_fs_suid_dumpable_action:testaction:1 + ocil:ssg-file_groupowner_var_log_syslog_action:testaction:1 - - Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces + + Disable the gpg_web_anon_write SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_route_localnet_action:testaction:1 + ocil:ssg-sebool_gpg_web_anon_write_action:testaction:1 - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces + + Disable the fcron_crond SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_max_addresses_action:testaction:1 + ocil:ssg-sebool_fcron_crond_action:testaction:1 - - Disable Accepting ICMP Redirects for All IPv4 Interfaces + + Configure System to Forward All Mail through a specific host - ocil:ssg-sysctl_net_ipv4_conf_all_accept_redirects_action:testaction:1 + ocil:ssg-postfix_client_configure_relayhost_action:testaction:1 - - Install fapolicyd Package + + SSH client uses strong entropy to seed (Bash-like shells) - ocil:ssg-package_fapolicyd_installed_action:testaction:1 + ocil:ssg-ssh_client_use_strong_rng_sh_action:testaction:1 - - Configure auditd Disk Error Action on Disk Error + + Verify Owner on cron.daily - ocil:ssg-auditd_data_disk_error_action_action:testaction:1 + ocil:ssg-file_owner_cron_daily_action:testaction:1 - - Ensure auditd Rules For Unauthorized Attempts To open Are Ordered Correctly + + Prevent remote hosts from connecting to the proxy display - ocil:ssg-audit_rules_unsuccessful_file_modification_open_rule_order_action:testaction:1 + ocil:ssg-sshd_x11_use_localhost_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fchmod + + Ensure sudo umask is appropriate - sudo umask - ocil:ssg-audit_rules_unsuccessful_file_modification_fchmod_action:testaction:1 + ocil:ssg-sudo_add_umask_action:testaction:1 - - Set PAM''s Password Hashing Algorithm - password-auth + + Enable the File Access Policy Service - ocil:ssg-set_password_hashing_algorithm_passwordauth_action:testaction:1 + ocil:ssg-service_fapolicyd_enabled_action:testaction:1 - - Disable the glance_api_can_network SELinux Boolean + + Configure Kerberos to use System Crypto Policy - ocil:ssg-sebool_glance_api_can_network_action:testaction:1 + ocil:ssg-configure_kerberos_crypto_policy_action:testaction:1 - - Disable the varnishd_connect_any SELinux Boolean + + All Interactive User Home Directories Must Be Group-Owned By The Primary Group - ocil:ssg-sebool_varnishd_connect_any_action:testaction:1 + ocil:ssg-file_groupownership_home_directories_action:testaction:1 - - Enable cron Service + + Uninstall gssproxy Package - ocil:ssg-service_crond_enabled_action:testaction:1 + ocil:ssg-package_gssproxy_removed_action:testaction:1 - - Verify Permissions on /var/log/syslog File + + Uninstall Sendmail Package - ocil:ssg-file_permissions_var_log_syslog_action:testaction:1 + ocil:ssg-package_sendmail_removed_action:testaction:1 - - Configure Periodic Execution of AIDE + + Limit CPU consumption of the Perf system - ocil:ssg-aide_periodic_cron_checking_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_cpu_time_max_percent_action:testaction:1 - - Verify Group Who Owns cron.weekly + + Record Successful Permission Changes to Files - fchmod - ocil:ssg-file_groupowner_cron_weekly_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchmod_action:testaction:1 - - Uninstall tftp-server Package + + Verify Owner on SSH Server config file - ocil:ssg-package_tftp-server_removed_action:testaction:1 + ocil:ssg-file_owner_sshd_config_action:testaction:1 - - Enable HTTPD System Logging + + Ensure PAM password complexity module is enabled in system-auth - ocil:ssg-httpd_enable_system_logging_action:testaction:1 + ocil:ssg-accounts_password_pam_pwquality_system_auth_action:testaction:1 - - Disable LDAP Server (slapd) + + Disable ATM Support - ocil:ssg-service_slapd_disabled_action:testaction:1 + ocil:ssg-kernel_module_atm_disabled_action:testaction:1 - - Enable auditd Service + + Record Any Attempts to Run setsebool - ocil:ssg-service_auditd_enabled_action:testaction:1 + ocil:ssg-audit_rules_execution_setsebool_action:testaction:1 - - Add nosuid Option to Removable Media Partitions + + Disable the sge_domain_can_network_connect SELinux Boolean - ocil:ssg-mount_option_nosuid_removable_partitions_action:testaction:1 + ocil:ssg-sebool_sge_domain_can_network_connect_action:testaction:1 - - Disable Kernel iwlmvm Module + + Limit Password Reuse - ocil:ssg-kernel_module_iwlmvm_disabled_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_remember_action:testaction:1 - - MIME types for csh or sh shell programs must be disabled + + Specify a Remote NTP Server - ocil:ssg-httpd_disable_mime_types_action:testaction:1 + ocil:ssg-chronyd_or_ntpd_specify_remote_server_action:testaction:1 - - Ensure the Default Umask is Set Correctly For Interactive Users + + Set Permissions on All Configuration Files Inside /etc/httpd/conf.modules.d/ - ocil:ssg-accounts_umask_interactive_users_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_modules_files_action:testaction:1 - - Record Successful Delete Attempts to Files - unlinkat + + Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_unlinkat_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_unconfined_dbadm_action:testaction:1 - - SSH client uses strong entropy to seed (Bash-like shells) + + Disable the httpd_can_sendmail SELinux Boolean - ocil:ssg-ssh_client_use_strong_rng_sh_action:testaction:1 + ocil:ssg-sebool_httpd_can_sendmail_action:testaction:1 - - Record Successful Ownership Changes to Files - chown + + System Audit Logs Must Have Mode 0640 or Less Permissive - ocil:ssg-audit_rules_successful_file_modification_chown_action:testaction:1 + ocil:ssg-file_permissions_var_log_audit_action:testaction:1 - - Audit Configuration Files Must Be Owned By Group root + + Disable anacron Service - ocil:ssg-file_groupownership_audit_configuration_action:testaction:1 + ocil:ssg-disable_anacron_action:testaction:1 - - Configure LDAP Client to Use TLS For All Transactions + + Verify /boot/grub2/user.cfg Permissions - ocil:ssg-ldap_client_start_tls_action:testaction:1 + ocil:ssg-file_permissions_user_cfg_action:testaction:1 - - Prevent applications from mapping low portion of virtual memory + + Ensure sudo Runs In A Minimal Environment - sudo env_reset - ocil:ssg-sysctl_vm_mmap_min_addr_action:testaction:1 + ocil:ssg-sudo_add_env_reset_action:testaction:1 - - Uninstall rsh-server Package + + Disable the httpd_sys_script_anon_write SELinux Boolean - ocil:ssg-package_rsh-server_removed_action:testaction:1 + ocil:ssg-sebool_httpd_sys_script_anon_write_action:testaction:1 - - Verify Group Who Owns Backup gshadow File + + Record Any Attempts to Run restorecon - ocil:ssg-file_groupowner_backup_etc_gshadow_action:testaction:1 + ocil:ssg-audit_rules_execution_restorecon_action:testaction:1 - - Verify Group Who Owns Crontab + + Install the Host Intrusion Prevention System (HIPS) Module - ocil:ssg-file_groupowner_crontab_action:testaction:1 + ocil:ssg-package_MFEhiplsm_installed_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session + + Disable the selinuxuser_execheap SELinux Boolean - ocil:ssg-accounts_password_pam_retry_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execheap_action:testaction:1 - - Disable hibernation + + Configure SSSD's Memory Cache to Expire - ocil:ssg-kernel_config_hibernation_action:testaction:1 + ocil:ssg-sssd_memcache_timeout_action:testaction:1 - - Configure low address space to protect from user allocation + + Disable Core Dumps for SUID programs - ocil:ssg-kernel_config_default_mmap_min_addr_action:testaction:1 + ocil:ssg-sysctl_fs_suid_dumpable_action:testaction:1 - - Add nodev Option to /boot + + Set Default ip6tables Policy for Incoming Packets - ocil:ssg-mount_option_boot_nodev_action:testaction:1 + ocil:ssg-set_ip6tables_default_rule_action:testaction:1 - - Disable the rsync_anon_write SELinux Boolean + + Add noexec Option to /tmp - ocil:ssg-sebool_rsync_anon_write_action:testaction:1 + ocil:ssg-mount_option_tmp_noexec_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd + + Ensure auditd Collects File Deletion Events by User - rename - ocil:ssg-audit_rules_privileged_commands_unix_chkpwd_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_rename_action:testaction:1 - - Enable the staff_exec_content SELinux Boolean + + Verify Group Who Owns cron.monthly - ocil:ssg-sebool_staff_exec_content_action:testaction:1 + ocil:ssg-file_groupowner_cron_monthly_action:testaction:1 - - Disable WIFI Network Notification in GNOME3 + + Record Unsuccessful Delete Attempts to Files - unlinkat - ocil:ssg-dconf_gnome_disable_wifi_notification_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_unlinkat_action:testaction:1 - - Enable NX or XD Support in the BIOS + + Verify Permissions on /var/log/syslog File - ocil:ssg-bios_enable_execution_restrictions_action:testaction:1 + ocil:ssg-file_permissions_var_log_syslog_action:testaction:1 - - Enable checks on scatter-gather (SG) table operations + + Remove Write Permissions From Filesystem Paths And Server Scripts - ocil:ssg-kernel_config_debug_sg_action:testaction:1 + ocil:ssg-httpd_configure_script_permissions_action:testaction:1 - - Disable Core Dumps for All Users + + Configure auditing of successful file creations - ocil:ssg-disable_users_coredumps_action:testaction:1 + ocil:ssg-audit_create_success_action:testaction:1 - - Disable the samba_enable_home_dirs SELinux Boolean + + Disable the ftpd_full_access SELinux Boolean - ocil:ssg-sebool_samba_enable_home_dirs_action:testaction:1 + ocil:ssg-sebool_ftpd_full_access_action:testaction:1 - - Configure Time Service Maxpoll Interval + + Record Any Attempts to Run setfiles - ocil:ssg-chronyd_or_ntpd_set_maxpoll_action:testaction:1 + ocil:ssg-audit_rules_execution_setfiles_action:testaction:1 - - Configure auditd Disk Error Action on Disk Error + + Install tar Package - ocil:ssg-auditd_data_disk_error_action_stig_action:testaction:1 + ocil:ssg-package_tar_installed_action:testaction:1 - - Disable compatibility with brk() + + Enable support for BUG() - ocil:ssg-kernel_config_compat_brk_action:testaction:1 + ocil:ssg-kernel_config_bug_action:testaction:1 - - Add noauto Option to /boot + + Configure auditing of successful file modifications - ocil:ssg-mount_option_boot_noauto_action:testaction:1 + ocil:ssg-audit_modify_success_action:testaction:1 - - Enable HTTPD Error Logging + + Disable the httpd_use_nfs SELinux Boolean - ocil:ssg-httpd_enable_error_logging_action:testaction:1 + ocil:ssg-sebool_httpd_use_nfs_action:testaction:1 - - Set Password Minimum Length in login.defs + + Record Successful Creation Attempts to Files - openat O_TRUNC_WRITE - ocil:ssg-accounts_password_minlen_login_defs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_o_trunc_write_action:testaction:1 - - Configure auditd admin_space_left on Low Disk Space + + Verify Group Who Owns cron.weekly - ocil:ssg-auditd_data_retention_admin_space_left_percentage_action:testaction:1 + ocil:ssg-file_groupowner_cron_weekly_action:testaction:1 - - Verify that Shared Library Directories Have Root Ownership + + Ensure All World-Writable Directories Are Owned by a System Account - ocil:ssg-dir_ownership_library_dirs_action:testaction:1 + ocil:ssg-dir_perms_world_writable_system_owned_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - faillock + + Ensure auditd Collects Information on the Use of Privileged Commands - postqueue - ocil:ssg-audit_rules_login_events_faillock_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_postqueue_action:testaction:1 - - Enable the xend_run_qemu SELinux Boolean + + Encrypt All File Uploads - ocil:ssg-sebool_xend_run_qemu_action:testaction:1 + ocil:ssg-httpd_encrypt_file_uploads_action:testaction:1 - - Disable the samba_share_fusefs SELinux Boolean + + Disable Software RAID Monitor (mdmonitor) - ocil:ssg-sebool_samba_share_fusefs_action:testaction:1 + ocil:ssg-service_mdmonitor_disabled_action:testaction:1 - - Configure auditd Number of Logs Retained + + Ensure All World-Writable Directories Are Owned by root User - ocil:ssg-auditd_data_retention_num_logs_action:testaction:1 + ocil:ssg-dir_perms_world_writable_root_owned_action:testaction:1 - - Ensure network interfaces are assigned to appropriate zone + + Configure auditd max_log_file_action Upon Reaching Maximum Log Size - ocil:ssg-set_firewalld_appropriate_zone_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action_action:testaction:1 - - Install the pcsc-lite package + + Disable the virt_sandbox_use_mknod SELinux Boolean - ocil:ssg-package_pcsc-lite_installed_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_mknod_action:testaction:1 - - Disable GDM Automatic Login + + All Interactive User Home Directories Must Be Owned By The Primary User - ocil:ssg-gnome_gdm_disable_automatic_login_action:testaction:1 + ocil:ssg-file_ownership_home_directories_action:testaction:1 - - Verify and Correct File Permissions with RPM + + Configure Accepting Router Advertisements on All IPv6 Interfaces - ocil:ssg-rpm_verify_permissions_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_action:testaction:1 - - Configure auditd Max Log File Size + + Disable systemd-journal-remote Socket - ocil:ssg-auditd_data_retention_max_log_file_action:testaction:1 + ocil:ssg-socket_systemd-journal-remote_disabled_action:testaction:1 - - All Interactive User Home Directories Must Have mode 0750 Or Less Permissive + + Enforce usage of pam_wheel for su authentication - ocil:ssg-file_permissions_home_directories_action:testaction:1 + ocil:ssg-use_pam_wheel_for_su_action:testaction:1 - - Ensure Default SNMP Password Is Not Used + + Configure auditd space_left on Low Disk Space - ocil:ssg-snmpd_not_default_password_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_percentage_action:testaction:1 - - Uninstall krb5-workstation Package + + Disable WIFI Network Connection Creation in GNOME3 - ocil:ssg-package_krb5-workstation_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_wifi_create_action:testaction:1 - - Encrypt All File Uploads + + Disable the minidlna_read_generic_user_content SELinux Boolean - ocil:ssg-httpd_encrypt_file_uploads_action:testaction:1 + ocil:ssg-sebool_minidlna_read_generic_user_content_action:testaction:1 - - Record Successful Access Attempts to Files - openat + + Verify Permissions on SSH Server Private *_key Key Files - ocil:ssg-audit_rules_successful_file_modification_openat_action:testaction:1 + ocil:ssg-file_permissions_sshd_private_key_action:testaction:1 - - Disable the telepathy_connect_all_ports SELinux Boolean + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow - ocil:ssg-sebool_telepathy_connect_all_ports_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_open_by_handle_at_action:testaction:1 - - Enable Auditing to Start Prior to the Audit Daemon in zIPL + + Disable the zabbix_can_network SELinux Boolean - ocil:ssg-zipl_audit_argument_action:testaction:1 + ocil:ssg-sebool_zabbix_can_network_action:testaction:1 - - Verify nftables Service is Enabled + + Record Unsuccessful Delete Attempts to Files - renameat - ocil:ssg-service_nftables_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_renameat_action:testaction:1 - - Ensure Rsyslog Encrypts Off-Loaded Audit Records + + Record Events that Modify User/Group Information - /etc/passwd - ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdrivermode_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_passwd_action:testaction:1 - - Ensure rsyslog Default File Permissions Configured + + Avoid speculative indirect branches in kernel - ocil:ssg-rsyslog_filecreatemode_action:testaction:1 + ocil:ssg-kernel_config_retpoline_action:testaction:1 - - Disable the postgresql_selinux_transmit_client_label SELinux Boolean + + Record Attempts to Alter Logon and Logout Events - tallylog - ocil:ssg-sebool_postgresql_selinux_transmit_client_label_action:testaction:1 + ocil:ssg-audit_rules_login_events_tallylog_action:testaction:1 - - Uninstall Samba Package + + Set kernel parameter 'crypto.fips_enabled' to 1 - ocil:ssg-package_samba_removed_action:testaction:1 + ocil:ssg-sysctl_crypto_fips_enabled_action:testaction:1 - - User Initialization Files Must Be Group-Owned By The Primary Group + + Record Any Attempts to Run semanage - ocil:ssg-accounts_user_dot_group_ownership_action:testaction:1 + ocil:ssg-audit_rules_execution_semanage_action:testaction:1 - - Enable syslog-ng Service + + Ensure that Root's Path Does Not Include World or Group-Writable Directories - ocil:ssg-service_syslogng_enabled_action:testaction:1 + ocil:ssg-accounts_root_path_dirs_no_write_action:testaction:1 - - Set Existing Passwords Minimum Age + + Mount Remote Filesystems with nosuid - ocil:ssg-accounts_password_set_min_life_existing_action:testaction:1 + ocil:ssg-mount_option_nosuid_remote_filesystems_action:testaction:1 - - Set SSH MaxSessions limit + + Disable Power Settings in GNOME3 - ocil:ssg-sshd_set_max_sessions_action:testaction:1 + ocil:ssg-dconf_gnome_disable_power_settings_action:testaction:1 - - Disable the zarafa_setrlimit SELinux Boolean + + Set SSH Client Alive Count Max - ocil:ssg-sebool_zarafa_setrlimit_action:testaction:1 + ocil:ssg-sshd_set_keepalive_action:testaction:1 - - Install the SSSD Package + + Warn on W+X mappings found at boot - ocil:ssg-package_sssd_installed_action:testaction:1 + ocil:ssg-kernel_config_debug_wx_action:testaction:1 - - Enforce Usage of pam_wheel with Group Parameter for su Authentication + + Disable Accepting Packets Routed Between Local Interfaces - ocil:ssg-use_pam_wheel_group_for_su_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_local_action:testaction:1 - - Ensure No Daemons are Unconfined by SELinux + + Remove Rsh Trust Files - ocil:ssg-selinux_confinement_of_daemons_action:testaction:1 + ocil:ssg-no_rsh_trust_files_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - openat + + Record Events that Modify the System's Discretionary Access Controls - fchown - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchown_action:testaction:1 - - Enable cron Service + + Disable GNOME3 Automount Opening - ocil:ssg-service_cron_enabled_action:testaction:1 + ocil:ssg-dconf_gnome_disable_automount_open_action:testaction:1 - - Enable the selinuxuser_execmod SELinux Boolean + + SSH client uses strong entropy to seed (for CSH like shells) - ocil:ssg-sebool_selinuxuser_execmod_action:testaction:1 + ocil:ssg-ssh_client_use_strong_rng_csh_action:testaction:1 - - Verify ufw Enabled + + Record Unsuccessful Modification Attempts to Files - open_by_handle_at O_TRUNC_WRITE - ocil:ssg-service_ufw_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 - - Lock Accounts After Failed Password Attempts + + Record Successful Creation Attempts to Files - open_by_handle_at O_TRUNC_WRITE - ocil:ssg-accounts_passwords_pam_faillock_deny_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 - - Enable the virt_sandbox_use_audit SELinux Boolean + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - ocil:ssg-sebool_virt_sandbox_use_audit_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_action:testaction:1 - - Disallow merge of slab caches + + The robots.txt Files Must Not Exist - ocil:ssg-kernel_config_slab_merge_default_action:testaction:1 + ocil:ssg-httpd_remove_robots_file_action:testaction:1 - - Ensure the default plugins for the audit dispatcher are Installed + + Uninstall rpcbind Package - ocil:ssg-package_audit-audispd-plugins_installed_action:testaction:1 + ocil:ssg-package_rpcbind_removed_action:testaction:1 - - Disable the httpd_can_connect_ftp SELinux Boolean + + Disable GNOME3 Automount running - ocil:ssg-sebool_httpd_can_connect_ftp_action:testaction:1 + ocil:ssg-dconf_gnome_disable_autorun_action:testaction:1 - - Uninstall geolite2-country Package + + Add nodev Option to /var/tmp - ocil:ssg-package_geolite2-country_removed_action:testaction:1 + ocil:ssg-mount_option_var_tmp_nodev_action:testaction:1 - - Disable the virt_use_samba SELinux Boolean + + Ensure Log Files Are Owned By Appropriate User - ocil:ssg-sebool_virt_use_samba_action:testaction:1 + ocil:ssg-rsyslog_files_ownership_action:testaction:1 - - Record Successful Permission Changes to Files - fsetxattr + + Configure L1 Terminal Fault mitigations - ocil:ssg-audit_rules_successful_file_modification_fsetxattr_action:testaction:1 + ocil:ssg-grub2_l1tf_argument_action:testaction:1 - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default + + Record Successful Access Attempts to Files - ftruncate - ocil:ssg-sysctl_net_ipv6_conf_default_max_addresses_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_ftruncate_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - userhelper + + Disable the samba_run_unconfined SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_userhelper_action:testaction:1 + ocil:ssg-sebool_samba_run_unconfined_action:testaction:1 - - Don't target root user in the sudoers file + + Disable the zoneminder_anon_write SELinux Boolean - ocil:ssg-sudoers_no_root_target_action:testaction:1 + ocil:ssg-sebool_zoneminder_anon_write_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/gshadow + + Disable the mailman_use_fusefs SELinux Boolean - ocil:ssg-audit_rules_usergroup_modification_gshadow_action:testaction:1 + ocil:ssg-sebool_mailman_use_fusefs_action:testaction:1 - - Disable the cluster_can_network_connect SELinux Boolean + + Enable Smartcards in SSSD - ocil:ssg-sebool_cluster_can_network_connect_action:testaction:1 + ocil:ssg-sssd_enable_smartcards_action:testaction:1 - - Configure Response Mode of ARP Requests for All IPv4 Interfaces + + Disable the kdumpgui_run_bootloader SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_arp_ignore_action:testaction:1 + ocil:ssg-sebool_kdumpgui_run_bootloader_action:testaction:1 - - Disable the CUPS Service + + Remove the X Windows Package Group - ocil:ssg-service_cups_disabled_action:testaction:1 + ocil:ssg-package_xorg-x11-server-common_removed_action:testaction:1 - - Configure Denying Router Solicitations on All IPv6 Interfaces + + Disable the xdm_bind_vnc_tcp_port SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_router_solicitations_action:testaction:1 + ocil:ssg-sebool_xdm_bind_vnc_tcp_port_action:testaction:1 - - Add nodev Option to /var/log/audit + + Uninstall ypserv Package - ocil:ssg-mount_option_var_log_audit_nodev_action:testaction:1 + ocil:ssg-package_ypserv_removed_action:testaction:1 - - Enable ExecShield via sysctl + + Ensure Insecure File Locking is Not Allowed - ocil:ssg-sysctl_kernel_exec_shield_action:testaction:1 + ocil:ssg-no_insecure_locks_exports_action:testaction:1 - - Disable core dump backtraces + + Record Successful Delete Attempts to Files - renameat - ocil:ssg-coredump_disable_backtraces_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_renameat_action:testaction:1 - - Configure immutable Audit login UIDs + + Verify File Hashes with RPM - ocil:ssg-audit_immutable_login_uids_action:testaction:1 + ocil:ssg-rpm_verify_hashes_action:testaction:1 - - Disable Host-Based Authentication + + Enable HTTPD LogLevel - ocil:ssg-disable_host_auth_action:testaction:1 + ocil:ssg-httpd_enable_loglevel_action:testaction:1 - - Ensure SMAP is not disabled during boot + + Ensure /var/tmp Located On Separate Partition - ocil:ssg-grub2_nosmap_argument_absent_action:testaction:1 + ocil:ssg-partition_for_var_tmp_action:testaction:1 - - Configure Polyinstantiation of /var/tmp Directories + + Set Password Hashing Algorithm in /etc/libuser.conf - ocil:ssg-accounts_polyinstantiated_var_tmp_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_libuserconf_action:testaction:1 - - Restrict Virtual Console Root Logins + + Configure Libreswan to use System Crypto Policy - ocil:ssg-securetty_root_login_console_only_action:testaction:1 + ocil:ssg-configure_libreswan_crypto_policy_action:testaction:1 - - Add nodev Option to /var + + Ensure auditd Collects Information on the Use of Privileged Commands - poweroff - ocil:ssg-mount_option_var_nodev_action:testaction:1 + ocil:ssg-audit_privileged_commands_poweroff_action:testaction:1 - - Disable the container_connect_any SELinux Boolean + + Firewalld Must Employ a Deny-all, Allow-by-exception Policy for Allowing Connections to Other Systems - ocil:ssg-sebool_container_connect_any_action:testaction:1 + ocil:ssg-configured_firewalld_default_deny_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - open O_TRUNC_WRITE + + Set Password Maximum Age - ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_trunc_write_action:testaction:1 + ocil:ssg-accounts_maximum_age_login_defs_action:testaction:1 - - Ensure ip6tables Firewall Rules Exist for All Open Ports + + Disable the exim_can_connect_db SELinux Boolean - ocil:ssg-ip6tables_rules_for_open_ports_action:testaction:1 + ocil:ssg-sebool_exim_can_connect_db_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/passwd + + Enable the auditadm_exec_content SELinux Boolean - ocil:ssg-audit_rules_etc_passwd_openat_action:testaction:1 + ocil:ssg-sebool_auditadm_exec_content_action:testaction:1 - - Record Any Attempts to Run setsebool + + Configure immutable Audit login UIDs - ocil:ssg-audit_rules_execution_setsebool_action:testaction:1 + ocil:ssg-audit_rules_immutable_login_uids_action:testaction:1 - - Configure auditing of successful file deletions + + The mailx Package Is Installed - ocil:ssg-audit_delete_success_action:testaction:1 + ocil:ssg-package_mailx_installed_action:testaction:1 - - Disable the dbadm_read_user_files SELinux Boolean + + Install systemd-journal-remote Package - ocil:ssg-sebool_dbadm_read_user_files_action:testaction:1 + ocil:ssg-package_systemd-journal-remote_installed_action:testaction:1 - - Verify and Correct Ownership with RPM + + Record Successful Access Attempts to Files - creat - ocil:ssg-rpm_verify_ownership_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_creat_action:testaction:1 - - Disable the mozilla_plugin_use_spice SELinux Boolean + + Encrypt Partitions - ocil:ssg-sebool_mozilla_plugin_use_spice_action:testaction:1 + ocil:ssg-encrypt_partitions_action:testaction:1 - - Install crypto-policies package + + System Audit Directories Must Be Owned By Root - ocil:ssg-package_crypto-policies_installed_action:testaction:1 + ocil:ssg-directory_ownership_var_log_audit_action:testaction:1 - - Do Not Show System Messages When Unsuccessful Logon Attempts Occur + + Disable the zarafa_setrlimit SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_silent_action:testaction:1 + ocil:ssg-sebool_zarafa_setrlimit_action:testaction:1 - - Disable the httpd_can_check_spam SELinux Boolean + + Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly - ocil:ssg-sebool_httpd_can_check_spam_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_rule_order_action:testaction:1 - - Include Local Events in Audit Logs + + Configure Firewalld to Use the Nftables Backend - ocil:ssg-auditd_local_events_action:testaction:1 + ocil:ssg-firewalld-backend_action:testaction:1 - - Record Any Attempts to Run chacl + + Enable the NTP Daemon - ocil:ssg-audit_rules_execution_chacl_action:testaction:1 + ocil:ssg-service_chronyd_or_ntpd_enabled_action:testaction:1 - - Configure ARP filtering for All IPv4 Interfaces + + Configure auditd to use audispd's syslog plugin - ocil:ssg-sysctl_net_ipv4_conf_all_arp_filter_action:testaction:1 + ocil:ssg-auditd_audispd_syslog_plugin_activated_action:testaction:1 - - Install audispd-plugins Package + + Verify that Shared Library Directories Have Root Group Ownership - ocil:ssg-package_audispd-plugins_installed_action:testaction:1 + ocil:ssg-dir_group_ownership_library_dirs_action:testaction:1 - - Ensure /var Located On Separate Partition + + Uninstall dovecot Package - ocil:ssg-partition_for_var_action:testaction:1 + ocil:ssg-package_dovecot_removed_action:testaction:1 - - Ensure journald is configured to write log files to persistent disk + + Configure GnuTLS library to use DoD-approved TLS Encryption - ocil:ssg-journald_storage_action:testaction:1 + ocil:ssg-configure_gnutls_tls_crypto_policy_action:testaction:1 - - System Audit Directories Must Be Group Owned By Root + + Limit Password Reuse: password-auth - ocil:ssg-directory_group_ownership_var_log_audit_action:testaction:1 + ocil:ssg-accounts_password_pam_pwhistory_remember_password_auth_action:testaction:1 - - Disable System Statistics Reset Service (sysstat) + + Disable the httpd_dbus_avahi SELinux Boolean - ocil:ssg-service_sysstat_disabled_action:testaction:1 + ocil:ssg-sebool_httpd_dbus_avahi_action:testaction:1 - - Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv4 Interfaces + + Disable Ctrl-Alt-Del Burst Action - ocil:ssg-sysctl_net_ipv4_conf_default_accept_redirects_action:testaction:1 + ocil:ssg-disable_ctrlaltdel_burstaction_action:testaction:1 - - Appropriate Action Must be Setup When the Internal Audit Event Queue is Full + + Extend Audit Backlog Limit for the Audit Daemon - ocil:ssg-auditd_overflow_action_action:testaction:1 + ocil:ssg-grub2_audit_backlog_limit_argument_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - unlinkat + + Disable the use_nfs_home_dirs SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_unlinkat_action:testaction:1 + ocil:ssg-sebool_use_nfs_home_dirs_action:testaction:1 - - Configure maximum number of process identifiers + + Disable the virt_sandbox_use_sys_admin SELinux Boolean - ocil:ssg-sysctl_kernel_pid_max_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_sys_admin_action:testaction:1 - - Enable checks on notifier call chains + + Add nosuid Option to Removable Media Partitions - ocil:ssg-kernel_config_debug_notifiers_action:testaction:1 + ocil:ssg-mount_option_nosuid_removable_partitions_action:testaction:1 - - Disable the httpd_enable_homedirs SELinux Boolean + + Disable the mpd_use_nfs SELinux Boolean - ocil:ssg-sebool_httpd_enable_homedirs_action:testaction:1 + ocil:ssg-sebool_mpd_use_nfs_action:testaction:1 - - Ensure debug-shell service is not enabled during boot + + Ensure tftp Daemon Uses Secure Mode - ocil:ssg-grub2_systemd_debug-shell_argument_absent_action:testaction:1 + ocil:ssg-tftpd_uses_secure_mode_action:testaction:1 - - Disable the condor_tcp_network_connect SELinux Boolean + + Add nosuid Option to /boot/efi - ocil:ssg-sebool_condor_tcp_network_connect_action:testaction:1 + ocil:ssg-mount_option_boot_efi_nosuid_action:testaction:1 - - Add noexec Option to /var/tmp + + Disable At Service (atd) - ocil:ssg-mount_option_var_tmp_noexec_action:testaction:1 + ocil:ssg-service_atd_disabled_action:testaction:1 - - Enable Kernel Paremeter to Log Martian Packets on all IPv4 Interfaces by Default + + Record Attempts to Alter Logon and Logout Events - faillock - ocil:ssg-sysctl_net_ipv4_conf_default_log_martians_action:testaction:1 + ocil:ssg-audit_rules_login_events_faillock_action:testaction:1 - - Add nodev Option to Non-Root Local Partitions + + Configure auditd Number of Logs Retained - ocil:ssg-mount_option_nodev_nonroot_local_partitions_action:testaction:1 + ocil:ssg-auditd_data_retention_num_logs_action:testaction:1 - - Disable the pppd_for_user SELinux Boolean + + Disable ypserv Service - ocil:ssg-sebool_pppd_for_user_action:testaction:1 + ocil:ssg-service_ypserv_disabled_action:testaction:1 - - Verify User Who Owns shadow File + + Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server - ocil:ssg-file_owner_etc_shadow_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_reqcert_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - unlink + + Enable HTTPD Error Logging - ocil:ssg-audit_rules_file_deletion_events_unlink_action:testaction:1 + ocil:ssg-httpd_enable_error_logging_action:testaction:1 - - Install the Policy Auditor (PA) Module + + Force opensc To Use Defined Smart Card Driver - ocil:ssg-install_mcafee_hbss_pa_action:testaction:1 + ocil:ssg-force_opensc_card_drivers_action:testaction:1 - - Disable the use_lpd_server SELinux Boolean + + Disable the collectd_tcp_network_connect SELinux Boolean - ocil:ssg-sebool_use_lpd_server_action:testaction:1 + ocil:ssg-sebool_collectd_tcp_network_connect_action:testaction:1 - - Require Re-Authentication When Using the sudo Command + + Disable SSH root Login with a Password (Insecure) - ocil:ssg-sudo_require_reauthentication_action:testaction:1 + ocil:ssg-sshd_disable_root_password_login_action:testaction:1 - - Prefer to use a 64-bit Operating System when supported + + Disable the cobbler_anon_write SELinux Boolean - ocil:ssg-prefer_64bit_os_action:testaction:1 + ocil:ssg-sebool_cobbler_anon_write_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/security/opasswd + + Verify that audit tools are owned by group root - ocil:ssg-audit_rules_usergroup_modification_opasswd_action:testaction:1 + ocil:ssg-file_groupownership_audit_binaries_action:testaction:1 - - Trigger a kernel BUG when data corruption is detected + + Record Successful Permission Changes to Files - fremovexattr - ocil:ssg-kernel_config_bug_on_data_corruption_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fremovexattr_action:testaction:1 - - Enable Kernel Parameter to Use TCP Syncookies on Network Interfaces + + Disable the httpd_can_network_connect_db SELinux Boolean - ocil:ssg-sysctl_net_ipv4_tcp_syncookies_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_db_action:testaction:1 - - Harden SSH client Crypto Policy + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces - ocil:ssg-harden_ssh_client_crypto_policy_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_action:testaction:1 - - Configure SSSD to Expire SSH Known Hosts + + Install Intrusion Detection Software - ocil:ssg-sssd_ssh_known_hosts_timeout_action:testaction:1 + ocil:ssg-install_hids_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE + + Add nosuid Option to /var/tmp - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_trunc_write_action:testaction:1 + ocil:ssg-mount_option_var_tmp_nosuid_action:testaction:1 - - Verify that Shared Library Files Have Root Ownership + + Verify Permissions on passwd File - ocil:ssg-file_ownership_library_dirs_action:testaction:1 + ocil:ssg-file_permissions_etc_passwd_action:testaction:1 - - Enable Kernel Page-Table Isolation (KPTI) + + Set Existing Passwords Maximum Age - ocil:ssg-grub2_pti_argument_action:testaction:1 + ocil:ssg-accounts_password_set_max_life_existing_action:testaction:1 - - Disable the mozilla_read_content SELinux Boolean + + Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo requiretty - ocil:ssg-sebool_mozilla_read_content_action:testaction:1 + ocil:ssg-sudo_add_requiretty_action:testaction:1 - - A remote time server for Chrony is configured + + Add noauto Option to /boot - ocil:ssg-chronyd_specify_remote_server_action:testaction:1 + ocil:ssg-mount_option_boot_noauto_action:testaction:1 - - Configure AIDE to Verify the Audit Tools + + Disable the conman_can_network SELinux Boolean - ocil:ssg-aide_check_audit_tools_action:testaction:1 + ocil:ssg-sebool_conman_can_network_action:testaction:1 - - SSH client uses strong entropy to seed (for CSH like shells) + + Configure auditd Disk Full Action when Disk Space Is Full - ocil:ssg-ssh_client_use_strong_rng_csh_action:testaction:1 + ocil:ssg-auditd_data_disk_full_action_stig_action:testaction:1 - - Disable the mmap_low_allowed SELinux Boolean + + Verify Permissions on /etc/shells File - ocil:ssg-sebool_mmap_low_allowed_action:testaction:1 + ocil:ssg-file_permissions_etc_shells_action:testaction:1 - - Disable the tor_can_network_relay SELinux Boolean + + Install the McAfee Runtime Libraries and Linux Agent - ocil:ssg-sebool_tor_can_network_relay_action:testaction:1 + ocil:ssg-install_mcafee_cma_rt_action:testaction:1 - - Disable x86 vsyscall emulation + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces - ocil:ssg-kernel_config_x86_vsyscall_emulation_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_defrtr_action:testaction:1 - - Make the module text and rodata read-only + + Ensure auditd Unauthorized Access Attempts To open_by_handle_at Are Ordered Correctly - ocil:ssg-kernel_config_strict_module_rwx_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_rule_order_action:testaction:1 - - Disable rsh Service + + Trigger a kernel BUG when data corruption is detected - ocil:ssg-service_rsh_disabled_action:testaction:1 + ocil:ssg-kernel_config_bug_on_data_corruption_action:testaction:1 - - Disable Cyrus SASL Authentication Daemon (saslauthd) + + Uninstall bind Package - ocil:ssg-service_saslauthd_disabled_action:testaction:1 + ocil:ssg-package_bind_removed_action:testaction:1 - - Require Client Certificates + + Record Events that Modify User/Group Information - /etc/gshadow - ocil:ssg-httpd_require_client_certs_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_gshadow_action:testaction:1 - - Disable the virt_read_qemu_ga_data SELinux Boolean + + Disable the smartmon_3ware SELinux Boolean - ocil:ssg-sebool_virt_read_qemu_ga_data_action:testaction:1 + ocil:ssg-sebool_smartmon_3ware_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Unloading - delete_module + + Uninstall net-snmp Package - ocil:ssg-audit_rules_kernel_module_loading_delete_action:testaction:1 + ocil:ssg-package_net-snmp_removed_action:testaction:1 - - Disable the openshift_use_nfs SELinux Boolean + + Enable the cron_userdomain_transition SELinux Boolean - ocil:ssg-sebool_openshift_use_nfs_action:testaction:1 + ocil:ssg-sebool_cron_userdomain_transition_action:testaction:1 - - Disable DHCP Service + + Enable poison without sanity check - ocil:ssg-service_dhcpd_disabled_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_no_sanity_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check + + Add noexec Option to /var/log/audit - ocil:ssg-audit_rules_privileged_commands_pam_timestamp_check_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_noexec_action:testaction:1 - - Each Web Content Directory Must Contain An index.html File + + Ensure SMEP is not disabled during boot - ocil:ssg-httpd_configure_documentroot_action:testaction:1 + ocil:ssg-grub2_nosmep_argument_absent_action:testaction:1 - - Install tar Package + + Ensure gpgcheck Enabled In Main yum Configuration - ocil:ssg-package_tar_installed_action:testaction:1 + ocil:ssg-ensure_gpgcheck_globally_activated_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/passwd + + Audit Tools Must Have a Mode of 0755 or Less Permissive - ocil:ssg-audit_rules_usergroup_modification_passwd_action:testaction:1 + ocil:ssg-file_audit_tools_permissions_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fremovexattr + + Remove NIS Client - ocil:ssg-audit_rules_dac_modification_fremovexattr_action:testaction:1 + ocil:ssg-package_ypbind_removed_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf/ + + UEFI Boot Loader Is Not Installed On Removeable Media - ocil:ssg-file_permissions_httpd_server_conf_files_action:testaction:1 + ocil:ssg-uefi_no_removeable_media_action:testaction:1 - - Disable IEEE 1394 (FireWire) Support + + Verify Ownership on SSH Server Private *_key Key Files - ocil:ssg-kernel_module_firewire-core_disabled_action:testaction:1 + ocil:ssg-file_ownership_sshd_private_key_action:testaction:1 - - Enable Kernel Parameter to Enforce DAC on Hardlinks + + Ensure SMAP is not disabled during boot - ocil:ssg-sysctl_fs_protected_hardlinks_action:testaction:1 + ocil:ssg-grub2_nosmap_argument_absent_action:testaction:1 - - Disable RDS Support + + Disable KDump Kernel Crash Analyzer (kdump) - ocil:ssg-kernel_module_rds_disabled_action:testaction:1 + ocil:ssg-service_kdump_disabled_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/group + + Configure the httpd_builtin_scripting SELinux Boolean - ocil:ssg-audit_rules_etc_group_open_action:testaction:1 + ocil:ssg-sebool_httpd_builtin_scripting_action:testaction:1 - - Disable the httpd_dbus_avahi SELinux Boolean + + Disable the httpd_can_connect_ftp SELinux Boolean - ocil:ssg-sebool_httpd_dbus_avahi_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_ftp_action:testaction:1 - - Disable the xserver_clients_write_xshm SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - newgrp - ocil:ssg-sebool_xserver_clients_write_xshm_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newgrp_action:testaction:1 - - Disable the collectd_tcp_network_connect SELinux Boolean + + Verify Owner on cron.d - ocil:ssg-sebool_collectd_tcp_network_connect_action:testaction:1 + ocil:ssg-file_owner_cron_d_action:testaction:1 - - Verify Owner on crontab + + Disable the authlogin_nsswitch_use_ldap SELinux Boolean - ocil:ssg-file_owner_crontab_action:testaction:1 + ocil:ssg-sebool_authlogin_nsswitch_use_ldap_action:testaction:1 - - Disable vsftpd Service + + Disable the prosody_bind_http_port SELinux Boolean - ocil:ssg-service_vsftpd_disabled_action:testaction:1 + ocil:ssg-sebool_prosody_bind_http_port_action:testaction:1 - - Ensure SNMP Read Write is disabled + + Disable the cluster_manage_all_files SELinux Boolean - ocil:ssg-snmpd_no_rwusers_action:testaction:1 + ocil:ssg-sebool_cluster_manage_all_files_action:testaction:1 - - Record Successful Delete Attempts to Files - renameat + + Ensure PAM Enforces Password Requirements - Minimum Different Characters - ocil:ssg-audit_rules_successful_file_modification_renameat_action:testaction:1 + ocil:ssg-accounts_password_pam_difok_action:testaction:1 - - Virus Scanning Software Definitions Are Updated + + Verify Owner on cron.weekly - ocil:ssg-mcafee_antivirus_definitions_updated_action:testaction:1 + ocil:ssg-file_owner_cron_weekly_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - open_by_handle_at O_CREAT + + Perform full reference count validation - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_creat_action:testaction:1 + ocil:ssg-kernel_config_refcount_full_action:testaction:1 - - Remove iptables-services Package + + Disable Geolocation in GNOME3 - ocil:ssg-package_iptables-services_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_geolocation_action:testaction:1 - - Verify iptables Enabled + + Assign Expiration Date to Temporary Accounts - ocil:ssg-service_iptables_enabled_action:testaction:1 + ocil:ssg-account_temp_expire_date_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchmod + + Ensure nss-tools is installed - ocil:ssg-audit_rules_dac_modification_fchmod_action:testaction:1 + ocil:ssg-package_nss-tools_installed_action:testaction:1 - - Certificate status checking in SSSD + + Disable the ssh_keysign SELinux Boolean - ocil:ssg-sssd_certificate_verification_action:testaction:1 + ocil:ssg-sebool_ssh_keysign_action:testaction:1 - - Disable Red Hat Network Service (rhnsd) + + Verify Permissions on gshadow File - ocil:ssg-service_rhnsd_disabled_action:testaction:1 + ocil:ssg-file_permissions_etc_gshadow_action:testaction:1 - - Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean + + Configure auditing of unsuccessful file creations - ocil:ssg-sebool_selinuxuser_postgresql_connect_enabled_action:testaction:1 + ocil:ssg-audit_create_failed_action:testaction:1 - - Prevent remote hosts from connecting to the proxy display + + Disable snmpd Service - ocil:ssg-sshd_x11_use_localhost_action:testaction:1 + ocil:ssg-service_snmpd_disabled_action:testaction:1 - - Ensure that /etc/at.deny does not exist + + Ensure that System Accounts Do Not Run a Shell Upon Login - ocil:ssg-file_at_deny_not_exist_action:testaction:1 + ocil:ssg-no_shelllogin_for_systemaccounts_action:testaction:1 - - Disable Samba + + Don't target root user in the sudoers file - ocil:ssg-service_smb_disabled_action:testaction:1 + ocil:ssg-sudoers_no_root_target_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Lock After Idle Period + + Disable the cron_can_relabel SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_lock_locked_action:testaction:1 + ocil:ssg-sebool_cron_can_relabel_action:testaction:1 - - Disable Kerberos by removing host keytab + + Use Only Strong Key Exchange algorithms - ocil:ssg-kerberos_disable_no_keytab_action:testaction:1 + ocil:ssg-sshd_use_strong_kex_action:testaction:1 - - Disable Kernel Parameter for IPv6 Forwarding + + Verify Permissions on Backup gshadow File - ocil:ssg-sysctl_net_ipv6_conf_all_forwarding_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_gshadow_action:testaction:1 - - Verify User Who Owns Backup gshadow File + + Disable the git_cgi_enable_homedirs SELinux Boolean - ocil:ssg-file_owner_backup_etc_gshadow_action:testaction:1 + ocil:ssg-sebool_git_cgi_enable_homedirs_action:testaction:1 - - Set Default iptables Policy for Incoming Packets + + Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown - ocil:ssg-set_iptables_default_rule_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_pt_chown_action:testaction:1 - - Disable KDump Kernel Crash Analyzer (kdump) + + Configure auditd admin_space_left on Low Disk Space - ocil:ssg-service_kdump_disabled_action:testaction:1 + ocil:ssg-auditd_data_retention_admin_space_left_percentage_action:testaction:1 - - Enable the NTP Daemon + + Install McAfee Virus Scanning Software - ocil:ssg-service_ntp_enabled_action:testaction:1 + ocil:ssg-install_mcafee_antivirus_action:testaction:1 - - All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary Group + + System Audit Logs Must Have Mode 0750 or Less Permissive - ocil:ssg-accounts_users_home_files_groupownership_action:testaction:1 + ocil:ssg-directory_permissions_var_log_audit_action:testaction:1 - - Verify Group Ownership on SSH Server Private *_key Key Files + + Disable the gitosis_can_sendmail SELinux Boolean - ocil:ssg-file_groupownership_sshd_private_key_action:testaction:1 + ocil:ssg-sebool_gitosis_can_sendmail_action:testaction:1 - - Disable the daemons_use_tcp_wrapper SELinux Boolean + + Authorize USB hubs in USBGuard daemon - ocil:ssg-sebool_daemons_use_tcp_wrapper_action:testaction:1 + ocil:ssg-usbguard_allow_hub_action:testaction:1 - - Disable Quagga Service + + Enable Dracut FIPS Module - ocil:ssg-service_zebra_disabled_action:testaction:1 + ocil:ssg-enable_dracut_fips_module_action:testaction:1 - - Ensure /var/log Located On Separate Partition + + Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces - ocil:ssg-partition_for_var_log_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_send_redirects_action:testaction:1 - - An SELinux Context must be configured for the pam_faillock.so records directory + + Disable the virt_use_usb SELinux Boolean - ocil:ssg-account_password_selinux_faillock_dir_action:testaction:1 + ocil:ssg-sebool_virt_use_usb_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on IPv4 Interfaces by Default + + Disable IEEE 1394 (FireWire) Support - ocil:ssg-sysctl_net_ipv4_conf_default_accept_source_route_action:testaction:1 + ocil:ssg-kernel_module_firewire-core_disabled_action:testaction:1 - - Disable the git_session_bind_all_unreserved_ports SELinux Boolean + + Harden slab freelist metadata - ocil:ssg-sebool_git_session_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-kernel_config_slab_freelist_hardened_action:testaction:1 - - Verify ownership of System Login Banner + + Ensure auditd Collects Information on the Use of Privileged Commands - postdrop - ocil:ssg-file_owner_etc_issue_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_postdrop_action:testaction:1 - - Uninstall talk-server Package + + Disable the xserver_clients_write_xshm SELinux Boolean - ocil:ssg-package_talk-server_removed_action:testaction:1 + ocil:ssg-sebool_xserver_clients_write_xshm_action:testaction:1 - - Specify the hash to use when signing modules + + Enable FIPS Mode - ocil:ssg-kernel_config_module_sig_hash_action:testaction:1 + ocil:ssg-enable_fips_mode_action:testaction:1 - - Configure System to Forward All Mail From Postmaster to The Root Account + + Disable the xdm_write_home SELinux Boolean - ocil:ssg-postfix_client_configure_mail_alias_postmaster_action:testaction:1 + ocil:ssg-sebool_xdm_write_home_action:testaction:1 - - Disable chrony daemon from acting as server + + Disable the nis_enabled SELinux Boolean - ocil:ssg-chronyd_client_only_action:testaction:1 + ocil:ssg-sebool_nis_enabled_action:testaction:1 - - Disable the abrt_handle_event SELinux Boolean + + Enable SLUB debugging support - ocil:ssg-sebool_abrt_handle_event_action:testaction:1 + ocil:ssg-kernel_config_slub_debug_action:testaction:1 - - Randomize the kernel memory sections + + Install pam_pwquality Package - ocil:ssg-kernel_config_randomize_memory_action:testaction:1 + ocil:ssg-package_pam_pwquality_installed_action:testaction:1 - - Configure auditing of unsuccessful file creations + + Disable the condor_tcp_network_connect SELinux Boolean - ocil:ssg-audit_create_failed_action:testaction:1 + ocil:ssg-sebool_condor_tcp_network_connect_action:testaction:1 - - Record attempts to alter time through settimeofday + + Record Events that Modify User/Group Information via open syscall - /etc/shadow - ocil:ssg-audit_rules_time_settimeofday_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_open_action:testaction:1 - - Verify that audit tools Have Mode 0755 or less + + Record Events that Modify the System's Mandatory Access Controls - ocil:ssg-file_permissions_audit_binaries_action:testaction:1 + ocil:ssg-audit_rules_mac_modification_action:testaction:1 - - Uninstall telnet-server Package + + Disable the GNOME3 Login Restart and Shutdown Buttons - ocil:ssg-package_telnet-server_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_restart_shutdown_action:testaction:1 - - Ensure LDAP client is not installed + + Enable the login_console_enabled SELinux Boolean - ocil:ssg-package_openldap-clients_removed_action:testaction:1 + ocil:ssg-sebool_login_console_enabled_action:testaction:1 - - Disable mutable hooks + + Enable Use of Privilege Separation - ocil:ssg-kernel_config_security_writable_hooks_action:testaction:1 + ocil:ssg-sshd_use_priv_separation_action:testaction:1 - - Configure auditing of successful file accesses + + Disable the cluster_can_network_connect SELinux Boolean - ocil:ssg-audit_access_success_action:testaction:1 + ocil:ssg-sebool_cluster_can_network_connect_action:testaction:1 - - Enable Encrypted X11 Forwarding + + Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. - ocil:ssg-sshd_enable_x11_forwarding_action:testaction:1 + ocil:ssg-fapolicy_default_deny_action:testaction:1 - - Configure the Use of the pam_faillock.so Module in the /etc/pam.d/password-auth File. + + Ensure SELinux State is Enforcing - ocil:ssg-account_password_pam_faillock_password_auth_action:testaction:1 + ocil:ssg-selinux_state_action:testaction:1 - - Ensure Chrony is only configured with the server directive + + Set Password Minimum Age - ocil:ssg-chronyd_server_directive_action:testaction:1 + ocil:ssg-accounts_minimum_age_login_defs_action:testaction:1 - - Disable the sge_use_nfs SELinux Boolean + + Enable the unconfined_mozilla_plugin_transition SELinux Boolean - ocil:ssg-sebool_sge_use_nfs_action:testaction:1 + ocil:ssg-sebool_unconfined_mozilla_plugin_transition_action:testaction:1 - - Record Successful Delete Attempts to Files - rename + + Configure HTTP PERL Scripts To Use TAINT Option - ocil:ssg-audit_rules_successful_file_modification_rename_action:testaction:1 + ocil:ssg-httpd_configure_perl_taint_action:testaction:1 - - Disable Quota Netlink (quota_nld) + + Set Password Hashing Rounds in /etc/login.defs - ocil:ssg-service_quota_nld_disabled_action:testaction:1 + ocil:ssg-set_password_hashing_min_rounds_logindefs_action:testaction:1 - - Enable SSH Print Last Log + + Install scap-security-guide Package - ocil:ssg-sshd_print_last_log_action:testaction:1 + ocil:ssg-package_scap-security-guide_installed_action:testaction:1 - - Ensure All Accounts on the System Have Unique Names + + Verify Group Who Owns Backup group File - ocil:ssg-account_unique_name_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_group_action:testaction:1 - - Disable the ftpd_connect_db SELinux Boolean + + Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD - ocil:ssg-sebool_ftpd_connect_db_action:testaction:1 + ocil:ssg-sudo_remove_nopasswd_action:testaction:1 - - Configure PAM in SSSD Services + + Add noexec Option to /home - ocil:ssg-sssd_enable_pam_services_action:testaction:1 + ocil:ssg-mount_option_home_noexec_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fremovexattr + + Disable Apache Qpid (qpidd) - ocil:ssg-audit_rules_unsuccessful_file_modification_fremovexattr_action:testaction:1 + ocil:ssg-service_qpidd_disabled_action:testaction:1 - - Ensure PAM Displays Last Logon/Access Notification + + Verify User Who Owns Backup shadow File - ocil:ssg-display_login_attempts_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_shadow_action:testaction:1 - - Configure audispd's Plugin disk_full_action When Disk Is Full + + User Initialization Files Must Be Group-Owned By The Primary Group - ocil:ssg-auditd_audispd_disk_full_action_action:testaction:1 + ocil:ssg-accounts_user_dot_group_ownership_action:testaction:1 - - Disable anacron Service + + Configure Polyinstantiation of /tmp Directories - ocil:ssg-disable_anacron_action:testaction:1 + ocil:ssg-accounts_polyinstantiated_tmp_action:testaction:1 - - Disable the cron_system_cronjob_use_shares SELinux Boolean + + Enable page allocator poisoning - ocil:ssg-sebool_cron_system_cronjob_use_shares_action:testaction:1 + ocil:ssg-grub2_page_poison_argument_action:testaction:1 - - Disable the selinuxuser_rw_noexattrfile SELinux Boolean + + Disable CPU Speed (cpupower) - ocil:ssg-sebool_selinuxuser_rw_noexattrfile_action:testaction:1 + ocil:ssg-service_cpupower_disabled_action:testaction:1 - - Ensure SELinux Not Disabled in the kernel arguments + + Ensure auditd Collects File Deletion Events by User - ocil:ssg-coreos_enable_selinux_kernel_argument_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_action:testaction:1 - - Disable the xguest_exec_content SELinux Boolean + + Disable the exim_read_user_files SELinux Boolean - ocil:ssg-sebool_xguest_exec_content_action:testaction:1 + ocil:ssg-sebool_exim_read_user_files_action:testaction:1 - - Record Successful Ownership Changes to Files - fchownat + + Use Kerberos Security on All Exports - ocil:ssg-audit_rules_successful_file_modification_fchownat_action:testaction:1 + ocil:ssg-use_kerberos_security_all_exports_action:testaction:1 - - Disable the openvpn_run_unconfined SELinux Boolean + + Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv6 Interfaces - ocil:ssg-sebool_openvpn_run_unconfined_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_redirects_action:testaction:1 - - Disable telnet Service + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-service_telnet_disabled_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_defrtr_action:testaction:1 - - Configure immutable Audit login UIDs + + Configure auditing of unsuccessful ownership changes - ocil:ssg-audit_rules_immutable_login_uids_action:testaction:1 + ocil:ssg-audit_owner_change_failed_action:testaction:1 - - Configure Notification of Post-AIDE Scan Details + + Add nodev Option to /tmp - ocil:ssg-aide_scan_notification_action:testaction:1 + ocil:ssg-mount_option_tmp_nodev_action:testaction:1 - - OpenSSL uses strong entropy source + + A public web server, if hosted on the NIPRNet, must be isolated in an accredited DoD DMZ extension - ocil:ssg-openssl_use_strong_entropy_action:testaction:1 + ocil:ssg-httpd_nipr_accredited_dmz_action:testaction:1 - - Add nodev Option to /dev/shm + + Install the opensc Package For Multifactor Authentication - ocil:ssg-mount_option_dev_shm_nodev_action:testaction:1 + ocil:ssg-package_opensc_installed_action:testaction:1 - - Disable Automatic Bug Reporting Tool (abrtd) + + Record Successful Access Attempts to Files - open_by_handle_at - ocil:ssg-service_abrtd_disabled_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_action:testaction:1 - - Ensure Sudo Logfile Exists - sudo logfile + + Disable the mcelog_server SELinux Boolean - ocil:ssg-sudo_custom_logfile_action:testaction:1 + ocil:ssg-sebool_mcelog_server_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/passwd + + Disable Kerberos by removing host keytab - ocil:ssg-no_legacy_plus_entries_etc_passwd_action:testaction:1 + ocil:ssg-kerberos_disable_no_keytab_action:testaction:1 - - Configure Polyinstantiation of /tmp Directories + + Configure kernel to trust the CPU random number generator - ocil:ssg-accounts_polyinstantiated_tmp_action:testaction:1 + ocil:ssg-grub2_kernel_trust_cpu_rng_action:testaction:1 - - Disable At Service (atd) + + Configure tmux to lock session after inactivity - ocil:ssg-service_atd_disabled_action:testaction:1 + ocil:ssg-configure_tmux_lock_after_time_action:testaction:1 - - Configure auditing of successful file creations + + Require Credential Prompting for Remote Access in GNOME3 - ocil:ssg-audit_create_success_action:testaction:1 + ocil:ssg-dconf_gnome_remote_access_credential_prompt_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Session Idle Settings + + Enable the logging_syslogd_use_tty SELinux Boolean - ocil:ssg-dconf_gnome_session_idle_user_locks_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_use_tty_action:testaction:1 - - Implement Blank Screensaver + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces - ocil:ssg-dconf_gnome_screensaver_mode_blank_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_pinfo_action:testaction:1 - - Disable the pppd_can_insmod SELinux Boolean + + Record Successful Ownership Changes to Files - fchown - ocil:ssg-sebool_pppd_can_insmod_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchown_action:testaction:1 - - Disable SSH root Login with a Password (Insecure) + + Disable TIPC Support - ocil:ssg-sshd_disable_root_password_login_action:testaction:1 + ocil:ssg-kernel_module_tipc_disabled_action:testaction:1 - - Disable kernel debugfs + + Disable the tmpreaper_use_nfs SELinux Boolean - ocil:ssg-kernel_config_debug_fs_action:testaction:1 + ocil:ssg-sebool_tmpreaper_use_nfs_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Lowercase Characters + + Install sssd-ipa Package - ocil:ssg-accounts_password_pam_lcredit_action:testaction:1 + ocil:ssg-package_sssd-ipa_installed_action:testaction:1 - - Disable the ssh_keysign SELinux Boolean + + Disable kexec system call - ocil:ssg-sebool_ssh_keysign_action:testaction:1 + ocil:ssg-kernel_config_kexec_action:testaction:1 - - Uninstall 389-ds-base Package + + Ensure auditd Rules For Unauthorized Attempts To open Are Ordered Correctly - ocil:ssg-package_389-ds-base_removed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_rule_order_action:testaction:1 - - All Interactive Users Home Directories Must Exist + + Configure Denying Router Solicitations on All IPv6 Interfaces - ocil:ssg-accounts_user_interactive_home_directory_exists_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_router_solicitations_action:testaction:1 - - Ensure System Log Files Have Correct Permissions + + Verify that Shared Library Directories Have Root Ownership - ocil:ssg-rsyslog_files_permissions_action:testaction:1 + ocil:ssg-dir_ownership_library_dirs_action:testaction:1 - - Restrict Access to Kernel Message Buffer + + Record Events that Modify the System's Discretionary Access Controls - fchmod - ocil:ssg-sysctl_kernel_dmesg_restrict_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchmod_action:testaction:1 - - Enable Logging of All FTP Transactions + + Disable the httpd_enable_homedirs SELinux Boolean - ocil:ssg-ftp_log_transactions_action:testaction:1 + ocil:ssg-sebool_httpd_enable_homedirs_action:testaction:1 - - Remove Write Permissions From Filesystem Paths And Server Scripts + + Configure the selinuxuser_direct_dri_enabled SELinux Boolean - ocil:ssg-httpd_configure_script_permissions_action:testaction:1 + ocil:ssg-sebool_selinuxuser_direct_dri_enabled_action:testaction:1 - - Disable Secure RPC Server Service (rpcsvcgssd) + + Allow Only SSH Protocol 2 - ocil:ssg-service_rpcsvcgssd_disabled_action:testaction:1 + ocil:ssg-sshd_allow_only_protocol2_action:testaction:1 - - Disable the xen_use_nfs SELinux Boolean + + Record Successful Permission Changes to Files - setxattr - ocil:ssg-sebool_xen_use_nfs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_setxattr_action:testaction:1 - - Disable the xguest_connect_network SELinux Boolean + + Verify that system commands files are group owned by root or a system account - ocil:ssg-sebool_xguest_connect_network_action:testaction:1 + ocil:ssg-file_groupownership_system_commands_dirs_action:testaction:1 - - Disable XDMCP in GDM + + Ensure auditd Collects Information on the Use of Privileged Commands - chsh - ocil:ssg-gnome_gdm_disable_xdmcp_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_chsh_action:testaction:1 - - Ensure cron Is Logging To Rsyslog + + Disable the httpd_can_connect_mythtv SELinux Boolean - ocil:ssg-rsyslog_cron_logging_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_mythtv_action:testaction:1 - - Disable SSH Support for .rhosts Files + + Ensure logrotate is Installed - ocil:ssg-sshd_disable_rhosts_action:testaction:1 + ocil:ssg-package_logrotate_installed_action:testaction:1 - - Set Existing Passwords Warning Age + + Record Successful Permission Changes to Files - lsetxattr - ocil:ssg-accounts_password_set_warn_age_existing_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lsetxattr_action:testaction:1 - - Disable the samba_export_all_ro SELinux Boolean + + Add grpquota Option to /home - ocil:ssg-sebool_samba_export_all_ro_action:testaction:1 + ocil:ssg-mount_option_home_grpquota_action:testaction:1 - - Set GNOME3 Screensaver Lock Delay After Activation Period + + Remove the GDM Package Group - ocil:ssg-dconf_gnome_screensaver_lock_delay_action:testaction:1 + ocil:ssg-package_gdm_removed_action:testaction:1 - - Audit Configuration Files Must Be Owned By Root + + Disable the httpd_read_user_content SELinux Boolean - ocil:ssg-file_ownership_audit_configuration_action:testaction:1 + ocil:ssg-sebool_httpd_read_user_content_action:testaction:1 - - Verify Group Ownership of Message of the Day Banner + + Ensure that /etc/cron.allow exists - ocil:ssg-file_groupowner_etc_motd_action:testaction:1 + ocil:ssg-file_cron_allow_exists_action:testaction:1 - - Detect stack corruption on calls to schedule() + + Uninstall nginx Package - ocil:ssg-kernel_config_sched_stack_end_check_action:testaction:1 + ocil:ssg-package_nginx_removed_action:testaction:1 - - Verify permissions on Message of the Day Banner + + Configure Periodic Execution of AIDE - ocil:ssg-file_permissions_etc_motd_action:testaction:1 + ocil:ssg-aide_periodic_cron_checking_action:testaction:1 - - Set SSH authentication attempt limit + + Verify Group Ownership of System Login Banner - ocil:ssg-sshd_set_max_auth_tries_action:testaction:1 + ocil:ssg-file_groupowner_etc_issue_action:testaction:1 - - Uninstall avahi-autoipd Server Package + + Remove iptables-services Package - ocil:ssg-package_avahi-autoipd_removed_action:testaction:1 + ocil:ssg-package_iptables-services_removed_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - umount + + Disable the logging_syslogd_can_sendmail SELinux Boolean - ocil:ssg-audit_rules_dac_modification_umount_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_can_sendmail_action:testaction:1 - - Verify User Who Owns Backup shadow File + + Ensure Users Cannot Change GNOME3 Screensaver Lock After Idle Period - ocil:ssg-file_groupowner_backup_etc_shadow_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_locked_action:testaction:1 - - Install the tmux Package + + Disable the httpd_can_network_relay SELinux Boolean - ocil:ssg-package_tmux_installed_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_relay_action:testaction:1 - - Set Daemon Umask + + Enable GNOME3 Screensaver Idle Activation - ocil:ssg-umask_for_daemons_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_activation_enabled_action:testaction:1 - - Enable authselect + + Limit sampling frequency of the Perf system - ocil:ssg-enable_authselect_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_event_max_sample_rate_action:testaction:1 - - Ensure the Default Umask is Set Correctly in /etc/profile + + Record attempts to alter time through settimeofday - ocil:ssg-accounts_umask_etc_profile_action:testaction:1 + ocil:ssg-audit_rules_time_settimeofday_action:testaction:1 - - Ensure sudo only includes the default configuration directory + + Record Access Events to Audit Log Directory - ocil:ssg-sudoers_default_includedir_action:testaction:1 + ocil:ssg-directory_access_var_log_audit_action:testaction:1 - - Resolve information before writing to audit logs + + Ensure /opt Located On Separate Partition - ocil:ssg-auditd_log_format_action:testaction:1 + ocil:ssg-partition_for_opt_action:testaction:1 - - Enable Kernel Parameter to Ignore ICMP Broadcast Echo Requests on IPv4 Interfaces + + Enable the postgresql_selinux_users_ddl SELinux Boolean - ocil:ssg-sysctl_net_ipv4_icmp_echo_ignore_broadcasts_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_users_ddl_action:testaction:1 - - Disable the httpd_execmem SELinux Boolean + + Configure SSH to use System Crypto Policy - ocil:ssg-sebool_httpd_execmem_action:testaction:1 + ocil:ssg-configure_ssh_crypto_policy_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Enforce for Local Accounts Only + + Enable the xend_run_blktap SELinux Boolean - ocil:ssg-accounts_password_pam_enforce_local_action:testaction:1 + ocil:ssg-sebool_xend_run_blktap_action:testaction:1 - - Install dnf-plugin-subscription-manager Package + + Ensure Default SNMP Password Is Not Used - ocil:ssg-package_dnf-plugin-subscription-manager_installed_action:testaction:1 + ocil:ssg-snmpd_not_default_password_action:testaction:1 - - Set Password Minimum Age + + The Chronyd service is enabled - ocil:ssg-accounts_minimum_age_login_defs_action:testaction:1 + ocil:ssg-service_chronyd_enabled_action:testaction:1 - - Record Successful Permission Changes to Files - setxattr + + Verify permissions on Message of the Day Banner - ocil:ssg-audit_rules_successful_file_modification_setxattr_action:testaction:1 + ocil:ssg-file_permissions_etc_motd_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - mount + + Extend Audit Backlog Limit for the Audit Daemon in zIPL - ocil:ssg-audit_rules_privileged_commands_mount_action:testaction:1 + ocil:ssg-zipl_audit_backlog_limit_argument_action:testaction:1 - - Ensure Logrotate Runs Periodically + + Disable the virt_transition_userdomain SELinux Boolean - ocil:ssg-ensure_logrotate_activated_action:testaction:1 + ocil:ssg-sebool_virt_transition_userdomain_action:testaction:1 - - Verify that System Executable Directories Have Restrictive Permissions + + Disallow merge of slab caches - ocil:ssg-dir_permissions_binary_dirs_action:testaction:1 + ocil:ssg-kernel_config_slab_merge_default_action:testaction:1 - - Enforce pam_faillock for Local Accounts Only + + Authorize Human Interface Devices and USB hubs in USBGuard daemon - ocil:ssg-accounts_passwords_pam_faillock_enforce_local_action:testaction:1 + ocil:ssg-usbguard_allow_hid_and_hub_action:testaction:1 - - Disable the ftpd_use_fusefs SELinux Boolean + + Record Successful Permission Changes to Files - fsetxattr - ocil:ssg-sebool_ftpd_use_fusefs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fsetxattr_action:testaction:1 - - Disable the cobbler_anon_write SELinux Boolean + + Install the OpenSSH Server Package - ocil:ssg-sebool_cobbler_anon_write_action:testaction:1 + ocil:ssg-package_openssh-server_installed_action:testaction:1 - - Web Content Directories Must Not Be Shared Anonymously + + Uninstall Samba Package - ocil:ssg-httpd_anonymous_content_sharing_action:testaction:1 + ocil:ssg-package_samba_removed_action:testaction:1 - - Verify User Who Owns /var/log/syslog File + + Uninstall 389-ds-base Package - ocil:ssg-file_owner_var_log_syslog_action:testaction:1 + ocil:ssg-package_389-ds-base_removed_action:testaction:1 - - Enable the nfs_export_all_rw SELinux Boolean + + Disable the cobbler_can_network_connect SELinux Boolean - ocil:ssg-sebool_nfs_export_all_rw_action:testaction:1 + ocil:ssg-sebool_cobbler_can_network_connect_action:testaction:1 - - Disable the deny_ptrace SELinux Boolean + + Disable the virt_use_xserver SELinux Boolean - ocil:ssg-sebool_deny_ptrace_action:testaction:1 + ocil:ssg-sebool_virt_use_xserver_action:testaction:1 - - Disable the samba_share_nfs SELinux Boolean + + Record Unsuccessful Creation Attempts to Files - openat O_CREAT - ocil:ssg-sebool_samba_share_nfs_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_creat_action:testaction:1 - - Disable the mcelog_foreground SELinux Boolean + + Configure SSSD to Expire Offline Credentials - ocil:ssg-sebool_mcelog_foreground_action:testaction:1 + ocil:ssg-sssd_offline_cred_expiration_action:testaction:1 - - Authorize Human Interface Devices in USBGuard daemon + + Configure AIDE to Verify Extended Attributes - ocil:ssg-usbguard_allow_hid_action:testaction:1 + ocil:ssg-aide_verify_ext_attributes_action:testaction:1 - - Configure HTTP PERL Scripts To Use TAINT Option + + Ensure Rsyslog Encrypts Off-Loaded Audit Records - ocil:ssg-httpd_configure_perl_taint_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdrivermode_action:testaction:1 - - The Postfix package is installed + + Verify /boot/grub2/user.cfg User Ownership - ocil:ssg-package_postfix_installed_action:testaction:1 + ocil:ssg-file_owner_user_cfg_action:testaction:1 - - Enable the NTP Daemon + + Disable the secure_mode SELinux Boolean - ocil:ssg-service_ntpd_enabled_action:testaction:1 + ocil:ssg-sebool_secure_mode_action:testaction:1 - - Enable module signature verification + + Ensure PAM Enforces Password Requirements - Minimum Digit Characters - ocil:ssg-kernel_config_module_sig_action:testaction:1 + ocil:ssg-accounts_password_pam_dcredit_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module + + Verify iptables Enabled - ocil:ssg-audit_rules_kernel_module_loading_query_action:testaction:1 + ocil:ssg-service_iptables_enabled_action:testaction:1 - - Allow Only SSH Protocol 2 + + Record Any Attempts to Run seunshare - ocil:ssg-sshd_allow_only_protocol2_action:testaction:1 + ocil:ssg-audit_rules_execution_seunshare_action:testaction:1 - - Install the ntp service + + Disable the xguest_exec_content SELinux Boolean - ocil:ssg-package_ntp_installed_action:testaction:1 + ocil:ssg-sebool_xguest_exec_content_action:testaction:1 - - Verify Permissions on /etc/shells File + + Disable the httpd_use_sasl SELinux Boolean - ocil:ssg-file_permissions_etc_shells_action:testaction:1 + ocil:ssg-sebool_httpd_use_sasl_action:testaction:1 - - Specify a Remote NTP Server + + Record attempts to alter time through adjtimex - ocil:ssg-ntpd_specify_remote_server_action:testaction:1 + ocil:ssg-audit_rules_time_adjtimex_action:testaction:1 - - Ensure a dedicated group owns sudo + + Prevent non-Privileged Users from Modifying Network Interfaces using nmcli - ocil:ssg-sudo_dedicated_group_action:testaction:1 + ocil:ssg-network_nmcli_permissions_action:testaction:1 - - Require Encryption for Remote Access in GNOME3 + + Configure auditd Disk Full Action when Disk Space Is Full - ocil:ssg-dconf_gnome_remote_access_encryption_action:testaction:1 + ocil:ssg-auditd_data_disk_full_action_action:testaction:1 - - Disable the webadm_manage_user_files SELinux Boolean + + Harden common str/mem functions against buffer overflows - ocil:ssg-sebool_webadm_manage_user_files_action:testaction:1 + ocil:ssg-kernel_config_fortify_source_action:testaction:1 - - Uninstall abrt-plugin-rhtsupport Package + + Disable the fenced_can_network_connect SELinux Boolean - ocil:ssg-package_abrt-plugin-rhtsupport_removed_action:testaction:1 + ocil:ssg-sebool_fenced_can_network_connect_action:testaction:1 - - Configure SNMP Service to Use Only SNMPv3 or Newer + + Randomize the kernel memory sections - ocil:ssg-snmpd_use_newer_protocol_action:testaction:1 + ocil:ssg-kernel_config_randomize_memory_action:testaction:1 - - Ensure All SGID Executables Are Authorized + + Disable rlogin Service - ocil:ssg-file_permissions_unauthorized_sgid_action:testaction:1 + ocil:ssg-service_rlogin_disabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - shutdown + + Enable systemd-journald Service - ocil:ssg-audit_privileged_commands_shutdown_action:testaction:1 + ocil:ssg-service_systemd-journald_enabled_action:testaction:1 - - Enable the OpenSSH Service + + Disable GSSAPI Authentication - ocil:ssg-service_sshd_enabled_action:testaction:1 + ocil:ssg-sshd_disable_gssapi_auth_action:testaction:1 - - Ensure All Accounts on the System Have Unique User IDs + + Configure Certificate Directives for LDAP Use of TLS - ocil:ssg-account_unique_id_action:testaction:1 + ocil:ssg-ldap_client_tls_cacertpath_action:testaction:1 - - Verify Group Who Owns gshadow File + + Disable Bluetooth Service - ocil:ssg-file_groupowner_etc_gshadow_action:testaction:1 + ocil:ssg-service_bluetooth_disabled_action:testaction:1 - - Set Password Hashing Algorithm in /etc/libuser.conf + + Set Password Maximum Consecutive Repeating Characters - ocil:ssg-set_password_hashing_algorithm_libuserconf_action:testaction:1 + ocil:ssg-accounts_password_pam_maxrepeat_action:testaction:1 - - Set Existing Passwords Maximum Age + + Verify that Shared Library Directories Have Restrictive Permissions - ocil:ssg-accounts_password_set_max_life_existing_action:testaction:1 + ocil:ssg-dir_permissions_library_dirs_action:testaction:1 - - Enable SLUB/SLAB allocator poisoning in zIPL + + Verify User Who Owns group File - ocil:ssg-zipl_slub_debug_argument_action:testaction:1 + ocil:ssg-file_owner_etc_group_action:testaction:1 - - Disable the zoneminder_run_sudo SELinux Boolean + + Disable the container_connect_any SELinux Boolean - ocil:ssg-sebool_zoneminder_run_sudo_action:testaction:1 + ocil:ssg-sebool_container_connect_any_action:testaction:1 - - Limit sampling frequency of the Perf system + + Disable graphical user interface - ocil:ssg-sysctl_kernel_perf_event_max_sample_rate_action:testaction:1 + ocil:ssg-xwindows_remove_packages_action:testaction:1 - - Verify Permissions on /etc/audit/rules.d/*.rules + + Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words - ocil:ssg-file_permissions_etc_audit_rulesd_action:testaction:1 + ocil:ssg-accounts_password_pam_dictcheck_action:testaction:1 - - Ensure All World-Writable Directories Are Owned by a System Account + + Remove the Kerberos Server Package - ocil:ssg-dir_perms_world_writable_system_owned_action:testaction:1 + ocil:ssg-package_krb5-server_removed_action:testaction:1 - - Mount Remote Filesystems with nosuid + + Configure auditd space_left on Low Disk Space - ocil:ssg-mount_option_nosuid_remote_filesystems_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_action:testaction:1 - - Verify Group Who Owns /var/log/syslog File + + Ensure All SUID Executables Are Authorized - ocil:ssg-file_groupowner_var_log_syslog_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_suid_action:testaction:1 - - Configure auditing of successful ownership changes + + Enable the sysadm_exec_content SELinux Boolean - ocil:ssg-audit_owner_change_success_action:testaction:1 + ocil:ssg-sebool_sysadm_exec_content_action:testaction:1 - - Configure Kernel Parameter for Accepting Secure Redirects By Default + + Enable the OpenSSH Service - ocil:ssg-sysctl_net_ipv4_conf_default_secure_redirects_action:testaction:1 + ocil:ssg-service_sshd_enabled_action:testaction:1 - - Disable the samba_export_all_rw SELinux Boolean + + Disable chrony daemon from acting as server - ocil:ssg-sebool_samba_export_all_rw_action:testaction:1 + ocil:ssg-chronyd_client_only_action:testaction:1 - - Uninstall pigz Package + + Enable the logadm_exec_content SELinux Boolean - ocil:ssg-package_pigz_removed_action:testaction:1 + ocil:ssg-sebool_logadm_exec_content_action:testaction:1 - - Harden the operation of the BPF just-in-time compiler + + Configure A Banner Page For Each Website - ocil:ssg-sysctl_net_core_bpf_jit_harden_action:testaction:1 + ocil:ssg-httpd_configure_banner_page_action:testaction:1 - - Disable the racoon_read_shadow SELinux Boolean + + Record Unsuccessful Permission Changes to Files - setxattr - ocil:ssg-sebool_racoon_read_shadow_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_setxattr_action:testaction:1 - - Disable the abrt_anon_write SELinux Boolean + + Disable Core Dumps for All Users - ocil:ssg-sebool_abrt_anon_write_action:testaction:1 + ocil:ssg-disable_users_coredumps_action:testaction:1 - - Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config + + Configure SSSD LDAP Backend to Use TLS For All Transactions - ocil:ssg-harden_sshd_macs_openssh_conf_crypto_policy_action:testaction:1 + ocil:ssg-sssd_ldap_start_tls_action:testaction:1 - - Disable the xdm_sysadm_login SELinux Boolean + + Ensure syslog-ng is Installed - ocil:ssg-sebool_xdm_sysadm_login_action:testaction:1 + ocil:ssg-package_syslogng_installed_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchown + + Require Client Certificates - ocil:ssg-audit_rules_dac_modification_fchown_action:testaction:1 + ocil:ssg-httpd_require_client_certs_action:testaction:1 - - Set number of records to cause an explicit flush to audit logs + + Ensure rsyslog Default File Permissions Configured - ocil:ssg-auditd_freq_action:testaction:1 + ocil:ssg-rsyslog_filecreatemode_action:testaction:1 - - Ensure Remote Administrative Access Is Encrypted + + Ensure gpgcheck Enabled for All yum Package Repositories - ocil:ssg-httpd_configure_remote_session_encryption_action:testaction:1 + ocil:ssg-ensure_gpgcheck_never_disabled_action:testaction:1 - - Disable the nagios_run_sudo SELinux Boolean + + Ensure auditd Collects File Deletion Events by User - unlink - ocil:ssg-sebool_nagios_run_sudo_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_unlink_action:testaction:1 - - Enable the cron_userdomain_transition SELinux Boolean + + Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - ocil:ssg-sebool_cron_userdomain_transition_action:testaction:1 + ocil:ssg-sebool_httpd_mod_auth_ntlm_winbind_action:testaction:1 - - Disable the haproxy_connect_any SELinux Boolean + + Disable Kernel cfg80211 Module - ocil:ssg-sebool_haproxy_connect_any_action:testaction:1 + ocil:ssg-kernel_module_cfg80211_disabled_action:testaction:1 - - Disable the httpd_use_nfs SELinux Boolean + + Disable the exim_manage_user_files SELinux Boolean - ocil:ssg-sebool_httpd_use_nfs_action:testaction:1 + ocil:ssg-sebool_exim_manage_user_files_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/group + + Enable SSH Print Last Log - ocil:ssg-no_legacy_plus_entries_etc_group_action:testaction:1 + ocil:ssg-sshd_print_last_log_action:testaction:1 - - All Interactive User Home Directories Must Be Owned By The Primary User + + Disable vsyscalls - ocil:ssg-file_ownership_home_directories_action:testaction:1 + ocil:ssg-grub2_vsyscall_argument_action:testaction:1 - - Disable Kerberos Authentication + + Disable the httpd_enable_ftp_server SELinux Boolean - ocil:ssg-sshd_disable_kerb_auth_action:testaction:1 + ocil:ssg-sebool_httpd_enable_ftp_server_action:testaction:1 - - Set GNOME3 Screensaver Inactivity Timeout + + Ensure No World-Writable Files Exist - ocil:ssg-dconf_gnome_screensaver_idle_delay_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_world_writable_action:testaction:1 - - Authorize Human Interface Devices and USB hubs in USBGuard daemon + + Enable rsyslog Service - ocil:ssg-usbguard_allow_hid_and_hub_action:testaction:1 + ocil:ssg-service_rsyslog_enabled_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg Group Ownership + + Set Permissions on the /var/log/httpd/ Directory - ocil:ssg-file_groupowner_efi_grub2_cfg_action:testaction:1 + ocil:ssg-dir_perms_var_log_httpd_action:testaction:1 - - Configure OpenSSL library to use TLS Encryption + + Disable ntpdate Service (ntpdate) - ocil:ssg-configure_openssl_tls_crypto_policy_action:testaction:1 + ocil:ssg-service_ntpdate_disabled_action:testaction:1 - - Verify that Shared Library Files Have Restrictive Permissions + + Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ - ocil:ssg-file_permissions_library_dirs_action:testaction:1 + ocil:ssg-audit_rules_sudoers_d_action:testaction:1 - - Verify Permissions on cron.hourly + + Disable the zoneminder_run_sudo SELinux Boolean - ocil:ssg-file_permissions_cron_hourly_action:testaction:1 + ocil:ssg-sebool_zoneminder_run_sudo_action:testaction:1 - - Don't define allowed commands in sudoers by means of exclusion + + OpenSSL uses strong entropy source - ocil:ssg-sudoers_no_command_negation_action:testaction:1 + ocil:ssg-openssl_use_strong_entropy_action:testaction:1 - - Enable the domain_fd_use SELinux Boolean + + Enable the dbadm_exec_content SELinux Boolean - ocil:ssg-sebool_domain_fd_use_action:testaction:1 + ocil:ssg-sebool_dbadm_exec_content_action:testaction:1 - - Install policycoreutils-python-utils package + + Disable the cobbler_use_cifs SELinux Boolean - ocil:ssg-package_policycoreutils-python-utils_installed_action:testaction:1 + ocil:ssg-sebool_cobbler_use_cifs_action:testaction:1 - - Disable Apache Qpid (qpidd) + + Ensure debug-shell service is not enabled during boot - ocil:ssg-service_qpidd_disabled_action:testaction:1 + ocil:ssg-grub2_systemd_debug-shell_argument_absent_action:testaction:1 - - Install the opensc Package For Multifactor Authentication + + Mount Remote Filesystems with nodev - ocil:ssg-package_opensc_installed_action:testaction:1 + ocil:ssg-mount_option_nodev_remote_filesystems_action:testaction:1 - - The web server password(s) must be entrusted to the SA or Web Manager + + Disable Advanced Configuration and Power Interface (acpid) - ocil:ssg-httpd_entrust_passwords_action:testaction:1 + ocil:ssg-service_acpid_disabled_action:testaction:1 - - Account Lockouts Must Persist + + Require Client SMB Packet Signing, if using smbclient - ocil:ssg-account_passwords_pam_faillock_dir_action:testaction:1 + ocil:ssg-require_smb_client_signing_action:testaction:1 - - Disable Network File System (nfs) + + Disable the virt_use_rawip SELinux Boolean - ocil:ssg-service_nfs_disabled_action:testaction:1 + ocil:ssg-sebool_virt_use_rawip_action:testaction:1 - - Firewalld Must Employ a Deny-all, Allow-by-exception Policy for Allowing Connections to Other Systems + + Configure the tmux Lock Command - ocil:ssg-configured_firewalld_default_deny_action:testaction:1 + ocil:ssg-configure_tmux_lock_command_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - chmod + + Disable the tftp_home_dir SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_chmod_action:testaction:1 + ocil:ssg-sebool_tftp_home_dir_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/gshadow + + Disable the tmpreaper_use_samba SELinux Boolean - ocil:ssg-audit_rules_etc_gshadow_openat_action:testaction:1 + ocil:ssg-sebool_tmpreaper_use_samba_action:testaction:1 - - Disable systemd-journal-remote Socket + + Enable Auditing to Start Prior to the Audit Daemon in zIPL - ocil:ssg-socket_systemd-journal-remote_disabled_action:testaction:1 + ocil:ssg-zipl_audit_argument_action:testaction:1 - - Disable the piranha_lvs_can_network_connect SELinux Boolean + + Uninstall quagga Package - ocil:ssg-sebool_piranha_lvs_can_network_connect_action:testaction:1 + ocil:ssg-package_quagga_removed_action:testaction:1 - - Verify Group Ownership on SSH Server Public *.pub Key Files + + Include Local Events in Audit Logs - ocil:ssg-file_groupownership_sshd_pub_key_action:testaction:1 + ocil:ssg-auditd_local_events_action:testaction:1 - - Ensure sudo umask is appropriate - sudo umask + + Set Daemon Umask - ocil:ssg-sudo_add_umask_action:testaction:1 + ocil:ssg-umask_for_daemons_action:testaction:1 - - Record Successful Delete Attempts to Files - unlink + + Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl - ocil:ssg-audit_rules_successful_file_modification_unlink_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_usernetctl_action:testaction:1 - - Authorize USB hubs in USBGuard daemon + + Disable Red Hat Network Service (rhnsd) - ocil:ssg-usbguard_allow_hub_action:testaction:1 + ocil:ssg-service_rhnsd_disabled_action:testaction:1 - - Disable GDM Guest Login + + Ensure auditd Collects Information on the Use of Privileged Commands - su - ocil:ssg-gnome_gdm_disable_guest_login_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_su_action:testaction:1 - - Configure auditd space_left Action on Low Disk Space + + Disable the icecast_use_any_tcp_ports SELinux Boolean - ocil:ssg-auditd_data_retention_space_left_action_action:testaction:1 + ocil:ssg-sebool_icecast_use_any_tcp_ports_action:testaction:1 - - Disable the git_system_enable_homedirs SELinux Boolean + + Configure the Use of the pam_faillock.so Module in the /etc/pam.d/password-auth File. - ocil:ssg-sebool_git_system_enable_homedirs_action:testaction:1 + ocil:ssg-account_password_pam_faillock_password_auth_action:testaction:1 - - Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly + + Record Successful Delete Attempts to Files - unlinkat - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_rule_order_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_unlinkat_action:testaction:1 - - Enable PAM + + Disable Client Dynamic DNS Updates - ocil:ssg-sshd_enable_pam_action:testaction:1 + ocil:ssg-network_disable_ddns_interfaces_action:testaction:1 - - Disable the logrotate_use_nfs SELinux Boolean + + Enable Encrypted X11 Forwarding - ocil:ssg-sebool_logrotate_use_nfs_action:testaction:1 + ocil:ssg-sshd_enable_x11_forwarding_action:testaction:1 - - Encrypt Partitions + + Ensure auditd Collects Information on the Use of Privileged Commands - mount - ocil:ssg-encrypt_partitions_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_mount_action:testaction:1 - - Configure Denying Router Solicitations on All IPv6 Interfaces By Default + + Set configuration for loopback traffic - ocil:ssg-sysctl_net_ipv6_conf_default_router_solicitations_action:testaction:1 + ocil:ssg-set_loopback_traffic_action:testaction:1 - - Enable the unconfined_mozilla_plugin_transition SELinux Boolean + + Disable the mpd_enable_homedirs SELinux Boolean - ocil:ssg-sebool_unconfined_mozilla_plugin_transition_action:testaction:1 + ocil:ssg-sebool_mpd_enable_homedirs_action:testaction:1 - - Harden common str/mem functions against buffer overflows + + Disable GDM Guest Login - ocil:ssg-kernel_config_fortify_source_action:testaction:1 + ocil:ssg-gnome_gdm_disable_guest_login_action:testaction:1 - - Disable the glance_use_execmem SELinux Boolean + + Ensure ip6tables Firewall Rules Exist for All Open Ports - ocil:ssg-sebool_glance_use_execmem_action:testaction:1 + ocil:ssg-ip6tables_rules_for_open_ports_action:testaction:1 - - Disable the selinuxuser_tcp_server SELinux Boolean + + Verify the UEFI Boot Loader grub.cfg Group Ownership - ocil:ssg-sebool_selinuxuser_tcp_server_action:testaction:1 + ocil:ssg-file_groupowner_efi_grub2_cfg_action:testaction:1 - - Disable the mplayer_execstack SELinux Boolean + + Configure auditd mail_acct Action on Low Disk Space - ocil:ssg-sebool_mplayer_execstack_action:testaction:1 + ocil:ssg-auditd_data_retention_action_mail_acct_action:testaction:1 - - Enable Use of Privilege Separation + + Disable loading and unloading of kernel modules - ocil:ssg-sshd_use_priv_separation_action:testaction:1 + ocil:ssg-sysctl_kernel_modules_disabled_action:testaction:1 - - Record Events that Modify the System's Mandatory Access Controls + + Ensure cron Is Logging To Rsyslog - ocil:ssg-audit_rules_mac_modification_action:testaction:1 + ocil:ssg-rsyslog_cron_logging_action:testaction:1 - - Disable the virt_use_rawip SELinux Boolean + + Add nodev Option to /boot - ocil:ssg-sebool_virt_use_rawip_action:testaction:1 + ocil:ssg-mount_option_boot_nodev_action:testaction:1 - - Disable storing core dump + + Disable the samba_create_home_dirs SELinux Boolean - ocil:ssg-coredump_disable_storage_action:testaction:1 + ocil:ssg-sebool_samba_create_home_dirs_action:testaction:1 - - Enable the postgresql_selinux_users_ddl SELinux Boolean + + Disable the xdm_exec_bootloader SELinux Boolean - ocil:ssg-sebool_postgresql_selinux_users_ddl_action:testaction:1 + ocil:ssg-sebool_xdm_exec_bootloader_action:testaction:1 - - Restrict Serial Port Root Logins + + Disable the httpd_use_fusefs SELinux Boolean - ocil:ssg-restrict_serial_port_logins_action:testaction:1 + ocil:ssg-sebool_httpd_use_fusefs_action:testaction:1 - - Use Only FIPS 140-2 Validated MACs + + Ensure auditd Collects Information on the Use of Privileged Commands - shutdown - ocil:ssg-sshd_use_approved_macs_action:testaction:1 + ocil:ssg-audit_privileged_commands_shutdown_action:testaction:1 - - Disable the dhcpd_use_ldap SELinux Boolean + + Configure audispd Plugin To Send Logs To Remote Server - ocil:ssg-sebool_dhcpd_use_ldap_action:testaction:1 + ocil:ssg-auditd_audispd_configure_remote_server_action:testaction:1 - - Configure Auto Configuration on All IPv6 Interfaces + + Enable the selinuxuser_execmod SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_autoconf_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execmod_action:testaction:1 - - Enable the auditadm_exec_content SELinux Boolean + + Set Kernel Parameter to Increase Local Port Range - ocil:ssg-sebool_auditadm_exec_content_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_ip_local_port_range_action:testaction:1 - - Install the Samba Common Package + + Configure Notification of Post-AIDE Scan Details - ocil:ssg-package_samba-common_installed_action:testaction:1 + ocil:ssg-aide_scan_notification_action:testaction:1 - - Disable the git_system_use_cifs SELinux Boolean + + Disable Accepting Router Advertisements on all IPv6 Interfaces by Default - ocil:ssg-sebool_git_system_use_cifs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_action:testaction:1 - - Disable the named_tcp_bind_http_port SELinux Boolean + + Ensure IPv6 is disabled through kernel boot parameter - ocil:ssg-sebool_named_tcp_bind_http_port_action:testaction:1 + ocil:ssg-grub2_ipv6_disable_argument_action:testaction:1 - - Configure dnf-automatic to Install Available Updates Automatically + + Enable SLUB/SLAB allocator poisoning - ocil:ssg-dnf-automatic_apply_updates_action:testaction:1 + ocil:ssg-grub2_slub_debug_argument_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - rename + + Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces by Default - ocil:ssg-audit_rules_unsuccessful_file_modification_rename_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_rp_filter_action:testaction:1 - - Make the auditd Configuration Immutable + + Ensure gnutls-utils is installed - ocil:ssg-audit_rules_immutable_action:testaction:1 + ocil:ssg-package_gnutls-utils_installed_action:testaction:1 - - Disable the rsync_full_access SELinux Boolean + + Disable legacy (BSD) PTY support - ocil:ssg-sebool_rsync_full_access_action:testaction:1 + ocil:ssg-kernel_config_legacy_ptys_action:testaction:1 + + + + Record Events that Modify User/Group Information via open syscall - /etc/passwd + + ocil:ssg-audit_rules_etc_passwd_open_action:testaction:1 + + + + Disable the abrt_anon_write SELinux Boolean + + ocil:ssg-sebool_abrt_anon_write_action:testaction:1 + + + + User a virtually-mapped stack + + ocil:ssg-kernel_config_vmap_stack_action:testaction:1 @@ -357746,370 +358248,370 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_cdrecord_read_content_action:testaction:1 - - Verify All Account Password Hashes are Shadowed with SHA512 + + Configure auditd max_log_file_action Upon Reaching Maximum Log Size - ocil:ssg-accounts_password_all_shadowed_sha512_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action_stig_action:testaction:1 - - Disable the minidlna_read_generic_user_content SELinux Boolean + + Ensure SNMP Read Write is disabled - ocil:ssg-sebool_minidlna_read_generic_user_content_action:testaction:1 + ocil:ssg-snmpd_no_rwusers_action:testaction:1 - - Verify Group Who Owns SSH Server config file + + Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session - ocil:ssg-file_groupowner_sshd_config_action:testaction:1 + ocil:ssg-accounts_password_pam_retry_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit + + Ensure the Group Used by pam_wheel.so Module Exists on System and is Empty - ocil:ssg-audit_rules_privileged_commands_sudoedit_action:testaction:1 + ocil:ssg-ensure_pam_wheel_group_empty_action:testaction:1 - - Disable the authlogin_nsswitch_use_ldap SELinux Boolean + + Disable the cvs_read_shadow SELinux Boolean - ocil:ssg-sebool_authlogin_nsswitch_use_ldap_action:testaction:1 + ocil:ssg-sebool_cvs_read_shadow_action:testaction:1 - - Disable Kernel Image Loading + + Set SSH MaxSessions limit - ocil:ssg-sysctl_kernel_kexec_load_disabled_action:testaction:1 + ocil:ssg-sshd_set_max_sessions_action:testaction:1 - - Uninstall rsync Package + + Configure SSH Client to Use FIPS 140-2 Validated Ciphers: openssh.config - ocil:ssg-package_rsync_removed_action:testaction:1 + ocil:ssg-harden_sshd_ciphers_openssh_conf_crypto_policy_action:testaction:1 - - Verify Permissions on /etc/audit/auditd.conf + + Disable the irc_use_any_tcp_ports SELinux Boolean - ocil:ssg-file_permissions_etc_audit_auditd_action:testaction:1 + ocil:ssg-sebool_irc_use_any_tcp_ports_action:testaction:1 - - Install the Host Intrusion Prevention System (HIPS) Module + + Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments - ocil:ssg-package_MFEhiplsm_installed_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_invalid_ratelimit_action:testaction:1 - - Install sssd-ipa Package + + Do Not Show System Messages When Unsuccessful Logon Attempts Occur - ocil:ssg-package_sssd-ipa_installed_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_silent_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on IPv6 Interfaces by Default + + Configure the secure_mode_insmod SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_source_route_action:testaction:1 + ocil:ssg-sebool_secure_mode_insmod_action:testaction:1 - - System Audit Logs Must Be Owned By Root + + Disable compatibility with brk() - ocil:ssg-file_ownership_var_log_audit_action:testaction:1 + ocil:ssg-kernel_config_compat_brk_action:testaction:1 - - Disable the httpd_use_gpg SELinux Boolean + + Configure dnf-automatic to Install Available Updates Automatically - ocil:ssg-sebool_httpd_use_gpg_action:testaction:1 + ocil:ssg-dnf-automatic_apply_updates_action:testaction:1 - - Disable Ctrl-Alt-Del Burst Action + + Disable the git_session_users SELinux Boolean - ocil:ssg-disable_ctrlaltdel_burstaction_action:testaction:1 + ocil:ssg-sebool_git_session_users_action:testaction:1 - - Lock Accounts Must Persist + + Disable the virt_use_nfs SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_dir_action:testaction:1 + ocil:ssg-sebool_virt_use_nfs_action:testaction:1 - - Verify /boot/grub2/user.cfg User Ownership + + Configure audit according to OSPP requirements - ocil:ssg-file_owner_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_for_ospp_action:testaction:1 - - Disable tftp Service + + Record Attempts to Alter the localtime File - ocil:ssg-service_tftp_disabled_action:testaction:1 + ocil:ssg-audit_rules_time_watch_localtime_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD + + Disable the mozilla_read_content SELinux Boolean - ocil:ssg-sudo_remove_nopasswd_action:testaction:1 + ocil:ssg-sebool_mozilla_read_content_action:testaction:1 - - Disable the webadm_read_user_files SELinux Boolean + + Enable the SSSD Service - ocil:ssg-sebool_webadm_read_user_files_action:testaction:1 + ocil:ssg-service_sssd_enabled_action:testaction:1 - - Warn on W+X mappings found at boot + + Verify /boot/grub2/grub.cfg Permissions - ocil:ssg-kernel_config_debug_wx_action:testaction:1 + ocil:ssg-file_permissions_grub2_cfg_action:testaction:1 - - Verify Owner on cron.monthly + + Disable the spamassassin_can_network SELinux Boolean - ocil:ssg-file_owner_cron_monthly_action:testaction:1 + ocil:ssg-sebool_spamassassin_can_network_action:testaction:1 - - Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo use_pty + + Boot Loader Is Not Installed On Removeable Media - ocil:ssg-sudo_add_use_pty_action:testaction:1 + ocil:ssg-grub2_no_removeable_media_action:testaction:1 - - Record Events that Modify the System's Mandatory Access Controls in usr/share + + Install Smart Card Packages For Multifactor Authentication - ocil:ssg-audit_rules_mac_modification_usr_share_action:testaction:1 + ocil:ssg-install_smartcard_packages_action:testaction:1 - - Disable the entropyd_use_audio SELinux Boolean + + Disable the samba_portmapper SELinux Boolean - ocil:ssg-sebool_entropyd_use_audio_action:testaction:1 + ocil:ssg-sebool_samba_portmapper_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate + + Verify the UEFI Boot Loader grub.cfg User Ownership - ocil:ssg-sudo_remove_no_authenticate_action:testaction:1 + ocil:ssg-file_owner_efi_grub2_cfg_action:testaction:1 - - Disable the httpd_can_network_connect SELinux Boolean + + Disable SSH TCP Forwarding - ocil:ssg-sebool_httpd_can_network_connect_action:testaction:1 + ocil:ssg-sshd_disable_tcp_forwarding_action:testaction:1 - - Ensure remote access methods are monitored in Rsyslog + + Disable the virt_use_execmem SELinux Boolean - ocil:ssg-rsyslog_remote_access_monitoring_action:testaction:1 + ocil:ssg-sebool_virt_use_execmem_action:testaction:1 - - Disable ypserv Service + + Disable the use_ecryptfs_home_dirs SELinux Boolean - ocil:ssg-service_ypserv_disabled_action:testaction:1 + ocil:ssg-sebool_use_ecryptfs_home_dirs_action:testaction:1 - - Verify Group Who Owns /etc/at.allow file + + Disable Network Console (netconsole) - ocil:ssg-file_groupowner_at_allow_action:testaction:1 + ocil:ssg-service_netconsole_disabled_action:testaction:1 - - Configure the gluster_export_all_rw SELinux Boolean + + Ensure All-Squashing Disabled On All Exports - ocil:ssg-sebool_gluster_export_all_rw_action:testaction:1 + ocil:ssg-no_all_squash_exports_action:testaction:1 - - Verify /boot/grub2/grub.cfg Permissions + + Emulate Privileged Access Never (PAN) - ocil:ssg-file_permissions_grub2_cfg_action:testaction:1 + ocil:ssg-kernel_config_arm64_sw_ttbr0_pan_action:testaction:1 - - Prevent Login to Accounts With Empty Password + + Verify Group Who Owns /etc/shells File - ocil:ssg-no_empty_passwords_action:testaction:1 + ocil:ssg-file_groupowner_etc_shells_action:testaction:1 - - Configure file name of core dumps + + Ensure that Users Path Contains Only Local Directories - ocil:ssg-sysctl_kernel_core_uses_pid_action:testaction:1 + ocil:ssg-accounts_user_home_paths_only_action:testaction:1 - - Enable the logging_syslogd_use_tty SELinux Boolean + + Ensure PAM Enforces Password Requirements - Enforce for root User - ocil:ssg-sebool_logging_syslogd_use_tty_action:testaction:1 + ocil:ssg-accounts_password_pam_enforce_root_action:testaction:1 - - Add noexec Option to /home + + Uninstall nfs-utils Package - ocil:ssg-mount_option_home_noexec_action:testaction:1 + ocil:ssg-package_nfs-utils_removed_action:testaction:1 - - Disable the polipo_connect_all_unreserved SELinux Boolean + + Require Authentication for Single User Mode - ocil:ssg-sebool_polipo_connect_all_unreserved_action:testaction:1 + ocil:ssg-require_singleuser_auth_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Different Characters + + Configure LDAP Client to Use TLS For All Transactions - ocil:ssg-accounts_password_pam_difok_action:testaction:1 + ocil:ssg-ldap_client_start_tls_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Digit Characters + + Disable the use of user namespaces - ocil:ssg-accounts_password_pam_dcredit_action:testaction:1 + ocil:ssg-sysctl_user_max_user_namespaces_action:testaction:1 - - Ensure that chronyd is running under chrony user account + + Configure Auto Configuration on All IPv6 Interfaces By Default - ocil:ssg-chronyd_run_as_chrony_user_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_autoconf_action:testaction:1 - - Uninstall rpcbind Package + + Disable the httpd_anon_write SELinux Boolean - ocil:ssg-package_rpcbind_removed_action:testaction:1 + ocil:ssg-sebool_httpd_anon_write_action:testaction:1 - - Disable Portreserve (portreserve) + + Account Lockouts Must Persist - ocil:ssg-service_portreserve_disabled_action:testaction:1 + ocil:ssg-account_passwords_pam_faillock_dir_action:testaction:1 - - Install libreswan Package + + Disable the webadm_read_user_files SELinux Boolean - ocil:ssg-package_libreswan_installed_action:testaction:1 + ocil:ssg-sebool_webadm_read_user_files_action:testaction:1 - - Disable Access to Network bpf() Syscall From Unprivileged Processes + + Disable vsyscall emulation - ocil:ssg-sysctl_kernel_unprivileged_bpf_disabled_action:testaction:1 + ocil:ssg-kernel_config_legacy_vsyscall_emulate_action:testaction:1 - - The robots.txt Files Must Not Exist + + Disable the cobbler_use_nfs SELinux Boolean - ocil:ssg-httpd_remove_robots_file_action:testaction:1 + ocil:ssg-sebool_cobbler_use_nfs_action:testaction:1 - - Verify ownership of System Login Banner for Remote Connections + + Disable the selinuxuser_execstack SELinux Boolean - ocil:ssg-file_owner_etc_issue_net_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execstack_action:testaction:1 - - Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces + + Configure immutable Audit login UIDs - ocil:ssg-sysctl_net_ipv4_conf_all_rp_filter_action:testaction:1 + ocil:ssg-audit_immutable_login_uids_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/group + + Verify Permissions on /etc/cron.allow file - ocil:ssg-audit_rules_usergroup_modification_group_action:testaction:1 + ocil:ssg-file_permissions_cron_allow_action:testaction:1 - - Kernel panic oops + + Configure SNMP Service to Use Only SNMPv3 or Newer - ocil:ssg-kernel_config_panic_on_oops_action:testaction:1 + ocil:ssg-snmpd_use_newer_protocol_action:testaction:1 - - Installation of a compiler on production web server is prohibited + + Uninstall avahi Server Package - ocil:ssg-httpd_no_compilers_in_prod_action:testaction:1 + ocil:ssg-package_avahi_removed_action:testaction:1 - - Disable CPU Speed (cpupower) + + Enable the gssd_read_tmp SELinux Boolean - ocil:ssg-service_cpupower_disabled_action:testaction:1 + ocil:ssg-sebool_gssd_read_tmp_action:testaction:1 - - Configure SSSD to run as user sssd + + Harden the operation of the BPF just-in-time compiler - ocil:ssg-sssd_run_as_sssd_user_action:testaction:1 + ocil:ssg-sysctl_net_core_bpf_jit_harden_action:testaction:1 - - Do Not Allow SSH Environment Options + + Configure OpenSSL library to use TLS Encryption - ocil:ssg-sshd_do_not_permit_user_env_action:testaction:1 + ocil:ssg-configure_openssl_tls_crypto_policy_action:testaction:1 - - Disable Software RAID Monitor (mdmonitor) + + Ensure auditd Collects File Deletion Events by User - renameat - ocil:ssg-service_mdmonitor_disabled_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_renameat_action:testaction:1 - - Map System Users To The Appropriate SELinux Role + + Require Client SMB Packet Signing, if using mount.cifs - ocil:ssg-selinux_user_login_roles_action:testaction:1 + ocil:ssg-mount_option_smb_client_signing_action:testaction:1 - - Add nosuid Option to /var + + Verify Permissions on /etc/audit/rules.d/*.rules - ocil:ssg-mount_option_var_nosuid_action:testaction:1 + ocil:ssg-file_permissions_etc_audit_rulesd_action:testaction:1 - - Verify Group Who Owns /etc/shells File + + Uninstall DHCP Server Package - ocil:ssg-file_groupowner_etc_shells_action:testaction:1 + ocil:ssg-package_dhcp_removed_action:testaction:1 - - The operating system must restrict privilege elevation to authorized personnel + + Enable Kernel Parameter to Enforce DAC on Symlinks - ocil:ssg-sudo_restrict_privilege_elevation_to_authorized_action:testaction:1 + ocil:ssg-sysctl_fs_protected_symlinks_action:testaction:1 - - Enable use of Berkeley Packet Filter with seccomp + + Configure Response Mode of ARP Requests for All IPv4 Interfaces - ocil:ssg-kernel_config_seccomp_filter_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_arp_ignore_action:testaction:1 - - Verify Only Root Has UID 0 + + Remove the OpenSSH Server Package - ocil:ssg-accounts_no_uid_except_zero_action:testaction:1 + ocil:ssg-package_openssh-server_removed_action:testaction:1 - - Ensure that /etc/cron.allow exists + + Ensure PAM Enforces Password Requirements - Maximum Consecutive Repeating Characters from Same Character Class - ocil:ssg-file_cron_allow_exists_action:testaction:1 + ocil:ssg-accounts_password_pam_maxclassrepeat_action:testaction:1 - - Disable Kernel iwlwifi Module + + Prefer to use a 64-bit Operating System when supported - ocil:ssg-kernel_module_iwlwifi_disabled_action:testaction:1 + ocil:ssg-prefer_64bit_os_action:testaction:1 @@ -358118,244 +358620,244 @@ which the system will be deployed as closely as possible.ocil:ssg-audit_rules_kernel_module_loading_finit_action:testaction:1 - - Verify Group Who Owns Backup shadow File + + Disable the deny_ptrace SELinux Boolean - ocil:ssg-file_owner_backup_etc_shadow_action:testaction:1 + ocil:ssg-sebool_deny_ptrace_action:testaction:1 - - Disable Recovery Booting + + Disable the squid_connect_any SELinux Boolean - ocil:ssg-grub2_disable_recovery_action:testaction:1 + ocil:ssg-sebool_squid_connect_any_action:testaction:1 - - Configure auditd mail_acct Action on Low Disk Space + + Uninstall rsh-server Package - ocil:ssg-auditd_data_retention_action_mail_acct_action:testaction:1 + ocil:ssg-package_rsh-server_removed_action:testaction:1 - - Record Any Attempts to Run chcon + + Disable the pcp_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-audit_rules_execution_chcon_action:testaction:1 + ocil:ssg-sebool_pcp_bind_all_unreserved_ports_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl + + Ensure the Logon Failure Delay is Set Correctly in login.defs - ocil:ssg-audit_rules_privileged_commands_usernetctl_action:testaction:1 + ocil:ssg-accounts_logon_fail_delay_action:testaction:1 - - Configure auditd Disk Full Action when Disk Space Is Full + + Record Unsuccessful Ownership Changes to Files - lchown - ocil:ssg-auditd_data_disk_full_action_stig_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lchown_action:testaction:1 - - Configure Firewalld to Use the Nftables Backend + + Configure Logind to terminate idle sessions after certain time of inactivity - ocil:ssg-firewalld-backend_action:testaction:1 + ocil:ssg-logind_session_timeout_action:testaction:1 - - Add nosuid Option to /var/log + + Ensure network interfaces are assigned to appropriate zone - ocil:ssg-mount_option_var_log_nosuid_action:testaction:1 + ocil:ssg-set_firewalld_appropriate_zone_action:testaction:1 - - Enable the sysadm_exec_content SELinux Boolean + + Set Account Expiration Following Inactivity - ocil:ssg-sebool_sysadm_exec_content_action:testaction:1 + ocil:ssg-account_disable_post_pw_expiration_action:testaction:1 - - Verify Group Ownership of System Login Banner + + Record Events that Modify the System's Network Environment - ocil:ssg-file_groupowner_etc_issue_action:testaction:1 + ocil:ssg-audit_rules_networkconfig_modification_action:testaction:1 - - Disable the saslauthd_read_shadow SELinux Boolean + + Install openscap-scanner Package - ocil:ssg-sebool_saslauthd_read_shadow_action:testaction:1 + ocil:ssg-package_openscap-scanner_installed_action:testaction:1 - - Disable X11 Forwarding + + Specify UID and GID for Anonymous NFS Connections - ocil:ssg-sshd_disable_x11_forwarding_action:testaction:1 + ocil:ssg-nfs_no_anonymous_action:testaction:1 - - Disable the 32-bit vDSO + + Add nosuid Option to /var - ocil:ssg-kernel_config_compat_vdso_action:testaction:1 + ocil:ssg-mount_option_var_nosuid_action:testaction:1 - - Uninstall setroubleshoot-plugins Package + + Disable the virt_rw_qemu_ga_data SELinux Boolean - ocil:ssg-package_setroubleshoot-plugins_removed_action:testaction:1 + ocil:ssg-sebool_virt_rw_qemu_ga_data_action:testaction:1 - - Ensure There Are No Accounts With Blank or Null Passwords + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module - ocil:ssg-no_empty_passwords_etc_shadow_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_query_action:testaction:1 - - Configure Libreswan to use System Crypto Policy + + Set Up a Private Namespace in PAM Configuration - ocil:ssg-configure_libreswan_crypto_policy_action:testaction:1 + ocil:ssg-enable_pam_namespace_action:testaction:1 - - Disable the awstats_purge_apache_log_files SELinux Boolean + + Disable the neutron_can_network SELinux Boolean - ocil:ssg-sebool_awstats_purge_apache_log_files_action:testaction:1 + ocil:ssg-sebool_neutron_can_network_action:testaction:1 - - Disable Geolocation in GNOME3 + + Modify the System Login Banner for Remote Connections - ocil:ssg-dconf_gnome_disable_geolocation_action:testaction:1 + ocil:ssg-banner_etc_issue_net_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - init + + Disable the unprivuser_use_svirt SELinux Boolean - ocil:ssg-audit_privileged_commands_init_action:testaction:1 + ocil:ssg-sebool_unprivuser_use_svirt_action:testaction:1 - - Disable Compression Or Set Compression to delayed + + Enable the Hardware RNG Entropy Gatherer Service - ocil:ssg-sshd_disable_compression_action:testaction:1 + ocil:ssg-service_rngd_enabled_action:testaction:1 - - Ensure auditd Collects Unauthorized Access Attempts to Files (unsuccessful) + + Support session locking with tmux (not enforcing) - ocil:ssg-audit_rules_unsuccessful_file_modification_action:testaction:1 + ocil:ssg-configure_bashrc_tmux_action:testaction:1 - - Disable the nagios_run_pnp4nagios SELinux Boolean + + Disable vsyscall mapping - ocil:ssg-sebool_nagios_run_pnp4nagios_action:testaction:1 + ocil:ssg-kernel_config_legacy_vsyscall_none_action:testaction:1 - - Ensure All SUID Executables Are Authorized + + Enable the kerberos_enabled SELinux Boolean - ocil:ssg-file_permissions_unauthorized_suid_action:testaction:1 + ocil:ssg-sebool_kerberos_enabled_action:testaction:1 - - Uninstall iprutils Package + + Record Events When Privileged Executables Are Run - ocil:ssg-package_iprutils_removed_action:testaction:1 + ocil:ssg-audit_rules_suid_privilege_function_action:testaction:1 - - Configure System Cryptography Policy + + Disable Kernel Parameter for IP Forwarding on IPv4 Interfaces - ocil:ssg-configure_crypto_policy_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_ip_forward_action:testaction:1 - - Set Password Maximum Age + + Enable Kernel Parameter to Enforce DAC on Hardlinks - ocil:ssg-accounts_maximum_age_login_defs_action:testaction:1 + ocil:ssg-sysctl_fs_protected_hardlinks_action:testaction:1 - - Add nosuid Option to /boot/efi + + Ensure there are no legacy + NIS entries in /etc/group - ocil:ssg-mount_option_boot_efi_nosuid_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_group_action:testaction:1 - - Disable merging of slabs with similar size + + Configure auditd Max Log File Size - ocil:ssg-grub2_slab_nomerge_argument_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action:testaction:1 - - Disable the httpd_mod_auth_pam SELinux Boolean + + Enable checks on notifier call chains - ocil:ssg-sebool_httpd_mod_auth_pam_action:testaction:1 + ocil:ssg-kernel_config_debug_notifiers_action:testaction:1 - - Disable the daemons_dump_core SELinux Boolean + + Record Any Attempts to Run ssh-agent - ocil:ssg-sebool_daemons_dump_core_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_ssh_agent_action:testaction:1 - - Disable the mozilla_plugin_use_gps SELinux Boolean + + Configure ARP filtering for All IPv4 Interfaces - ocil:ssg-sebool_mozilla_plugin_use_gps_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_arp_filter_action:testaction:1 - - Enable poison of pages after freeing + + Verify Group Who Owns Backup shadow File - ocil:ssg-kernel_config_page_poisoning_action:testaction:1 + ocil:ssg-file_owner_backup_etc_shadow_action:testaction:1 - - Uninstall tuned Package + + Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - ocil:ssg-package_tuned_removed_action:testaction:1 + ocil:ssg-sebool_telepathy_tcp_connect_generic_network_ports_action:testaction:1 - - Enable the httpd_graceful_shutdown SELinux Boolean + + Install the tmux Package - ocil:ssg-sebool_httpd_graceful_shutdown_action:testaction:1 + ocil:ssg-package_tmux_installed_action:testaction:1 - - Verify ip6tables Enabled if Using IPv6 + + Disable the named_write_master_zones SELinux Boolean - ocil:ssg-service_ip6tables_enabled_action:testaction:1 + ocil:ssg-sebool_named_write_master_zones_action:testaction:1 - - Sign kernel modules with SHA-512 + + Enable the xend_run_qemu SELinux Boolean - ocil:ssg-kernel_config_module_sig_sha512_action:testaction:1 + ocil:ssg-sebool_xend_run_qemu_action:testaction:1 - - Ensure gnutls-utils is installed + + Configure System to Forward All Mail For The Root Account - ocil:ssg-package_gnutls-utils_installed_action:testaction:1 + ocil:ssg-postfix_client_configure_mail_alias_action:testaction:1 - - Uninstall avahi Server Package + + Ensure Authentication Required for Single User Mode - ocil:ssg-package_avahi_removed_action:testaction:1 + ocil:ssg-ensure_root_password_configured_action:testaction:1 - - Set type of computer node name logging in audit logs + + Record Successful Access Attempts to Files - open - ocil:ssg-auditd_name_format_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_action:testaction:1 - - Remove Host-Based Authentication Files + + Record Unsuccessful Delete Attempts to Files - rename - ocil:ssg-no_host_based_files_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_rename_action:testaction:1 @@ -358364,172 +358866,172 @@ which the system will be deployed as closely as possible.ocil:ssg-has_nonlocal_mta_action:testaction:1 - - Disable the cobbler_can_network_connect SELinux Boolean + + Ensure the Default C Shell Umask is Set Correctly - ocil:ssg-sebool_cobbler_can_network_connect_action:testaction:1 + ocil:ssg-accounts_umask_etc_csh_cshrc_action:testaction:1 - - Disable the polipo_session_users SELinux Boolean + + Configure A Valid Server Certificate - ocil:ssg-sebool_polipo_session_users_action:testaction:1 + ocil:ssg-httpd_configure_valid_server_cert_action:testaction:1 - - Strong Stack Protector + + Stack Protector buffer overlow detection - ocil:ssg-kernel_config_stackprotector_strong_action:testaction:1 + ocil:ssg-kernel_config_stackprotector_action:testaction:1 - - Enable Postfix Service + + Enable Auditing for Processes Which Start Prior to the Audit Daemon - ocil:ssg-service_postfix_enabled_action:testaction:1 + ocil:ssg-grub2_audit_argument_action:testaction:1 - - Enable the USBGuard Service + + Add nosuid Option to /dev/shm - ocil:ssg-service_usbguard_enabled_action:testaction:1 + ocil:ssg-mount_option_dev_shm_nosuid_action:testaction:1 - - Disable Client Dynamic DNS Updates + + Disable the domain_kernel_load_modules SELinux Boolean - ocil:ssg-network_disable_ddns_interfaces_action:testaction:1 + ocil:ssg-sebool_domain_kernel_load_modules_action:testaction:1 - - Disable PubkeyAuthentication Authentication + + Verify All Account Password Hashes are Shadowed - ocil:ssg-sshd_disable_pubkey_auth_action:testaction:1 + ocil:ssg-accounts_password_all_shadowed_action:testaction:1 - - Install the McAfee Runtime Libraries and Linux Agent + + Enable checks on scatter-gather (SG) table operations - ocil:ssg-install_mcafee_cma_rt_action:testaction:1 + ocil:ssg-kernel_config_debug_sg_action:testaction:1 - - Require Client SMB Packet Signing, if using smbclient + + Configure OpenSSL library to use System Crypto Policy - ocil:ssg-require_smb_client_signing_action:testaction:1 + ocil:ssg-configure_openssl_crypto_policy_action:testaction:1 - - HTTPD Log Files Must Be Owned By Root + + Disable Samba - ocil:ssg-http_configure_log_file_ownership_action:testaction:1 + ocil:ssg-service_smb_disabled_action:testaction:1 - - Ensure yum Removes Previous Package Versions + + Prevent user from disabling the screen lock - ocil:ssg-clean_components_post_updating_action:testaction:1 + ocil:ssg-no_tmux_in_shells_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - open + + Ensure Sudo Logfile Exists - sudo logfile - ocil:ssg-audit_rules_unsuccessful_file_modification_open_action:testaction:1 + ocil:ssg-sudo_custom_logfile_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_update + + Disable hibernation - ocil:ssg-audit_rules_privileged_commands_unix_update_action:testaction:1 + ocil:ssg-kernel_config_hibernation_action:testaction:1 - - Install vim Package + + Record Unsuccessful Permission Changes to Files - fsetxattr - ocil:ssg-package_vim_installed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fsetxattr_action:testaction:1 - - System Audit Logs Must Have Mode 0640 or Less Permissive + + Record Unsuccessful Delete Attempts to Files - unlink - ocil:ssg-file_permissions_var_log_audit_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_unlink_action:testaction:1 - - Disable Bluetooth Service + + Disable the awstats_purge_apache_log_files SELinux Boolean - ocil:ssg-service_bluetooth_disabled_action:testaction:1 + ocil:ssg-sebool_awstats_purge_apache_log_files_action:testaction:1 - - Ensure /opt Located On Separate Partition + + Disable the virt_use_fusefs SELinux Boolean - ocil:ssg-partition_for_opt_action:testaction:1 + ocil:ssg-sebool_virt_use_fusefs_action:testaction:1 - - Install the OpenSSH Server Package + + Set LogLevel to INFO - ocil:ssg-package_openssh-server_installed_action:testaction:1 + ocil:ssg-sshd_set_loglevel_info_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fsetxattr + + Ensure that chronyd is running under chrony user account - ocil:ssg-audit_rules_dac_modification_fsetxattr_action:testaction:1 + ocil:ssg-chronyd_run_as_chrony_user_action:testaction:1 - - Disable the httpd_use_openstack SELinux Boolean + + Verify ownership of System Login Banner for Remote Connections - ocil:ssg-sebool_httpd_use_openstack_action:testaction:1 + ocil:ssg-file_owner_etc_issue_net_action:testaction:1 - - Verify User Who Owns Backup passwd File + + Verify that Shared Library Files Have Root Ownership - ocil:ssg-file_owner_backup_etc_passwd_action:testaction:1 + ocil:ssg-file_ownership_library_dirs_action:testaction:1 - - Ensure sudo Ignores Commands In Current Dir - sudo ignore_dot + + Verify Group Who Owns cron.daily - ocil:ssg-sudo_add_ignore_dot_action:testaction:1 + ocil:ssg-file_groupowner_cron_daily_action:testaction:1 - - Ensure all users last password change date is in the past + + Configure the tmux lock session key binding - ocil:ssg-accounts_password_last_change_is_in_past_action:testaction:1 + ocil:ssg-configure_tmux_lock_keybinding_action:testaction:1 - - Disable the secure_mode_policyload SELinux Boolean + + Disable named Service - ocil:ssg-sebool_secure_mode_policyload_action:testaction:1 + ocil:ssg-service_named_disabled_action:testaction:1 - - Install dnf-automatic Package + + Disable the httpd_execmem SELinux Boolean - ocil:ssg-package_dnf-automatic_installed_action:testaction:1 + ocil:ssg-sebool_httpd_execmem_action:testaction:1 - - Disable Cockpit Management Server + + Ensure Web Content Located on Separate partition - ocil:ssg-service_cockpit_disabled_action:testaction:1 + ocil:ssg-partition_for_web_content_action:testaction:1 - - Configure GnuTLS library to use DoD-approved TLS Encryption + + Disable WIFI Network Notification in GNOME3 - ocil:ssg-configure_gnutls_tls_crypto_policy_action:testaction:1 + ocil:ssg-dconf_gnome_disable_wifi_notification_action:testaction:1 - - Ensure the Default Umask is Set Correctly in login.defs + + Ensure /var/log Located On Separate Partition - ocil:ssg-accounts_umask_etc_login_defs_action:testaction:1 + ocil:ssg-partition_for_var_log_action:testaction:1 @@ -358538,395 +359040,394 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_abrt_upload_watch_anon_write_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User + + Disable Squid - ocil:ssg-audit_rules_file_deletion_events_action:testaction:1 + ocil:ssg-service_squid_disabled_action:testaction:1 - - UEFI Boot Loader Is Not Installed On Removeable Media + + Restrict Serial Port Root Logins - ocil:ssg-uefi_no_removeable_media_action:testaction:1 + ocil:ssg-restrict_serial_port_logins_action:testaction:1 - - Configure System to Forward All Mail For The Root Account + + Record Successful Access Attempts to Files - openat - ocil:ssg-postfix_client_configure_mail_alias_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_action:testaction:1 - - Enable Kernel Parameter to Log Martian Packets on all IPv4 Interfaces + + Install sudo Package - ocil:ssg-sysctl_net_ipv4_conf_all_log_martians_action:testaction:1 + ocil:ssg-package_sudo_installed_action:testaction:1 - - Disable the git_session_users SELinux Boolean + + Configure auditd Disk Error Action on Disk Error - ocil:ssg-sebool_git_session_users_action:testaction:1 + ocil:ssg-auditd_data_disk_error_action_stig_action:testaction:1 - - Disable the virt_use_nfs SELinux Boolean + + Record Successful Permission Changes to Files - removexattr - ocil:ssg-sebool_virt_use_nfs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_removexattr_action:testaction:1 - - Verify the system-wide library files in directories -"/lib", "/lib64", "/usr/lib/" and "/usr/lib64" are group-owned by root. + + Disable Web Content Symbolic Links - ocil:ssg-root_permissions_syslibrary_files_action:testaction:1 + ocil:ssg-httpd_disable_content_symlinks_action:testaction:1 - - Configure the tmux lock session key binding + + Disable the virt_use_comm SELinux Boolean - ocil:ssg-configure_tmux_lock_keybinding_action:testaction:1 + ocil:ssg-sebool_virt_use_comm_action:testaction:1 - - Disable GNOME3 Automount running + + Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check - ocil:ssg-dconf_gnome_disable_autorun_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_pam_timestamp_check_action:testaction:1 - - Disable the openvpn_can_network_connect SELinux Boolean + + Disable the cluster_use_execmem SELinux Boolean - ocil:ssg-sebool_openvpn_can_network_connect_action:testaction:1 + ocil:ssg-sebool_cluster_use_execmem_action:testaction:1 - - Verify Group Who Owns /etc/cron.allow file + + Ensure auditd Collects Information on the Use of Privileged Commands - reboot - ocil:ssg-file_groupowner_cron_allow_action:testaction:1 + ocil:ssg-audit_privileged_commands_reboot_action:testaction:1 - - Enable SSH Warning Banner + + Ensure sudo only includes the default configuration directory - ocil:ssg-sshd_enable_warning_banner_net_action:testaction:1 + ocil:ssg-sudoers_default_includedir_action:testaction:1 - - Install binutils Package + + Record Events that Modify the System's Discretionary Access Controls - fchmodat - ocil:ssg-package_binutils_installed_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchmodat_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - ssh-keysign + + Enable the staff_exec_content SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_ssh_keysign_action:testaction:1 + ocil:ssg-sebool_staff_exec_content_action:testaction:1 - - Disable the cluster_manage_all_files SELinux Boolean + + Restrict usage of ptrace to descendant processes - ocil:ssg-sebool_cluster_manage_all_files_action:testaction:1 + ocil:ssg-sysctl_kernel_yama_ptrace_scope_action:testaction:1 - - Disable Dovecot Service + + Uninstall python3-abrt-addon Package - ocil:ssg-service_dovecot_disabled_action:testaction:1 + ocil:ssg-package_python3-abrt-addon_removed_action:testaction:1 - - Verify the SSH Private Key Files Have a Passcode + + Verify Permissions on shadow File - ocil:ssg-ssh_keys_passphrase_protected_action:testaction:1 + ocil:ssg-file_permissions_etc_shadow_action:testaction:1 - - Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. + + Enable module signature verification - ocil:ssg-fapolicy_default_deny_action:testaction:1 + ocil:ssg-kernel_config_module_sig_action:testaction:1 - - Disable Ctrl-Alt-Del Reboot Activation + + Verify User Who Owns Backup group File - ocil:ssg-disable_ctrlaltdel_reboot_action:testaction:1 + ocil:ssg-file_owner_backup_etc_group_action:testaction:1 - - Ensure journald is configured to compress large log files + + Uninstall tftp-server Package - ocil:ssg-journald_compress_action:testaction:1 + ocil:ssg-package_tftp-server_removed_action:testaction:1 - - Configure the Use of the pam_faillock.so Module in the /etc/pam.d/system-auth File. + + Disable the uvcvideo module - ocil:ssg-account_password_pam_faillock_system_auth_action:testaction:1 + ocil:ssg-kernel_module_uvcvideo_disabled_action:testaction:1 - - Set configuration for loopback traffic + + Ensure All Groups on the System Have Unique Group Names - ocil:ssg-set_loopback_traffic_action:testaction:1 + ocil:ssg-group_unique_name_action:testaction:1 - - Verify Group Who Owns /var/log/messages File + + Configure auditing of loading and unloading of kernel modules - ocil:ssg-file_groupowner_var_log_messages_action:testaction:1 + ocil:ssg-audit_module_load_action:testaction:1 - - Enable the dbadm_exec_content SELinux Boolean + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces - ocil:ssg-sebool_dbadm_exec_content_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_max_addresses_action:testaction:1 - - Audit Tools Must Be Owned by Root + + Ensure SELinux Not Disabled in the kernel arguments - ocil:ssg-file_audit_tools_ownership_action:testaction:1 + ocil:ssg-coreos_enable_selinux_kernel_argument_action:testaction:1 - - Restrict usage of ptrace to descendant processes + + Disable the privoxy_connect_any SELinux Boolean - ocil:ssg-sysctl_kernel_yama_ptrace_scope_action:testaction:1 + ocil:ssg-sebool_privoxy_connect_any_action:testaction:1 - - Disable the selinuxuser_execstack SELinux Boolean + + Ensure auditd Collects Information on Kernel Module Unloading - delete_module - ocil:ssg-sebool_selinuxuser_execstack_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_delete_action:testaction:1 - - Add nosuid Option to /var/tmp + + Detect stack corruption on calls to schedule() - ocil:ssg-mount_option_var_tmp_nosuid_action:testaction:1 + ocil:ssg-kernel_config_sched_stack_end_check_action:testaction:1 - - Configure The Number of Allowed Simultaneous Requests + + Disable Kernel Parameter for Accepting Source-Routed Packets on IPv4 Interfaces by Default - ocil:ssg-httpd_configure_max_keepalive_requests_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_accept_source_route_action:testaction:1 - - Ensure syslog-ng is Installed + + Disable the mysql_connect_any SELinux Boolean - ocil:ssg-package_syslogng_installed_action:testaction:1 + ocil:ssg-sebool_mysql_connect_any_action:testaction:1 - - Disable Network Console (netconsole) + + Configure auditing of unsuccessful file deletions - ocil:ssg-service_netconsole_disabled_action:testaction:1 + ocil:ssg-audit_delete_failed_action:testaction:1 - - Uninstall xinetd Package + + Record Successful Creation Attempts to Files - open O_CREAT - ocil:ssg-package_xinetd_removed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_o_creat_action:testaction:1 - - Verify that All World-Writable Directories Have Sticky Bits Set + + Ensure the default plugins for the audit dispatcher are Installed - ocil:ssg-dir_perms_world_writable_sticky_bits_action:testaction:1 + ocil:ssg-package_audit-audispd-plugins_installed_action:testaction:1 - - Uninstall Automatic Bug Reporting Tool (abrt) + + Enable SSH Warning Banner - ocil:ssg-package_abrt_removed_action:testaction:1 + ocil:ssg-sshd_enable_warning_banner_action:testaction:1 - - Disable the xguest_use_bluetooth SELinux Boolean + + Install dnf-plugin-subscription-manager Package - ocil:ssg-sebool_xguest_use_bluetooth_action:testaction:1 + ocil:ssg-package_dnf-plugin-subscription-manager_installed_action:testaction:1 - - Configure auditing of loading and unloading of kernel modules + + Enable the NTP Daemon - ocil:ssg-audit_module_load_action:testaction:1 + ocil:ssg-service_ntp_enabled_action:testaction:1 - - Add nosuid Option to /srv + + Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config - ocil:ssg-mount_option_srv_nosuid_action:testaction:1 + ocil:ssg-harden_sshd_macs_openssh_conf_crypto_policy_action:testaction:1 - - Disable Modprobe Loading of USB Storage Driver + + Record Events that Modify the System's Discretionary Access Controls - lchown - ocil:ssg-kernel_module_usb-storage_disabled_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lchown_action:testaction:1 - - Enable the fips_mode SELinux Boolean + + Disable DCCP Support - ocil:ssg-sebool_fips_mode_action:testaction:1 + ocil:ssg-kernel_module_dccp_disabled_action:testaction:1 - - Set Password Hashing Rounds in /etc/login.defs + + Configure PAM in SSSD Services - ocil:ssg-set_password_hashing_min_rounds_logindefs_action:testaction:1 + ocil:ssg-sssd_enable_pam_services_action:testaction:1 - - Disable the squid_use_tproxy SELinux Boolean + + Enable logrotate Timer - ocil:ssg-sebool_squid_use_tproxy_action:testaction:1 + ocil:ssg-timer_logrotate_enabled_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow + + Scan All Uploaded Content for Malicious Software - ocil:ssg-audit_rules_etc_shadow_open_by_handle_at_action:testaction:1 + ocil:ssg-httpd_antivirus_scan_uploads_action:testaction:1 - - Ensure PAM password complexity module is enabled in system-auth + + Uninstall abrt-addon-ccpp Package - ocil:ssg-accounts_password_pam_pwquality_system_auth_action:testaction:1 + ocil:ssg-package_abrt-addon-ccpp_removed_action:testaction:1 - - Ensure journald is configured to send logs to rsyslog + + Add noexec Option to /dev/shm - ocil:ssg-journald_forward_to_syslog_action:testaction:1 + ocil:ssg-mount_option_dev_shm_noexec_action:testaction:1 - - Disable the IPv6 protocol + + Kernel panic oops - ocil:ssg-kernel_config_ipv6_action:testaction:1 + ocil:ssg-kernel_config_panic_on_oops_action:testaction:1 - - Configure session renegotiation for SSH client + + Uninstall avahi-autoipd Server Package - ocil:ssg-ssh_client_rekey_limit_action:testaction:1 + ocil:ssg-package_avahi-autoipd_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - passwd + + Record Unsuccessful Access Attempts to Files - open_by_handle_at - ocil:ssg-audit_rules_privileged_commands_passwd_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_action:testaction:1 - - Require Authentication for Single User Mode + + Disable the samba_load_libgfapi SELinux Boolean - ocil:ssg-require_singleuser_auth_action:testaction:1 + ocil:ssg-sebool_samba_load_libgfapi_action:testaction:1 - - Use Only FIPS 140-2 Validated Ciphers + + Disable Red Hat Subscription Manager Daemon (rhsmcertd) - ocil:ssg-sshd_use_approved_ciphers_action:testaction:1 + ocil:ssg-service_rhsmcertd_disabled_action:testaction:1 - - Set Lockout Time for Failed Password Attempts + + Disable the virt_sandbox_use_netlink SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_unlock_time_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_netlink_action:testaction:1 - - Ensure Red Hat GPG Key Installed + + Enable the nscd_use_shm SELinux Boolean - ocil:ssg-ensure_redhat_gpgkey_installed_action:testaction:1 + ocil:ssg-sebool_nscd_use_shm_action:testaction:1 - - Disable the gpg_web_anon_write SELinux Boolean + + Disable the httpd_setrlimit SELinux Boolean - ocil:ssg-sebool_gpg_web_anon_write_action:testaction:1 + ocil:ssg-sebool_httpd_setrlimit_action:testaction:1 - - Enforce Spectre v2 mitigation + + Install the Policy Auditor (PA) Module - ocil:ssg-grub2_spectre_v2_argument_action:testaction:1 + ocil:ssg-install_mcafee_hbss_pa_action:testaction:1 - - Ensure Software Patches Installed + + Enable Logging of All FTP Transactions - ocil:ssg-security_patches_up_to_date_action:testaction:1 + ocil:ssg-ftp_log_transactions_action:testaction:1 - - Enable the xend_run_blktap SELinux Boolean + + Install policycoreutils Package - ocil:ssg-sebool_xend_run_blktap_action:testaction:1 + ocil:ssg-package_policycoreutils_installed_action:testaction:1 - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces + + Record Events that Modify User/Group Information via open syscall - /etc/group - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_action:testaction:1 + ocil:ssg-audit_rules_etc_group_open_action:testaction:1 - - Record Successful Creation Attempts to Files - open_by_handle_at O_TRUNC_WRITE + + Verify Ownership on SSH Server Public *.pub Key Files - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 + ocil:ssg-file_ownership_sshd_pub_key_action:testaction:1 - - Disable vsyscall mapping + + Verify ip6tables Enabled if Using IPv6 - ocil:ssg-kernel_config_legacy_vsyscall_none_action:testaction:1 + ocil:ssg-service_ip6tables_enabled_action:testaction:1 - - Verify Group Who Owns cron.hourly + + Ensure No Device Files are Unlabeled by SELinux - ocil:ssg-file_groupowner_cron_hourly_action:testaction:1 + ocil:ssg-selinux_all_devicefiles_labeled_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - chmod + + SSH server uses strong entropy to seed - ocil:ssg-audit_rules_dac_modification_chmod_action:testaction:1 + ocil:ssg-sshd_use_strong_rng_action:testaction:1 - - Disable GSSAPI Authentication + + Remove tftp Daemon - ocil:ssg-sshd_disable_gssapi_auth_action:testaction:1 + ocil:ssg-package_tftp_removed_action:testaction:1 - - Disable DHCP Client in ifcfg + + Install firewalld Package - ocil:ssg-sysconfig_networking_bootproto_ifcfg_action:testaction:1 + ocil:ssg-package_firewalld_installed_action:testaction:1 - - Disable the puppetmaster_use_db SELinux Boolean + + Set type of computer node name logging in audit logs - ocil:ssg-sebool_puppetmaster_use_db_action:testaction:1 + ocil:ssg-auditd_name_format_action:testaction:1 - - Uninstall squid Package + + Remove ftp Package - ocil:ssg-package_squid_removed_action:testaction:1 + ocil:ssg-package_ftp_removed_action:testaction:1 - - Ensure /usr Located On Separate Partition + + Disable the xen_use_nfs SELinux Boolean - ocil:ssg-partition_for_usr_action:testaction:1 + ocil:ssg-sebool_xen_use_nfs_action:testaction:1 @@ -358935,267 +359436,273 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_ftpd_use_nfs_action:testaction:1 - - Enable the unconfined_login SELinux Boolean + + Lock Accounts Must Persist - ocil:ssg-sebool_unconfined_login_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_dir_action:testaction:1 - - Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces by Default + + Enable TCP/IP syncookie support - ocil:ssg-sysctl_net_ipv4_conf_default_send_redirects_action:testaction:1 + ocil:ssg-kernel_config_syn_cookies_action:testaction:1 - - Install scap-security-guide Package + + Disable the nagios_run_sudo SELinux Boolean - ocil:ssg-package_scap-security-guide_installed_action:testaction:1 + ocil:ssg-sebool_nagios_run_sudo_action:testaction:1 - - Ensure gpgcheck Enabled for Local Packages + + Ensure all zIPL boot entries are BLS compliant - ocil:ssg-ensure_gpgcheck_local_packages_action:testaction:1 + ocil:ssg-zipl_bls_entries_only_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - unlink + + MIME types for csh or sh shell programs must be disabled - ocil:ssg-audit_rules_unsuccessful_file_modification_unlink_action:testaction:1 + ocil:ssg-httpd_disable_mime_types_action:testaction:1 - - Enable page allocator poisoning in zIPL + + Add nosuid Option to /opt - ocil:ssg-zipl_page_poison_argument_action:testaction:1 + ocil:ssg-mount_option_opt_nosuid_action:testaction:1 - - Uninstall DHCP Server Package + + Verify Group Who Owns /var/log/messages File - ocil:ssg-package_dhcp_removed_action:testaction:1 + ocil:ssg-file_groupowner_var_log_messages_action:testaction:1 - - Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config + + Disable ypbind Service - ocil:ssg-harden_sshd_macs_opensshserver_conf_crypto_policy_action:testaction:1 + ocil:ssg-service_ypbind_disabled_action:testaction:1 - - Verify Ownership on SSH Server Public *.pub Key Files + + Ensure auditd Collects File Deletion Events by User - rmdir - ocil:ssg-file_ownership_sshd_pub_key_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_rmdir_action:testaction:1 - - Disable the GNOME3 Login Restart and Shutdown Buttons + + Set the GNOME3 Login Number of Failures - ocil:ssg-dconf_gnome_disable_restart_shutdown_action:testaction:1 + ocil:ssg-dconf_gnome_login_retries_action:testaction:1 - - Ensure SELinux Not Disabled in /etc/default/grub + + Specify the hash to use when signing modules - ocil:ssg-grub2_enable_selinux_action:testaction:1 + ocil:ssg-kernel_config_module_sig_hash_action:testaction:1 - - Ensure rsyslog-gnutls is installed + + Record Unsuccessful Permission Changes to Files - removexattr - ocil:ssg-package_rsyslog-gnutls_installed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_removexattr_action:testaction:1 - - Enable Process Accounting (psacct) + + Configure auditd flush priority - ocil:ssg-service_psacct_enabled_action:testaction:1 + ocil:ssg-auditd_data_retention_flush_action:testaction:1 - - Disable the exim_can_connect_db SELinux Boolean + + Verify Group Who Owns group File - ocil:ssg-sebool_exim_can_connect_db_action:testaction:1 + ocil:ssg-file_groupowner_etc_group_action:testaction:1 - - Disable the logging_syslogd_can_sendmail SELinux Boolean + + Disable the openshift_use_nfs SELinux Boolean - ocil:ssg-sebool_logging_syslogd_can_sendmail_action:testaction:1 + ocil:ssg-sebool_openshift_use_nfs_action:testaction:1 - - The Chrony package is installed + + Disable GNOME3 Automounting - ocil:ssg-package_chrony_installed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_automount_action:testaction:1 - - Force frequent session key renegotiation + + Install the psacct package - ocil:ssg-sshd_rekey_limit_action:testaction:1 + ocil:ssg-package_psacct_installed_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - openat O_CREAT + + Add nodev Option to /var/log - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_creat_action:testaction:1 + ocil:ssg-mount_option_var_log_nodev_action:testaction:1 - - Disable the mpd_use_nfs SELinux Boolean + + Ensure rsyslog is Installed - ocil:ssg-sebool_mpd_use_nfs_action:testaction:1 + ocil:ssg-package_rsyslog_installed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown + + Disable the httpd_dbus_sssd SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_pt_chown_action:testaction:1 + ocil:ssg-sebool_httpd_dbus_sssd_action:testaction:1 - - Disable the cvs_read_shadow SELinux Boolean + + Ensure SSH MaxStartups is configured - ocil:ssg-sebool_cvs_read_shadow_action:testaction:1 + ocil:ssg-sshd_set_maxstartups_action:testaction:1 - - Limit Password Reuse + + Force kernel panic on uncorrected MCEs - ocil:ssg-accounts_password_pam_unix_remember_action:testaction:1 + ocil:ssg-grub2_mce_argument_action:testaction:1 - - Ensure debug-shell service is not enabled in zIPL + + Disable the puppetagent_manage_all_files SELinux Boolean - ocil:ssg-zipl_systemd_debug-shell_argument_absent_action:testaction:1 + ocil:ssg-sebool_puppetagent_manage_all_files_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - chown + + Disable the ftpd_connect_all_unreserved SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_chown_action:testaction:1 + ocil:ssg-sebool_ftpd_connect_all_unreserved_action:testaction:1 - - Verify Permissions on group File + + Ensure Remote Administrative Access Is Encrypted - ocil:ssg-file_permissions_etc_group_action:testaction:1 + ocil:ssg-httpd_configure_remote_session_encryption_action:testaction:1 - - Record Successful Creation Attempts to Files - open_by_handle_at O_CREAT + + Record Successful Permission Changes to Files - chmod - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_creat_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_chmod_action:testaction:1 - - Record Successful Permission Changes to Files - fchmod + + Disable Kernel Parameter for Accepting Source-Routed Packets on IPv6 Interfaces by Default - ocil:ssg-audit_rules_successful_file_modification_fchmod_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_source_route_action:testaction:1 - - Ensure Rsyslog Encrypts Off-Loaded Audit Records + + Set PAM''s Password Hashing Algorithm - ocil:ssg-rsyslog_encrypt_offload_defaultnetstreamdriver_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_systemauth_action:testaction:1 - - Disable the virt_use_sanlock SELinux Boolean + + Enable the unconfined_chrome_sandbox_transition SELinux Boolean - ocil:ssg-sebool_virt_use_sanlock_action:testaction:1 + ocil:ssg-sebool_unconfined_chrome_sandbox_transition_action:testaction:1 - - Verify Permissions on /var/log Directory + + Record Events that Modify the System's Discretionary Access Controls - lsetxattr - ocil:ssg-file_permissions_var_log_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lsetxattr_action:testaction:1 - - Record Successful Ownership Changes to Files - fchown + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd - ocil:ssg-audit_rules_successful_file_modification_fchown_action:testaction:1 + ocil:ssg-audit_rules_etc_passwd_open_by_handle_at_action:testaction:1 - - Add noexec Option to /dev/shm + + Configure audispd's Plugin disk_full_action When Disk Is Full - ocil:ssg-mount_option_dev_shm_noexec_action:testaction:1 + ocil:ssg-auditd_audispd_disk_full_action_action:testaction:1 - - Configure auditing of unsuccessful file deletions + + Ensure There Are No Accounts With Blank or Null Passwords - ocil:ssg-audit_delete_failed_action:testaction:1 + ocil:ssg-no_empty_passwords_etc_shadow_action:testaction:1 - - The Installed Operating System Is Vendor Supported + + Disable the httpd_use_openstack SELinux Boolean - ocil:ssg-installed_OS_is_vendor_supported_action:testaction:1 + ocil:ssg-sebool_httpd_use_openstack_action:testaction:1 - - Install sudo Package + + Verify ownership of System Login Banner - ocil:ssg-package_sudo_installed_action:testaction:1 + ocil:ssg-file_owner_etc_issue_action:testaction:1 - - Disable the fenced_can_network_connect SELinux Boolean + + Record Unsuccessful Modification Attempts to Files - open O_TRUNC_WRITE - ocil:ssg-sebool_fenced_can_network_connect_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_trunc_write_action:testaction:1 - - Uninstall CUPS Package + + Uninstall libreport-plugin-rhtsupport Package - ocil:ssg-package_cups_removed_action:testaction:1 + ocil:ssg-package_libreport-plugin-rhtsupport_removed_action:testaction:1 - - Record Any Attempts to Run setfiles + + Enable Kernel Parameter to Ignore ICMP Broadcast Echo Requests on IPv4 Interfaces - ocil:ssg-audit_rules_execution_setfiles_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_icmp_echo_ignore_broadcasts_action:testaction:1 - - Set Default ip6tables Policy for Incoming Packets + + Verify Root Has A Primary GID 0 - ocil:ssg-set_ip6tables_default_rule_action:testaction:1 + ocil:ssg-accounts_root_gid_zero_action:testaction:1 - - Disable the virt_sandbox_use_all_caps SELinux Boolean + + Verify firewalld Enabled - ocil:ssg-sebool_virt_sandbox_use_all_caps_action:testaction:1 + ocil:ssg-service_firewalld_enabled_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/group + + Configure AIDE to Use FIPS 140-2 for Validating Hashes - ocil:ssg-audit_rules_etc_group_openat_action:testaction:1 + ocil:ssg-aide_use_fips_hashes_action:testaction:1 - - Disable the selinuxuser_use_ssh_chroot SELinux Boolean + + Drop Gratuitious ARP frames on All IPv4 Interfaces - ocil:ssg-sebool_selinuxuser_use_ssh_chroot_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_drop_gratuitous_arp_action:testaction:1 - - Enable GNOME3 Screensaver Idle Activation + + Disable the ftpd_use_passive_mode SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_idle_activation_enabled_action:testaction:1 + ocil:ssg-sebool_ftpd_use_passive_mode_action:testaction:1 + + + + Verify Permissions on /var/log Directory + + ocil:ssg-file_permissions_var_log_action:testaction:1 - + PASS @@ -359203,7 +359710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359211,7 +359718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359219,7 +359726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359227,7 +359734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359235,7 +359742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359243,7 +359750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359251,7 +359758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359259,7 +359766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359267,7 +359774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359275,7 +359782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359283,7 +359790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359291,7 +359798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359299,7 +359806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359307,7 +359814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359315,7 +359822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359323,7 +359830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359331,7 +359838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359339,7 +359846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359347,7 +359854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359355,7 +359862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359363,7 +359870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359371,7 +359878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359379,7 +359886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359387,7 +359894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359395,7 +359902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359403,7 +359910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359411,7 +359918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359419,7 +359926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359427,7 +359934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359435,7 +359942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359443,7 +359950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359451,7 +359958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359459,7 +359966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359467,7 +359974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359475,7 +359982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359483,7 +359990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359491,7 +359998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359499,7 +360006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359507,7 +360014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359515,7 +360022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359523,7 +360030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359531,7 +360038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359539,7 +360046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359547,7 +360054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359555,7 +360062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359563,7 +360070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359571,7 +360078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359579,7 +360086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359587,7 +360094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359595,7 +360102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359603,7 +360110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359611,7 +360118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359619,7 +360126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359627,7 +360134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359635,7 +360142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359643,7 +360150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359651,7 +360158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359659,7 +360166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359667,7 +360174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359675,7 +360182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359683,7 +360190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359691,7 +360198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359699,7 +360206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359707,7 +360214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359715,7 +360222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359723,7 +360230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359731,7 +360238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359739,7 +360246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359747,7 +360254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359755,7 +360262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359763,7 +360270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359771,7 +360278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359779,7 +360286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359787,7 +360294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359795,7 +360302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359803,7 +360310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359811,7 +360318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359819,7 +360326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359827,7 +360334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359835,7 +360342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359843,7 +360350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359851,7 +360358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359859,7 +360366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359867,7 +360374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359875,7 +360382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359883,7 +360390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359891,7 +360398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359899,7 +360406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359907,7 +360414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359915,7 +360422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359923,7 +360430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359931,7 +360438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359939,7 +360446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359947,7 +360454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359955,7 +360462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359963,7 +360470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359971,7 +360478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359979,7 +360486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359987,7 +360494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359995,7 +360502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360003,7 +360510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360011,7 +360518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360019,7 +360526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360027,7 +360534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360035,7 +360542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360043,7 +360550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360051,7 +360558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360059,7 +360566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360067,7 +360574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360075,7 +360582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360083,7 +360590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360091,7 +360598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360099,7 +360606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360107,7 +360614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360115,7 +360622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360123,7 +360630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360131,7 +360638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360139,7 +360646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360147,7 +360654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360155,7 +360662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360163,7 +360670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360171,7 +360678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360179,7 +360686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360187,7 +360694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360195,7 +360702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360203,7 +360710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360211,7 +360718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360219,7 +360726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360227,7 +360734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360235,7 +360742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360243,7 +360750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360251,7 +360758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360259,7 +360766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360267,7 +360774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360275,7 +360782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360283,7 +360790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360291,7 +360798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360299,7 +360806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360307,7 +360814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360315,7 +360822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360323,7 +360830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360331,7 +360838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360339,7 +360846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360347,7 +360854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360355,7 +360862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360363,7 +360870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360371,7 +360878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360379,7 +360886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360387,7 +360894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360395,7 +360902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360403,7 +360910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360411,7 +360918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360419,7 +360926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360427,7 +360934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360435,7 +360942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360443,7 +360950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360451,7 +360958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360459,7 +360966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360467,7 +360974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360475,7 +360982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360483,7 +360990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360491,7 +360998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360499,7 +361006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360507,7 +361014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360515,7 +361022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360523,7 +361030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360531,7 +361038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360539,7 +361046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360547,7 +361054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360555,7 +361062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360563,7 +361070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360571,7 +361078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360579,7 +361086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360587,7 +361094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360595,7 +361102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360603,7 +361110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360611,7 +361118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360619,7 +361126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360627,7 +361134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360635,7 +361142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360643,7 +361150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360651,7 +361158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360659,7 +361166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360667,7 +361174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360675,7 +361182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360683,7 +361190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360691,7 +361198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360699,7 +361206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360707,7 +361214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360715,7 +361222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360723,7 +361230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360731,7 +361238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360739,7 +361246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360747,7 +361254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360755,7 +361262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360763,7 +361270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360771,7 +361278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360779,7 +361286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360787,7 +361294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360795,7 +361302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360803,7 +361310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360811,7 +361318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360819,7 +361326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360827,7 +361334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360835,7 +361342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360843,7 +361350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360851,7 +361358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360859,7 +361366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360867,7 +361374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360875,7 +361382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360883,7 +361390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360891,7 +361398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360899,7 +361406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360907,7 +361414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360915,7 +361422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360923,7 +361430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360931,7 +361438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360939,7 +361446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360947,7 +361454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360955,7 +361462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360963,7 +361470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360971,7 +361478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360979,7 +361486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360987,7 +361494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360995,7 +361502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361003,7 +361510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361011,7 +361518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361019,7 +361526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361027,7 +361534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361035,7 +361542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361043,7 +361550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361051,7 +361558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361059,7 +361566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361067,7 +361574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361075,7 +361582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361083,7 +361590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361091,7 +361598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361099,7 +361606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361107,7 +361614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361115,7 +361622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361123,7 +361630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361131,7 +361638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361139,7 +361646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361147,7 +361654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361155,7 +361662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361163,7 +361670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361171,7 +361678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361179,7 +361686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361187,7 +361694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361195,7 +361702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361203,7 +361710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361211,7 +361718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361219,7 +361726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361227,7 +361734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361235,7 +361742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361243,7 +361750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361251,7 +361758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361259,7 +361766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361267,7 +361774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361275,7 +361782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361283,7 +361790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361291,7 +361798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361299,7 +361806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361307,7 +361814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361315,7 +361822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361323,7 +361830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361331,7 +361838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361339,7 +361846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361347,7 +361854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361355,7 +361862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361363,7 +361870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361371,7 +361878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361379,7 +361886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361387,7 +361894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361395,7 +361902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361403,7 +361910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361411,7 +361918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361419,7 +361926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361427,7 +361934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361435,7 +361942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361443,7 +361950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361451,7 +361958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361459,7 +361966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361467,7 +361974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361475,7 +361982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361483,7 +361990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361491,7 +361998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361499,7 +362006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361507,7 +362014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361515,7 +362022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361523,7 +362030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361531,7 +362038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361539,7 +362046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361547,7 +362054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361555,7 +362062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361563,7 +362070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361571,7 +362078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361579,7 +362086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361587,7 +362094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361595,7 +362102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361603,7 +362110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361611,7 +362118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361619,7 +362126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361627,7 +362134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361635,7 +362142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361643,7 +362150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361651,7 +362158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361659,7 +362166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361667,7 +362174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361675,7 +362182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361683,7 +362190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361691,7 +362198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361699,7 +362206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361707,7 +362214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361715,7 +362222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361723,7 +362230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361731,7 +362238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361739,7 +362246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361747,7 +362254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361755,7 +362262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361763,7 +362270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361771,7 +362278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361779,7 +362286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361787,7 +362294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361795,7 +362302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361803,7 +362310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361811,7 +362318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361819,7 +362326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361827,7 +362334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361835,7 +362342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361843,7 +362350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361851,7 +362358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361859,7 +362366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361867,7 +362374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361875,7 +362382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361883,7 +362390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361891,7 +362398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361899,7 +362406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361907,7 +362414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361915,7 +362422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361923,7 +362430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361931,7 +362438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361939,7 +362446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361947,7 +362454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361955,7 +362462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361963,7 +362470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361971,7 +362478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361979,7 +362486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361987,7 +362494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361995,7 +362502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362003,7 +362510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362011,7 +362518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362019,7 +362526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362027,7 +362534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362035,7 +362542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362043,7 +362550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362051,7 +362558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362059,7 +362566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362067,7 +362574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362075,7 +362582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362083,7 +362590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362091,7 +362598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362099,7 +362606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362107,7 +362614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362115,7 +362622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362123,7 +362630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362131,7 +362638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362139,7 +362646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362147,7 +362654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362155,7 +362662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362163,7 +362670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362171,7 +362678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362179,7 +362686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362187,7 +362694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362195,7 +362702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362203,7 +362710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362211,7 +362718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362219,7 +362726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362227,7 +362734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362235,7 +362742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362243,7 +362750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362251,7 +362758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362259,7 +362766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362267,7 +362774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362275,7 +362782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362283,7 +362790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362291,7 +362798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362299,7 +362806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362307,7 +362814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362315,7 +362822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362323,7 +362830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362331,7 +362838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362339,7 +362846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362347,7 +362854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362355,7 +362862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362363,7 +362870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362371,7 +362878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362379,7 +362886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362387,7 +362894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362395,7 +362902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362403,7 +362910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362411,7 +362918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362419,7 +362926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362427,7 +362934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362435,7 +362942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362443,7 +362950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362451,7 +362958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362459,7 +362966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362467,7 +362974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362475,7 +362982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362483,7 +362990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362491,7 +362998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362499,7 +363006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362507,7 +363014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362515,7 +363022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362523,7 +363030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362531,7 +363038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362539,7 +363046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362547,7 +363054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362555,7 +363062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362563,7 +363070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362571,7 +363078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362579,7 +363086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362587,7 +363094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362595,7 +363102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362603,7 +363110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362611,7 +363118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362619,7 +363126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362627,7 +363134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362635,7 +363142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362643,7 +363150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362651,7 +363158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362659,7 +363166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362667,7 +363174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362675,7 +363182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362683,7 +363190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362691,7 +363198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362699,7 +363206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362707,7 +363214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362715,7 +363222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362723,7 +363230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362731,7 +363238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362739,7 +363246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362747,7 +363254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362755,7 +363262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362763,7 +363270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362771,7 +363278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362779,7 +363286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362787,7 +363294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362795,7 +363302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362803,7 +363310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362811,7 +363318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362819,7 +363326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362827,7 +363334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362835,7 +363342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362843,7 +363350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362851,7 +363358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362859,7 +363366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362867,7 +363374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362875,7 +363382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362883,7 +363390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362891,7 +363398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362899,7 +363406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362907,7 +363414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362915,7 +363422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362923,7 +363430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362931,7 +363438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362939,7 +363446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362947,7 +363454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362955,7 +363462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362963,7 +363470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362971,7 +363478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362979,7 +363486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362987,7 +363494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362995,7 +363502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363003,7 +363510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363011,7 +363518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363019,7 +363526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363027,7 +363534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363035,7 +363542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363043,7 +363550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363051,7 +363558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363059,7 +363566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363067,7 +363574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363075,7 +363582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363083,7 +363590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363091,7 +363598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363099,7 +363606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363107,7 +363614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363115,7 +363622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363123,7 +363630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363131,7 +363638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363139,7 +363646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363147,7 +363654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363155,7 +363662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363163,7 +363670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363171,7 +363678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363179,7 +363686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363187,7 +363694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363195,7 +363702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363203,7 +363710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363211,7 +363718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363219,7 +363726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363227,7 +363734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363235,7 +363742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363243,7 +363750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363251,7 +363758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363259,7 +363766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363267,7 +363774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363275,7 +363782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363283,7 +363790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363291,7 +363798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363299,7 +363806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363307,7 +363814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363315,7 +363822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363323,7 +363830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363331,7 +363838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363339,7 +363846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363347,7 +363854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363355,7 +363862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363363,7 +363870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363371,7 +363878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363379,7 +363886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363387,7 +363894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363395,7 +363902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363403,7 +363910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363411,7 +363918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363419,7 +363926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363427,7 +363934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363435,7 +363942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363443,7 +363950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363451,7 +363958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363459,7 +363966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363467,7 +363974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363475,7 +363982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363483,7 +363990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363491,7 +363998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363499,7 +364006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363507,7 +364014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363515,7 +364022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363523,7 +364030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363531,7 +364038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363539,7 +364046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363547,7 +364054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363555,7 +364062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363563,7 +364070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363571,7 +364078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363579,7 +364086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363587,7 +364094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363595,7 +364102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363603,7 +364110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363611,7 +364118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363619,7 +364126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363627,7 +364134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363635,7 +364142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363643,7 +364150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363651,7 +364158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363659,7 +364166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363667,7 +364174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363675,7 +364182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363683,7 +364190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363691,7 +364198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363699,7 +364206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363707,7 +364214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363715,7 +364222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363723,7 +364230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363731,7 +364238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363739,7 +364246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363747,7 +364254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363755,7 +364262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363763,7 +364270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363771,7 +364278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363779,7 +364286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363787,7 +364294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363795,7 +364302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363803,7 +364310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363811,7 +364318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363819,7 +364326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363827,7 +364334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363835,7 +364342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363843,7 +364350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363851,7 +364358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363859,7 +364366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363867,7 +364374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363875,7 +364382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363883,7 +364390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363891,7 +364398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363899,7 +364406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363907,7 +364414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363915,7 +364422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363923,7 +364430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363931,7 +364438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363939,7 +364446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363947,7 +364454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363955,7 +364462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363963,7 +364470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363971,7 +364478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363979,7 +364486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363987,7 +364494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363995,7 +364502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364003,7 +364510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364011,7 +364518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364019,7 +364526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364027,7 +364534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364035,7 +364542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364043,7 +364550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364051,7 +364558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364059,7 +364566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364067,7 +364574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364075,7 +364582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364083,7 +364590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364091,7 +364598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364099,7 +364606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364107,7 +364614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364115,7 +364622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364123,7 +364630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364131,7 +364638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364139,7 +364646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364147,7 +364654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364155,7 +364662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364163,7 +364670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364171,7 +364678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364179,7 +364686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364187,7 +364694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364195,7 +364702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364203,7 +364710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364211,7 +364718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364219,7 +364726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364227,7 +364734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364235,7 +364742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364243,7 +364750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364251,7 +364758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364259,7 +364766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364267,7 +364774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364275,7 +364782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364283,7 +364790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364291,7 +364798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364299,7 +364806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364307,7 +364814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364315,7 +364822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364323,7 +364830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364331,7 +364838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364339,7 +364846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364347,7 +364854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364355,7 +364862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364363,7 +364870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364371,7 +364878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364379,7 +364886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364387,7 +364894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364395,7 +364902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364403,7 +364910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364411,7 +364918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364419,7 +364926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364427,7 +364934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364435,7 +364942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364443,7 +364950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364451,7 +364958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364459,7 +364966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364467,7 +364974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364475,7 +364982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364483,7 +364990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364491,7 +364998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364499,7 +365006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364507,7 +365014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364515,7 +365022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364523,7 +365030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364531,7 +365038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364539,7 +365046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364547,7 +365054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364555,7 +365062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364563,7 +365070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364571,7 +365078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364579,7 +365086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364587,7 +365094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364595,7 +365102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364603,7 +365110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364611,7 +365118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364619,7 +365126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364627,7 +365134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364635,7 +365142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364643,7 +365150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364651,7 +365158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364659,7 +365166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364667,7 +365174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364675,7 +365182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364683,7 +365190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364691,7 +365198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364699,7 +365206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364707,7 +365214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364715,7 +365222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364723,7 +365230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364731,7 +365238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364739,7 +365246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364747,7 +365254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364755,7 +365262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364763,7 +365270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364771,7 +365278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364779,7 +365286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364787,7 +365294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364795,7 +365302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364803,7 +365310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364811,7 +365318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364819,7 +365326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364827,7 +365334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364835,7 +365342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364843,7 +365350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364851,7 +365358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364859,7 +365366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364867,7 +365374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364875,7 +365382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364883,7 +365390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364891,7 +365398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364899,7 +365406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364907,7 +365414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364915,7 +365422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364923,7 +365430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364931,7 +365438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364939,7 +365446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364947,7 +365454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364955,7 +365462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364963,7 +365470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364971,7 +365478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364979,7 +365486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364987,7 +365494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364995,7 +365502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365003,7 +365510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365011,7 +365518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365019,7 +365526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365027,7 +365534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365035,7 +365542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365043,7 +365550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365051,7 +365558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365059,7 +365566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365067,7 +365574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365075,7 +365582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365083,7 +365590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365091,7 +365598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365099,7 +365606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365107,7 +365614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365115,7 +365622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365123,7 +365630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365131,7 +365638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365139,7 +365646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365147,7 +365654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365155,7 +365662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365163,7 +365670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365171,7 +365678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365179,7 +365686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365187,7 +365694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365195,7 +365702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365203,7 +365710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365211,7 +365718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365219,7 +365726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365227,7 +365734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365235,7 +365742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365243,7 +365750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365251,7 +365758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365259,7 +365766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365267,7 +365774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365275,7 +365782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365283,7 +365790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365291,7 +365798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365299,7 +365806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365307,7 +365814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365315,7 +365822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365323,7 +365830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365331,7 +365838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365339,7 +365846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365347,7 +365854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365355,7 +365862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365363,7 +365870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365371,7 +365878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365379,7 +365886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365387,7 +365894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365395,7 +365902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365403,7 +365910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365411,7 +365918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365419,7 +365926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365427,7 +365934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365435,7 +365942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365443,7 +365950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365451,7 +365958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365459,7 +365966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365467,7 +365974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365475,7 +365982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365483,7 +365990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365491,7 +365998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365499,7 +366006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365507,7 +366014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365515,7 +366022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365523,7 +366030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365531,7 +366038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365539,7 +366046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365547,7 +366054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365555,7 +366062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365563,7 +366070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365571,7 +366078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365579,7 +366086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365587,7 +366094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365595,7 +366102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365603,7 +366110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365611,7 +366118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365619,7 +366126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365627,7 +366134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365635,7 +366142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365643,7 +366150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365651,7 +366158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365659,7 +366166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365667,7 +366174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365675,7 +366182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365683,7 +366190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365691,7 +366198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365699,7 +366206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365707,7 +366214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365715,7 +366222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365723,7 +366230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365731,7 +366238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365739,7 +366246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365747,7 +366254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365755,7 +366262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365763,7 +366270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365771,7 +366278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365779,7 +366286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365787,7 +366294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365795,7 +366302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365803,7 +366310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365811,7 +366318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365819,7 +366326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365827,7 +366334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365835,7 +366342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365843,7 +366350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365851,7 +366358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365859,7 +366366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365867,7 +366374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365875,7 +366382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365883,7 +366390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365891,7 +366398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365899,7 +366406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365907,7 +366414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365915,7 +366422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365923,7 +366430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365931,7 +366438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365939,7 +366446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365947,7 +366454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365955,7 +366462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365963,7 +366470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365971,7 +366478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365979,7 +366486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365987,7 +366494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365995,7 +366502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366003,7 +366510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366011,7 +366518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366019,7 +366526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366027,7 +366534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366035,7 +366542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366043,7 +366550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366051,7 +366558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366059,7 +366566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366067,7 +366574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366075,7 +366582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366083,7 +366590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366091,7 +366598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366099,7 +366606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366107,7 +366614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366115,7 +366622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366123,7 +366630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366131,7 +366638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366139,7 +366646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366147,7 +366654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366155,7 +366662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366163,7 +366670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366171,7 +366678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366179,7 +366686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366187,7 +366694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366195,7 +366702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366203,7 +366710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366211,7 +366718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366219,7 +366726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366227,7 +366734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366235,7 +366742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366243,7 +366750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366251,7 +366758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366259,7 +366766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366267,7 +366774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366275,7 +366782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366283,7 +366790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366291,7 +366798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366299,7 +366806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366307,7 +366814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366315,7 +366822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366323,7 +366830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366331,7 +366838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366339,7 +366846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366347,7 +366854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366355,7 +366862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366363,7 +366870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366371,7 +366878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366379,7 +366886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366387,7 +366894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366395,7 +366902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366403,7 +366910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366411,7 +366918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366419,7 +366926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366427,7 +366934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366435,7 +366942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366443,7 +366950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366451,7 +366958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366459,7 +366966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366467,7 +366974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366475,7 +366982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366483,7 +366990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366491,7 +366998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366499,7 +367006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366507,7 +367014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366515,7 +367022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366523,7 +367030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366531,7 +367038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366539,7 +367046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366547,7 +367054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366555,7 +367062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366563,7 +367070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366571,7 +367078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366579,7 +367086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366587,7 +367094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366595,7 +367102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366603,7 +367110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366611,7 +367118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366619,7 +367126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366627,7 +367134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366635,7 +367142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366643,7 +367150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366651,7 +367158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366659,7 +367166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366667,7 +367174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366675,7 +367182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366683,7 +367190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366691,7 +367198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366699,7 +367206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366707,7 +367214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366715,7 +367222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366723,7 +367230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366731,7 +367238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366739,7 +367246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366747,7 +367254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366755,7 +367262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366763,7 +367270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366771,7 +367278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366779,7 +367286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366787,7 +367294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366795,7 +367302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366803,7 +367310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366811,7 +367318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366819,7 +367326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366827,7 +367334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366835,7 +367342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366843,7 +367350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366851,7 +367358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366859,7 +367366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366867,7 +367374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366875,7 +367382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366883,7 +367390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366891,7 +367398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366899,7 +367406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366907,7 +367414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366915,7 +367422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366923,7 +367430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366931,7 +367438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366939,7 +367446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366947,7 +367454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366955,7 +367462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366963,7 +367470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366971,7 +367478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366979,7 +367486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366987,7 +367494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366995,7 +367502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367003,7 +367510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367011,7 +367518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367019,7 +367526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367027,7 +367534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367035,7 +367542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367043,7 +367550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367051,7 +367558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367059,7 +367566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367067,7 +367574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367075,7 +367582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367083,7 +367590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367091,7 +367598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367099,7 +367606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367107,7 +367614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367115,7 +367622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367123,7 +367630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367131,7 +367638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367139,7 +367646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367147,7 +367654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367155,7 +367662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367163,7 +367670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367171,7 +367678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367179,7 +367686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367187,7 +367694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367195,7 +367702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367203,7 +367710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367211,7 +367718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367219,7 +367726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367227,7 +367734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367235,7 +367742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367243,7 +367750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367251,7 +367758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367259,7 +367766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367267,7 +367774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367275,7 +367782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367283,7 +367790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367291,7 +367798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367299,7 +367806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367307,7 +367814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367315,7 +367822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367323,7 +367830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367331,7 +367838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367339,7 +367846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367347,7 +367854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367355,7 +367862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367363,7 +367870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367371,7 +367878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367379,7 +367886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367387,7 +367894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367395,7 +367902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367403,7 +367910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367411,7 +367918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367419,7 +367926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367427,7 +367934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367435,7 +367942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367443,7 +367950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367451,7 +367958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367459,7 +367966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367467,7 +367974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367475,7 +367982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367483,7 +367990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367491,7 +367998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367499,7 +368006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367507,7 +368014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367515,7 +368022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367523,7 +368030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367531,7 +368038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367539,7 +368046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367547,7 +368054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367555,7 +368062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367563,7 +368070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367571,7 +368078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367579,7 +368086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367587,7 +368094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367595,7 +368102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367603,7 +368110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367611,7 +368118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367619,7 +368126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367627,7 +368134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367635,7 +368142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367643,7 +368150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367651,7 +368158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367659,7 +368166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367667,7 +368174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367675,7 +368182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367683,7 +368190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367691,7 +368198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367699,7 +368206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367707,7 +368214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367715,7 +368222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367723,7 +368230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367731,7 +368238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367739,7 +368246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367747,7 +368254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367755,7 +368262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367763,7 +368270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367771,7 +368278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367779,7 +368286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367787,7 +368294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367795,7 +368302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367803,7 +368310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367811,7 +368318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367819,7 +368326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367827,7 +368334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367835,7 +368342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367843,7 +368350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367851,7 +368358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367859,7 +368366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367867,7 +368374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367875,7 +368382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367883,7 +368390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367891,7 +368398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367899,7 +368406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367907,7 +368414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367915,7 +368422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367923,7 +368430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367931,7 +368438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367939,7 +368446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367947,7 +368454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367955,7 +368462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367963,7 +368470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367971,7 +368478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367979,7 +368486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367987,7 +368494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367995,7 +368502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368003,7 +368510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368011,7 +368518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368019,7 +368526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368027,7 +368534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368035,7 +368542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368043,7 +368550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368051,7 +368558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368059,7 +368566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368067,7 +368574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368075,7 +368582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368083,7 +368590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368091,7 +368598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368099,7 +368606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368107,7 +368614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368115,7 +368622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368123,7 +368630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368131,7 +368638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368139,7 +368646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368147,7 +368654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368155,7 +368662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368163,7 +368670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368171,7 +368678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368179,7 +368686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368187,7 +368694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368195,7 +368702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368203,7 +368710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368211,7 +368718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368219,7 +368726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368227,7 +368734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368235,7 +368742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368243,7 +368750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368251,7 +368758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368259,7 +368766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368267,7 +368774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368275,7 +368782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368283,7 +368790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368291,7 +368798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368299,7 +368806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368307,7 +368814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368315,7 +368822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368323,7 +368830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368331,7 +368838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368339,7 +368846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368347,7 +368854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368355,7 +368862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368363,7 +368870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368371,7 +368878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368379,7 +368886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368387,7 +368894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368395,7 +368902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368403,7 +368910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368411,7 +368918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368419,7 +368926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368427,7 +368934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368435,7 +368942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368443,7 +368950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368451,7 +368958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368459,7 +368966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368467,7 +368974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368475,7 +368982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368483,7 +368990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368491,7 +368998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368499,7 +369006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368507,7 +369014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368515,7 +369022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368523,7 +369030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368531,7 +369038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368539,7 +369046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368547,7 +369054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368555,7 +369062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368563,7 +369070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368571,7 +369078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368579,7 +369086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368587,7 +369094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368595,7 +369102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368603,7 +369110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368611,7 +369118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368619,7 +369126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368627,7 +369134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368635,7 +369142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368643,7 +369150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368651,7 +369158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368659,7 +369166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368667,7 +369174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368675,7 +369182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368683,7 +369190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368691,7 +369198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368699,7 +369206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368707,7 +369214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368715,7 +369222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368723,7 +369230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368731,7 +369238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368739,7 +369246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368747,7 +369254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368755,7 +369262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368763,7 +369270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368771,7 +369278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368779,7 +369286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368787,7 +369294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368795,7 +369302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368803,7 +369310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368811,7 +369318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368819,7 +369326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368827,7 +369334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368835,7 +369342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368843,7 +369350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368851,7 +369358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368859,7 +369366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368867,7 +369374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368875,7 +369382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368883,7 +369390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368891,7 +369398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368899,7 +369406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368907,7 +369414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368915,7 +369422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368923,7 +369430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368931,7 +369438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368939,7 +369446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368947,7 +369454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368955,7 +369462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368963,7 +369470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368971,7 +369478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368979,7 +369486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368987,7 +369494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368995,7 +369502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369003,7 +369510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369011,7 +369518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369019,7 +369526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369027,7 +369534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369035,7 +369542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369043,7 +369550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369051,7 +369558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369059,7 +369566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369067,7 +369574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369075,7 +369582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369083,7 +369590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369091,7 +369598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369099,7 +369606,23 @@ which the system will be deployed as closely as possible.FAIL - + + + PASS + + + FAIL + + + + + PASS + + + FAIL + + + PASS @@ -369115,7 +369638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369123,7 +369646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369131,7 +369654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369139,7 +369662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369147,7 +369670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369155,7 +369678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369163,7 +369686,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369171,7 +369694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369179,7 +369702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369187,7 +369710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369195,7 +369718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369203,7 +369726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369211,7 +369734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369219,7 +369742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369227,7 +369750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369235,7 +369758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369243,7 +369766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369251,7 +369774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369259,7 +369782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369267,7 +369790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369275,7 +369798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369283,7 +369806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369291,7 +369814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369299,7 +369822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369307,7 +369830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369315,7 +369838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369323,7 +369846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369331,7 +369854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369339,7 +369862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369347,7 +369870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369355,7 +369878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369363,7 +369886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369371,7 +369894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369379,7 +369902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369387,7 +369910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369395,7 +369918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369403,7 +369926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369411,7 +369934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369419,7 +369942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369427,7 +369950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369435,7 +369958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369443,7 +369966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369451,7 +369974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369459,7 +369982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369467,7 +369990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369475,7 +369998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369483,7 +370006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369491,7 +370014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369499,7 +370022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369507,7 +370030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369515,7 +370038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369523,7 +370046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369531,7 +370054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369539,7 +370062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369547,7 +370070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369555,7 +370078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369563,7 +370086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369571,7 +370094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369579,7 +370102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369587,7 +370110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369595,7 +370118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369611,7 +370134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369619,7 +370142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369627,7 +370150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369635,7 +370158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369643,7 +370166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369651,7 +370174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369659,7 +370182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369667,7 +370190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369675,7 +370198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369683,7 +370206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369691,7 +370214,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369699,7 +370222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369707,7 +370230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369715,7 +370238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369723,7 +370246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369731,7 +370254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369739,7 +370262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369747,7 +370270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369755,7 +370278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369763,7 +370286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369771,7 +370294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369779,7 +370302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369787,7 +370310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369795,7 +370318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369803,7 +370326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369811,7 +370334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369819,7 +370342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369827,7 +370350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369835,7 +370358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369843,7 +370366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369851,7 +370374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369859,7 +370382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369867,7 +370390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369875,7 +370398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369883,7 +370406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369891,7 +370414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369899,7 +370422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369907,7 +370430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369915,7 +370438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369923,7 +370446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369939,7 +370462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369947,7 +370470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369955,7 +370478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369963,7 +370486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369971,7 +370494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369979,7 +370502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369987,7 +370510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369995,7 +370518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370003,7 +370526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370011,7 +370534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370019,7 +370542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370027,7 +370550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370035,7 +370558,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370043,7 +370566,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370051,7 +370574,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370059,7 +370582,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370067,7 +370590,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370075,7 +370598,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370083,7 +370606,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370091,7 +370614,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370099,7 +370622,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370107,7 +370630,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370115,7 +370638,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370123,7 +370646,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370131,7 +370654,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370139,7 +370662,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370147,7 +370670,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370155,7 +370678,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370171,7 +370694,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370179,7 +370702,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370187,7 +370710,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370195,7 +370718,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370203,7 +370726,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370211,7 +370734,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370219,7 +370742,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370227,7 +370750,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370235,7 +370758,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370243,7 +370766,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370251,7 +370774,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370259,7 +370782,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370267,7 +370790,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370275,7 +370798,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370283,7 +370806,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370291,7 +370814,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370299,7 +370822,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370307,7 +370830,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370315,7 +370838,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370323,7 +370846,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370331,7 +370854,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370339,7 +370862,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370347,7 +370870,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370355,7 +370878,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370363,7 +370886,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370371,7 +370894,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370379,7 +370902,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370387,7 +370910,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370395,7 +370918,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370403,7 +370926,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370411,7 +370934,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370419,7 +370942,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370427,7 +370950,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370435,7 +370958,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370443,7 +370966,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370451,7 +370974,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370459,7 +370982,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370467,7 +370990,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370475,7 +370998,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370483,7 +371006,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370491,7 +371014,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370499,7 +371022,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370507,7 +371030,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370515,7 +371038,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370523,7 +371046,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370531,7 +371054,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370539,7 +371062,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370547,7 +371070,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370555,7 +371078,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370563,7 +371086,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370571,7 +371094,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370579,7 +371102,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370587,7 +371110,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370595,7 +371118,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370603,7 +371126,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370611,7 +371134,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370619,7 +371142,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370627,7 +371150,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370635,7 +371158,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370643,7 +371166,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370651,7 +371174,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370659,7 +371182,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370667,7 +371190,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370675,7 +371198,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370683,7 +371206,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370699,7 +371222,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370707,7 +371230,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370715,7 +371238,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370723,7 +371246,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370731,7 +371254,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370739,7 +371262,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370747,7 +371270,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370755,7 +371278,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370763,7 +371286,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370771,7 +371294,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370779,7 +371302,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370787,7 +371310,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370795,7 +371318,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370803,7 +371326,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370811,7 +371334,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370819,7 +371342,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370827,7 +371350,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370835,7 +371358,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370843,7 +371366,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370851,7 +371374,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370859,7 +371382,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370867,7 +371390,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370875,7 +371398,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370883,7 +371406,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370891,7 +371414,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370899,7 +371422,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370907,7 +371430,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370915,7 +371438,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370923,7 +371446,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370931,7 +371454,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370939,7 +371462,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370947,7 +371470,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370955,7 +371478,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370963,7 +371486,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370971,7 +371494,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370979,7 +371502,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370987,7 +371510,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370995,7 +371518,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371003,7 +371526,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371011,7 +371534,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371019,7 +371542,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371027,7 +371550,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371035,7 +371558,15 @@ which the system will be deployed as closely as possible.FAIL - + + + PASS + + + FAIL + + + PASS @@ -371045,761 +371576,703 @@ which the system will be deployed as closely as possible. - - To ensure that the GUI power settings are not active, run the following command: -$ gsettings get org.gnome.settings-daemon.plugins.power active -If properly configured, the output should be false. -To ensure that users cannot enable the power settings, run the following: -$ grep power /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/settings-daemon/plugins/power/active - Is it the case that power settings are enabled and are not disabled? - - - - -Run the following command to determine if the httpd_serve_cobbler_files SELinux boolean is disabled: -$ getsebool httpd_serve_cobbler_files -If properly configured, the output should show the following: -httpd_serve_cobbler_files --> off - Is it the case that httpd_serve_cobbler_files is not disabled? - - - - Run the following command to see what the timeout interval is: -$ sudo grep ClientAliveInterval /etc/ssh/sshd_config -If properly configured, the output should be: -ClientAliveInterval - Is it the case that it is commented out or not configured properly? + + To check the permissions of /etc/cron.d, +run the command: +$ ls -l /etc/cron.d +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.d does not have unix mode -rwx------? - - To determine if LDAP is being used for authentication, use the following -command: -$ sudo grep -i useldapauth /etc/sysconfig/authconfig -The output should return: -USELDAPAUTH=yes - Is it the case that USELDAPAUTH=yes is not configured correctly in /etc/sysconfig/authconfig? + + Run the following command to determine if the dnf-automatic package is installed: $ rpm -q dnf-automatic + Is it the case that the package is not installed? - - To check that all boot entries extend the backlog limit; -Check that all boot entries extend the log events queue: -sudo grep -L "^options\s+.*\baudit_backlog_limit=8192\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that does not extend the log events queue. - Is it the case that audit backlog limit is not configured? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules +The output has to be exactly as follows: +## Successful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change + Is it the case that the file does not exist or the content differs? - - Verify the operating system is not configured to bypass password requirements for privilege -escalation. Check the configuration of the "/etc/pam.d/sudo" file with the following command: -$ sudo grep pam_succeed_if /etc/pam.d/sudo - Is it the case that system is configured to bypass password requirements for privilege escalation? + + +Run the following command to determine if the mozilla_plugin_use_bluejeans SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_bluejeans +If properly configured, the output should show the following: +mozilla_plugin_use_bluejeans --> off + Is it the case that mozilla_plugin_use_bluejeans is not disabled? - + -Run the following command to determine if the puppetagent_manage_all_files SELinux boolean is disabled: -$ getsebool puppetagent_manage_all_files +Run the following command to determine if the authlogin_radius SELinux boolean is disabled: +$ getsebool authlogin_radius If properly configured, the output should show the following: -puppetagent_manage_all_files --> off - Is it the case that puppetagent_manage_all_files is not disabled? +authlogin_radius --> off + Is it the case that authlogin_radius is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postqueue" command with the following command: - -$ sudo auditctl -l | grep postqueue + + --a always,exit -F path=/usr/bin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postqueue - Is it the case that the command does not return a line, or the line is commented out? +Run the following command to determine the current status of the +nftables service: +$ sudo systemctl is-active nftables +If the service is running, it should return the following: active + Is it the case that the "nftables" service is disabled, masked, or not started.? - - -Run the following command to determine if the httpd_verify_dns SELinux boolean is disabled: -$ getsebool httpd_verify_dns -If properly configured, the output should show the following: -httpd_verify_dns --> off - Is it the case that httpd_verify_dns is not disabled? + + Verify the system commands contained in the following directories have mode "755" or less permissive with the following command: + +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin -perm /022 -exec ls -l {} \; + Is it the case that any system commands are found to be group-writable or world-writable? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_GCC_PLUGIN_STRUCTLEAK /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that binaries cannot be directly executed from removable media, run the following command: +$ grep -v noexec /etc/fstab +The resulting output will show partitions which do not have the noexec flag. Verify all partitions +in the output are not removable media. + Is it the case that removable media partitions are present? - - To check the ownership of /etc/group, -run the command: -$ ls -lL /etc/group -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/group does not have an owner of root? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes rng_core.default_quality=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*rng_core.default_quality=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*rng_core.default_quality=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'rng_core.default_quality=' +The command should not return any output. + Is it the case that trust on hardware random number generator is not configured appropriately? - + -Run the following command to determine if the httpd_tmp_exec SELinux boolean is disabled: -$ getsebool httpd_tmp_exec +Run the following command to determine if the xguest_mount_media SELinux boolean is disabled: +$ getsebool xguest_mount_media If properly configured, the output should show the following: -httpd_tmp_exec --> off - Is it the case that httpd_tmp_exec is not disabled? - - - - Run the following command to determine if the gssproxy package is installed: -$ rpm -q gssproxy - Is it the case that the package is installed? - - - - Run the following command to determine if the rng-tools package is installed: $ rpm -q rng-tools - Is it the case that the package is not installed? - - - - To check the permissions of /var/log/messages, -run the command: -$ ls -l /var/log/messages -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /var/log/messages does not have unix mode -rw-r-----? +xguest_mount_media --> off + Is it the case that xguest_mount_media is not disabled? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: - -$ sudo grep disk_full_action /etc/audit/auditd.conf - -disk_full_action = - -If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. - Is it the case that there is no evidence of appropriate action? + + To verify that HBSS ACCM is installed, run the following command(s): +$ sudo ls /opt/McAfee/accm/bin/accm + Is it the case that the HBSS ACCM module is not installed? - - -Run the following command to determine if the domain_kernel_load_modules SELinux boolean is disabled: -$ getsebool domain_kernel_load_modules -If properly configured, the output should show the following: -domain_kernel_load_modules --> off - Is it the case that domain_kernel_load_modules is not disabled? + + Run the following command to determine if the talk package is installed: +$ rpm -q talk + Is it the case that the package is installed? - + -Run the following command to determine if the cluster_use_execmem SELinux boolean is disabled: -$ getsebool cluster_use_execmem +Run the following command to determine if the openvpn_run_unconfined SELinux boolean is disabled: +$ getsebool openvpn_run_unconfined If properly configured, the output should show the following: -cluster_use_execmem --> off - Is it the case that cluster_use_execmem is not disabled? +openvpn_run_unconfined --> off + Is it the case that openvpn_run_unconfined is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_KEY /boot/config.* - - For each kernel installed, a line with value "" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to see what the timeout interval is: +$ sudo grep ClientAliveInterval /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveInterval + Is it the case that it is commented out or not configured properly? - - To verify that a remote NTP service is configured for time synchronization, -open the following file: - -/etc/chrony.conf in the case the system in question is -configured to use the chronyd as the NTP daemon (default setting) -/etc/ntp.conf in the case the system in question is configured -to use the ntpd as the NTP daemon + + The runtime status of the net.ipv4.icmp_ignore_bogus_error_responses kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.icmp_ignore_bogus_error_responses +1. -In the file, there should be a section similar to the following: -server ntpserver - Is it the case that this is not the case? + Is it the case that the correct value is not returned? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config.* + $ grep CONFIG_DEBUG_LIST /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter can be queried + + To ensure that users cannot disable the screensaver idle inactivity setting, run the following: +$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled + Is it the case that idle-activation-enabled is not locked? + + + + To check the ownership of /etc/passwd-, +run the command: +$ ls -lL /etc/passwd- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/passwd- does not have an owner of root? + + + + The runtime status of the kernel.kexec_load_disabled kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_pinfo -0. +$ sysctl kernel.kexec_load_disabled +1. Is it the case that the correct value is not returned? - - To check for legacy lines in /etc/shadow, run the following command: - grep '^\+' /etc/shadow -The command should not return any output. - Is it the case that the file contains legacy lines? + + Run the following command to determine if the abrt-cli package is installed: +$ rpm -q abrt-cli + Is it the case that the package is installed? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes iommu=force, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*iommu=force.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*iommu=force.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'iommu=force' -The command should not return any output. - Is it the case that I/OMMU is not activated? + + +Run the following command to determine if the git_system_use_nfs SELinux boolean is disabled: +$ getsebool git_system_use_nfs +If properly configured, the output should show the following: +git_system_use_nfs --> off + Is it the case that git_system_use_nfs is not disabled? - + -Run the following command to determine if the rsync_export_all_ro SELinux boolean is disabled: -$ getsebool rsync_export_all_ro +Run the following command to determine if the xdm_sysadm_login SELinux boolean is disabled: +$ getsebool xdm_sysadm_login If properly configured, the output should show the following: -rsync_export_all_ro --> off - Is it the case that rsync_export_all_ro is not disabled? +xdm_sysadm_login --> off + Is it the case that xdm_sysadm_login is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to take action in the event of allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep admin_space_left_action /etc/audit/auditd.conf - -admin_space_left_action = single + + To determine if the system is configured to audit unsuccessful calls +to the fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -If the value of the "admin_space_left_action" is not set to "single", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. - Is it the case that there is no evidence that real-time alerts are configured on the system? + Is it the case that no line is returned? - - Verify that DNS servers have been configured properly, perform the following: -$ sudo grep nameserver /etc/resolv.conf - Is it the case that less than two lines are returned that are not commented out? + + The runtime status of the kernel.sysrq kernel parameter can be queried +by running the following command: +$ sysctl kernel.sysrq +0. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the virt_sandbox_use_netlink SELinux boolean is disabled: -$ getsebool virt_sandbox_use_netlink -If properly configured, the output should show the following: -virt_sandbox_use_netlink --> off - Is it the case that virt_sandbox_use_netlink is not disabled? - - - - -Run the following command to determine if the httpd_can_network_connect_db SELinux boolean is disabled: -$ getsebool httpd_can_network_connect_db -If properly configured, the output should show the following: -httpd_can_network_connect_db --> off - Is it the case that httpd_can_network_connect_db is not disabled? - - - - Run the following command to determine if the abrt-plugin-sosreport package is installed: -$ rpm -q abrt-plugin-sosreport - Is it the case that the package is installed? - - - - To determine if passwd_timeout has been configured for sudo, run the following command: -$ sudo grep -ri '^Defaults.*passwd_timeout=' /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that passwd_timeout is not set with the appropriate value for sudo? + + To determine how the SSH daemon's IgnoreUserKnownHosts option is set, run the following command: + +$ sudo grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine how the SSH daemon's PermitRootLogin option is set, run the following command: + + To check that the saslauthd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled saslauthd +Output should indicate the saslauthd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled saslauthd disabled -$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config +Run the following command to verify saslauthd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active saslauthd -If a line indicating no is returned, then the required value is set. +If the service is not running the command will return the following output: +inactive - Is it the case that the required value is not set? +The service will also be masked, to check that the saslauthd is masked, run the following command: +$ sudo systemctl show saslauthd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "saslauthd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -create_module system call, run the following command: -$ sudo grep "create_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the operating system authenticates the remote logging server for off-loading audit logs with the following command: - Is it the case that no line is returned? +$ sudo grep -i '$ActionSendStreamDriverAuthMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should be +$/etc/rsyslog.conf:$ActionSendStreamDriverAuthMode x509/name + Is it the case that $ActionSendStreamDriverAuthMode in /etc/rsyslog.conf is not set to x509/name? - + -If the system is configured to prevent the loading of the can kernel module, +Run the following command to determine if the ftpd_connect_db SELinux boolean is disabled: +$ getsebool ftpd_connect_db +If properly configured, the output should show the following: +ftpd_connect_db --> off + Is it the case that ftpd_connect_db is not disabled? + + + + To verify that automatic logins are disabled, run the following command: +$ grep -Pzoi "^\[daemon]\\nautomaticlogin.*" /etc/gdm/custom.conf +The output should show the following: +[daemon] +AutomaticLoginEnable=false + Is it the case that GDM allows users to automatically login? + + + + +If the system is configured to prevent the loading of the iwlwifi kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the can kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the iwlwifi kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r can /etc/modprobe.conf /etc/modprobe.d +$ grep -r iwlwifi /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the minimum password length, run the command: +$ grep PASS_MIN_LEN /etc/login.defs +The DoD requirement is 15. + Is it the case that it is not set to the required value? - - Ensure that CGI backup scripts are not left on the production web server. -This check is limited to CGI/interactive content and not static HTML. - -Search for backup copies of CGI scripts on the web server or ask the Web -Administrator if they keep backup copies of CGI scripts on the web server. - -Common backup file extensions are: *.bak, *.old, *.temp, *.tmp, *.backup, -*.??0. This would also apply to .jsp files. - -On Red Hat Enterprise Linux, run the following commands to find backup -scripts: -find / name "*.bak" -print -find / name "*.*" -print -find / name "*.old" -print - Is it the case that If fileos with these extensions have no relationship with web activity, -such as backup batch file for operating system utility, and they are -not accessible by the web application, this is not a finding. - -If files with these extensions are found in either the document -directory or the home directory of the web server, this is -a finding. - -If files with these extensions are stored in a repository (not in the -document root) as backups for the web server? + + To verify all accounts have unique names, run the following command: +$ sudo getent passwd | awk -F: '{ print $1}' | uniq -d +No output should be returned. + Is it the case that a line is returned? - + -Run the following command to determine if the logwatch_can_network_connect_mail SELinux boolean is disabled: -$ getsebool logwatch_can_network_connect_mail +Run the following command to determine if the gluster_export_all_rw SELinux boolean is disabled: +$ getsebool gluster_export_all_rw If properly configured, the output should show the following: -logwatch_can_network_connect_mail --> off - Is it the case that logwatch_can_network_connect_mail is not disabled? +gluster_export_all_rw --> off + Is it the case that gluster_export_all_rw is not disabled? - - Run the following command to determine if the openssh-clients package is installed: $ rpm -q openssh-clients - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECCOMP_FILTER /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Ensure that Red Hat Enterprise Linux 8 does not disable SELinux. - -Check if "SELinux" is active and in "enforcing" or "permissive" mode with the following command: - -$ sudo getenforce -Enforcing --OR- -Permissive - Is it the case that SELinux is disabled? + + To verify that the log_config_module exists in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep log_config_module /etc/httpd/conf/httpd.conf +The output should return: +<IfModule log_config_module> + Is it the case that it is not? - - If the device or Red Hat Enterprise Linux 8 does not have a camera installed, this requirement is not applicable. - -This requirement is not applicable to mobile devices (smartphones and tablets), where the use of the camera is a local AO decision. - -This requirement is not applicable to dedicated VTC suites located in approved VTC locations that are centrally managed. - -For an external camera, if there is not a method for the operator to manually disconnect the camera at the end of collaborative computing sessions, this is a finding. - -For a built-in camera, the camera must be protected by a camera cover (e.g., laptop camera cover slide) when not in use. If the built-in camera is not protected with a camera cover, or is not physically disabled, this is a finding. - -If the camera is not disconnected, covered, or physically disabled, determine if it is being disabled via software with the following commands: - -Verify the operating system disables the ability to load the uvcvideo kernel module. - -$ sudo grep -r uvcvideo /etc/modprobe.d/* | grep "/bin/true" - -install uvcvideo /bin/true - Is it the case that the command does not return any output, or the line is commented out, and the collaborative computing device has not been authorized for use? + + To check the group ownership of /etc/ssh/sshd_config, +run the command: +$ ls -lL /etc/ssh/sshd_config +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/ssh/sshd_config does not have a group owner of root? - - -To check that the rexec service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rexec --list -Output should indicate the rexec service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rexec --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. - -rexec off - -To check that the rexec socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rexec -Output should indicate the rexec socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rexecdisabled - -Run the following command to verify rexec is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rexec - -If the socket is not running the command will return the following output: -inactive - -The socket will also be masked, to check that the rexec is masked, run the following command: -$ sudo systemctl show rexec | grep "LoadState\|UnitFileState" - -If the socket is masked the command will return the following outputs: - -LoadState=masked + + Verify the noexec option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . noexec . . . -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that the "/var/tmp" file system does not have the "noexec" option set? - - To verify that smart cards are enabled in SSSD, run the following command: -$ sudo grep pam_cert_auth /etc/sssd/sssd.conf -If configured properly, output should be -pam_cert_auth = True - - -To verify that smart cards are enabled in PAM files, run the following command: -$ sudo grep -e "auth.*pam_sss\.so.*\(allow_missing_name\|try_cert_auth\)" /etc/pam.d/smartcard-auth /etc/pam.d/system-auth -If configured properly, output should be - -/etc/pam.d/smartcard-auth:auth sufficient pam_sss.so allow_missing_name -/etc/pam.d/system-auth:auth [success=done authinfo_unavail=ignore ignore=ignore default=die] pam_sss.so try_cert_auth + + The runtime status of the kernel.perf_event_paranoid kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_event_paranoid +2. - Is it the case that smart cards are not enabled in SSSD? + Is it the case that the correct value is not returned? - - The runtime status of the net.ipv4.conf.all.secure_redirects kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.route_localnet kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.secure_redirects +$ sysctl net.ipv4.conf.all.route_localnet 0. Is it the case that the correct value is not returned? - - Verify that temporary accounts have been provisioned with an expiration date -of 72 hours. For every temporary account, run the following command to -obtain its account aging and expiration information: -$ sudo chage -l temporary_account_name -Verify each of these accounts has an expiration date set within 72 hours or -as documented. - Is it the case that any temporary accounts have no expiration date set or do not expire within 72 hours? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_ACPI_CUSTOM_METHOD /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify if the OpenSSH server uses defined Crypto Policy, run: -$ grep 'CRYPTO_POLICY' /etc/crypto-policies/back-ends/opensshserver.config | tail -n 1 -and verify that the line matches -CRYPTO_POLICY='-oCiphers=aes256-ctr,aes128-ctr,aes256-cbc,aes128-cbc -oMACs=hmac-sha2-512,hmac-sha2-256 -oGSSAPIKeyExchange=no -oKexAlgorithms=ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 -oHostKeyAlgorithms=ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -oPubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256' - Is it the case that Crypto Policy for OpenSSH Server is not configured according to CC requirements? + + To verify the operating system implements cryptography to protect the integrity of +remote ldap access sessions, run the following command: +$ sudo grep ldap_tls_cacert /etc/sssd/sssd.conf +The output should return the following with a correctly configured CA cert path: +ldap_tls_cacert /path/to/tls/ca.cert + Is it the case that the TLS CA cert is not configured? - - To determine if the system is configured to audit calls to the -fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Inspect the password section of /etc/pam.d/password-auth +and ensure that the pam_unix.so module includes the argument +sha512: +$ grep sha512 /etc/pam.d/password-auth + Is it the case that it does not? - - To check the permissions of /etc/cron.allow, + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules +The output has to be exactly as follows: +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification + Is it the case that the file does not exist or the content differs? + + + + To check the permissions of /etc/group, run the command: -$ ls -l /etc/cron.allow +$ ls -l /etc/group If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/cron.allow does not have unix mode -rw-------? +-rw-r--r-- + Is it the case that /etc/group does not have unix mode -rw-r--r--? - - -Run the following command to determine if the irssi_use_full_network SELinux boolean is disabled: -$ getsebool irssi_use_full_network -If properly configured, the output should show the following: -irssi_use_full_network --> off - Is it the case that irssi_use_full_network is not disabled? + + To check the permissions of /etc/http/conf, +run the command: +$ ls -l /etc/http/conf +If properly configured, the output should indicate the following permissions: +-rwxr-x--- + Is it the case that ? - - -Run the following command to determine if the httpd_run_stickshift SELinux boolean is disabled: -$ getsebool httpd_run_stickshift -If properly configured, the output should show the following: -httpd_run_stickshift --> off - Is it the case that httpd_run_stickshift is not disabled? + + To check the ownership of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have an owner of root? - - If FTP services are not installed, this is not applicable. - -To verify this configuration, run the following command: + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/10-base-config.rules +The output has to be exactly as follows: +## First rule - delete all +-D -grep "banner_file" /etc/vsftpd/vsftpd.conf +## Increase the buffers to survive stress events. +## Make this bigger for busy systems +-b 8192 +## This determine how long to wait in burst of events +--backlog_wait_time 60000 -The output should show the value of banner_file is set to /etc/issue, an example of which is shown below: +## Set failure mode to syslog +-f 1 + Is it the case that the file does not exist or the content differs? + + + + Verify that Red Hat Enterprise Linux 8 contains no duplicate User IDs (UIDs) for interactive users. -$ sudo grep "banner_file" /etc/vsftpd/vsftpd.conf +Check that the operating system contains no duplicate UIDs for interactive users with the following command: -banner_file=/etc/issue - Is it the case that it does not? +$ sudo awk -F ":" 'list[$3]++{print $1, $3}' /etc/passwd + Is it the case that output is produced and the accounts listed are interactive user accounts? - - Verify Red Hat Enterprise Linux 8 disables network management of the chrony daemon with the following command: -$ grep -w cmdport /etc/chrony.conf -cmdport 0 - Is it the case that the "cmdport" option is not set to "0", is commented out, or is missing? + + The following command will discover and print world-writable directories that +are not group owned by a system account, given the assumption that only system +accounts have a gid lower than 1000. Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -gid +999 -print + Is it the case that there is output? - - To check the permissions of /etc/issue, -run the command: -$ ls -l /etc/issue -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/issue does not have unix mode -rw-r--r--? + + Run the following command to determine if the iptables package is installed: $ rpm -q iptables + Is it the case that the package is not installed? - - To verify whether audispd plugin off-loads audit records onto a different -system or media from the system being audited, run the following command: - -$ sudo grep -i remote_server /etc/audit/audisp-remote.conf - -The output should return something similar to where REMOTE_SYSTEM -is an IP address or hostname: -remote_server = REMOTE_SYSTEM - -Determine which partition the audit records are being written to with the -following command: - -$ sudo grep log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log - -Check the size of the partition that audit records are written to with the -following command and verify whether it is sufficiently large: - -$ sudo df -h /var/log/audit/ -/dev/sda2 24G 10.4G 13.6G 43% /var/log/audit - Is it the case that audispd is not sending logs to a remote system and the local partition has inadequate space? + + +Run the following command to determine if the antivirus_use_jit SELinux boolean is disabled: +$ getsebool antivirus_use_jit +If properly configured, the output should show the following: +antivirus_use_jit --> off + Is it the case that antivirus_use_jit is not disabled? - - Verify Red Hat Enterprise Linux 8 is configured to lock the root account after -unsuccessful logon attempts with the command: - - -$ grep even_deny_root /etc/security/faillock.conf -even_deny_root - Is it the case that the "even_deny_root" option is not set, is missing or commented out? + + To verify if the OpenSSH server uses defined MACs in the Crypto Policy, run: +$ grep -Po '(-oMACs=\S+)' /etc/crypto-policies/back-ends/opensshserver.config +and verify that the line matches: +-oMACS= + Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? - + -Run the following command to determine if the ssh_sysadm_login SELinux boolean is disabled: -$ getsebool ssh_sysadm_login +Run the following command to determine if the use_lpd_server SELinux boolean is disabled: +$ getsebool use_lpd_server If properly configured, the output should show the following: -ssh_sysadm_login --> off - Is it the case that ssh_sysadm_login is not disabled? +use_lpd_server --> off + Is it the case that use_lpd_server is not disabled? - - -Run the following command to determine if the fcron_crond SELinux boolean is disabled: -$ getsebool fcron_crond -If properly configured, the output should show the following: -fcron_crond --> off - Is it the case that fcron_crond is not disabled? + + Run the following command to determine if the rng-tools package is installed: $ rpm -q rng-tools + Is it the case that the package is not installed? - - To ensure the X Windows package group is removed, run the following command: + + To check that SLUB/SLAB poisoning is enabled, check all boot entries with following command; +sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that does not enable poisoning. + Is it the case that SLUB/SLAB poisoning is not enabled? + + + + To determine if arguments that commands can be executed with are restricted, run the following command: +$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+(?:[ \t]+[^,\s]+)+[ \t]*,)*(\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+[ \t]*(?:,|$))' /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that /etc/sudoers file contains user specifications that allow execution of commands with any arguments? + + + + To check that the portreserve service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled portreserve +Output should indicate the portreserve service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled portreserve disabled -$ rpm -qi xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-server-Xwayland +Run the following command to verify portreserve is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active portreserve -For each package mentioned above you should receive following line: -package <package> is not installed - Is it the case that xorg related packages are not removed and run level is not correctly configured? +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the portreserve is masked, run the following command: +$ sudo systemctl show portreserve | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "portreserve" is loaded and not masked? - + -Run the following command to determine if the tftp_home_dir SELinux boolean is disabled: -$ getsebool tftp_home_dir -If properly configured, the output should show the following: -tftp_home_dir --> off - Is it the case that tftp_home_dir is not disabled? - - - - To determine if the system is configured to audit unsuccessful calls -to the lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the system is configured to prevent the loading of the mac80211 kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the mac80211 kernel module via blacklist keyword. +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r mac80211 /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - The runtime status of the net.ipv4.ip_forward kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.ip_forward -0. -The ability to forward packets is only appropriate for routers. - Is it the case that the correct value is not returned? + + Run the following command to determine if the ntp package is installed: $ rpm -q ntp + Is it the case that the package is not installed? - - The runtime status of the net.ipv4.ip_local_port_range kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.ip_local_port_range -32768 65535. - - Is it the case that the correct value is not returned? + + To verify that USB Human Interface Devices will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +The output lines should include +allow with-interface match-all { 03:*:* } + Is it the case that USB devices of class 3 are not authorized? - + + Verify the audit logs are owned by "root". First, determine where the audit logs are stored with the following command: +$ sudo grep -iw log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log +Using the location of the audit log file, determine if the audit log is owned by "root" using the following command: +$ sudo stat -c "%n %U" /var/log/audit/audit.log +Audit logs must be owned by user root. +If the log_file isn't defined in /etc/audit/auditd.conf, check all files in /var/log/audit/ directory instead. + Is it the case that the audit log is not owned by root? + + + -Run the following command to determine if the antivirus_can_scan_system SELinux boolean is enabled: -$ getsebool antivirus_can_scan_system +Run the following command to determine if the selinuxuser_ping SELinux boolean is enabled: +$ getsebool selinuxuser_ping If properly configured, the output should show the following: -antivirus_can_scan_system --> on - Is it the case that antivirus_can_scan_system is not enabled? +selinuxuser_ping --> on + Is it the case that selinuxuser_ping is not enabled? - - Verify the nodev option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . nodev . . . + + Verify that a separate file system/partition has been created for /tmp with the following command: - Is it the case that the "/var/tmp" file system does not have the "nodev" option set? +$ mountpoint /tmp + + Is it the case that "/tmp is not a mountpoint" is returned? - - Verify the "umask" setting is configured correctly in the "/etc/csh.cshrc" file with the following command: + + Ensure that Red Hat Enterprise Linux 8 does not disable SELinux. -$ grep umask /etc/csh.cshrc +Check if "SELinux" is active and in "enforcing" or "permissive" mode with the following command: -umask 077 -umask 077 - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? +$ sudo getenforce +Enforcing +-OR- +Permissive + Is it the case that SELinux is disabled? - - The runtime status of the net.ipv6.conf.default.accept_ra kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra -0. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the openat system call with O_TRUNC_WRITE flag. - Is it the case that the correct value is not returned? - - - - Check the root home directory for a .mozilla directory. If -one exists, ensure browsing is limited to local service administration. - Is it the case that this is not the case? +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit unsuccessful calls -to the fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the creat system call. - Is it the case that no line is returned? +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r creat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep creat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - - To check the system for the existence of any .netrc files, -run the following command: -$ sudo find /home -xdev -name .netrc - Is it the case that any .netrc files exist? + + To determine if ignore_dot has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\bignore_dot\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that ignore_dot is not enabled in sudo? - - Run the following command to determine if the libpwquality package is installed: -$ rpm -q libpwquality - Is it the case that the package is not installed? + + +Run the following command to determine if the httpd_use_gpg SELinux boolean is disabled: +$ getsebool httpd_use_gpg +If properly configured, the output should show the following: +httpd_use_gpg --> off + Is it the case that httpd_use_gpg is not disabled? - - The runtime status of the kernel.panic_on_oops kernel parameter can be queried -by running the following command: -$ sysctl kernel.panic_on_oops -1. - - Is it the case that the correct value is not returned? + + Ensure there are no unconfined daemons running on the system, +the following command should produce no output: +$ sudo ps -eZ | grep "unconfined_service_t" + Is it the case that There are unconfined daemons running on the system? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules -The output has to be exactly as follows: -## Successful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification - Is it the case that the file does not exist or the content differs? + + Run the following command to determine if the rsync-daemon package is installed: +$ rpm -q rsync-daemon + Is it the case that the package is installed? - - Run the following command to check for duplicate group names: -Check that the operating system contains no duplicate group names for interactive users by running the following command: + + To check which SSH protocol version is allowed, check version of +openssh-server with following command: +$ rpm -qi openssh-server | grep Version +Versions equal to or higher than 7.4 have deprecated the RhostsRSAAuthentication option. +If version is lower than 7.4, run the following command to check configuration: +To determine how the SSH daemon's RhostsRSAAuthentication option is set, run the following command: - cut -d : -f 1 /etc/group | uniq -d +$ sudo grep -i RhostsRSAAuthentication /etc/ssh/sshd_config -If output is produced, this is a finding. -Configure the operating system to contain no duplicate names for groups. -Edit the file "/etc/group" and provide each group that has a duplicate group name with a unique group name. - Is it the case that has duplicate group names? - - - - To check the permissions of /etc/issue.net, -run the command: -$ ls -l /etc/issue.net -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/issue.net does not have unix mode -rw-r--r--? +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODIFY_LDT_SYSCALL /boot/config.* + $ grep CONFIG_BINFMT_MISC /boot/config.* Configs with value 'n' are not explicitly set in the file, so either commented lines or no lines should be returned. @@ -371807,641 +372280,475 @@ If properly configured, the output should indicate the following permissions: Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the abrt-plugin-logger package is installed: -$ rpm -q abrt-plugin-logger + + Run the following command to determine if the talk-server package is installed: +$ rpm -q talk-server Is it the case that the package is installed? - - Make sure that /boot/bootmap is newer than /boot/loader/entries/*.conf -and /etc/zipl.conf: -find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap -No line should be returned, if a line is returned /boot/bootmap is outdated and needs to be regenerated. - Is it the case that the bootmap is outdated? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.thumbnailers disable-all +If properly configured, the output should be true. +To ensure that users cannot how long until the screensaver locks, run the following: +$ grep disable-all /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/thumbnailers/disable-all + Is it the case that GNOME thumbnailers are not disabled? - - To determine if the system is configured to audit successful calls -to the openat system call, run the following command: -$ sudo grep "openat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the virt_sandbox_use_all_caps SELinux boolean is disabled: +$ getsebool virt_sandbox_use_all_caps +If properly configured, the output should show the following: +virt_sandbox_use_all_caps --> off + Is it the case that virt_sandbox_use_all_caps is not disabled? - - To determine if the system is configured to audit successful calls -to the openat system call, run the following command: -$ sudo grep "openat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine how the SSH daemon's X11Forwarding option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i X11Forwarding /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to get the current configured value for polyinstantiation_enabled -SELinux boolean: -$ getsebool polyinstantiation_enabled -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that polyinstantiation_enabled is not set as expected? +Run the following command to determine if the dhcpc_exec_iptables SELinux boolean is disabled: +$ getsebool dhcpc_exec_iptables +If properly configured, the output should show the following: +dhcpc_exec_iptables --> off + Is it the case that dhcpc_exec_iptables is not disabled? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one special character with the following command: + + Verify that Promiscuous mode of an interface is disabled, run the following command: +$ ip link | grep PROMISC + Is it the case that any network device is in promiscuous mode? + + + + To check the permissions of /etc/passwd-, +run the command: +$ ls -l /etc/passwd- +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/passwd- does not have unix mode -rw-r--r--? + + + + To determine how the SSH daemon's UsePAM option is set, run the following command: -$ sudo grep ocredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +$ sudo grep -i UsePAM /etc/ssh/sshd_config -ocredit = - Is it the case that value of "ocredit" is a positive number or is commented out? +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to determine if the use_nfs_home_dirs SELinux boolean is disabled: -$ getsebool use_nfs_home_dirs -If properly configured, the output should show the following: -use_nfs_home_dirs --> off - Is it the case that use_nfs_home_dirs is not disabled? +To check that the rsh service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rsh --list +Output should indicate the rsh service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rsh --list + +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. + +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. + +rsh off + +To check that the rsh socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rsh +Output should indicate the rsh socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rshdisabled + +Run the following command to verify rsh is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rsh + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the rsh is masked, run the following command: +$ sudo systemctl show rsh | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - + -Run the following command to determine if the rsync_client SELinux boolean is disabled: -$ getsebool rsync_client +Run the following command to determine if the cups_execmem SELinux boolean is disabled: +$ getsebool cups_execmem If properly configured, the output should show the following: -rsync_client --> off - Is it the case that rsync_client is not disabled? - - - - To check the group ownership of /etc/shadow, -run the command: -$ ls -lL /etc/shadow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shadow does not have a group owner of root? +cups_execmem --> off + Is it the case that cups_execmem is not disabled? - - To verify that audit is configured for OSPP v4.2.1, run the following commands: -for file in "10-base-config" "11-loginuid" "30-ospp-v42" "43-module-load";do diff /etc/audit/rules.d/$file.rules /usr/share/doc/audit*/rules/$file.rules; done - -If the system is configured properly, no lines should be returned. - Is it the case that the files are not there or differ? + + Verify that authselect is enabled by running +authselect current +If authselect is enabled on the system, the output should show the ID of the profile which is currently in use. + Is it the case that authselect is not used to manage user authentication setup on the system? - - To check the permissions of /usr/bin/sudo, -run the command: -$ ls -l /usr/bin/sudo -If properly configured, the output should indicate the following permissions: ----s--x--- - Is it the case that /usr/bin/sudo does not have unix mode ---s--x---? + + Determine if "sudoers" file restricts sudo access run the following commands: +$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* +$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\:ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* + Is it the case that either of the commands returned a line? - - Run the following command to determine if the cron package is installed: -$ rpm -q cron - Is it the case that the package is installed? + + Verify that Red Hat Enterprise Linux 8 generates an audit record for all uses of the "umount" and system call. +To determine if the system is configured to audit calls to the +"umount" system call, run the following command: +$ sudo grep "umount" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line like the following. +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -k privileged-umount + Is it the case that the command does not return a line, or the line is commented out? - - The runtime status of the net.ipv4.conf.all.shared_media kernel parameter can be queried + + The runtime status of the kernel.core_pattern kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.shared_media -0. +$ sysctl kernel.core_pattern +|/bin/false. - Is it the case that the correct value is not returned? + Is it the case that the returned line does not have a value of "|/bin/false", or a line is not +returned and the need for core dumps is not documented with the Information +System Security Officer (ISSO) as an operational requirement? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PANIC_TIMEOUT /boot/config.* + $ grep CONFIG_X86_VSYSCALL_EMULATION /boot/config.* - For each kernel installed, a line with value "" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - To verify the system is not configured to use a boot loader on removable media, -check that the grub configuration file has the set root command in each menu -entry with the following commands: -$ sudo grep -cw menuentry /boot/grub2/grub.cfg -Note that the -c option for the grep command will print -only the count of menuentry occurrences. This number should match -the number of occurrences reported by the following command: -$ sudo grep "set root='hd0" /boot/grub2/grub.cfg -The output should return something similar to: -set root='hd0,msdos1' -usb0, cd, fd0, etc. are some examples of removeable -media which should not exist in the lines: -set root='hd0,msdos1' - Is it the case that it is not? + + The runtime status of the net.ipv6.conf.all.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_redirects +0. + + Is it the case that the correct value is not returned? - - Verify the nosuid option is configured for the /opt mount point, - run the following command: - $ sudo mount | grep '\s/opt\s' - . . . /opt . . . nosuid . . . + + To determine how the SSH daemon's Banner option is set, run the following command: - Is it the case that the "/opt" file system does not have the "nosuid" option set? +$ sudo grep -i Banner /etc/ssh/sshd_config + +If a line indicating /etc/issue.net is returned, then the required value is set. + + Is it the case that the required value is not set? - - The runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.secure_redirects kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_rtr_pref +$ sysctl net.ipv4.conf.all.secure_redirects 0. Is it the case that the correct value is not returned? - - -Run the following command to determine if the squid_connect_any SELinux boolean is disabled: -$ getsebool squid_connect_any -If properly configured, the output should show the following: -squid_connect_any --> off - Is it the case that squid_connect_any is not disabled? - - - - The existence of the file /etc/hosts.equiv or a file named -.rhosts inside a user home directory indicates the presence -of an Rsh trust relationship. - Is it the case that these files exist? + + To verify that DHCP is not being used, examine the following file for each interface: +# /etc/sysconfig/network-scripts/ifcfg-interface +Look for the following: +BOOTPROTO=none +and the following, substituting the appropriate values based on your site's addressing scheme: +NETMASK=255.255.255.0 +IPADDR=192.168.1.2 +GATEWAY=192.168.1.1 + Is it the case that it does not? - - To determine if the system is configured to audit calls to the -init_module system call, run the following command: -$ sudo grep "init_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -finit_module system call, run the following command: -$ sudo grep "finit_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -delete_module system call, run the following command: -$ sudo grep "delete_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? + + Verify it by running the following command: +$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + +/sbin/auditctl 755 +/sbin/aureport 755 +/sbin/ausearch 755 +/sbin/autrace 755 +/sbin/auditd 755 +/sbin/audispd 755 +/sbin/augenrules 755 + + +If the command does not return all the above lines, the missing ones +need to be added. + +Run the following command to correct the permissions of the missing +entries: +$ sudo chmod 0755 [audit_tool] + +Replace "[audit_tool]" with the audit tool that does not have the +correct permissions. + Is it the case that ? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_FREELIST_HARDENED /boot/config.* + $ grep CONFIG_PROC_KCORE /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - -Run the following command to determine if the httpd_use_sasl SELinux boolean is disabled: -$ getsebool httpd_use_sasl -If properly configured, the output should show the following: -httpd_use_sasl --> off - Is it the case that httpd_use_sasl is not disabled? - - - - To verify the operating system implements cryptography to protect the integrity of -remote ldap access sessions, run the following command: -$ sudo grep ldap_tls_cacert /etc/sssd/sssd.conf -The output should return the following with a correctly configured CA cert path: -ldap_tls_cacert /path/to/tls/ca.cert - Is it the case that the TLS CA cert is not configured? - - - - Verify the operating system authenticates the remote logging server for off-loading audit logs with the following command: - -$ sudo grep -i '$ActionSendStreamDriverAuthMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should be -$/etc/rsyslog.conf:$ActionSendStreamDriverAuthMode x509/name - Is it the case that $ActionSendStreamDriverAuthMode in /etc/rsyslog.conf is not set to x509/name? - - - - To verify that repo_gpgcheck is configured properly, run the following -command: -$ grep repo_gpgcheck /etc/yum.conf -The output should return something similar to: -repo_gpgcheck=1 - Is it the case that gpgcheck is not enabled or configured correctly to verify repository metadata? - - - - The runtime status of the net.ipv4.conf.all.accept_local kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_local -0. - - Is it the case that the correct value is not returned? - - - - To determine if the system is configured to audit successful calls -to the lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - -Run the following command to determine if the unprivuser_use_svirt SELinux boolean is disabled: -$ getsebool unprivuser_use_svirt -If properly configured, the output should show the following: -unprivuser_use_svirt --> off - Is it the case that unprivuser_use_svirt is not disabled? + + Verify Red Hat Enterprise Linux 8 limits the number of concurrent sessions to +"" for all +accounts and/or account types with the following command: +$ grep -r -s maxlogins /etc/security/limits.conf /etc/security/limits.d/*.conf +/etc/security/limits.conf:* hard maxlogins 10 +This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. + Is it the case that the "maxlogins" item is missing, commented out, or the value is set greater +than "<sub idref="var_accounts_max_concurrent_login_sessions" />" and +is not documented with the Information System Security Officer (ISSO) as an +operational requirement for all domains that have the "maxlogins" item +assigned'? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_GCC_PLUGIN_LATENT_ENTROPY /boot/config.* + $ grep CONFIG_MODULE_SIG_FORCE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling automount-open -If properly configured, the output for automount-openshould be false. -To ensure that users cannot enable automount opening in GNOME3, run the following: -$ grep 'automount-open' /etc/dconf/db/local.d/locks/* -If properly configured, the output for automount-open should be /org/gnome/desktop/media-handling/automount-open - Is it the case that GNOME automounting is not disabled? - - - - -Run the following command to determine if the use_samba_home_dirs SELinux boolean is disabled: -$ getsebool use_samba_home_dirs -If properly configured, the output should show the following: -use_samba_home_dirs --> off - Is it the case that use_samba_home_dirs is not disabled? - - - - The runtime status of the kernel.kptr_restrict kernel parameter can be queried -by running the following command: -$ sysctl kernel.kptr_restrict -The output of the command should indicate either: -kernel.kptr_restrict = 1 -or: -kernel.kptr_restrict = 2 -The output of the command should not indicate: -kernel.kptr_restrict = 0 - -The preferable way how to assure the runtime compliance is to have -correct persistent configuration, and rebooting the system. - -The persistent kernel parameter configuration is performed by specifying the appropriate -assignment in any file located in the /etc/sysctl.d directory. -Verify that there is not any existing incorrect configuration by executing the following command: -$ grep -r '^\s*kernel.kptr_restrict\s*=' /etc/sysctl.conf /etc/sysctl.d -The command should not find any assignments other than: -kernel.kptr_restrict = 1 -or: -kernel.kptr_restrict = 2 - -Conflicting assignments are not allowed. - Is it the case that the kernel.kptr_restrict is not set to 1 or 2 or is configured to be 0? - - - - -Run the following command to determine if the mpd_use_cifs SELinux boolean is disabled: -$ getsebool mpd_use_cifs -If properly configured, the output should show the following: -mpd_use_cifs --> off - Is it the case that mpd_use_cifs is not disabled? - - - - To ensure that remote access requires credentials, run the following command: -$ gsettings get org.gnome.Vino authentication-methods -If properly configured, the output should be false. -To ensure that users cannot disable credentials for remote access, run the following: -$ grep authentication-methods /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/Vino/authentication-methods - Is it the case that wireless network notification is enabled and not disabled? - - - - Verify the noexec option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . noexec . . . - - Is it the case that the "/var" file system does not have the "noexec" option set? - - - - To verify .netrc file in interactive user home directory is -not group or world accessible", run the following command: -$ sudo ls -lLR /home/USER/.netrc - Is it the case that the group and world permissions are incorrect? - - - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep '\bat\b' /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? - - - - Verify that a separate file system/partition has been created for /srv with the following command: - -$ mountpoint /srv - - Is it the case that "/srv is not a mountpoint" is returned? - - - - To verify if LogFormat is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i logformat /etc/httpd/conf/httpd.conf -The output should contain the following: -LogFormat "a %A %h %H %l %m %s %t %u %U \"%{Referer}i\" \"%{User-Agent}i\"" combined - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_GCC_PLUGIN_STRUCTLEAK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the login_console_enabled SELinux boolean is enabled: -$ getsebool login_console_enabled +Run the following command to determine if the httpd_tmp_exec SELinux boolean is disabled: +$ getsebool httpd_tmp_exec If properly configured, the output should show the following: -login_console_enabled --> on - Is it the case that login_console_enabled is not enabled? - - - - Verify the grpquota option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . grpquota . . . - - Is it the case that the "/home" file system does not have the "grpquota" option set? - - - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To check the system for the existence of any .forward files, -run the following command: -$ sudo find /home -xdev -name .forward - Is it the case that any .forward files exist? +httpd_tmp_exec --> off + Is it the case that httpd_tmp_exec is not disabled? - - To check that the squid service is disabled in system boot configuration, + + To check that the abrtd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled squid -Output should indicate the squid service has either not been installed, +$ sudo systemctl is-enabled abrtd +Output should indicate the abrtd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled squid disabled +$ sudo systemctl is-enabled abrtd disabled -Run the following command to verify squid is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active squid +Run the following command to verify abrtd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active abrtd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the squid is masked, run the following command: -$ sudo systemctl show squid | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the abrtd is masked, run the following command: +$ sudo systemctl show abrtd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "squid" is loaded and not masked? + Is it the case that the "abrtd" is loaded and not masked? - - To check the permissions of /etc/passwd, -run the command: -$ ls -l /etc/passwd -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/passwd does not have unix mode -rw-r--r--? + + +Run the following command to determine if the nfsd_anon_write SELinux boolean is disabled: +$ getsebool nfsd_anon_write +If properly configured, the output should show the following: +nfsd_anon_write --> off + Is it the case that nfsd_anon_write is not disabled? - - Inspect /etc/default/grub for any instances of -systemd.confirm_spawn=(1|yes|true|on) in the kernel boot arguments. -Presence of a systemd.confirm_spawn=(1|yes|true|on) indicates -that interactive boot is enabled at boot time and verify that -GRUB_DISABLE_RECOVERY=true to disable recovery boot. - Is it the case that Interactive boot is enabled at boot time? + + To verify if the OpenSSH server uses defined ciphers in the Crypto Policy, run: +$ grep -Po '(-oCiphers=\S+)' /etc/crypto-policies/back-ends/opensshserver.config +and verify that the line matches: +-oCiphers= + Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? - - The runtime status of the net.ipv6.conf.all.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_source_route -0. - - Is it the case that the correct value is not returned? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules +The output has to be exactly as follows: +## Successful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change + Is it the case that the file does not exist or the content differs? - - To ensure the failed password attempt policy is configured correctly, run the following command: + + Query the SA and the Web Manager to determine if a compiler is present on +the server. + Is it the case that the web server is part of an application suite and a comiler is needed +for installation, patching, and upgrading of the suite or if the compiler +is embedded and can't be removed without breaking the suite, document the +installation of the compiler with the ISSO/ISSM and verify that the compiler +is restricted to administrative users only. If documented and restricted to +administrative users, this is not a finding. -$ grep fail_interval /etc/security/faillock.conf -The output should show fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. - Is it the case that the "fail_interval" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_fail_interval" />" -or less (but not "0"), the line is commented out, or the line is missing? +If an undocumented compiler is present, and available to non-administrative +users? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_TABLE_ISOLATION /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the password warning age, run the command: +$ grep PASS_WARN_AGE /etc/login.defs +The DoD requirement is 7. + Is it the case that it is not set to the required value? - - Verify that Red Hat Enterprise Linux 8 is configured to prevent unrestricted mail relaying, -run the following command: -$ sudo postconf -n smtpd_client_restrictions - Is it the case that the "smtpd_client_restrictions" parameter contains any entries other than "permit_mynetworks" and "reject"? + + Only FIPS ciphers should be used. To verify that only FIPS-approved +ciphers are in use, run the following command: +$ sudo grep Ciphers /etc/ssh/sshd_config +The output should contain only those ciphers which are FIPS-approved. + Is it the case that FIPS ciphers are not configured or the enabled ciphers are not FIPS-approved? - - To check if the system login banner is compliant, run the following command: -$ cat /etc/issue.net - Is it the case that it does not display the required banner? + + To determine that AIDE is verifying ACLs, run the following command: +$ grep acl /etc/aide.conf +Verify that the acl option is added to the correct ruleset. + Is it the case that the acl option is missing or not added to the correct ruleset? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "poweroff" command with the following command: - -$ sudo auditctl -l | grep poweroff - --a always,exit -F path=/poweroff -F perm=x -F auid>=1000 -F auid!=unset -k privileged-poweroff - Is it the case that the command does not return a line, or the line is commented out? + + To check the group ownership of /etc/cron.d, +run the command: +$ ls -lL /etc/cron.d +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.d does not have a group owner of root? - - Verify Red Hat Enterprise Linux 8 enables the user to initiate a session lock with the following command: - -$ grep lock-command /etc/tmux.conf - -set -g lock-command vlock - -Then, verify that the /etc/tmux.conf file can be read by other users than root: - -$ sudo ls -al /etc/tmux.conf - Is it the case that the "lock-command" is not set in the global settings to call "vlock"? + + +Run the following command to determine if the secure_mode_policyload SELinux boolean is disabled: +$ getsebool secure_mode_policyload +If properly configured, the output should show the following: +secure_mode_policyload --> off + Is it the case that secure_mode_policyload is not disabled? - - Verify the audit logs are owned by "root". First, determine where the audit logs are stored with the following command: -$ sudo grep -iw log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log -Using the location of the audit log file, determine if the audit log is owned by "root" using the following command: -$ sudo stat -c "%n %U" /var/log/audit/audit.log -Audit logs must be owned by user root. -If the log_file isn't defined in /etc/audit/auditd.conf, check all files in /var/log/audit/ directory instead. - Is it the case that the audit log is not owned by root? + + +Run the following command to determine if the postfix_local_write_mail_spool SELinux boolean is enabled: +$ getsebool postfix_local_write_mail_spool +If properly configured, the output should show the following: +postfix_local_write_mail_spool --> on + Is it the case that postfix_local_write_mail_spool is not enabled? - + -Run the following command to determine if the httpd_dontaudit_search_dirs SELinux boolean is disabled: -$ getsebool httpd_dontaudit_search_dirs +Run the following command to determine if the sanlock_use_nfs SELinux boolean is disabled: +$ getsebool sanlock_use_nfs If properly configured, the output should show the following: -httpd_dontaudit_search_dirs --> off - Is it the case that httpd_dontaudit_search_dirs is not disabled? +sanlock_use_nfs --> off + Is it the case that sanlock_use_nfs is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/10-base-config.rules -The output has to be exactly as follows: -## First rule - delete all --D - -## Increase the buffers to survive stress events. -## Make this bigger for busy systems --b 8192 + + Verify users are provided with feedback on when account accesses last occurred with the following command: -## This determine how long to wait in burst of events ---backlog_wait_time 60000 +$ sudo grep pam_lastlog /etc/pam.d/postlogin -## Set failure mode to syslog --f 1 - Is it the case that the file does not exist or the content differs? +session [default=1] pam_lastlog.so showfailed + Is it the case that "pam_lastlog.so" is not properly configured in "/etc/pam.d/postlogin" file? - - To determine if the system is configured to audit unsuccessful calls -to the lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify the noexec option is configured for all NFS mounts, run the following command: +$ mount | grep nfs +All NFS mounts should show the noexec setting in parentheses. This is not applicable if NFS is +not implemented. + Is it the case that the setting does not show? - - The runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_defrtr -0. - - Is it the case that the correct value is not returned? + + To find SGID files, run the following command: +$ sudo find / -xdev -type f -perm -2000 + Is it the case that there is output? - + - -Run the following command to determine the current status of the -systemd-journald service: -$ sudo systemctl is-active systemd-journald -If the service is running, it should return the following: active - Is it the case that the systemd-journald service is not running? +Run the following command to determine if the samba_share_fusefs SELinux boolean is disabled: +$ getsebool samba_share_fusefs +If properly configured, the output should show the following: +samba_share_fusefs --> off + Is it the case that samba_share_fusefs is not disabled? - - Verify the operating system audits activities performed during nonlocal -maintenance and diagnostic sessions. Run the following command: -$ sudo auditctl -l | grep sudo.log --w /var/log/sudo.log -p wa -k maintenance + + +To properly set the owner of /etc/audit/, run the command: +$ sudo chown root /etc/audit/ - Is it the case that Audit rule is not present? +To properly set the owner of /etc/audit/rules.d/, run the command: +$ sudo chown root /etc/audit/rules.d/ + Is it the case that ? - - The runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter can be queried + + The runtime status of the kernel.randomize_va_space kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_pinfo -0. +$ sysctl kernel.randomize_va_space +2. Is it the case that the correct value is not returned? - - -Run the following command to determine if the httpd_run_ipa SELinux boolean is disabled: -$ getsebool httpd_run_ipa -If properly configured, the output should show the following: -httpd_run_ipa --> off - Is it the case that httpd_run_ipa is not disabled? - - - - Run the following command to determine if the systemd-journal-remote package is installed: $ rpm -q systemd-journal-remote + + Run the following command to determine if the samba-common package is installed: $ rpm -q samba-common Is it the case that the package is not installed? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open_by_handle_at system call with O_TRUNC_WRITE flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open_by_handle_at /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep open_by_handle_at /etc/audit/audit.rules + + Run the following command to check for duplicate group names: +Check that the operating system contains no duplicate group names for interactive users by running the following command: -The output should be the following: + cut -d : -f 3 /etc/group | uniq -d --a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? - - - - Run the following command to determine if the subscription-manager package is installed: $ rpm -q subscription-manager - Is it the case that the package is not installed? +If output is produced, this is a finding. +Configure the operating system to contain no duplicate names for groups. +Edit the file "/etc/group" and provide each group that has a duplicate group id with a unique group id. + Is it the case that the system has duplicate group ids? @@ -372450,580 +372757,598 @@ $ sudo auditctl -l | grep "watch=/etc/sudoers\|watch=/etc/sudoers.d\|-w /etc/sud Is it the case that there is not output? - - To verify that the Dracut FIPS module is enabled, run the following command: -grep "add_dracutmodules" /etc/dracut.conf.d/40-fips.conf -The output should look like this: -add_dracutmodules+=" fips " - Is it the case that the Dracut FIPS module is not enabled? - - - - + + To determine how the SSH daemon's KerberosAuthentication option is set, run the following command: -Run the following command to determine the current status of the -rngd service: -$ sudo systemctl is-active rngd -If the service is running, it should return the following: active - Is it the case that the "rngd" service is disabled, masked, or not started.? - - - - -Run the following command to determine if the virt_use_comm SELinux boolean is disabled: -$ getsebool virt_use_comm -If properly configured, the output should show the following: -virt_use_comm --> off - Is it the case that virt_use_comm is not disabled? - - - - -Run the following command to determine if the icecast_use_any_tcp_ports SELinux boolean is disabled: -$ getsebool icecast_use_any_tcp_ports -If properly configured, the output should show the following: -icecast_use_any_tcp_ports --> off - Is it the case that icecast_use_any_tcp_ports is not disabled? - - - - -Run the following command to determine if the prosody_bind_http_port SELinux boolean is disabled: -$ getsebool prosody_bind_http_port -If properly configured, the output should show the following: -prosody_bind_http_port --> off - Is it the case that prosody_bind_http_port is not disabled? +$ sudo grep -i KerberosAuthentication /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - Run the following command to determine if the aide package is installed: $ rpm -q aide - Is it the case that the package is not installed? + + To check the group ownership of /etc/gshadow-, +run the command: +$ ls -lL /etc/gshadow- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/gshadow- does not have a group owner of root? - + -Run the following command to determine if the virt_transition_userdomain SELinux boolean is disabled: -$ getsebool virt_transition_userdomain -If properly configured, the output should show the following: -virt_transition_userdomain --> off - Is it the case that virt_transition_userdomain is not disabled? - - - - The runtime status of the net.ipv4.icmp_ignore_bogus_error_responses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.icmp_ignore_bogus_error_responses -1. +To properly set the owner of /var/log/audit, run the command: +$ sudo chown root /var/log/audit - Is it the case that the correct value is not returned? +To properly set the owner of /var/log/audit/*, run the command: +$ sudo chown root /var/log/audit/* + Is it the case that ? - + -Run the following command to determine if the gitosis_can_sendmail SELinux boolean is disabled: -$ getsebool gitosis_can_sendmail +Run the following command to determine if the mcelog_client SELinux boolean is disabled: +$ getsebool mcelog_client If properly configured, the output should show the following: -gitosis_can_sendmail --> off - Is it the case that gitosis_can_sendmail is not disabled? +mcelog_client --> off + Is it the case that mcelog_client is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "semanage" command with the following command: + + The file /etc/cron.deny should not exist. +This can be checked by runnig the following -$ sudo auditctl -l | grep semanage +stat /etc/cron.deny --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update - Is it the case that the command does not return a line, or the line is commented out? +and the output should be + +stat: cannot stat `/etc/cron.deny': No such file or directory + + Is it the case that the file /etc/cron.deny exists? - + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +cat /etc/audit/rules.d/30-ospp-v42-3-access-success.rules The output has to be exactly as follows: -## Unsuccessful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +## Successful file access (any other opens) This has to go last. +## These next two are likely to result in a whole lot of events +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access Is it the case that the file does not exist or the content differs? - - The owner of all log files written by rsyslog should be - -root. - -These log files are determined by the second part of each Rule line in -/etc/rsyslog.conf and typically all appear in /var/log. -To see the owner of a given log file, run the following command: -$ ls -l LOGFILE - Is it the case that the owner is not correct? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_REFCOUNT_FULL /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? - - - - Run the following command to determine if the nfs-utils package is installed: -$ rpm -q nfs-utils - Is it the case that the package is installed? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "newgrp" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "passwd" command with the following command: -$ sudo auditctl -l | grep newgrp +$ sudo auditctl -l | grep passwd --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -k privileged-newgrp +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-passwd Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit calls to the -clock_settime system call, run the following command: -$ sudo grep "clock_settime" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To determine if the system is configured to audit calls to the -setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To check the ownership of /etc/cron.hourly, + + To check the ownership of /etc/passwd, run the command: -$ ls -lL /etc/cron.hourly +$ ls -lL /etc/passwd If properly configured, the output should indicate the following owner: root - Is it the case that /etc/cron.hourly does not have an owner of root? - - - - Verify that a separate file system/partition has been created for /dev/shm with the following command: - -$ mountpoint /dev/shm - - Is it the case that "/dev/shm is not a mountpoint" is returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_ALL /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + Is it the case that /etc/passwd does not have an owner of root? - + -Run the following command to determine if the selinuxuser_mysql_connect_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_mysql_connect_enabled +Run the following command to determine if the git_cgi_use_nfs SELinux boolean is disabled: +$ getsebool git_cgi_use_nfs If properly configured, the output should show the following: -selinuxuser_mysql_connect_enabled --> off - Is it the case that selinuxuser_mysql_connect_enabled is not disabled? +git_cgi_use_nfs --> off + Is it the case that git_cgi_use_nfs is not disabled? - + -Run the following command to determine if the xdm_bind_vnc_tcp_port SELinux boolean is disabled: -$ getsebool xdm_bind_vnc_tcp_port +Run the following command to determine if the samba_export_all_ro SELinux boolean is disabled: +$ getsebool samba_export_all_ro If properly configured, the output should show the following: -xdm_bind_vnc_tcp_port --> off - Is it the case that xdm_bind_vnc_tcp_port is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_YAMA /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +samba_export_all_ro --> off + Is it the case that samba_export_all_ro is not disabled? - - Run the following command to determine if the nss-tools package is installed: $ rpm -q nss-tools - Is it the case that the package is not installed? + + To check the permissions of /etc/cron.monthly, +run the command: +$ ls -l /etc/cron.monthly +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.monthly does not have unix mode -rwx------? - - -Run the following command to determine if the ftpd_anon_write SELinux boolean is disabled: -$ getsebool ftpd_anon_write -If properly configured, the output should show the following: -ftpd_anon_write --> off - Is it the case that ftpd_anon_write is not disabled? + + To verify if MaxKeepAliveRequests is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i maxkeepaliverequests /etc/httpd/conf/httpd.conf +The command should return the following: +MaxKeepAliveRequests 100 + Is it the case that it is not? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_UNMAP_KERNEL_AT_EL0 /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services + Is it the case that the iptables-services package is not installed? - + -Run the following command to determine if the logging_syslogd_run_nagios_plugins SELinux boolean is disabled: -$ getsebool logging_syslogd_run_nagios_plugins +Run the following command to determine if the httpd_use_cifs SELinux boolean is disabled: +$ getsebool httpd_use_cifs If properly configured, the output should show the following: -logging_syslogd_run_nagios_plugins --> off - Is it the case that logging_syslogd_run_nagios_plugins is not disabled? +httpd_use_cifs --> off + Is it the case that httpd_use_cifs is not disabled? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep -E '(/etc/security/opasswd)' + +-w /etc/security/opasswd -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - - The telnet package can be removed with the following command: $ sudo yum erase telnet - Is it the case that ? + + To verify if password complexities are only enforce on local users, run the following command: +$ grep local_users_only /etc/security/pwquality.conf +The output should return local_users_only uncommented. + Is it the case that local_users_only is not uncommented or configured correctly? - - -Run the following command to determine if the mock_enable_homedirs SELinux boolean is disabled: -$ getsebool mock_enable_homedirs -If properly configured, the output should show the following: -mock_enable_homedirs --> off - Is it the case that mock_enable_homedirs is not disabled? + + Verify the nosuid option is configured for the /srv mount point, + run the following command: + $ sudo mount | grep '\s/srv\s' + . . . /srv . . . nosuid . . . + + Is it the case that the "/srv" file system does not have the "nosuid" option set? - - Verify that all local interactive user initialization file executable search path statements do not contain statements that will reference a working directory other than user home directories with the following commands: + + +To check that the rexec service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rexec --list +Output should indicate the rexec service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rexec --list -$ sudo grep -i path= /home/*/.* +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. -/home/[localinteractiveuser]/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin - Is it the case that any local interactive user initialization files have executable search path statements that include directories outside of their home directory and is not documented with the ISSO as an operational requirement? - - - - To determine if arguments that commands can be executed with are restricted, run the following command: -$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+(?:[ \t]+[^,\s]+)+[ \t]*,)*(\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+[ \t]*(?:,|$))' /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that /etc/sudoers file contains user specifications that allow execution of commands with any arguments? - - - - Verify that interactive users on the system have a home directory assigned with the following command: +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. -$ sudo awk -F: '($3>=1000)&&($7 !~ /nologin/){print $1, $3, $6}' /etc/passwd +rexec off -Inspect the output and verify that all interactive users (normally users with a UID greater than 1000) have a home directory defined. - Is it the case that users home directory is not defined? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chage" command with the following command: +To check that the rexec socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rexec +Output should indicate the rexec socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rexecdisabled -$ sudo auditctl -l | grep chage +Run the following command to verify rexec is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rexec --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_IA32_EMULATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine if the system is configured to audit unsuccessful calls -to the fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the socket is not running the command will return the following output: +inactive - Is it the case that no line is returned? +The socket will also be masked, to check that the rexec is masked, run the following command: +$ sudo systemctl show rexec | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - - -Run the following command to determine if the cobbler_use_cifs SELinux boolean is disabled: -$ getsebool cobbler_use_cifs -If properly configured, the output should show the following: -cobbler_use_cifs --> off - Is it the case that cobbler_use_cifs is not disabled? + + Verify the audit system is configured to take an appropriate action when the internal event queue is full: +$ sudo grep -i overflow_action /etc/audit/auditd.conf + +The output should contain overflow_action = syslog + +If the value of the "overflow_action" option is not set to syslog, +single, halt or the line is commented out, ask the System Administrator +to indicate how the audit logs are off-loaded to a different system or media. + Is it the case that auditd overflow action is not set correctly? - - To check the permissions of /etc/group-, + + To check the permissions of /etc/ssh/sshd_config, run the command: -$ ls -l /etc/group- +$ ls -l /etc/ssh/sshd_config If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/group- does not have unix mode -rw-r--r--? +-rw------- + Is it the case that /etc/ssh/sshd_config does not have unix mode -rw-------? - - To check that the rdisc service is disabled in system boot configuration, + + To check that the debug-shell service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled rdisc -Output should indicate the rdisc service has either not been installed, +$ sudo systemctl is-enabled debug-shell +Output should indicate the debug-shell service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rdisc disabled +$ sudo systemctl is-enabled debug-shell disabled -Run the following command to verify rdisc is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rdisc +Run the following command to verify debug-shell is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active debug-shell If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the rdisc is masked, run the following command: -$ sudo systemctl show rdisc | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the debug-shell is masked, run the following command: +$ sudo systemctl show debug-shell | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "rdisc" is loaded and not masked? + Is it the case that the "debug-shell" is loaded and not masked? - - Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/system-auth file -and is configured to prohibit password reuse for a minimum of -generations. - -Verify the "/etc/pam.d/system-auth" file with the following command: - -$ grep pam_pwhistory.so /etc/pam.d/system-auth -password pam_pwhistory.so use_authtok remember= - - -Verify the "/etc/security/pwhistory.conf" file using the following command: - -$ grep remember /etc/security/pwhistory.conf -remember = + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -The pam_pwhistory.so "remember" option must be configured only in one file. - Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in -/etc/pam.d/system-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set -with a value less than "<sub idref="var_password_pam_remember" />"? - - - - -Run the following command to determine if the httpd_can_connect_mythtv SELinux boolean is disabled: -$ getsebool httpd_can_connect_mythtv -If properly configured, the output should show the following: -httpd_can_connect_mythtv --> off - Is it the case that httpd_can_connect_mythtv is not disabled? + Is it the case that no line is returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_PTYS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit calls to the +init_module system call, run the following command: +$ sudo grep "init_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the ownership of /boot/efi/EFI/redhat/grub.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following owner: -root - Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have an owner of root? + + To verify ExecShield is enabled on 64-bit Red Hat Enterprise Linux 8 systems, +run the following command: +$ dmesg | grep '[NX|DX]*protection' +The output should not contain 'disabled by kernel command line option'. +Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes noexec=off, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*noexec=off.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*noexec=off.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'noexec=off' +The command should not return any output. + Is it the case that ExecShield is not supported by the hardware, is not enabled, or has been disabled by the kernel configuration.? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "umount" command with the following command: - -$ sudo auditctl -l | grep umount + + Verify the system-wide shared library files contained in the following directories have mode "755" or less permissive with the following command: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-umount - Is it the case that the command does not return a line, or the line is commented out? +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 -perm /022 -type f -exec ls -l {} \; + Is it the case that any system-wide shared library file is found to be group-writable or world-writable? - + + The runtime status of the net.ipv4.conf.all.forwarding kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.forwarding +0. +The ability to forward packets is only appropriate for routers. + Is it the case that IP forwarding value is "1" and the system is not router? + + + -Run the following command to determine if the use_ecryptfs_home_dirs SELinux boolean is disabled: -$ getsebool use_ecryptfs_home_dirs +Run the following command to determine if the nagios_run_pnp4nagios SELinux boolean is disabled: +$ getsebool nagios_run_pnp4nagios If properly configured, the output should show the following: -use_ecryptfs_home_dirs --> off - Is it the case that use_ecryptfs_home_dirs is not disabled? +nagios_run_pnp4nagios --> off + Is it the case that nagios_run_pnp4nagios is not disabled? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine if the system is configured to synchronize audit event data -with the log files on the disk: -$ sudo grep flush /etc/audit/auditd.conf -flush = DATA -Acceptable values are DATA, and SYNC. The setting is -case-insensitive. - Is it the case that auditd is not configured to synchronously write audit event data to disk? + + +Run the following command to get the current configured value for deny_execmem +SELinux boolean: +$ getsebool deny_execmem +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that deny_execmem is not set as expected? - - To ensure write permissions are disabled for group and other - for each element in root's path, run the following command: -# ls -ld DIR - Is it the case that group or other write permissions exist? + + To check if RekeyLimit is set correctly, run the following command: +$ sudo grep RekeyLimit /etc/ssh/ssh_config.d/*.conf +If configured properly, output should be +/etc/ssh/ssh_config.d/02-rekey-limit.conf: +RekeyLimit +Check also the main configuration file with the following command: +$ sudo grep RekeyLimit /etc/ssh/ssh_config +The command should not return any output. + Is it the case that it is commented out or is not set? - - Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. - -Determine the location of the tmux script with the following command: - -$ sudo grep tmux /etc/bashrc /etc/profile.d/* - -/etc/profile.d/tmux.sh: case "$name" in (sshd|login) tmux ;; esac + + To check the group ownership of /etc/passwd, +run the command: +$ ls -lL /etc/passwd +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/passwd does not have a group owner of root? + + + + To check the ownership of /boot/grub2/grub.cfg, +run the command: +$ ls -lL /boot/grub2/grub.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/grub2/grub.cfg does not have an owner of root? + + + + To check that the avahi-daemon service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled avahi-daemon +Output should indicate the avahi-daemon service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled avahi-daemon disabled -Review the tmux script by using the following example: +Run the following command to verify avahi-daemon is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active avahi-daemon -$ cat /etc/profile.d/tmux.sh +If the service is not running the command will return the following output: +inactive -if [ "$PS1" ]; then -parent=$(ps -o ppid= -p $$) -name=$(ps -o comm= -p $parent) -case "$name" in (sshd|login) tmux ;; esac -fi +The service will also be masked, to check that the avahi-daemon is masked, run the following command: +$ sudo systemctl show avahi-daemon | grep "LoadState\|UnitFileState" -If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. +If the service is masked the command will return the following outputs: -Determine if tmux is currently running with the following command: +LoadState=masked -$ sudo ps all | grep tmux | grep -v grep - Is it the case that the command does not produce output? +UnitFileState=masked + Is it the case that the "avahi-daemon" is loaded and not masked? - - To check if the system login banner is compliant, -run the following command: -$ cat /etc/issue - Is it the case that it does not display the required banner? + + Run the following command to determine if the fapolicyd package is installed: $ rpm -q fapolicyd + Is it the case that the fapolicyd package is not installed? - - To verify that all user initialization files have a mode of 0740 or -less permissive, run the following command: -$ sudo find /home -type f -name '\.*' \( -perm -0002 -o -perm -0020 \) -There should be no output. - Is it the case that they are not 0740 or more permissive? + + +If the system is configured to prevent the loading of the usb-storage kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the usb-storage kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r usb-storage /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling automount -If properly configured, the output for automount should be false. -To ensure that users cannot enable automount in GNOME3, run the following: -$ grep 'automount' /etc/dconf/db/local.d/locks/* -If properly configured, the output for automount should be /org/gnome/desktop/media-handling/automount - Is it the case that GNOME automounting is not disabled? + + To verify that a remote NTP service is configured for time synchronization, +open the following file: +/etc/ntp.conf +In the file, there should be a section similar to the following: +server ntpserver + Is it the case that this is not the case? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine if the system is configured correctly: -space_left SIZE_in_MB - Is it the case that the system is not configured a specfic size in MB to notify administrators of an issue? + + If the system uses IPv6, this is not applicable. + +If the system is configured to prevent the usage of the ipv6 on +network interfaces, it will contain a line of the form: +net.ipv6.conf.all.disable_ipv6 = 1 +Such lines may be inside any file in the /etc/sysctl.d directory. +This permits insertion of the IPv6 kernel module (which other parts of the +system expect to be present), but otherwise keeps all network interfaces +from using IPv6. Run the following command to search for such lines in all +files in /etc/sysctl.d: +$ grep -r ipv6 /etc/sysctl.d + Is it the case that the ipv6 support is disabled on all network interfaces? - - To verify that rsyslog's Forwarding Output Module is configured -to use TLS for logging to remote server, run the following command: -$ grep omfwd /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should include record similar to -action(type="omfwd" protocol="tcp" Target="<remote system>" port="6514" - StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name" streamdriver.CheckExtendedKeyPurpose="on") + + Verify the assigned home directories of all interactive users on the system exist with the following command: -where the <remote system> present in the configuration line above must be a valid IP address or a host name of the remote logging server. - Is it the case that omfwd is not configured with gtls and AuthMode? +$ sudo pwck -r + +user 'mailnull': directory 'var/spool/mqueue' does not exist + +The output should not return any interactive users. + Is it the case that users home directory does not exist? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_FREELIST_RANDOM /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/cron.allow, +run the command: +$ ls -lL /etc/cron.allow +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.allow does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "usermod" command with the following command: - -$ sudo auditctl -l | grep usermod - --a always,exit -F path=/usr/bin/usermod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-usermod - Is it the case that the command does not return a line, or the line is commented out? + + To verify that Audit Daemon is configured to flush to disk after +every records, run the following command: +$ sudo grep freq /etc/audit/auditd.conf +The output should return the following: +freq = + Is it the case that freq isn't set to <sub idref="var_auditd_freq" />? - - -Run the following command to determine if the httpd_setrlimit SELinux boolean is disabled: -$ getsebool httpd_setrlimit -If properly configured, the output should show the following: -httpd_setrlimit --> off - Is it the case that httpd_setrlimit is not disabled? + + Only FIPS-approved key exchange algorithms must be used. To verify that only FIPS-approved +key exchange algorithms are in use, run the following command: +$ sudo grep -i kexalgorithms /etc/crypto-policies/back-ends/opensshserver.config +The output should contain only following algorithms (or a subset) in the exact order: +CRYPTO_POLICY='-oKexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512' + Is it the case that KexAlgorithms option is commented out, contains non-approved algorithms, or the FIPS-approved algorithms are not in the exact order? - - To check that the named service is disabled in system boot configuration, + + To check that the nftables service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled named -Output should indicate the named service has either not been installed, +$ sudo systemctl is-enabled nftables +Output should indicate the nftables service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled named disabled +$ sudo systemctl is-enabled nftables disabled -Run the following command to verify named is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active named +Run the following command to verify nftables is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active nftables If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the named is masked, run the following command: -$ sudo systemctl show named | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the nftables is masked, run the following command: +$ sudo systemctl show nftables | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "named" is loaded and not masked? + Is it the case that the "nftables" is loaded and not masked? - - To ensure that WIFI connections caanot be created, run the following command: -$ gsettings get org.gnome.nm-applet disable-wifi-create -If properly configured, the output should be true. -To ensure that users cannot enable WIFI connection creation, run the following: -$ grep wifi-create /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/nm-applet/disable-wifi-create - Is it the case that WIFI connections can be created through GNOME? + + +If the system is configured to prevent the loading of the can kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the can kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r can /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? + + + + To determine if the system is configured to audit calls to the +setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/system-auth file +and is configured to prohibit password reuse for a minimum of +generations. + +Verify the "/etc/pam.d/system-auth" file with the following command: + +$ grep pam_pwhistory.so /etc/pam.d/system-auth +password pam_pwhistory.so use_authtok remember= + + +Verify the "/etc/security/pwhistory.conf" file using the following command: + +$ grep remember /etc/security/pwhistory.conf +remember = + +The pam_pwhistory.so "remember" option must be configured only in one file. + Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in +/etc/pam.d/system-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set +with a value less than "<sub idref="var_password_pam_remember" />"? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_IPV6 /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + + +Run the following command to determine if the pppd_can_insmod SELinux boolean is disabled: +$ getsebool pppd_can_insmod +If properly configured, the output should show the following: +pppd_can_insmod --> off + Is it the case that pppd_can_insmod is not disabled? + + + + To verify the assigned home directory of all interactive user home directories +have a mode of 0750 or less permissive, run the following command: +$ sudo ls -l /home +Inspect the output for any directories with incorrect permissions. + Is it the case that they are more permissive? + + + + + +Run the following command to determine the current status of the +syslog-ng service: +$ sudo systemctl is-active syslog-ng +If the service is running, it should return the following: active + Is it the case that the "syslog-ng" service is disabled, masked, or not started.? + + + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep newuidmap /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? + + + + +Run the following command to determine if the domain_fd_use SELinux boolean is enabled: +$ getsebool domain_fd_use +If properly configured, the output should show the following: +domain_fd_use --> on + Is it the case that domain_fd_use is not enabled? + + + + Verify Red Hat Enterprise Linux 8 disables storing core dumps for all users by issuing the following command: + +$ grep -i storage /etc/systemd/coredump.conf + +Storage=none + Is it the case that Storage is not set to none or is commented out and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + + + +If the system is configured to prevent the loading of the bluetooth kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the bluetooth kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r bluetooth /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? @@ -373041,195 +373366,172 @@ If private resources (e.g. drives, partitions, folders/directories, printers, etc.) are sharedw ith the public web server? - - To determine if NOPASSWD has been configured for the vdsm user for sudo, -run the following command: -$ sudo grep -ri nopasswd /etc/sudoers.d/ -The command should return output only for the vdsm user. - Is it the case that nopasswd is set for any users beyond vdsm? + + +Run the following command to determine if the samba_enable_home_dirs SELinux boolean is disabled: +$ getsebool samba_enable_home_dirs +If properly configured, the output should show the following: +samba_enable_home_dirs --> off + Is it the case that samba_enable_home_dirs is not disabled? - - To verify that there are no unauthorized local user accounts, run the following command: -$ less /etc/passwd -Inspect the results, and if unauthorized local user accounts exist, remove them by running -the following command: -$ sudo userdel unauthorized_user - Is it the case that there are unauthorized local user accounts on the system? + + The runtime status of the net.ipv4.conf.all.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.accept_redirects +0. + + Is it the case that the correct value is not returned? - - To determine if the system is configured to audit calls to the -adjtimex system call, run the following command: -$ sudo grep "adjtimex" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep newgidmap /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the httpd package is installed: -$ rpm -q httpd - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_serve_cobbler_files SELinux boolean is disabled: +$ getsebool httpd_serve_cobbler_files +If properly configured, the output should show the following: +httpd_serve_cobbler_files --> off + Is it the case that httpd_serve_cobbler_files is not disabled? - - To check the permissions of /etc/cron.d, -run the command: -$ ls -l /etc/cron.d -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.d does not have unix mode -rwx------? + + Run the following command to determine if the setroubleshoot-server package is installed: +$ rpm -q setroubleshoot-server + Is it the case that the package is installed? - - To determine how the SSH daemon's AllowTcpForwarding option is set, run the following command: + + +Determine the audit log group by running the following command: -$ sudo grep -i AllowTcpForwarding /etc/ssh/sshd_config +$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf -If a line indicating no is returned, then the required value is set. - Is it the case that The AllowTcpForwarding option exists and is disabled? - - - - Verify the audit tools are protected from unauthorized access, deletion, or modification by checking the permissive mode. +Then, check that all directories within the /var/log/audit directory are owned by the group specified as log_group or by root if the log_group is not specified. +Run the following command: -Check the octal permission of each audit tool by running the following command: +$ sudo find /var/log/audit -type d -printf "%p %g\n" -$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules - Is it the case that any of these files have more permissive permissions than 0755? +All listed directories must be owned by the log_group or by root if the log_group is not specified. + Is it the case that there is a directory owned by different group? - - To verify that the system will shutdown when auditd fails, -run the following command: -$ sudo grep "\-f " /etc/audit/audit.rules -The output should contain: --f - Is it the case that the system is not configured to shutdown on auditd failures? + + To determine if the system is configured to audit unsuccessful calls +to the chown system call, run the following command: +$ sudo grep "chown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -To check that the rlogin service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rlogin --list -Output should indicate the rlogin service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rlogin --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. - -rlogin off - -To check that the rlogin socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rlogin -Output should indicate the rlogin socket has either not been installed, +Run the following command to determine if the polipo_use_cifs SELinux boolean is disabled: +$ getsebool polipo_use_cifs +If properly configured, the output should show the following: +polipo_use_cifs --> off + Is it the case that polipo_use_cifs is not disabled? + + + + Run the following command to determine if the policycoreutils-python-utils package is installed: $ rpm -q policycoreutils-python-utils + Is it the case that the package is not installed? + + + + To check that the zebra service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled zebra +Output should indicate the zebra service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rlogindisabled +$ sudo systemctl is-enabled zebra disabled -Run the following command to verify rlogin is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rlogin +Run the following command to verify zebra is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active zebra -If the socket is not running the command will return the following output: +If the service is not running the command will return the following output: inactive -The socket will also be masked, to check that the rlogin is masked, run the following command: -$ sudo systemctl show rlogin | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the zebra is masked, run the following command: +$ sudo systemctl show zebra | grep "LoadState\|UnitFileState" -If the socket is masked the command will return the following outputs: +If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that service and/or socket are running? - - - - -Run the following command to determine if the cups_execmem SELinux boolean is disabled: -$ getsebool cups_execmem -If properly configured, the output should show the following: -cups_execmem --> off - Is it the case that cups_execmem is not disabled? + Is it the case that the "zebra" is loaded and not masked? - + -Run the following command to determine if the secadm_exec_content SELinux boolean is enabled: -$ getsebool secadm_exec_content +Run the following command to determine if the glance_use_execmem SELinux boolean is disabled: +$ getsebool glance_use_execmem If properly configured, the output should show the following: -secadm_exec_content --> on - Is it the case that secadm_exec_content is not enabled? +glance_use_execmem --> off + Is it the case that glance_use_execmem is not disabled? - - To determine if the system is configured to audit unsuccessful calls -to the fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To ensure that the GPG key is installed, run: +$ rpm -q --queryformat "%{SUMMARY}\n" gpg-pubkey +The command should return the string below: +gpg(Red Hat, Inc. (release key 2) <security@redhat.com> + Is it the case that the Red Hat GPG Key is not installed? - - Run the following command to ensure the TMOUT value is configured for all users -on the system: - -$ sudo grep TMOUT /etc/profile /etc/profile.d/*.sh - -The output should return the following: -TMOUT= - Is it the case that value of TMOUT is not less than or equal to expected setting? + + To verify if the OpenSSL uses defined Crypto Policy, run: +$ grep 'Ciphersuites' /etc/crypto-policies/back-ends/opensslcnf.config | tail -n 1 +and verify that the line matches +Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 + Is it the case that Crypto Policy for OpenSSL is not configured according to CC requirements? - - Verify the system commands contained in the following directories have mode "755" or less permissive with the following command: + + The runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.router_solicitations +0. -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin -perm /022 -exec ls -l {} \; - Is it the case that any system commands are found to be group-writable or world-writable? + Is it the case that the correct value is not returned? - - Run the following command to determine if the libcap-ng-utils package is installed: $ rpm -q libcap-ng-utils - Is it the case that the package is not installed? + + Inspect /etc/default/grub for any instances of selinux=0 +in the kernel boot arguments. Presence of selinux=0 indicates +that SELinux is disabled at boot time. + Is it the case that SELinux is disabled at boot time? - - -Run the following command to determine if the mozilla_plugin_use_bluejeans SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_bluejeans -If properly configured, the output should show the following: -mozilla_plugin_use_bluejeans --> off - Is it the case that mozilla_plugin_use_bluejeans is not disabled? + + Verify that a separate file system/partition has been created for /dev/shm with the following command: + +$ mountpoint /dev/shm + + Is it the case that "/dev/shm is not a mountpoint" is returned? - - -Run the following command to determine if the polipo_use_nfs SELinux boolean is disabled: -$ getsebool polipo_use_nfs -If properly configured, the output should show the following: -polipo_use_nfs --> off - Is it the case that polipo_use_nfs is not disabled? + + Verify that the interactive user account passwords last change time is not in the future +The following command should return no output +$ sudo expiration=$(cat /etc/shadow|awk -F ':' '{print $3}'); +for edate in ${expiration[@]}; do if [[ $edate > $(( $(date +%s)/86400 )) ]]; +then echo "Expiry date in future"; +fi; done + Is it the case that any interactive user password that has last change time in the future? - - If the system uses IPv6, this is not applicable. - -If the system is configured to prevent the usage of the ipv6 on -network interfaces, it will contain a line of the form: -net.ipv6.conf.all.disable_ipv6 = 1 -Such lines may be inside any file in the /etc/sysctl.d directory. -This permits insertion of the IPv6 kernel module (which other parts of the -system expect to be present), but otherwise keeps all network interfaces -from using IPv6. Run the following command to search for such lines in all -files in /etc/sysctl.d: -$ grep -r ipv6 /etc/sysctl.d - Is it the case that the ipv6 support is disabled on all network interfaces? + + Run the following command to determine if the vim-enhanced package is installed: $ rpm -q vim-enhanced + Is it the case that the package is not installed? @@ -373241,1121 +373543,871 @@ authlogin_yubikey --> off Is it the case that authlogin_yubikey is not disabled? - - Run the following command to determine if the python3-abrt-addon package is installed: -$ rpm -q python3-abrt-addon - Is it the case that the package is installed? - - - - Make sure that the kernel is not disabling SMEP with the following -commands. -grep -q nosmep /boot/config-`uname -r` -If the command returns a line, it means that SMEP is being disabled. - Is it the case that the kernel is configured to disable SMEP? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one upper-case character. + +Check the value for "ucredit" with the following command: + +$ sudo grep ucredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +ucredit = -1 + Is it the case that the value of "ucredit" is a positive number or is commented out? - + -Run the following command to determine if the tmpreaper_use_samba SELinux boolean is disabled: -$ getsebool tmpreaper_use_samba +Run the following command to determine if the selinuxuser_use_ssh_chroot SELinux boolean is disabled: +$ getsebool selinuxuser_use_ssh_chroot If properly configured, the output should show the following: -tmpreaper_use_samba --> off - Is it the case that tmpreaper_use_samba is not disabled? +selinuxuser_use_ssh_chroot --> off + Is it the case that selinuxuser_use_ssh_chroot is not disabled? - - Run the following command to determine if the rear package is installed: $ rpm -q rear - Is it the case that the package is not installed? + + To determine the status and frequency of logrotate, run the following command: +$ sudo grep logrotate /var/log/cron* +If logrotate is configured properly, output should include references to +/etc/cron.daily. + Is it the case that logrotate is not configured to run daily? - + -Run the following command to determine if the httpd_manage_ipa SELinux boolean is disabled: -$ getsebool httpd_manage_ipa -If properly configured, the output should show the following: -httpd_manage_ipa --> off - Is it the case that httpd_manage_ipa is not disabled? - - - - To check the permissions of /etc/http/conf.modules.d/*, -run the command: -$ ls -l /etc/http/conf.modules.d/* -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/http/conf.modules.d/* does not have unix mode -rw-r-----? +Run the following command to get the current configured value for polyinstantiation_enabled +SELinux boolean: +$ getsebool polyinstantiation_enabled +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that polyinstantiation_enabled is not set as expected? - - To check for incorrectly labeled device files, run following commands: -$ sudo find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n" -$ sudo find /dev -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z\n" -It should produce no output in a well-configured system. - Is it the case that there is output? + + To check that the cups service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled cups +Output should indicate the cups service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled cups disabled + +Run the following command to verify cups is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cups + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the cups is masked, run the following command: +$ sudo systemctl show cups | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "cups" is loaded and not masked? - - To check the ownership of /etc/cron.daily, -run the command: -$ ls -lL /etc/cron.daily -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.daily does not have an owner of root? + + Find the list of alias maps used by the Postfix mail server: +$ sudo postconf alias_maps +Query the Postfix alias maps for an alias for the postmaster user: +$ sudo postmap -q postmaster hash:/etc/aliases +The output should return root. + Is it the case that the alias is not set or is not root? - - To ensure root may not directly login to the system over physical consoles, -run the following command: -cat /etc/securetty -If any output is returned, this is a finding. - Is it the case that the /etc/securetty file is not empty? + + +Run the following command to determine if the httpd_verify_dns SELinux boolean is disabled: +$ getsebool httpd_verify_dns +If properly configured, the output should show the following: +httpd_verify_dns --> off + Is it the case that httpd_verify_dns is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HARDENED_USERCOPY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit calls to the +lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -Run the following command to determine if the daemons_use_tty SELinux boolean is disabled: -$ getsebool daemons_use_tty +Run the following command to determine if the httpd_run_ipa SELinux boolean is disabled: +$ getsebool httpd_run_ipa If properly configured, the output should show the following: -daemons_use_tty --> off - Is it the case that daemons_use_tty is not disabled? +httpd_run_ipa --> off + Is it the case that httpd_run_ipa is not disabled? - - To verify the noexec option is configured for all NFS mounts, run the following command: -$ mount | grep nfs -All NFS mounts should show the noexec setting in parentheses. This is not applicable if NFS is -not implemented. - Is it the case that the setting does not show? + + Verify the SELINUX on Red Hat Enterprise Linux 8 is using the policy with the following command: + +$ sestatus | grep policy + +Loaded policy name: + Is it the case that the loaded policy name is not "<sub idref="var_selinux_policy_name" />"? - - Run the following command to determine if the abrt-addon-kerneloops package is installed: -$ rpm -q abrt-addon-kerneloops - Is it the case that the package is installed? + + Verify that the system backups user data. + Is it the case that it is not? - - Verify the nosuid option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . nosuid . . . - - Is it the case that the "/var/log/audit" file system does not have the "nosuid" option set? + + Verify that the ipv6 loopback interface has required rules in order: +$ iptables -L INPUT -v -n + Is it the case that ipv6 loopback traffic is not configured? - - To verify that rsyslog's Forwarding Output Module has CA certificate -configured for its TLS connections to remote server, run the following command: -$ grep DefaultNetstreamDriverCAFile /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should include record similar to -global(DefaultNetstreamDriverCAFile="/etc/pki/tls/cert.pem") -where the path to the CA file (/etc/pki/tls/cert.pem in case above) must point to the correct CA certificate. - Is it the case that CA certificate for rsyslog remote logging via TLS is not set? + + To verify that the installed operating system is supported or certified, run +the following command: + +The output should contain something similar to: +Red Hat Enterprise Linux 8 + Is it the case that the installed operating system is not FIPS 140-2 certified? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.thumbnailers disable-all -If properly configured, the output should be true. -To ensure that users cannot how long until the screensaver locks, run the following: -$ grep disable-all /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/thumbnailers/disable-all - Is it the case that GNOME thumbnailers are not disabled? + + Run the following command to determine if the abrt-plugin-logger package is installed: +$ rpm -q abrt-plugin-logger + Is it the case that the package is installed? - - To check the permissions of /boot/efi/EFI/redhat/grub.cfg, run the command: -$ sudo ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following -permissions: -rwx------ - Is it the case that it does not? + + To check that the nfs-server service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled nfs-server +Output should indicate the nfs-server service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled nfs-server disabled + +Run the following command to verify nfs-server is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active nfs-server + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the nfs-server is masked, run the following command: +$ sudo systemctl show nfs-server | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "nfs-server" is loaded and not masked? - - Run the following command to determine if the abrt-addon-ccpp package is installed: -$ rpm -q abrt-addon-ccpp - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_can_network_memcache SELinux boolean is disabled: +$ getsebool httpd_can_network_memcache +If properly configured, the output should show the following: +httpd_can_network_memcache --> off + Is it the case that httpd_can_network_memcache is not disabled? - + -Run the following command to determine if the ksmtuned_use_nfs SELinux boolean is disabled: -$ getsebool ksmtuned_use_nfs +Run the following command to determine if the httpd_can_connect_zabbix SELinux boolean is disabled: +$ getsebool httpd_can_connect_zabbix If properly configured, the output should show the following: -ksmtuned_use_nfs --> off - Is it the case that ksmtuned_use_nfs is not disabled? +httpd_can_connect_zabbix --> off + Is it the case that httpd_can_connect_zabbix is not disabled? - - To check the group ownership of /etc/cron.daily, + + To check the ownership of /etc/gshadow, run the command: -$ ls -lL /etc/cron.daily -If properly configured, the output should indicate the following group-owner: +$ ls -lL /etc/gshadow +If properly configured, the output should indicate the following owner: root - Is it the case that /etc/cron.daily does not have a group owner of root? + Is it the case that /etc/gshadow does not have an owner of root? - - The following command will locate the mount points related to local devices: -$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) - -The following command will show files which do not belong to a valid group: -$ sudo find MOUNTPOINT -xdev -nogroup 2>/dev/null - -Replace MOUNTPOINT by the mount points listed by the fist command. + + Verify the hidepid=value option is configured for the /proc mount point, + run the following command: + $ sudo mount | grep '\s/proc\s' + . . . /proc . . . hidepid=value . . . -No files without a valid group should be located. - Is it the case that there is output? + Is it the case that the "/proc" file system does not have the "hidepid=value" option set? - - To check the group ownership of /etc/passwd, + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the group ownership of /etc/ssh/*.pub, run the command: -$ ls -lL /etc/passwd +$ ls -lL /etc/ssh/*.pub If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/passwd does not have a group owner of root? + Is it the case that /etc/ssh/*.pub does not have a group owner of root? - - To determine if the system is configured to audit successful calls -to the truncate system call, run the following command: -$ sudo grep "truncate" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that auditing of privileged command use is configured, run the following command +to search privileged commands in relevant partitions and check if they are covered by auditd +rules: - Is it the case that no line is returned? - - - - To verify the LDAP client backend demands a valid certificate from the server in -remote LDAP access sessions, run the following command: -$ sudo grep ldap_tls_reqcert /etc/sssd/sssd.conf -The output should return the following: -ldap_tls_reqcert = demand - Is it the case that the TLS reqcert is not set to demand? +FILTER_NODEV=$(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) +PARTITIONS=$(findmnt -n -l -k -it $FILTER_NODEV | grep -Pv "noexec|nosuid" | awk '{ print $1 }') +for PARTITION in $PARTITIONS; do + for PRIV_CMD in $(find "${PARTITION}" -xdev -perm /6000 -type f 2>/dev/null); do + grep -qr "${PRIV_CMD}" /etc/audit/rules.d /etc/audit/audit.rules && + printf "OK: ${PRIV_CMD}\n" || printf "WARNING - rule not found for: ${PRIV_CMD}\n" + done +done + +The output should not contain any WARNING. + Is it the case that any setuid or setgid programs doesn't have a line in the audit rules? - - The runtime status of the net.ipv6.conf.all.accept_ra kernel parameter can be queried + + The runtime status of the net.ipv6.conf.default.max_addresses kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra -0. +$ sysctl net.ipv6.conf.default.max_addresses +1. Is it the case that the correct value is not returned? - - Remote web authors should not be able to upload files to the Document Root -directory structure without virus checking and checking for malicious or mobile -code. - Is it the case that it is not? + + To check that the slapd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled slapd +Output should indicate the slapd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled slapd disabled + +Run the following command to verify slapd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active slapd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the slapd is masked, run the following command: +$ sudo systemctl show slapd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "slapd" is loaded and not masked? - - -Run the following command to determine if the selinuxuser_udp_server SELinux boolean is disabled: -$ getsebool selinuxuser_udp_server -If properly configured, the output should show the following: -selinuxuser_udp_server --> off - Is it the case that selinuxuser_udp_server is not disabled? + + Verify Red Hat Enterprise Linux 8 is configured to lock an account until released by an administrator +after unsuccessful logon +attempts with the command: + + +$ grep 'unlock_time =' /etc/security/faillock.conf +unlock_time = + Is it the case that the "unlock_time" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_unlock_time" />", +the line is missing, or commented out? - - To verify that SSSD's in-memory cache expires after a day, run the following command: -$ sudo grep memcache_timeout /etc/sssd/sssd.conf -If configured properly, output should be memcache_timeout = . - Is it the case that it does not exist or is not configured properly? + + The runtime status of the net.ipv4.conf.all.rp_filter parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.rp_filter +The output of the command should indicate either: +net.ipv4.conf.all.rp_filter = 1 +or: +net.ipv4.conf.all.rp_filter = 2 +The output of the command should not indicate: +net.ipv4.conf.all.rp_filter = 0 + +The preferable way how to assure the runtime compliance is to have +correct persistent configuration, and rebooting the system. + +The persistent sysctl parameter configuration is performed by specifying the appropriate +assignment in any file located in the /etc/sysctl.d directory. +Verify that there is not any existing incorrect configuration by executing the following command: +$ grep -r '^\s*net.ipv4.conf.all.rp_filter\s*=' /etc/sysctl.conf /etc/sysctl.d +The command should not find any assignments other than: +net.ipv4.conf.all.rp_filter = 1 +or: +net.ipv4.conf.all.rp_filter = 2 + +Conflicting assignments are not allowed. + Is it the case that the net.ipv4.conf.all.rp_filter is not set to 1 or 2 or is configured to be 0? - - To verify /etc/system-fips exists, run the following command: -ls -l /etc/system-fips -The output should be similar to the following: --rw-r--r--. 1 root root 36 Nov 26 11:31 /etc/system-fips - Is it the case that /etc/system-fips does not exist? + + The telnet package can be removed with the following command: $ sudo yum erase telnet + Is it the case that ? - - Run the following command to determine if the iptables package is installed: $ rpm -q iptables + + Run the following command to determine if the audispd-plugins package is installed: $ rpm -q audispd-plugins Is it the case that the package is not installed? - - Verify that there are no wireless interfaces configured on the system -with the following command: - -Note: This requirement is Not Applicable for systems that do not have physical wireless network radios. - -$ nmcli device status -DEVICE TYPE STATE CONNECTION -virbr0 bridge connected virbr0 -wlp7s0 wifi connected wifiSSID -enp6s0 ethernet disconnected -- -p2p-dev-wlp7s0 wifi-p2p disconnected -- -lo loopback unmanaged -- -virbr0-nic tun unmanaged -- - Is it the case that a wireless interface is configured and has not been documented and approved by the Information System Security Officer (ISSO)? - - - - To verify the audispd's syslog plugin is active, run the following command: -$ sudo grep active /etc/audit/plugins.d/syslog.conf -If the plugin is active, the output will show yes. - Is it the case that it is not activated? - - - - To verify that Audit Daemon is configured to write logs to the disk, run the -following command: -$ sudo grep write_logs /etc/audit/auditd.conf -The output should return the following: -write_logs = yes - Is it the case that write_logs isn't set to yes? + + +Run the following command to determine if the postgresql_selinux_transmit_client_label SELinux boolean is disabled: +$ getsebool postgresql_selinux_transmit_client_label +If properly configured, the output should show the following: +postgresql_selinux_transmit_client_label --> off + Is it the case that postgresql_selinux_transmit_client_label is not disabled? - - Verify that a separate file system/partition has been created for /tmp with the following command: - -$ mountpoint /tmp - - Is it the case that "/tmp is not a mountpoint" is returned? + + To ensure the splash screen is configured not to show user name, run the following command: +$ gsettings get org.gnome.desktop.screensaver show-full-name-in-top-bar +If properly configured, the output should be false. +To ensure that users cannot enable user name on the lock screen, run the following: +$ grep show-full-name-in-top-bar /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/show-full-name-in-top-bar + Is it the case that it is not set or configured properly? - - Using a non-privileged account, verify that users cannot modify or change -network settings with the nmcli command with the following command: -$ nmcli general permissions -The output should contain the following: -PERMISSION VALUE -org.freedesktop.NetworkManager.enable-disable-network auth -org.freedesktop.NetworkManager.enable-disable-wifi auth -org.freedesktop.NetworkManager.enable-disable-wwan auth -org.freedesktop.NetworkManager.enable-disable-wimax auth -org.freedesktop.NetworkManager.sleep-wake auth -org.freedesktop.NetworkManager.network-control auth -org.freedesktop.NetworkManager.wifi.share.protected auth -org.freedesktop.NetworkManager.wifi.share.open auth -org.freedesktop.NetworkManager.settings.modify.system auth -org.freedesktop.NetworkManager.settings.modify.own auth -org.freedesktop.NetworkManager.settings.modify.hostname auth -org.freedesktop.NetworkManager.settings.modify.global-dns auth -org.freedesktop.NetworkManager.reload auth -org.freedesktop.NetworkManager.checkpoint-rollback auth -org.freedesktop.NetworkManager.enable-disable-statistics auth -org.freedesktop.NetworkManager.enable-disable-connectivity-check auth -org.freedesktop.NetworkManager.wifi.scan auth + + Verify the nodev option is configured for the /var mount point, + run the following command: + $ sudo mount | grep '\s/var\s' + . . . /var . . . nodev . . . - Is it the case that non-privileged users can modify or change network settings? + Is it the case that the "/var" file system does not have the "nodev" option set? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open_by_handle_at system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + + If the system does not have SELinux enabled and enforcing a targeted policy, or if the +pam_faillock.so module is not configured for use, this requirement is not applicable. -$ sudo grep -r open_by_handle_at /etc/audit/rules.d +Verify the location of the non-default tally directory for the pam_faillock.so module with +the following command: -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +$ sudo grep -w dir /etc/security/faillock.conf -$ sudo grep open_by_handle_at /etc/audit/audit.rules +dir = /var/log/faillock -The output should be the following: +Check the security context type of the non-default tally directory with the following command: --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? - - - - The runtime status of the kernel.sysrq kernel parameter can be queried -by running the following command: -$ sysctl kernel.sysrq -0. +$ sudo ls -Zd /var/log/faillock - Is it the case that the correct value is not returned? - - - - To verify that McAfee VirusScan Enterprise for Linux is installed -and running, run the following command(s): -$ sudo systemctl status nails -$ rpm -q McAfeeVSEForLinux - Is it the case that virus scanning software is not installed or running? - - - - -Run the following command to determine if the nscd_use_shm SELinux boolean is enabled: -$ getsebool nscd_use_shm -If properly configured, the output should show the following: -nscd_use_shm --> on - Is it the case that nscd_use_shm is not enabled? +unconfined_u:object_r:faillog_t:s0 /var/log/faillock + Is it the case that the security context type of the non-default tally directory is not "faillog_t"? - + -Run the following command to determine if the mozilla_plugin_can_network_connect SELinux boolean is disabled: -$ getsebool mozilla_plugin_can_network_connect -If properly configured, the output should show the following: -mozilla_plugin_can_network_connect --> off - Is it the case that mozilla_plugin_can_network_connect is not disabled? - - - - If the system uses IPv6, this is not applicable. - -If the system is configured to disable the -ipv6 kernel module, it will contain a line -of the form: -options ipv6 disable=1 -Such lines may be inside any file in /etc/modprobe.d or the -deprecated/etc/modprobe.conf. This permits insertion of the IPv6 -kernel module (which other parts of the system expect to be present), but -otherwise keeps it inactive. Run the following command to search for such -lines in all files in /etc/modprobe.d and the deprecated -/etc/modprobe.conf: -$ grep -r ipv6 /etc/modprobe.conf /etc/modprobe.d - Is it the case that the ipv6 kernel module is not disabled? - - - - To ensure the GUI does not allow user administratrion capabilities to all users, -run the following command: -$ gsettings get org.gnome.desktop.lockdown user-administration-disabled -If properly configured, the output should be true. -To ensure that users cannot enable user administration, run the following: -$ grep user-administration /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/desktop/lockdown/user-administration-disabled - Is it the case that user administration is not configured or disabled? - - - - Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services - Is it the case that the iptables-services package is not installed? - - - - The runtime status of the kernel.randomize_va_space kernel parameter can be queried -by running the following command: -$ sysctl kernel.randomize_va_space -2. +To properly set the group owner of /etc/audit/, run the command: +$ sudo chgrp root /etc/audit/ - Is it the case that the correct value is not returned? +To properly set the group owner of /etc/audit/rules.d/, run the command: +$ sudo chgrp root /etc/audit/rules.d/ + Is it the case that ? - - To verify that only security updates will be automatically installed by dnf-automatic, run the following command: -$ sudo grep upgrade_type /etc/dnf/automatic.conf + + To verify if CustomLog is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i customlog /etc/httpd/conf/httpd.conf The output should return the following: -upgrade_type = security - Is it the case that the upgrade_type is not set to security? +CustomLog "logs/access_log" combined + Is it the case that it is not? - - To check the permissions of /boot/grub2/user.cfg, -run the command: -$ ls -l /boot/grub2/user.cfg -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /boot/grub2/user.cfg does not have unix mode -rw-------? + + To check if only local user are impacted by pam_faillock, run the following command: +$ grep local_users_only /etc/security/faillock.conf +The output should return local_users_only not commented. + Is it the case that local_users_only is not uncommented or configured correctly? - + -Run the following command to determine if the sanlock_use_samba SELinux boolean is disabled: -$ getsebool sanlock_use_samba +Run the following command to determine if the polipo_session_users SELinux boolean is disabled: +$ getsebool polipo_session_users If properly configured, the output should show the following: -sanlock_use_samba --> off - Is it the case that sanlock_use_samba is not disabled? +polipo_session_users --> off + Is it the case that polipo_session_users is not disabled? - - To check the group ownership of /etc/group-, + + To check the permissions of /var/log/messages, run the command: -$ ls -lL /etc/group- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/group- does not have a group owner of root? - - - - Run the following command to determine if the abrt-cli package is installed: -$ rpm -q abrt-cli - Is it the case that the package is installed? - - - - Inspect the mounts configured in /etc/exports. Each mount should specify a value -greater than UID_MAX and GID_MAX as defined in /etc/login.defs. - Is it the case that anonuid or anongid are not set to a value greater than UID_MAX (for anonuid) and GID_MAX (for anongid)? - - - - -Run the following command to determine if the boinc_execmem SELinux boolean is disabled: -$ getsebool boinc_execmem -If properly configured, the output should show the following: -boinc_execmem --> off - Is it the case that boinc_execmem is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SYN_COOKIES /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +$ ls -l /var/log/messages +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /var/log/messages does not have unix mode -rw-r-----? - + -Run the following command to determine if the spamassassin_can_network SELinux boolean is disabled: -$ getsebool spamassassin_can_network +Run the following command to determine if the samba_share_nfs SELinux boolean is disabled: +$ getsebool samba_share_nfs If properly configured, the output should show the following: -spamassassin_can_network --> off - Is it the case that spamassassin_can_network is not disabled? - - - - Verify that a separate file system/partition has been created for /var/tmp with the following command: - -$ mountpoint /var/tmp - - Is it the case that "/var/tmp is not a mountpoint" is returned? - - - - To verify all files and directories contained in interactive user home -directory, excluding local initialization files, have a mode of 0750, -run the following command: -$ sudo ls -lLR /home/USER - Is it the case that home directory files or folders have incorrect permissions? - - - - Verify that the system backups user data. - Is it the case that it is not? +samba_share_nfs --> off + Is it the case that samba_share_nfs is not disabled? - - To verify that is configured -as the smart card driver, run the following command: -$ grep force_card_driver /etc/opensc.conf -The output should return something similar to: -force_card_driver = ; - Is it the case that the smart card driver is not configured correctly? + + To check the permissions of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -l /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have unix mode -rw-------? - - Verify that a separate file system/partition has been created for /home with the following command: - -$ mountpoint /home - - Is it the case that "/home is not a mountpoint" is returned? + + To ensure that users cannot change session idle and lock settings, run the following: +$ grep 'lock-delay' /etc/dconf/db/local.d/locks/* +If properly configured, the output should return: +/org/gnome/desktop/screensaver/lock-delay + Is it the case that GNOME3 session settings are not locked or configured properly? - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* + + To determine if the system is configured to audit calls to the +clock_settime system call, run the following command: +$ sudo grep "clock_settime" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that the operating system protects against or limits the effects of DoS -attacks by ensuring implementation of rate-limiting measures -on impacted network interfaces, run the following command: -# grep 'net.ipv4.tcp_invalid_ratelimit' /etc/sysctl.conf /etc/sysctl.d/* -The command should output the following line: -/etc/sysctl.conf:net.ipv4.tcp_invalid_ratelimit = -The file where the line has been found can differ, but it must be either /etc/sysctl.conf -or a file located under the /etc/sysctl.d/ directory. - Is it the case that rate limiting of duplicate TCP acknowledgments is not configured? + + To check the permissions of /etc/audit/auditd.conf, +run the command: +$ ls -l /etc/audit/auditd.conf +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/audit/auditd.conf does not have unix mode -rw-r-----? - - Verify Red Hat Enterprise Linux 8 audits execution as another user. - -Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: - -$ sudo grep execve /etc/audit/audit.rules + + Verify Red Hat Enterprise Linux 8 defines default permissions for all authenticated users in such a way that the user can only read and modify their own files with the following command: -The output should be the following: +# grep -i umask /etc/login.defs --a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation --a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset-k user_emulation - Is it the case that the command does not return all lines, or the lines are commented out? +UMASK + Is it the case that the value for the "UMASK" parameter is not "<sub idref="var_accounts_user_umask" />", or the "UMASK" parameter is missing or is commented out? - + -Run the following command to determine if the telepathy_tcp_connect_generic_network_ports SELinux boolean is disabled: -$ getsebool telepathy_tcp_connect_generic_network_ports +Run the following command to determine if the sge_use_nfs SELinux boolean is disabled: +$ getsebool sge_use_nfs If properly configured, the output should show the following: -telepathy_tcp_connect_generic_network_ports --> off - Is it the case that telepathy_tcp_connect_generic_network_ports is not disabled? +sge_use_nfs --> off + Is it the case that sge_use_nfs is not disabled? - + -Run the following command to determine if the httpd_can_network_relay SELinux boolean is disabled: -$ getsebool httpd_can_network_relay +Run the following command to determine if the daemons_use_tcp_wrapper SELinux boolean is disabled: +$ getsebool daemons_use_tcp_wrapper If properly configured, the output should show the following: -httpd_can_network_relay --> off - Is it the case that httpd_can_network_relay is not disabled? +daemons_use_tcp_wrapper --> off + Is it the case that daemons_use_tcp_wrapper is not disabled? - - Verify the nodev option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . nodev . . . - - Is it the case that the "/var/log" file system does not have the "nodev" option set? + + To check that page poisoning is enabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't enable page poisoning. + Is it the case that page allocator poisoning is not enabled? - - Verify that Red Hat Enterprise Linux 8 is configured to boot to the command line: -$ systemctl get-default -multi-user.target - Is it the case that the system default target is not set to "multi-user.target" and the Information System Security Officer (ISSO) lacks a documented requirement for a graphical user interface? + + Only strong MACs should be used. To verify that only strong +MACs are in use, run the following command: +$ sudo grep -i macs /etc/ssh/sshd_config +The output should contain only those MACs which are strong, namely, + hash functions. + Is it the case that MACs option is commented out or not using strong hash algorithms? - - Shared libraries are stored in the following directories: -/lib -/lib64 -/usr/lib -/usr/lib64 + + The runtime status of the net.ipv4.conf.default.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.accept_redirects +0. -To find shared libraries that are group-writable or world-writable, -run the following command for each directory DIR which contains shared libraries: -$ sudo find -L DIR -perm /022 -type d - Is it the case that any of these files are group-writable or world-writable? + Is it the case that the correct value is not returned? - - To determine if the system is configured to audit calls to the -lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 is configured to lock an account after +unsuccessful logon attempts with the command: - Is it the case that no line is returned? - - - - To check the ownership of /etc/group-, -run the command: -$ ls -lL /etc/group- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/group- does not have an owner of root? + +$ grep 'deny =' /etc/security/faillock.conf +deny = . + Is it the case that the "deny" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_deny" />" +or less (but not "0"), is missing or commented out? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the renameat system call. + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42.rules +The output has to be exactly as follows: +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## the following rule files copied to /etc/audit/rules.d: +## +## 10-base-config.rules, 11-loginuid.rules, +## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, +## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, +## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, +## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, +## 30-ospp-v42-5-perm-change-failed.rules, +## 30-ospp-v42-5-perm-change-success.rules, +## 30-ospp-v42-6-owner-change-failed.rules, +## 30-ospp-v42-6-owner-change-success.rules +## +## original copies may be found in /usr/share/audit/sample-rules/ -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r renameat /etc/audit/rules.d +## User add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch passwd and +## shadow for writes +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +## User enable and disable. This is entirely handled by pam. -$ sudo grep renameat /etc/audit/audit.rules +## Group add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch group and +## gshadow for writes +-a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify +-a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify -The output should be the following: --a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? - - - - To check that the debug-shell service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled debug-shell -Output should indicate the debug-shell service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled debug-shell disabled +## Use of special rights for config changes. This would be use of setuid +## programs that relate to user accts. This is not all setuid apps because +## requirements are only for ones that affect system configuration. +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes -Run the following command to verify debug-shell is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active debug-shell +## Privilege escalation via su or sudo. This is entirely handled by pam. -If the service is not running the command will return the following output: -inactive +## Watch for configuration changes to privilege escalation. +-a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes +-a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes -The service will also be masked, to check that the debug-shell is masked, run the following command: -$ sudo systemctl show debug-shell | grep "LoadState\|UnitFileState" +## Audit log access +-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail +## Attempts to Alter Process and Session Initiation Information +-a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session -If the service is masked the command will return the following outputs: +## Attempts to modify MAC controls +-a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy -LoadState=masked +## Software updates. This is entirely handled by rpm. -UnitFileState=masked - Is it the case that the "debug-shell" is loaded and not masked? - - - - Run the following command to determine if the ypserv package is installed: -$ rpm -q ypserv - Is it the case that the package is installed? - - - - -Run the following command to determine if the virt_sandbox_use_sys_admin SELinux boolean is disabled: -$ getsebool virt_sandbox_use_sys_admin -If properly configured, the output should show the following: -virt_sandbox_use_sys_admin --> off - Is it the case that virt_sandbox_use_sys_admin is not disabled? - - - - -Run the following command to determine if the xguest_mount_media SELinux boolean is disabled: -$ getsebool xguest_mount_media -If properly configured, the output should show the following: -xguest_mount_media --> off - Is it the case that xguest_mount_media is not disabled? - - - - -Run the following command to determine if the polipo_use_cifs SELinux boolean is disabled: -$ getsebool polipo_use_cifs -If properly configured, the output should show the following: -polipo_use_cifs --> off - Is it the case that polipo_use_cifs is not disabled? - - - - To check the permissions of /boot/Sysem.map-*, -run the command: -$ ls -l /boot/Sysem.map-* -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that ? - - - - +## System start and shutdown. This is entirely handled by systemd -Run the following command to determine the current status of the -sssd service: -$ sudo systemctl is-active sssd -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_VSYSCALL_EMULATE /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - Check that Red Hat Enterprise Linux 8 has the packages for smart card support installed. +## Kernel Module loading. This is handled in 43-module-load.rules -Run the following command to determine if the openssl-pkcs11 package is installed: -$ rpm -q openssl-pkcs11 - Is it the case that smartcard software is not installed? - - - - -Run the following command to determine if the daemons_enable_cluster_mode SELinux boolean is disabled: -$ getsebool daemons_enable_cluster_mode -If properly configured, the output should show the following: -daemons_enable_cluster_mode --> off - Is it the case that daemons_enable_cluster_mode is not disabled? +## Application invocation. The requirements list an optional requirement +## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to +## state results from that policy. This would be handled entirely by +## that daemon. + Is it the case that the file does not exist or the content differs? - + -Run the following command to determine if the antivirus_use_jit SELinux boolean is disabled: -$ getsebool antivirus_use_jit +Run the following command to determine if the haproxy_connect_any SELinux boolean is disabled: +$ getsebool haproxy_connect_any If properly configured, the output should show the following: -antivirus_use_jit --> off - Is it the case that antivirus_use_jit is not disabled? - - - - To check the permissions of /etc/crontab, -run the command: -$ ls -l /etc/crontab -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/crontab does not have unix mode -rw-------? - - - - Verify all local interactive users on Red Hat Enterprise Linux 8 are assigned a home -directory upon creation with the following command: -$ grep -i create_home /etc/login.defs -CREATE_HOME yes - Is it the case that the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out? +haproxy_connect_any --> off + Is it the case that haproxy_connect_any is not disabled? - - To check the ownership of /etc/motd, -run the command: -$ ls -lL /etc/motd -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/motd does not have an owner of root? + + To determine if the system is configured to audit successful calls +to the fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To verify the sec option is configured for all NFS mounts, run the following command: -$ mount | grep "sec=" -All NFS mounts should show the sec=krb5:krb5i:krb5p setting in parentheses. -This is not applicable if NFS is not implemented. - Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? + + To verify that remote access methods are logging to rsyslog, +run the following command: +grep -rE '(auth.\*|authpriv.\*|daemon.\*)' /etc/rsyslog.* +The output should contain auth.*, authpriv.*, and daemon.* +pointing to a log file. + Is it the case that remote access methods are not logging to rsyslog? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HARDENED_USERCOPY_FALLBACK /boot/config.* + $ grep CONFIG_STRICT_KERNEL_WRX /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the pcp_read_generic_logs SELinux boolean is disabled: -$ getsebool pcp_read_generic_logs +Run the following command to determine if the nfs_export_all_rw SELinux boolean is enabled: +$ getsebool nfs_export_all_rw If properly configured, the output should show the following: -pcp_read_generic_logs --> off - Is it the case that pcp_read_generic_logs is not disabled? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes l1tf=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*l1tf=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*l1tf=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'l1tf=' -The command should not return any output. - Is it the case that l1tf mitigations are not configured appropriately? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes slub_debug=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slub_debug=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*slub_debug=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'slub_debug=' -The command should not return any output. - Is it the case that SLUB/SLAB poisoning is not enabled? +nfs_export_all_rw --> on + Is it the case that nfs_export_all_rw is not enabled? - - Run the following command to determine if the nftables package is installed: $ rpm -q nftables + + Run the following command to determine if the binutils package is installed: $ rpm -q binutils Is it the case that the package is not installed? - - Ensure that Red Hat Enterprise Linux 8 verifies correct operation of security functions. - -Check if "SELinux" is active and in "" mode with the following command: - -$ sudo getenforce - - Is it the case that SELINUX is not set to enforcing? - - - - To check the permissions of /etc/gshadow, -run the command: -$ ls -l /etc/gshadow -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/gshadow does not have unix mode ----------? + + Inspect /etc/default/grub for any instances of +systemd.confirm_spawn=(1|yes|true|on) in the kernel boot arguments. +Presence of a systemd.confirm_spawn=(1|yes|true|on) indicates +that interactive boot is enabled at boot time and verify that +GRUB_DISABLE_RECOVERY=true to disable recovery boot. + Is it the case that Interactive boot is enabled at boot time? - - To check that the autofs service is disabled in system boot configuration, + + To check that the rsyncd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled autofs -Output should indicate the autofs service has either not been installed, +$ sudo systemctl is-enabled rsyncd +Output should indicate the rsyncd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled autofs disabled +$ sudo systemctl is-enabled rsyncd disabled -Run the following command to verify autofs is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active autofs +Run the following command to verify rsyncd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rsyncd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the autofs is masked, run the following command: -$ sudo systemctl show autofs | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rsyncd is masked, run the following command: +$ sudo systemctl show rsyncd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "autofs" is loaded and not masked? - - - - -Run the following command to determine if the ftpd_use_cifs SELinux boolean is disabled: -$ getsebool ftpd_use_cifs -If properly configured, the output should show the following: -ftpd_use_cifs --> off - Is it the case that ftpd_use_cifs is not disabled? - - - - To determine whether the SSH service is configured to use strong entropy seed, -run $ sudo grep SSH_USE_STRONG_RNG /etc/sysconfig/sshd -If a line indicating that SSH_USE_STRONG_RNG is set to 32 is returned, -then the option is set correctly. - Is it the case that the SSH_USE_STRONG_RNG is not set to 32 in /etc/sysconfig/sshd? + Is it the case that the "rsyncd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Run the following command to Verify that the sudoers security policy is configured to use the invoking user's password for privilege escalation: + sudo cvtsudoers -f sudoers /etc/sudoers | grep -E '^Defaults !?(rootpw|targetpw|runaspw)' +or if cvtsudoers not supported: + sudo find /etc/sudoers /etc/sudoers.d \( \! -name '*~' -a \! -name '*.*' \) -exec grep -E --with-filename '^[[:blank:]]*Defaults[[:blank:]](.*[[:blank:]])?!?\b(rootpw|targetpw|runaspw)' -- {} \; +If no results are returned, this is a finding. +If conflicting results are returned, this is a finding. +If "Defaults !targetpw" is not defined, this is a finding. +If "Defaults !rootpw" is not defined, this is a finding. +If "Defaults !runaspw" is not defined, this is a finding. + Is it the case that invoke user passwd when using sudo? - - To determine if the system is configured to audit calls to the -fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nodev option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . nodev . . . - Is it the case that no line is returned? + Is it the case that the "/var/log/audit" file system does not have the "nodev" option set? - - Verify the SELINUX on Red Hat Enterprise Linux 8 is using the policy with the following command: - -$ sestatus | grep policy - -Loaded policy name: - Is it the case that the loaded policy name is not "<sub idref="var_selinux_policy_name" />"? + + Verify that there are no shosts.equiv files on the system, run the following command: +$ find / -name shosts.equiv + Is it the case that shosts.equiv files exist? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes mce=0, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*mce=0.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*mce=0.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'mce=0' -The command should not return any output. - Is it the case that MCE tolerance is not set to zero? + + Run the following command to determine if the postfix package is installed: $ rpm -q postfix + Is it the case that the package is not installed? - - To ensure the login screen resets after a specified number of failures, -run the following command: -$ grep allowed-failures /etc/dconf/db/gdm.d/* -The output should be 3 or less. -To ensure that users cannot change or configure the resets after a specified -number of failures on the login screen, run the following: -$ grep allowed-failures /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/allowed-failures - Is it the case that allowed-failures is not equal to or less than the expected value? + + Run the following command to determine if the cyrus-imapd package is installed: +$ rpm -q cyrus-imapd + Is it the case that the package is installed? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules -The output has to be exactly as follows: -## Unsuccessful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change - Is it the case that the file does not exist or the content differs? + + Run the following command to determine if the squid package is installed: +$ rpm -q squid + Is it the case that the package is installed? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv4.conf.all.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.accept_source_route +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Run the following command to ensure postfix routes mail to this system: -$ grep relayhost /etc/postfix/main.cf -If properly configured, the output should show only . - Is it the case that it is not? + + To verify that BIND uses the system crypto policy, check out that the BIND config file +/etc/named.conf contains the include "/etc/crypto-policies/back-ends/bind.config"; +directive: +$ sudo grep 'include "/etc/crypto-policies/back-ends/bind.config";' /etc/named.conf +Verify that the directive is at the bottom of the options section of the config file. + Is it the case that BIND is installed and the BIND config file doesn't contain the +<pre>include "/etc/crypto-policies/back-ends/bind.config";</pre> directive? - - Inspect the password section of /etc/pam.d/system-auth -and ensure that the pam_unix.so module is configured to use the argument -sha512: - -$ sudo grep "^password.*pam_unix\.so.*sha512" /etc/pam.d/system-auth - -password sufficient pam_unix.so sha512 - Is it the case that "sha512" is missing, or is commented out? + + To check the permissions of /etc/at.allow, +run the command: +$ ls -l /etc/at.allow +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/at.allow does not have unix mode -rw-------? - - To determine if the system is configured to audit calls to the -rmdir system call, run the following command: -$ sudo grep "rmdir" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check if RekeyLimit is set correctly, run the +following command: - Is it the case that no line is returned? - - - - Run the following command to determine if the firewalld package is installed: $ rpm -q firewalld - Is it the case that the package is not installed? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECCOMP /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To ensure the user list is disabled, run the following command: -$ grep disable-user-list /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot enable displaying the user list, run the following: -$ grep disable-user-list /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/disable-user-list - Is it the case that disable-user-list has not been configured or is not disabled? - - - - -Run the following command to determine if the sanlock_use_fusefs SELinux boolean is disabled: -$ getsebool sanlock_use_fusefs -If properly configured, the output should show the following: -sanlock_use_fusefs --> off - Is it the case that sanlock_use_fusefs is not disabled? +$ sudo grep RekeyLimit /etc/ssh/sshd_config + +If configured properly, output should be +RekeyLimit + Is it the case that it is commented out or is not set? - - To determine how the SSH daemon's IgnoreUserKnownHosts option is set, run the following command: + + To check if authentication is required for emergency mode, run the following command: +$ grep sulogin /usr/lib/systemd/system/emergency.service +The output should be similar to the following, and the line must begin with +ExecStart and /usr/lib/systemd/systemd-sulogin-shell. + ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency -$ sudo grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config +Then, check if the emergency target requires the emergency service: +Run the following command: +$ sudo grep Requires /usr/lib/systemd/system/emergency.target +The output should be the following: +Requires=emergency.service -If a line indicating yes is returned, then the required value is set. +Then, check if there is no custom emergency target configured in systemd configuration. +Run the following command: +$ sudo grep -r emergency.target /etc/systemd/system/ +The output should be empty. - Is it the case that the required value is not set? +Then, check if there is no custom emergency service configured in systemd configuration. +Run the following command: +$ sudo grep -r emergency.service /etc/systemd/system/ +The output should be empty. + Is it the case that the output is different? - - -Run the following command to determine if the dhcpc_exec_iptables SELinux boolean is disabled: -$ getsebool dhcpc_exec_iptables -If properly configured, the output should show the following: -dhcpc_exec_iptables --> off - Is it the case that dhcpc_exec_iptables is not disabled? + + To ensure smart card authentication on the login screen is enabled, run the following command: +$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot disable smart card authentication on the login screen, run the following: +$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/enable-smartcard-authentication + Is it the case that enable-smartcard-authentication has not been configured or is disabled? - + -If the system is configured to prevent the loading of the atm kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the atm kernel module via blacklist keyword. - -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r atm /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? +Run the following command to determine if the user_exec_content SELinux boolean is enabled: +$ getsebool user_exec_content +If properly configured, the output should show the following: +user_exec_content --> on + Is it the case that user_exec_content is not enabled? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size. + + The runtime status of the kernel.kptr_restrict kernel parameter can be queried +by running the following command: +$ sysctl kernel.kptr_restrict +The output of the command should indicate either: +kernel.kptr_restrict = 1 +or: +kernel.kptr_restrict = 2 +The output of the command should not indicate: +kernel.kptr_restrict = 0 -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size with the following command: +The preferable way how to assure the runtime compliance is to have +correct persistent configuration, and rebooting the system. -$ sudo grep max_log_file_action /etc/audit/auditd.conf +The persistent kernel parameter configuration is performed by specifying the appropriate +assignment in any file located in the /etc/sysctl.d directory. +Verify that there is not any existing incorrect configuration by executing the following command: +$ grep -r '^\s*kernel.kptr_restrict\s*=' /etc/sysctl.conf /etc/sysctl.d +The command should not find any assignments other than: +kernel.kptr_restrict = 1 +or: +kernel.kptr_restrict = 2 -max_log_file_action = - Is it the case that the value of the "max_log_file_action" option is not "ROTATE", "SINGLE", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. If there is no evidence of appropriate action? +Conflicting assignments are not allowed. + Is it the case that the kernel.kptr_restrict is not set to 1 or 2 or is configured to be 0? - - -Run the following command to determine if the cobbler_use_nfs SELinux boolean is disabled: -$ getsebool cobbler_use_nfs -If properly configured, the output should show the following: -cobbler_use_nfs --> off - Is it the case that cobbler_use_nfs is not disabled? + + To check the group ownership of /etc/cron.hourly, +run the command: +$ ls -lL /etc/cron.hourly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.hourly does not have a group owner of root? - + To determine if the system is configured to audit successful calls -to the creat system call, run the following command: -$ sudo grep "creat" /etc/audit.* +to the lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the git_system_use_nfs SELinux boolean is disabled: -$ getsebool git_system_use_nfs -If properly configured, the output should show the following: -git_system_use_nfs --> off - Is it the case that git_system_use_nfs is not disabled? + + To determine if NOPASSWD or !authenticate have been configured for +sudo, run the following command: +$ sudo grep -ri "nopasswd\|\!authenticate" /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that nopasswd and/or !authenticate is enabled in sudo? @@ -374367,1240 +374419,999 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/cron.daily does not have unix mode -rwx------? - + -Run the following command to determine if the mpd_enable_homedirs SELinux boolean is disabled: -$ getsebool mpd_enable_homedirs +Run the following command to determine if the tftp_anon_write SELinux boolean is disabled: +$ getsebool tftp_anon_write If properly configured, the output should show the following: -mpd_enable_homedirs --> off - Is it the case that mpd_enable_homedirs is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEVKMEM /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine how the SSH daemon's StrictModes option is set, run the following command: - -$ sudo grep -i StrictModes /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - Verify that the system is integrated with a centralized authentication mechanism -such as as Active Directory, Kerberos, Directory Server, etc. that has -automated account mechanisms in place. - Is it the case that the system is not using a centralized authentication mechanism, or it is not automated? +tftp_anon_write --> off + Is it the case that tftp_anon_write is not disabled? - - To determine that AIDE is verifying ACLs, run the following command: -$ grep acl /etc/aide.conf -Verify that the acl option is added to the correct ruleset. - Is it the case that the acl option is missing or not added to the correct ruleset? + + +Run the following command to determine if the zebra_write_config SELinux boolean is disabled: +$ getsebool zebra_write_config +If properly configured, the output should show the following: +zebra_write_config --> off + Is it the case that zebra_write_config is not disabled? - - To check that the nftables service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled nftables -Output should indicate the nftables service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled nftables disabled - -Run the following command to verify nftables is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active nftables - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the nftables is masked, run the following command: -$ sudo systemctl show nftables | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked + + If the system uses IPv6, this is not applicable. -UnitFileState=masked - Is it the case that the "nftables" is loaded and not masked? - - - - Run the following command to determine if the setroubleshoot-server package is installed: -$ rpm -q setroubleshoot-server - Is it the case that the package is installed? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_CREDENTIALS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +If the system is configured to disable the +ipv6 kernel module, it will contain a line +of the form: +options ipv6 disable=1 +Such lines may be inside any file in /etc/modprobe.d or the +deprecated/etc/modprobe.conf. This permits insertion of the IPv6 +kernel module (which other parts of the system expect to be present), but +otherwise keeps it inactive. Run the following command to search for such +lines in all files in /etc/modprobe.d and the deprecated +/etc/modprobe.conf: +$ grep -r ipv6 /etc/modprobe.conf /etc/modprobe.d + Is it the case that the ipv6 kernel module is not disabled? - + -Run the following command to determine if the samba_create_home_dirs SELinux boolean is disabled: -$ getsebool samba_create_home_dirs +Run the following command to determine if the pppd_for_user SELinux boolean is disabled: +$ getsebool pppd_for_user If properly configured, the output should show the following: -samba_create_home_dirs --> off - Is it the case that samba_create_home_dirs is not disabled? +pppd_for_user --> off + Is it the case that pppd_for_user is not disabled? - + -Run the following command to determine if the mcelog_server SELinux boolean is disabled: -$ getsebool mcelog_server +Run the following command to determine if the mount_anyfile SELinux boolean is enabled: +$ getsebool mount_anyfile If properly configured, the output should show the following: -mcelog_server --> off - Is it the case that mcelog_server is not disabled? - - - - To check that the snmpd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled snmpd -Output should indicate the snmpd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled snmpd disabled - -Run the following command to verify snmpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active snmpd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the snmpd is masked, run the following command: -$ sudo systemctl show snmpd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "snmpd" is loaded and not masked? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes rng_core.default_quality=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*rng_core.default_quality=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*rng_core.default_quality=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'rng_core.default_quality=' -The command should not return any output. - Is it the case that trust on hardware random number generator is not configured appropriately? +mount_anyfile --> on + Is it the case that mount_anyfile is not enabled? - + To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To ensure sshd limits the users who can log in, run the following: -pre>$ sudo grep -rPi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$' /etc/ssh/sshd_config* -If properly configured, the output should be a list of usernames and/or -groups allowed to log in to this system. - Is it the case that sshd does not limit the users who can log in? - - - - -Run the following command to determine if the nfs_export_all_ro SELinux boolean is enabled: -$ getsebool nfs_export_all_ro -If properly configured, the output should show the following: -nfs_export_all_ro --> on - Is it the case that nfs_export_all_ro is not enabled? - - - - To determine that AIDE is configured for FIPS 140-2 file hashing, run the following command: -$ grep sha512 /etc/aide.conf -Verify that the sha512 option is added to the correct ruleset. - Is it the case that the sha512 option is missing or not added to the correct ruleset? + + To verify that the system will shutdown when auditd fails, +run the following command: +$ sudo grep "\-f " /etc/audit/audit.rules +The output should contain: +-f + Is it the case that the system is not configured to shutdown on auditd failures? - - Verify Red Hat Enterprise Linux 8 initiates a session lock after 15 minutes of inactivity. - -Check the value of the system inactivity timeout with the following command: + + First, check whether the password is defined in either /boot/grub2/user.cfg or +/boot/grub2/grub.cfg. +Run the following commands: +$ sudo grep '^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$' /boot/grub2/user.cfg +$ sudo grep '^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$' /boot/grub2/grub.cfg -$ grep -i lock-after-time /etc/tmux.conf -set -g lock-after-time 900 +Second, check that a superuser is defined in /boot/grub2/grub.cfg. +$ sudo grep '^[\s]*set[\s]+superusers=("?)[a-zA-Z_]+\1$' /boot/grub2/grub.cfg + Is it the case that it does not produce any output? + + + + To find world-writable directories that lack the sticky bit, run the following command: +$ sudo find / -type d \( -perm -0002 -a ! -perm -1000 \) -print 2>/dev/null +fixtext: |- +Configure all world-writable directories to have the sticky bit set to prevent unauthorized and unintended information transferred via shared system resources. -Then, verify that the /etc/tmux.conf file can be read by other users than root: +Set the sticky bit on all world-writable directories using the command, replace "[World-Writable Directory]" with any directory path missing the sticky bit: -$ sudo ls -al /etc/tmux.conf - Is it the case that "lock-after-time" is not set to "900" or less in the global tmux configuration file to enforce session lock after inactivity? +$ chmod a+t [World-Writable Directory] +srg_requirement: +A sticky bit must be set on all Red Hat Enterprise Linux 8 public directories to prevent unauthorized and unintended information transferred via shared system resources. + Is it the case that any world-writable directories are missing the sticky bit? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING_ZERO /boot/config.* + $ grep CONFIG_RANDOMIZE_BASE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_defrtr -0. + + +Run the following command to determine if the tor_can_network_relay SELinux boolean is disabled: +$ getsebool tor_can_network_relay +If properly configured, the output should show the following: +tor_can_network_relay --> off + Is it the case that tor_can_network_relay is not disabled? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "crontab" command with the following command: - Is it the case that the correct value is not returned? +$ sudo auditctl -l | grep crontab + +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -k privileged-crontab + Is it the case that the command does not return a line, or the line is commented out? - - To check the ownership of /etc/gshadow, + + To check the group ownership of /etc/cron.allow, run the command: -$ ls -lL /etc/gshadow -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/cron.allow +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/gshadow does not have an owner of root? + Is it the case that /etc/cron.allow does not have a group owner of root? - - + + The following command will locate the mount points related to local devices: +$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -Run the following command to determine the current status of the -fapolicyd service: -$ sudo systemctl is-active fapolicyd -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - The runtime status of the kernel.perf_event_paranoid kernel parameter can be queried -by running the following command: -$ sysctl kernel.perf_event_paranoid -2. +The following command will show files which do not belong to a valid user: +$ sudo find MOUNTPOINT -xdev -nouser 2>/dev/null - Is it the case that the correct value is not returned? +Replace MOUNTPOINT by the mount points listed by the fist command. + +No files without a valid user should be located. + Is it the case that files exist that are not owned by a valid user? - - Verify the audit tools are group-owned by "root" to prevent any unauthorized access, deletion, or modification. - -Check the group-owner of each audit tool by running the following command: - -$ sudo stat -c "%G %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules - -root /sbin/auditctl -root /sbin/aureport -root /sbin/ausearch -root /sbin/autrace -root /sbin/auditd -root /sbin/rsyslogd -root /sbin/augenrules - Is it the case that any audit tools are not group-owned by root? + + To ensure that users cannot change session idle and lock settings, run the following: +$ grep 'idle-delay' /etc/dconf/db/local.d/locks/* +If properly configured, the output should return: +/org/gnome/desktop/session/idle-delay + Is it the case that idle-delay is not locked? - + -Run the following command to determine if the httpd_unified SELinux boolean is disabled: -$ getsebool httpd_unified +Run the following command to determine if the mcelog_foreground SELinux boolean is disabled: +$ getsebool mcelog_foreground If properly configured, the output should show the following: -httpd_unified --> off - Is it the case that httpd_unified is not disabled? - - - - To verify that TLS is configured properly in -/etc/httpd/conf.modules.d/ssl.conf, run the following command: -$ grep -i "sslengine\|sslprotocol" /etc/httpd/conf.d/ssl.conf -The output should return the following: - -SSLEngine on -SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 - - Is it the case that it is not? - - - - To verify insecure file locking has been disabled, run the following command: -$ grep insecure_locks /etc/exports - Is it the case that there is output? +mcelog_foreground --> off + Is it the case that mcelog_foreground is not disabled? - + -Run the following command to determine if the conman_can_network SELinux boolean is disabled: -$ getsebool conman_can_network +Run the following command to determine if the mplayer_execstack SELinux boolean is disabled: +$ getsebool mplayer_execstack If properly configured, the output should show the following: -conman_can_network --> off - Is it the case that conman_can_network is not disabled? +mplayer_execstack --> off + Is it the case that mplayer_execstack is not disabled? - - To determine if the system is configured to audit successful calls -to the ftruncate system call, run the following command: -$ sudo grep "ftruncate" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the noexec option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . noexec . . . - Is it the case that no line is returned? + Is it the case that the "/boot" file system does not have the "noexec" option set? - - Verify that the system is not accepting "rsyslog" messages from other systems unless it is -documented as a log aggregation server. -Display the contents of the rsyslog configuration files: -find /etc -maxdepth 2 -regex '/etc/rsyslog\(\.conf\|\.d\/.*\.conf\)' -exec cat '{}' \; - -If any of the below lines are found, ask to see the documentation for the system being used -for log aggregation: - -If using legacy syntax: -$ModLoad imtcp -$InputTCPServerRun port -$ModLoad imudp -$UDPServerRun port -$ModLoad imrelp -$InputRELPServerRun port - -If using RainerScript syntax: -module(load="imtcp") -module(load="imudp") -input(type="imtcp" port="514") -input(type="imudp" port="514") + + The runtime status of the net.ipv4.conf.all.shared_media kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.shared_media +0. - Is it the case that rsyslog accepts remote messages and is not documented as a log aggregation system? + Is it the case that the correct value is not returned? - - Verify the noexec option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . noexec . . . - - Is it the case that the "/var/log/audit" file system does not have the "noexec" option set? + + +Run the following command to determine if the pcp_read_generic_logs SELinux boolean is disabled: +$ getsebool pcp_read_generic_logs +If properly configured, the output should show the following: +pcp_read_generic_logs --> off + Is it the case that pcp_read_generic_logs is not disabled? - - To check the permissions of /etc/shadow, -run the command: -$ ls -l /etc/shadow -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/shadow does not have unix mode ----------? + + +Run the following command to determine if the selinuxuser_rw_noexattrfile SELinux boolean is disabled: +$ getsebool selinuxuser_rw_noexattrfile +If properly configured, the output should show the following: +selinuxuser_rw_noexattrfile --> off + Is it the case that selinuxuser_rw_noexattrfile is not disabled? - - To obtain a listing of all users, their UIDs, and their shells, run the command: -$ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd -Identify the system accounts from this listing. These will primarily be the accounts with UID -numbers less than 1000, other than root. - Is it the case that any system account other than root has a login shell? + + +Run the following command to determine if the rsync_full_access SELinux boolean is disabled: +$ getsebool rsync_full_access +If properly configured, the output should show the following: +rsync_full_access --> off + Is it the case that rsync_full_access is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "gpasswd" command with the following command: + + Run the following command to determine if the usbguard package is installed: $ rpm -q usbguard + Is it the case that the package is not installed? + + + + Verify the operating system encrypts audit records off-loaded onto a different system +or media from the system being audited with the following commands: -$ sudo auditctl -l | grep gpasswd +$ sudo grep -i '$DefaultNetstreamDriver' /etc/rsyslog.conf /etc/rsyslog.d/*.conf --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-gpasswd - Is it the case that the command does not return a line, or the line is commented out? +The output should be: + +/etc/rsyslog.conf:$DefaultNetstreamDriver gtls + Is it the case that rsyslogd DefaultNetstreamDriver not set to gtls? - + -Run the following command to determine if the httpd_sys_script_anon_write SELinux boolean is disabled: -$ getsebool httpd_sys_script_anon_write +Run the following command to determine if the ssh_chroot_rw_homedirs SELinux boolean is disabled: +$ getsebool ssh_chroot_rw_homedirs If properly configured, the output should show the following: -httpd_sys_script_anon_write --> off - Is it the case that httpd_sys_script_anon_write is not disabled? - - - - Verify that Red Hat Enterprise Linux 8 enforces a minimum -character password length with the following command: - -$ grep minlen /etc/security/pwquality.conf - -minlen = - Is it the case that the command does not return a "minlen" value of "<sub idref="var_password_pam_minlen" />" or greater, does not return a line, or the line is commented out? +ssh_chroot_rw_homedirs --> off + Is it the case that ssh_chroot_rw_homedirs is not disabled? - - Make sure that the kernel is configured to trust the CPU RNG by following -commands. To check if the option was correctly configured at kernel compile -time, run the following command: -grep -q CONFIG_RANDOM_TRUST_CPU=y /boot/config-`uname -r` -If the command outputs: -CONFIG_RANDOM_TRUST_CPU=y, -it means that the option is compiled into the kernel. Make sure that the -option is not overridden through a boot parameter: -sudo grep 'kernelopts.*random\.trust_cpu=off.*' /boot/grub2/grubenv -The command should not return any output. If the option is not compiled into -the kernel, check that the option is configured through boot parameter. -Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes random.trust_cpu=on, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes pti=on, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*random.trust_cpu=on.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*pti=on.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*random.trust_cpu=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*pti=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'random.trust_cpu=on' +$ sudo grubby --info=ALL | grep args | grep -v 'pti=on' The command should not return any output. - Is it the case that the kernel is not configured to trust the CPU RNG? + Is it the case that Kernel page-table isolation is not enabled? - - To check that the sshd service is disabled in system boot configuration, + + To determine if the system is configured to audit account changes, run the following command: -$ sudo systemctl is-enabled sshd -Output should indicate the sshd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled sshd disabled - -Run the following command to verify sshd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active sshd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the sshd is masked, run the following command: -$ sudo systemctl show sshd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "sshd" is loaded and not masked? +auditctl -l | grep -E '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)' +If the system is configured to watch for account changes, lines should be returned for +each file specified (and with perm=wa for each). + Is it the case that the system is not configured to audit account changes? - - To verify that execution of the command is being audited, run the following command: -$ sudo grep "path=/usr/sbin/seunshare" /etc/audit/audit.rules /etc/audit/rules.d/* -The output should return something similar to: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - Is it the case that ? + + To ensure root may not directly login to the system over physical consoles, +run the following command: +cat /etc/securetty +If any output is returned, this is a finding. + Is it the case that the /etc/securetty file is not empty? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING_NO_SANITY /boot/config.* + $ grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/lastlog" with the following command: - -$ sudo auditctl -l | grep /var/log/lastlog - --w /var/log/lastlog -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? - - - + -Run the following command to get the current configured value for deny_execmem -SELinux boolean: -$ getsebool deny_execmem -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that deny_execmem is not set as expected? +Run the following command to determine if the unconfined_login SELinux boolean is enabled: +$ getsebool unconfined_login +If properly configured, the output should show the following: +unconfined_login --> on + Is it the case that unconfined_login is not enabled? - - To check the permissions of /etc/cron.weekly, + + To check the group ownership of /var/log, run the command: -$ ls -l /etc/cron.weekly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.weekly does not have unix mode -rwx------? +$ ls -lL /var/log +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /var/log does not have a group owner of root? - - To verify the boot loader superuser account has been set, run the following -command: -sudo grep -A1 "superusers" /boot/efi/EFI/redhat/grub.cfg -The output should show the following: -set superusers="superusers-account" -export superusers -where superusers-account is the actual account name different from common names like root, -admin, or administrator and different from any other existing user name. - Is it the case that superuser account is not set or is set to an existing name or to a common name? + + +Run the following command to determine if the samba_export_all_rw SELinux boolean is disabled: +$ getsebool samba_export_all_rw +If properly configured, the output should show the following: +samba_export_all_rw --> off + Is it the case that samba_export_all_rw is not disabled? - + -Run the following command to determine if the selinuxuser_ping SELinux boolean is enabled: -$ getsebool selinuxuser_ping +Run the following command to determine if the spamd_enable_home_dirs SELinux boolean is enabled: +$ getsebool spamd_enable_home_dirs If properly configured, the output should show the following: -selinuxuser_ping --> on - Is it the case that selinuxuser_ping is not enabled? +spamd_enable_home_dirs --> on + Is it the case that spamd_enable_home_dirs is not enabled? - - To ensure the splash screen is configured not to show user name, run the following command: -$ gsettings get org.gnome.desktop.screensaver show-full-name-in-top-bar -If properly configured, the output should be false. -To ensure that users cannot enable user name on the lock screen, run the following: -$ grep show-full-name-in-top-bar /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/show-full-name-in-top-bar - Is it the case that it is not set or configured properly? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chcon" command with the following command: + +$ sudo auditctl -l | grep chcon + +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the httpd_can_connect_ldap SELinux boolean is disabled: -$ getsebool httpd_can_connect_ldap -If properly configured, the output should show the following: -httpd_can_connect_ldap --> off - Is it the case that httpd_can_connect_ldap is not disabled? + + The runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_rtr_pref +0. + + Is it the case that the correct value is not returned? - - To verify that tmux is not listed as allowed shell on the system -run the following command: -$ grep 'tmux$' /etc/shells -The output should be empty. - Is it the case that tmux is listed in /etc/shells? + + The runtime status of the net.ipv4.tcp_rfc1337 kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.tcp_rfc1337 +1. + + Is it the case that the correct value is not returned? - - To determine how the SSH daemon's LogLevel option is set, run the following command: + + Verify emergency accounts have been provisioned with an expiration date of 72 hours. -$ sudo grep -i LogLevel /etc/ssh/sshd_config +For every emergency account, run the following command to obtain its account aging and expiration information: -If a line indicating INFO is returned, then the required value is set. +$ sudo chage -l emergency_account_name - Is it the case that the required value is not set? +Verify each of these accounts has an expiration date set within 72 hours or as documented. + Is it the case that any emergency accounts have no expiration date set or do not expire within 72 hours? - + + To verify that there are no .shosts files +on the system, run the following command: +$ sudo find / -name '.shosts' + Is it the case that .shosts files exist? + + + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers" with the following command: + +$ sudo auditctl -l | grep /etc/sudoers + +-w /etc/sudoers -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? + + + -Run the following command to determine if the neutron_can_network SELinux boolean is disabled: -$ getsebool neutron_can_network +Run the following command to determine if the git_system_enable_homedirs SELinux boolean is disabled: +$ getsebool git_system_enable_homedirs If properly configured, the output should show the following: -neutron_can_network --> off - Is it the case that neutron_can_network is not disabled? +git_system_enable_homedirs --> off + Is it the case that git_system_enable_homedirs is not disabled? - - The runtime status of the net.ipv4.conf.default.shared_media kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.shared_media -0. + + Run the following command to determine if the crypto-policies package is installed: $ rpm -q crypto-policies + Is it the case that the package is not installed? + + + + Verify that a separate file system/partition has been created for /usr with the following command: - Is it the case that the correct value is not returned? +$ mountpoint /usr + + Is it the case that "/usr is not a mountpoint" is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "su" command with the following command: + + +If the system is configured to prevent the loading of the rds kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -$ sudo auditctl -l | grep su +These lines can also instruct the module loading system to ignore the rds kernel module via blacklist keyword. --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -k privileged-su - Is it the case that the command does not return a line, or the line is commented out? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r rds /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - To ensure the user home directory is not group-writable or world-readable, run the following: -# ls -ld /home/USER - Is it the case that the user home directory is group-writable or world-readable? + + Inspect the file /etc/firewalld/firewalld.conf to determine +the default zone for the firewalld. It should be set to DefaultZone=drop: +$ sudo grep DefaultZone /etc/firewalld/firewalld.conf + Is it the case that the default zone is not set to DROP? - - To verify that a nftables table exists, run the following command: -$ sudo nft list tables -Output should include a list of nftables similar to: + + Verify that Red Hat Enterprise Linux 8 loads the driver with the following command: - table inet filter +$ grep card_drivers /etc/opensc.conf - Is it the case that a nftables table does not exist? +card_drivers = ; + Is it the case that "<sub idref="var_smartcard_drivers" />" is not listed as a card driver, or there is no line returned for "card_drivers"? + + + + +Run the following command to determine if the staff_use_svirt SELinux boolean is disabled: +$ getsebool staff_use_svirt +If properly configured, the output should show the following: +staff_use_svirt --> off + Is it the case that staff_use_svirt is not disabled? + + + + +Run the following command to determine if the selinuxuser_udp_server SELinux boolean is disabled: +$ getsebool selinuxuser_udp_server +If properly configured, the output should show the following: +selinuxuser_udp_server --> off + Is it the case that selinuxuser_udp_server is not disabled? + + + + Run the following command to determine if the chrony package is installed: $ rpm -q chrony + Is it the case that the package is not installed? + + + + Verify the pam_faillock.so module is present in the "/etc/pam.d/system-auth" file: + +$ sudo grep pam_faillock.so /etc/pam.d/system-auth + +auth required pam_faillock.so preauth +auth required pam_faillock.so authfail +account required pam_faillock.so + Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/system-auth" file with the "preauth" line listed before pam_unix.so? + + + + To check the group ownership of /etc/motd, +run the command: +$ ls -lL /etc/motd +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/motd does not have a group owner of root? - - To determine if the system is configured to audit calls to the -umount2 system call, run the following command: -$ sudo grep "umount2" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check the permissions of /etc/group-, +run the command: +$ ls -l /etc/group- +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/group- does not have unix mode -rw-r--r--? + + + + The runtime status of the net.ipv6.conf.all.autoconf kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.autoconf +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + -Run the following command to determine if the privoxy_connect_any SELinux boolean is disabled: -$ getsebool privoxy_connect_any +Run the following command to determine if the rsync_client SELinux boolean is disabled: +$ getsebool rsync_client If properly configured, the output should show the following: -privoxy_connect_any --> off - Is it the case that privoxy_connect_any is not disabled? +rsync_client --> off + Is it the case that rsync_client is not disabled? - - To verify that the installed operating system is supported or certified, run -the following command: - -The output should contain something similar to: -Red Hat Enterprise Linux 8 - Is it the case that the installed operating system is not FIPS 140-2 certified? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_HARDENED_USERCOPY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + - -Run the following command to determine the current status of the -firewalld service: -$ sudo systemctl is-active firewalld -If the service is running, it should return the following: active - Is it the case that the "firewalld" service is disabled, masked, or not started.? +Run the following command to determine if the racoon_read_shadow SELinux boolean is disabled: +$ getsebool racoon_read_shadow +If properly configured, the output should show the following: +racoon_read_shadow --> off + Is it the case that racoon_read_shadow is not disabled? - - To verify that auditing of privileged command use is configured, run the + + To verify that Audit Daemon is configured to write logs to the disk, run the following command: -$ sudo grep newuidmap /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? +$ sudo grep write_logs /etc/audit/auditd.conf +The output should return the following: +write_logs = yes + Is it the case that write_logs isn't set to yes? - - Verify the nodev option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . nodev . . . + + Verify that Red Hat Enterprise Linux 8 's INACTIVE conforms to site policy (no more than 30 days) with the following command: - Is it the case that the "/home" file system does not have the "nodev" option set? +$ sudo awk -F: '$7 > 30 {print $1 " " $7}' /etc/shadow + Is it the case that the value of INACTIVE is greater than the expected value or is -1? - - Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: - -$ sudo grep audit /etc/security/faillock.conf + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -audit - Is it the case that the "audit" option is not set, is missing or commented out? - - - - To verify all files and directories in a local interactive user's -home directory have a valid owner, run the following command: -$ sudo ls -lLR /home/USER - Is it the case that the user ownership is incorrect? + Is it the case that no line is returned? - + -Run the following command to determine if the samba_portmapper SELinux boolean is disabled: -$ getsebool samba_portmapper +Run the following command to determine if the httpd_ssi_exec SELinux boolean is disabled: +$ getsebool httpd_ssi_exec If properly configured, the output should show the following: -samba_portmapper --> off - Is it the case that samba_portmapper is not disabled? +httpd_ssi_exec --> off + Is it the case that httpd_ssi_exec is not disabled? - - To check that the rsyncd service is disabled in system boot configuration, + + To determine if NOPASSWD has been configured for the vdsm user for sudo, run the following command: -$ sudo systemctl is-enabled rsyncd -Output should indicate the rsyncd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rsyncd disabled - -Run the following command to verify rsyncd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rsyncd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the rsyncd is masked, run the following command: -$ sudo systemctl show rsyncd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: +$ sudo grep -ri nopasswd /etc/sudoers.d/ +The command should return output only for the vdsm user. + Is it the case that nopasswd is set for any users beyond vdsm? + + + + Verify that GRUB_DISABLE_RECOVERY is set to true in /etc/default/grub to disable recovery boot. +Run the following command: -LoadState=masked +$ sudo grep GRUB_DISABLE_RECOVERY /etc/default/grub + Is it the case that GRUB_DISABLE_RECOVERY is not set to true or is missing? + + + + The runtime status of the vm.mmap_min_addr kernel parameter can be queried +by running the following command: +$ sysctl vm.mmap_min_addr +65536. -UnitFileState=masked - Is it the case that the "rsyncd" is loaded and not masked? + Is it the case that the correct value is not returned? - - To check the permissions of /etc/cron.monthly, + + To check the group ownership of /etc/passwd-, run the command: -$ ls -l /etc/cron.monthly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.monthly does not have unix mode -rwx------? +$ ls -lL /etc/passwd- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/passwd- does not have a group owner of root? - - To check that the ypbind service is disabled in system boot configuration, + + To check that the dhcpd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled ypbind -Output should indicate the ypbind service has either not been installed, +$ sudo systemctl is-enabled dhcpd +Output should indicate the dhcpd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ypbind disabled +$ sudo systemctl is-enabled dhcpd disabled -Run the following command to verify ypbind is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ypbind +Run the following command to verify dhcpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active dhcpd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the ypbind is masked, run the following command: -$ sudo systemctl show ypbind | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the dhcpd is masked, run the following command: +$ sudo systemctl show dhcpd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "ypbind" is loaded and not masked? + Is it the case that the "dhcpd" is loaded and not masked? - - To determine if the system is configured to audit unsuccessful calls -to the removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify that a separate file system/partition has been created for /var/log/audit with the following command: - Is it the case that no line is returned? - - - - -Run the following command to determine if the selinuxuser_share_music SELinux boolean is disabled: -$ getsebool selinuxuser_share_music -If properly configured, the output should show the following: -selinuxuser_share_music --> off - Is it the case that selinuxuser_share_music is not disabled? - - - - The runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.drop_gratuitous_arp -1. +$ mountpoint /var/log/audit - Is it the case that the correct value is not returned? - - - - -Run the following command to determine if the exim_manage_user_files SELinux boolean is disabled: -$ getsebool exim_manage_user_files -If properly configured, the output should show the following: -exim_manage_user_files --> off - Is it the case that exim_manage_user_files is not disabled? + Is it the case that "/var/log/audit is not a mountpoint" is returned? - - To check that the oddjobd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled oddjobd -Output should indicate the oddjobd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled oddjobd disabled + + If FTP services are not installed, this is not applicable. -Run the following command to verify oddjobd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active oddjobd +To verify this configuration, run the following command: -If the service is not running the command will return the following output: -inactive +grep "banner_file" /etc/vsftpd/vsftpd.conf -The service will also be masked, to check that the oddjobd is masked, run the following command: -$ sudo systemctl show oddjobd | grep "LoadState\|UnitFileState" -If the service is masked the command will return the following outputs: +The output should show the value of banner_file is set to /etc/issue, an example of which is shown below: -LoadState=masked +$ sudo grep "banner_file" /etc/vsftpd/vsftpd.conf -UnitFileState=masked - Is it the case that the "oddjobd" is loaded and not masked? +banner_file=/etc/issue + Is it the case that it does not? - - -If the system is configured to prevent the loading of the dccp kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the dccp kernel module via blacklist keyword. + + The runtime status of the net.ipv6.conf.all.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_source_route +0. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r dccp /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Run the following command to check for duplicate group names: -Check that the operating system contains no duplicate group names for interactive users by running the following command: + + To verify the boot loader superuser account has been set, run the following +command: +sudo grep -A1 "superusers" /boot/efi/EFI/redhat/grub.cfg +The output should show the following: +set superusers="superusers-account" +export superusers +where superusers-account is the actual account name different from common names like root, +admin, or administrator and different from any other existing user name. + Is it the case that superuser account is not set or is set to an existing name or to a common name? + + + + The reviewed should make a note of the name of the account being used for +the web service. This information may be needed later in the SRR. There +may also be other server services running related to the web server in +support of a particular web application, these passwords must be entrusted +to the SA or Web Manager as well. - cut -d : -f 3 /etc/group | uniq -d +Query the SA or Web Manager to determine if they have the web service +password(s). -If output is produced, this is a finding. -Configure the operating system to contain no duplicate names for groups. -Edit the file "/etc/group" and provide each group that has a duplicate group id with a unique group id. - Is it the case that the system has duplicate group ids? +NOTE: For installations that run as a service, or without a password, +the SA or Web Manager having an Admin account on the system would meet +the intent of this check. + Is it the case that the web server password(s) are not entrusted to the SA or Web Manager? - - -If the system is configured to prevent the loading of the cfg80211 kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the cfg80211 kernel module via blacklist keyword. + + Verify the nosuid option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . nosuid . . . -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r cfg80211 /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the "/var/log" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_can_connect_zabbix SELinux boolean is disabled: -$ getsebool httpd_can_connect_zabbix +Run the following command to determine if the httpd_dontaudit_search_dirs SELinux boolean is disabled: +$ getsebool httpd_dontaudit_search_dirs If properly configured, the output should show the following: -httpd_can_connect_zabbix --> off - Is it the case that httpd_can_connect_zabbix is not disabled? +httpd_dontaudit_search_dirs --> off + Is it the case that httpd_dontaudit_search_dirs is not disabled? - - Run the following command to determine if the policycoreutils package is installed: $ rpm -q policycoreutils - Is it the case that the policycoreutils package is not installed? + + +Run the following command to determine if the xguest_connect_network SELinux boolean is disabled: +$ getsebool xguest_connect_network +If properly configured, the output should show the following: +xguest_connect_network --> off + Is it the case that xguest_connect_network is not disabled? - + -If the system is configured to prevent the loading of the bluetooth kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. +To properly set the owner of /var/log/httpd, run the command: +$ sudo chown root /var/log/httpd -These lines can also instruct the module loading system to ignore the bluetooth kernel module via blacklist keyword. +To properly set the owner of /var/log/httpd/*, run the command: +$ sudo chown root /var/log/httpd/* + Is it the case that ? + + + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r bluetooth /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - To check the status of the idle screen lock activation, run the following command: - -$ gsettings get org.gnome.desktop.screensaver lock-enabled -If properly configured, the output should be true. -To ensure that users cannot change how long until the screensaver locks, run the following: -$ grep lock-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled - Is it the case that screensaver locking is not enabled and/or has not been set or configured correctly? + + Verify all local interactive users on Red Hat Enterprise Linux 8 are assigned a home +directory upon creation with the following command: +$ grep -i create_home /etc/login.defs +CREATE_HOME yes + Is it the case that the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out? - - To verify the audispd plugin encrypts audit records off-loaded onto a different -system or media from the system being audited, run the following command: - -$ sudo grep -i transport /etc/audit/audisp-remote.conf -The output should return the following: -transport = KRB5 - Is it the case that audispd is not encrypting audit records when sent over the network? + + +Run the following command to determine if the fips_mode SELinux boolean is enabled: +$ getsebool fips_mode +If properly configured, the output should show the following: +fips_mode --> on + Is it the case that fips_mode is not enabled? - - To check the ownership of /boot/efi/EFI/redhat/user.cfg, + + To check the ownership of /var/log/messages, run the command: -$ ls -lL /boot/efi/EFI/redhat/user.cfg +$ ls -lL /var/log/messages If properly configured, the output should indicate the following owner: root - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have an owner of root? + Is it the case that /var/log/messages does not have an owner of root? - - To check the group ownership of /boot/grub2/grub.cfg, -run the command: -$ ls -lL /boot/grub2/grub.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/grub2/grub.cfg does not have a group owner of root? + + +Run the following command to determine if the xserver_object_manager SELinux boolean is disabled: +$ getsebool xserver_object_manager +If properly configured, the output should show the following: +xserver_object_manager --> off + Is it the case that xserver_object_manager is not disabled? - - Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. - -Determine the location of the tmux script with the following command: - -$ sudo grep tmux /etc/bashrc /etc/profile.d/* - -/etc/profile.d/tmux.sh: case "$name" in (sshd|login) exec tmux ;; esac - -Review the tmux script by using the following example: - -$ cat /etc/profile.d/tmux.sh - -if [ "$PS1" ]; then -parent=$(ps -o ppid= -p $$) -name=$(ps -o comm= -p $parent) -case "$name" in (sshd|login) exec tmux ;; esac -fi - -If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. - -Determine if tmux is currently running with the following command: + + The runtime status of the net.ipv4.conf.default.send_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.send_redirects +0. -$ sudo ps all | grep tmux | grep -v grep - Is it the case that the command does not produce output? - - - - To ensure screen locking on smartcard removal is enabled, run the following command: -$ grep removal-action /etc/dconf/db/local.d/* -The output should be 'lock-screen'. -To ensure that users cannot disable screen locking on smartcard removal, run the following: -$ grep removal-action /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/settings-daemon/peripherals/smartcard/removal-action - Is it the case that removal-action has not been configured? + Is it the case that the correct value is not returned? - - Verify that Red Hat Enterprise Linux 8 does not have unauthorized IP tunnels configured. - - -# yum list installed libreswan -libreswan.x86-64 3.20-5.el7_4 - - -If "libreswan" is installed, check to see if the "IPsec" service is active with the following command: - -# systemctl status ipsec -ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec -Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) -Active: inactive (dead) - - -If the "IPsec" service is active, check for configured IPsec connections (conn), perform the following: -grep -rni conn /etc/ipsec.conf /etc/ipsec.d/ -Verify any returned results for organizational approval. - Is it the case that the IPSec tunnels are not approved? + + To verify that there are no unauthorized local user accounts, run the following command: +$ less /etc/passwd +Inspect the results, and if unauthorized local user accounts exist, remove them by running +the following command: +$ sudo userdel unauthorized_user + Is it the case that there are unauthorized local user accounts on the system? - - To check the group ownership of /boot/efi/EFI/redhat/user.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/user.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have a group owner of root? + + To determine if LDAP is being used for authentication, use the following +command: +$ sudo grep -i useldapauth /etc/sysconfig/authconfig +The output should return: +USELDAPAUTH=yes + Is it the case that USELDAPAUTH=yes is not configured correctly in /etc/sysconfig/authconfig? - - To check the permissions of /boot/efi/EFI/redhat/user.cfg, -run the command: -$ ls -l /boot/efi/EFI/redhat/user.cfg -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have unix mode -rw-------? + + +Run the following command to determine if the daemons_enable_cluster_mode SELinux boolean is disabled: +$ getsebool daemons_enable_cluster_mode +If properly configured, the output should show the following: +daemons_enable_cluster_mode --> off + Is it the case that daemons_enable_cluster_mode is not disabled? - - Check that the symlink exists and target the correct Kerberos crypto policy, with the following command: -file /etc/krb5.conf.d/crypto-policies -If command ouput shows the following line, Kerberos is configured to use the system-wide crypto policy. -/etc/krb5.conf.d/crypto-policies: symbolic link to /etc/crypto-policies/back-ends/krb5.config - Is it the case that the symlink does not exist or points to a different target? + + To verify if LogFormat is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i logformat /etc/httpd/conf/httpd.conf +The output should contain the following: +LogFormat "a %A %h %H %l %m %s %t %u %U \"%{Referer}i\" \"%{User-Agent}i\"" combined + Is it the case that it is not? - - To check the permissions of /etc/ssh/*.pub, -run the command: -$ ls -l /etc/ssh/*.pub -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/ssh/*.pub does not have unix mode -rw-r--r--? + + To preclude access to the servers root directory, ensure the following +directive is in the httpd.conf file. This entry will also stop users +from setting up .htaccess files which can override security features +configured in /etc/httpd/conf/httpd.conf. +AllowOverride none + Is it the case that it is not? - - To verify the INACTIVE setting, run the following command: -$ grep "INACTIVE" /etc/default/useradd -The output should indicate the INACTIVE configuration option is set -to an appropriate integer as shown in the example below: -$ grep "INACTIVE" /etc/default/useradd -INACTIVE= - Is it the case that the value of INACTIVE is greater than the expected value or is -1? + + To determine how the SSH daemon's LogLevel option is set, run the following command: + +$ sudo grep -i LogLevel /etc/ssh/sshd_config + +If a line indicating VERBOSE is returned, then the required value is set. + + Is it the case that the required value is not set? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules -The output has to be exactly as follows: -## Successful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change - Is it the case that the file does not exist or the content differs? + + If the system is not configured to audit time changes, this is a finding. +If the system is 64-bit only, this is not applicable +ocil: | +To determine if the system is configured to audit calls to the +stime system call, run the following command: +$ sudo grep "stime" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - + -Run the following command to determine if the smbd_anon_write SELinux boolean is disabled: -$ getsebool smbd_anon_write +Run the following command to determine if the httpd_mod_auth_pam SELinux boolean is disabled: +$ getsebool httpd_mod_auth_pam If properly configured, the output should show the following: -smbd_anon_write --> off - Is it the case that smbd_anon_write is not disabled? +httpd_mod_auth_pam --> off + Is it the case that httpd_mod_auth_pam is not disabled? - - Verify it by running the following command: -$ stat -c "%n %G" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules - -/sbin/auditctl root -/sbin/aureport root -/sbin/ausearch root -/sbin/autrace root -/sbin/auditd root -/sbin/audispd root -/sbin/augenrules root - - -If the command does not return all the above lines, the missing ones -need to be added. - -Run the following command to correct the permissions of the missing -entries: -$ sudo chown :root [audit_tool] - -Replace "[audit_tool]" with each audit tool not group-owned by root. - Is it the case that ? + + To verify if the OpenSSH server uses defined Crypto Policy, run: +$ grep 'CRYPTO_POLICY' /etc/crypto-policies/back-ends/opensshserver.config | tail -n 1 +and verify that the line matches +CRYPTO_POLICY='-oCiphers=aes256-ctr,aes128-ctr,aes256-cbc,aes128-cbc -oMACs=hmac-sha2-512,hmac-sha2-256 -oGSSAPIKeyExchange=no -oKexAlgorithms=ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 -oHostKeyAlgorithms=ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -oPubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256' + Is it the case that Crypto Policy for OpenSSH Server is not configured according to CC requirements? - + + Run the following command to determine if the rear package is installed: $ rpm -q rear + Is it the case that the package is not installed? + + + + Run the following command to determine if the abrt-addon-kerneloops package is installed: +$ rpm -q abrt-addon-kerneloops + Is it the case that the package is installed? + + + -Run the following command to determine if the httpd_enable_cgi SELinux boolean is disabled: -$ getsebool httpd_enable_cgi +Run the following command to determine if the use_fusefs_home_dirs SELinux boolean is disabled: +$ getsebool use_fusefs_home_dirs If properly configured, the output should show the following: -httpd_enable_cgi --> off - Is it the case that httpd_enable_cgi is not disabled? +use_fusefs_home_dirs --> off + Is it the case that use_fusefs_home_dirs is not disabled? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_VMAP_STACK /boot/config.* + $ grep CONFIG_DEBUG_CREDENTIALS /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - - -Run the following command to determine the current status of the -rsyslog service: -$ sudo systemctl is-active rsyslog -If the service is running, it should return the following: active - Is it the case that the "rsyslog" service is disabled, masked, or not started.? - - - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd with the following command: + + Inspect the list of enabled firewall ports and verify they are configured correctly by running +the following command: -$ sudo auditctl -l | grep -E '(/etc/shadow)' +$ sudo firewall-cmd --list-all --w /etc/shadow -p wa -k identity - Is it the case that command does not return a line, or the line is commented out? +Ask the System Administrator for the site or program Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA). Verify the services allowed by the firewall match the PPSM CLSA. + Is it the case that there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), or there are no firewall rules configured? - - -If the system is configured to prevent the loading of the sctp kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + The following command will locate the mount points related to local devices: +$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -These lines can also instruct the module loading system to ignore the sctp kernel module via blacklist keyword. +The following command will show files which do not belong to a valid group: +$ sudo find MOUNTPOINT -xdev -nogroup 2>/dev/null -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r sctp /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - The runtime status of the net.ipv6.conf.all.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_redirects -0. +Replace MOUNTPOINT by the mount points listed by the fist command. - Is it the case that the correct value is not returned? +No files without a valid group should be located. + Is it the case that there is output? - - To check that the acpid service is disabled in system boot configuration, + + To check that the cockpit service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled acpid -Output should indicate the acpid service has either not been installed, +$ sudo systemctl is-enabled cockpit +Output should indicate the cockpit service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled acpid disabled +$ sudo systemctl is-enabled cockpit disabled -Run the following command to verify acpid is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active acpid +Run the following command to verify cockpit is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cockpit If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the acpid is masked, run the following command: -$ sudo systemctl show acpid | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the cockpit is masked, run the following command: +$ sudo systemctl show cockpit | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "acpid" is loaded and not masked? + Is it the case that the "cockpit" is loaded and not masked? - - -Run the following command to determine if the secure_mode SELinux boolean is disabled: -$ getsebool secure_mode -If properly configured, the output should show the following: -secure_mode --> off - Is it the case that secure_mode is not disabled? + + Run the following command to determine if the openssh-clients package is installed: $ rpm -q openssh-clients + Is it the case that the package is not installed? - - The following command will discover and print world-writable directories that -are not owned by root. Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -uid +0 -print - Is it the case that there are world-writable directories not owned by root? + + Ensure that debug-shell service is not enabled with the following command: +sudo grep -L "^options\s+.*\bsystemd.debug-shell=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that enables the debug-shell. + Is it the case that the comand returns a line? - + -Run the following command to determine if the zoneminder_anon_write SELinux boolean is disabled: -$ getsebool zoneminder_anon_write +Run the following command to determine if the mozilla_plugin_can_network_connect SELinux boolean is disabled: +$ getsebool mozilla_plugin_can_network_connect If properly configured, the output should show the following: -zoneminder_anon_write --> off - Is it the case that zoneminder_anon_write is not disabled? +mozilla_plugin_can_network_connect --> off + Is it the case that mozilla_plugin_can_network_connect is not disabled? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +To ensure the login warning banner text is properly set, run the following: +$ grep banner-message-text /etc/dconf/db/gdm.d/* +If properly configured, the proper banner text will appear. +To ensure the login warning banner text is locked and cannot be changed by a user, run the following: +$ grep banner-message-text /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/banner-message-text. + Is it the case that it does not? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv4.conf.default.log_martians kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.log_martians +1. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the virt_sandbox_use_mknod SELinux boolean is disabled: -$ getsebool virt_sandbox_use_mknod -If properly configured, the output should show the following: -virt_sandbox_use_mknod --> off - Is it the case that virt_sandbox_use_mknod is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_SHA512 /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify that each web content directory exists on separate partitions, -run the following command: -$ grep `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` /etc/fstab -Each of the corresponding DocumentRoot entries should have a -corresponding entry in /etc/fstab. - Is it the case that it is not? + + Run the following command to determine if the abrt package is installed: +$ rpm -q abrt + Is it the case that the package is installed? - - To check that the certmonger service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled certmonger -Output should indicate the certmonger service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled certmonger disabled - -Run the following command to verify certmonger is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active certmonger - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the certmonger is masked, run the following command: -$ sudo systemctl show certmonger | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked + + To determine if the system is configured to audit successful calls +to the lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -UnitFileState=masked - Is it the case that the "certmonger" is loaded and not masked? - - - - -Run the following command to determine if the samba_domain_controller SELinux boolean is disabled: -$ getsebool samba_domain_controller -If properly configured, the output should show the following: -samba_domain_controller --> off - Is it the case that samba_domain_controller is not disabled? + Is it the case that no line is returned? - - To check that the rhsmcertd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rhsmcertd -Output should indicate the rhsmcertd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rhsmcertd disabled - -Run the following command to verify rhsmcertd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rhsmcertd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the rhsmcertd is masked, run the following command: -$ sudo systemctl show rhsmcertd | grep "LoadState\|UnitFileState" + + Verify Red Hat Enterprise Linux 8 notifies the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: -If the service is masked the command will return the following outputs: +$ sudo grep -w space_left_action /etc/audit/auditd.conf -LoadState=masked +space_left_action = -UnitFileState=masked - Is it the case that the "rhsmcertd" is loaded and not masked? - - - - To determine if requiretty has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\brequiretty\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that requiretty is not enabled in sudo? +If the value of the "space_left_action" is not set to "", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. + Is it the case that there is no evidence that real-time alerts are configured on the system? @@ -375612,346 +375423,314 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/http/conf.d/* does not have unix mode -rw-r-----? - - Run the following command to determine if the McAfeeTP package is installed: $ rpm -q McAfeeTP - Is it the case that the package is not installed? - - - - -Run the following command to determine if the lsmd_plugin_connect_any SELinux boolean is disabled: -$ getsebool lsmd_plugin_connect_any -If properly configured, the output should show the following: -lsmd_plugin_connect_any --> off - Is it the case that lsmd_plugin_connect_any is not disabled? + + To ensure that remote access connections are encrypted, run the following command: +$ gsettings get org.gnome.Vino require-encrpytion +If properly configured, the output should be true. +To ensure that users cannot disable encrypted remote connections, run the following: +$ grep require-encryption /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/Vino/require-encryption + Is it the case that remote access connections are not encrypted? - - -Run the following command to determine if the httpd_can_network_memcache SELinux boolean is disabled: -$ getsebool httpd_can_network_memcache -If properly configured, the output should show the following: -httpd_can_network_memcache --> off - Is it the case that httpd_can_network_memcache is not disabled? + + The runtime status of the net.ipv4.tcp_syncookies kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.tcp_syncookies +1. + + Is it the case that the correct value is not returned? - - To check the group ownership of /etc/issue.net, + + To check the permissions of /etc/ssh/*.pub, run the command: -$ ls -lL /etc/issue.net -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/issue.net does not have a group owner of root? +$ ls -l /etc/ssh/*.pub +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/ssh/*.pub does not have unix mode -rw-r--r--? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudo" command with the following command: - -$ sudo auditctl -l | grep sudo - --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudo - Is it the case that the command does not return a line, or the line is commented out? + + To verify that only security updates will be automatically installed by dnf-automatic, run the following command: +$ sudo grep upgrade_type /etc/dnf/automatic.conf +The output should return the following: +upgrade_type = security + Is it the case that the upgrade_type is not set to security? - + -Run the following command to determine if the polipo_session_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool polipo_session_bind_all_unreserved_ports +Run the following command to determine if the saslauthd_read_shadow SELinux boolean is disabled: +$ getsebool saslauthd_read_shadow If properly configured, the output should show the following: -polipo_session_bind_all_unreserved_ports --> off - Is it the case that polipo_session_bind_all_unreserved_ports is not disabled? +saslauthd_read_shadow --> off + Is it the case that saslauthd_read_shadow is not disabled? - + -Run the following command to determine if the httpd_use_cifs SELinux boolean is disabled: -$ getsebool httpd_use_cifs +Run the following command to determine if the boinc_execmem SELinux boolean is disabled: +$ getsebool boinc_execmem If properly configured, the output should show the following: -httpd_use_cifs --> off - Is it the case that httpd_use_cifs is not disabled? - - - - To ensure LoginGraceTime is set correctly, run the following command: -$ sudo grep LoginGraceTime /etc/ssh/sshd_config -If properly configured, the output should be: -LoginGraceTime -If the option is set to a number greater than 0, then the unauthenticated session will be disconnected -after the configured number seconds. - Is it the case that it is commented out or not configured properly? - - - - To determine how the SSH daemon's LogLevel option is set, run the following command: - -$ sudo grep -i LogLevel /etc/ssh/sshd_config - -If a line indicating VERBOSE is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - Verify Red Hat Enterprise Linux 8 prevents the use of dictionary words for passwords with the following command: - -$ sudo grep dictcheck /etc/security/pwquality.conf /etc/pwquality.conf.d/*.conf - -/etc/security/pwquality.conf:dictcheck=1 - Is it the case that "dictcheck" does not have a value other than "0", or is commented out? +boinc_execmem --> off + Is it the case that boinc_execmem is not disabled? - + -Run the following command to determine if the httpd_mod_auth_ntlm_winbind SELinux boolean is disabled: -$ getsebool httpd_mod_auth_ntlm_winbind +Run the following command to determine if the mozilla_plugin_use_gps SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_gps If properly configured, the output should show the following: -httpd_mod_auth_ntlm_winbind --> off - Is it the case that httpd_mod_auth_ntlm_winbind is not disabled? - - - - Run the following command to determine if the bind package is installed: -$ rpm -q bind - Is it the case that the package is installed? - - - - To verify that McAfee Endpoint Security for Linux is -running, run the following command: -$ sudo ps -ef | grep -i mfetpd - Is it the case that virus scanning software is not running? - - - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep newgidmap /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? - - - - To check if MaxStartups is configured, run the following command: -$ sudo grep MaxStartups /etc/ssh/sshd_config -If configured, this command should output the configuration. - Is it the case that maxstartups is not configured? +mozilla_plugin_use_gps --> off + Is it the case that mozilla_plugin_use_gps is not disabled? - - Review the web site to determine if HTTP and HTTPs are used in accordance with -well known ports (e.g., 80 and 443) or those ports and services as registered -and approved for use by the DoD PPSM. + + Check to see if Online Certificate Status Protocol (OCSP) +is enabled and using the proper digest value on the system with the following command: +$ sudo grep certificate_verification /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf | grep -v "^#" +If configured properly, output should look like -To configure firewalld to allow http access, run the following command(s): -firewall-cmd --permanent --add-service=http -Then run the following command to load the newly created rule(s): -firewall-cmd --reload + certificate_verification = ocsp_dgst= -To configure firewalld to allow https access, run the following command(s): -firewall-cmd --permanent --add-service=https -Then run the following command to load the newly created rule(s): -firewall-cmd --reload - Is it the case that it is not? + Is it the case that certificate_verification in sssd is not configured? - - Verify the TFTP daemon is configured to operate in secure mode. - -Check if a TFTP server is installed with the following command: - -$ rpm -qa | grep tftp - - -If a TFTP server is not installed, this is Not Applicable. - - -If a TFTP server is installed, verify TFTP is configured by with -the -s option by running the following command: - -grep "server_args" /etc/xinetd.d/tftp -server_args = -s - Is it the case that '"server_args" line does not have a "-s" option, and a subdirectory is not assigned'? + + The rsh package can be removed with the following command: $ sudo yum erase rsh + Is it the case that ? - - - The runtime status of the kernel.perf_cpu_time_max_percent kernel parameter can be queried + + + The runtime status of the kernel.unprivileged_bpf_disabled kernel parameter can be queried by running the following command: -$ sysctl kernel.perf_cpu_time_max_percent +$ sysctl kernel.unprivileged_bpf_disabled 1. Is it the case that the correct value is not returned? - - Verify the hidepid=value option is configured for the /proc mount point, - run the following command: - $ sudo mount | grep '\s/proc\s' - . . . /proc . . . hidepid=value . . . - - Is it the case that the "/proc" file system does not have the "hidepid=value" option set? + + Run the following command to determine if the nftables package is installed: $ rpm -q nftables + Is it the case that the package is not installed? - - Check group owners of the system audit logs. + + The runtime status of the kernel.panic_on_oops kernel parameter can be queried +by running the following command: +$ sysctl kernel.panic_on_oops +1. -First, determine where the audit log file is located. + Is it the case that the correct value is not returned? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the ftruncate system call. -$ sudo grep -iw ^log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -The log_file option specifies the audit log file path. -If the log_file option isn't defined, check all files within /var/log/audit directory. +$ sudo grep -r ftruncate /etc/audit/rules.d +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -Then, determine the audit log group by running the following command: -$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf +$ sudo grep ftruncate /etc/audit/audit.rules +The output should be the following: -Then, check that the audit log file is owned by the correct group. -Run the following command to display the owner of the audit log file: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? + + + + To ensure ClientAliveInterval is set correctly, run the following command: -$ sudo stat -c "%n %G" log_file +$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveCountMax 0 -The audit log file must be owned by the log_group or by root if the log_group is not specified. - Is it the case that audit log files are owned by incorrect group? +In this case, the SSH timeout occurs precisely when +the ClientAliveInterval is set. + Is it the case that it is commented out or not configured properly? - + -Run the following command to determine if the xdm_write_home SELinux boolean is disabled: -$ getsebool xdm_write_home +Run the following command to determine if the guest_exec_content SELinux boolean is disabled: +$ getsebool guest_exec_content If properly configured, the output should show the following: -xdm_write_home --> off - Is it the case that xdm_write_home is not disabled? +guest_exec_content --> off + Is it the case that guest_exec_content is not disabled? - - To verify all squashing has been disabled, run the following command: -$ grep all_squash /etc/exports - Is it the case that there is output? + + Run the following command to determine if the libreswan package is installed: $ rpm -q libreswan + Is it the case that the package is not installed? - - To verify the operating system implements cryptography to protect the integrity of -remote ldap access sessions, run the following command: -$ sudo grep ldap_tls_cacertdir /etc/sssd/sssd.conf -The output should return the following with a correctly configured CA cert path: -ldap_tls_cacertdir /path/to/tls/cacert - Is it the case that the TLS CA cert is not configured? + + +Run the following command to determine if the polipo_session_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool polipo_session_bind_all_unreserved_ports +If properly configured, the output should show the following: +polipo_session_bind_all_unreserved_ports --> off + Is it the case that polipo_session_bind_all_unreserved_ports is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chsh" command with the following command: + + -$ sudo auditctl -l | grep chsh +Run the following command to determine the current status of the +crond service: +$ sudo systemctl is-active crond +If the service is running, it should return the following: active + Is it the case that ? + + + + To verify the openldap-servers package is not installed, run the +following command: +$ rpm -q openldap-servers +The output should show the following: +package openldap-servers is not installed + Is it the case that it does not? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfacl" command with the following command: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chsh +$ sudo auditctl -l | grep setfacl + +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod Is it the case that the command does not return a line, or the line is commented out? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_FORCE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/lastlog" with the following command: + +$ sudo auditctl -l | grep /var/log/lastlog + +-w /var/log/lastlog -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the psacct package is installed: $ rpm -q psacct - Is it the case that the package is not installed? + + Run the following command to ensure that /var/tmp is configured as a +polyinstantiated directory: +$ sudo grep /var/tmp /etc/security/namespace.conf +The output should return the following: +/var/tmp /var/tmp/tmp-inst/ level root,adm + Is it the case that is not configured? - - Verify the nosuid option is configured for the /dev/shm mount point, - run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . nosuid . . . + + Verify the site's network diagram and visually check the web server, to +ensure that the private web server is located on a separate controlled +access subnet and is not part of the public DMZ that houses the public +web servers. - Is it the case that the "/dev/shm" file system does not have the "nosuid" option set? +In addition, the private web server needs to be isolated via a controlled +access mechanism from the local general population lan. + Is it the case that the private web server is not on a separate controlled access subnet? - - - -Run the following command to determine the current status of the -pcscd service: -$ sudo systemctl is-active pcscd -If the service is running, it should return the following: active - Is it the case that the pcscd service is not enabled? + + Run the following command to determine if the sssd package is installed: $ rpm -q sssd + Is it the case that the package is not installed? - - Verify the audit log directories have a correct mode or less permissive mode. - -Find the location of the audit logs: - -$ sudo grep "^log_file" /etc/audit/auditd.conf - - - -Run the following command to check the mode of the system audit logs: - -$ sudo stat -c "%a %n" [audit_log_directory] + + To determine how the SSH daemon's PermitRootLogin option is set, run the following command: -Replace "[audit_log_directory]" to the correct audit log directory path, by default this location is "/var/log/audit". +$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config +If a line indicating no is returned, then the required value is set. -The correct permissions are 0700 - Is it the case that audit logs have a more permissive mode? + Is it the case that the required value is not set? - - To check the group ownership of /var/log, -run the command: -$ ls -lL /var/log -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /var/log does not have a group owner of root? + + +Run the following command to determine if the dbadm_manage_user_files SELinux boolean is disabled: +$ getsebool dbadm_manage_user_files +If properly configured, the output should show the following: +dbadm_manage_user_files --> off + Is it the case that dbadm_manage_user_files is not disabled? - - To check the group ownership of /etc/cron.d, -run the command: -$ ls -lL /etc/cron.d -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.d does not have a group owner of root? + + +Run the following command to determine if the rsync_anon_write SELinux boolean is disabled: +$ getsebool rsync_anon_write +If properly configured, the output should show the following: +rsync_anon_write --> off + Is it the case that rsync_anon_write is not disabled? - - To check the group ownership of /etc/cron.monthly, -run the command: -$ ls -lL /etc/cron.monthly -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.monthly does not have a group owner of root? + + Verify that local initialization files do not execute world-writable programs with the following command: + +Note: The example will be for a system that is configured to create user home directories in the "/home" directory. + +$ sudo find /home -perm -002 -type f -name ".[^.]*" -exec ls -ld {} \; + Is it the case that any local initialization files are found to reference world-writable files? - - Inspect the system to determine if intrusion detection software has been installed. -Verify this intrusion detection software is active. - Is it the case that no host-based intrusion detection tools are installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODIFY_LDT_SYSCALL /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the tftp_anon_write SELinux boolean is disabled: -$ getsebool tftp_anon_write +Run the following command to determine if the fenced_can_ssh SELinux boolean is disabled: +$ getsebool fenced_can_ssh If properly configured, the output should show the following: -tftp_anon_write --> off - Is it the case that tftp_anon_write is not disabled? +fenced_can_ssh --> off + Is it the case that fenced_can_ssh is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the mock_enable_homedirs SELinux boolean is disabled: +$ getsebool mock_enable_homedirs +If properly configured, the output should show the following: +mock_enable_homedirs --> off + Is it the case that mock_enable_homedirs is not disabled? + + + + Verify Red Hat Enterprise Linux 8 disables core dump backtraces by issuing the following command: + +$ grep -i process /etc/systemd/coredump.conf + +ProcessSizeMax=0 + Is it the case that the "ProcessSizeMax" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + + + Verify that Red Hat Enterprise Linux 8 has configured the minimum time period between password changes for each user account is one day or greater with the following command: + +$ sudo awk -F: '$4 < 1 {print $1 " " $4}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? + + + + To verify the number of rounds for the password hashing algorithm is configured, run the following command: +$ sudo grep rounds /etc/pam.d/system-auth +The output should show the following match: +password sufficient pam_unix.so sha512 rounds= + Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? @@ -375973,122 +375752,247 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/security/opasswd does not have an owner of root and /etc/security/opasswd does not have a group owner of root and /etc/security/opasswd does not have unix mode 0600? - - To determine whether yum has been configured to disable -gpgcheck for any repos, inspect all files in -/etc/yum.repos.d and ensure the following does not appear in any -sections: -gpgcheck=0 -A value of 0 indicates that gpgcheck has been disabled for that repo. - Is it the case that GPG checking is disabled? - - - + -Run the following command to determine if the postgresql_selinux_unconfined_dbadm SELinux boolean is enabled: -$ getsebool postgresql_selinux_unconfined_dbadm +Run the following command to determine if the httpd_tty_comm SELinux boolean is disabled: +$ getsebool httpd_tty_comm If properly configured, the output should show the following: -postgresql_selinux_unconfined_dbadm --> on - Is it the case that postgresql_selinux_unconfined_dbadm is not enabled? +httpd_tty_comm --> off + Is it the case that httpd_tty_comm is not disabled? - - Verify that the SA and ISSO (at a minimum) are notified when the audit storage volume is full. + + Verify that a separate file system/partition has been created for /var with the following command: -Check which action Red Hat Enterprise Linux 8 takes when the audit storage volume is full with the following command: +$ mountpoint /var -$ sudo grep max_log_file_action /etc/audit/auditd.conf -max_log_file_action = - Is it the case that the value of the "max_log_file_action" option is set to "ignore", "rotate", or "suspend", or the line is commented out? + Is it the case that "/var is not a mountpoint" is returned? - + -Run the following command to determine if the xserver_object_manager SELinux boolean is disabled: -$ getsebool xserver_object_manager +Run the following command to determine if the varnishd_connect_any SELinux boolean is disabled: +$ getsebool varnishd_connect_any If properly configured, the output should show the following: -xserver_object_manager --> off - Is it the case that xserver_object_manager is not disabled? +varnishd_connect_any --> off + Is it the case that varnishd_connect_any is not disabled? - - To check the permissions of /etc/ssh/*_key, + + Verify it by running the following command: +$ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + +/sbin/auditctl root +/sbin/aureport root +/sbin/ausearch root +/sbin/autrace root +/sbin/auditd root +/sbin/audispd root +/sbin/augenrules root + + +If the command does not return all the above lines, the missing ones +need to be added. + +Run the following command to correct the permissions of the missing +entries: +$ sudo chown root [audit_tool] + +Replace "[audit_tool]" with each audit tool not owned by root. + Is it the case that ? + + + + Verify that Red Hat Enterprise Linux 8 is configured to take action in the event of allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: + +$ sudo grep admin_space_left_action /etc/audit/auditd.conf + +admin_space_left_action = single + +If the value of the "admin_space_left_action" is not set to "single", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. + Is it the case that there is no evidence that real-time alerts are configured on the system? + + + + To check the permissions of /etc/cron.hourly, run the command: -$ ls -l /etc/ssh/*_key +$ ls -l /etc/cron.hourly If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/ssh/*_key does not have unix mode -rw-------? +-rwx------ + Is it the case that /etc/cron.hourly does not have unix mode -rwx------? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes ipv6.disable=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*ipv6.disable=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*ipv6.disable=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'ipv6.disable=1' -The command should not return any output. - Is it the case that IPv6 is not disabled? + + To determine if passwd_timeout has been configured for sudo, run the following command: +$ sudo grep -ri '^Defaults.*passwd_timeout=' /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that passwd_timeout is not set with the appropriate value for sudo? - - To verify all local initialization files for interactive users are owned by the -primary user, run the following command: -$ sudo ls -al /home/USER/.* -The user initialization files should be owned by USER. - Is it the case that they are not? + + Run the following command to ensure postfix accepts mail messages from only the local system: +$ grep inet_interfaces /etc/postfix/main.cf +If properly configured, the output should show only . + Is it the case that it does not? - + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + -Run the following command to determine if the httpd_anon_write SELinux boolean is disabled: -$ getsebool httpd_anon_write +Run the following command to determine if the sanlock_use_fusefs SELinux boolean is disabled: +$ getsebool sanlock_use_fusefs If properly configured, the output should show the following: -httpd_anon_write --> off - Is it the case that httpd_anon_write is not disabled? +sanlock_use_fusefs --> off + Is it the case that sanlock_use_fusefs is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the creat system call. + + To determine if the system is configured to audit calls to the +fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the truncate system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r creat /etc/audit/rules.d +$ sudo grep -r truncate /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep creat /etc/audit/audit.rules +$ sudo grep truncate /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access Is it the case that the command does not return a line, or the line is commented out? - - To preclude access to the servers root directory, ensure the following -directive is in the httpd.conf file. This entry will also stop users -from setting up .htaccess files which can override security features -configured in /etc/httpd/conf/httpd.conf. -AllowOverride none + + To determine if the system is configured to audit calls to the +mount system call, run the following command: +$ sudo grep "mount" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_TABLE_ISOLATION /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the permissions of /etc/shadow-, +run the command: +$ ls -l /etc/shadow- +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/shadow- does not have unix mode ----------? + + + + To ensure screen locking on smartcard removal is enabled, run the following command: +$ grep removal-action /etc/dconf/db/local.d/* +The output should be 'lock-screen'. +To ensure that users cannot disable screen locking on smartcard removal, run the following: +$ grep removal-action /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/settings-daemon/peripherals/smartcard/removal-action + Is it the case that removal-action has not been configured? + + + + +Run the following command to determine if the swift_can_network SELinux boolean is disabled: +$ getsebool swift_can_network +If properly configured, the output should show the following: +swift_can_network --> off + Is it the case that swift_can_network is not disabled? + + + + To verify that no .java and .jpp files exist, run the +following command: +find / -name *.java -o -name *.jpp +The output should not return any .java or .jpp files Is it the case that it is not? - - The runtime status of the fs.protected_symlinks kernel parameter can be queried -by running the following command: -$ sysctl fs.protected_symlinks -1. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_update" command with the following command: - Is it the case that the correct value is not returned? +$ sudo auditctl -l | grep unix_update + +-a always,exit -F path=/usr/bin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_update + Is it the case that the command does not return a line, or the line is commented out? + + + + To verify the nodev option is configured for non-root local partitions, run the following command: +$ sudo mount | grep '^/dev\S* on /\S' | grep --invert-match 'nodev' +The output shows local non-root partitions mounted without the nodev option, and there should be no output at all. + + Is it the case that some mounts appear among output lines? + + + + Verify the value of the "minclass" option in "/etc/security/pwquality.conf" with the following command: + +$ grep minclass /etc/security/pwquality.conf + +minclass = + Is it the case that the value of "minclass" is set to less than "<sub idref="var_password_pam_minclass" />" or is commented out? + + + + Verify an anti-virus solution is installed on the system. The anti-virus solution may be +bundled with an approved host-based security solution. + Is it the case that there is no anti-virus solution installed on the system? + + + + To check the ownership of /etc/cron.monthly, +run the command: +$ ls -lL /etc/cron.monthly +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.monthly does not have an owner of root? + + + + Verify that there are no wireless interfaces configured on the system +with the following command: + +Note: This requirement is Not Applicable for systems that do not have physical wireless network radios. + +$ nmcli device status +DEVICE TYPE STATE CONNECTION +virbr0 bridge connected virbr0 +wlp7s0 wifi connected wifiSSID +enp6s0 ethernet disconnected -- +p2p-dev-wlp7s0 wifi-p2p disconnected -- +lo loopback unmanaged -- +virbr0-nic tun unmanaged -- + Is it the case that a wireless interface is configured and has not been documented and approved by the Information System Security Officer (ISSO)? @@ -376102,1782 +376006,2055 @@ If the command does not return results or an error is returned, ask the SA to in Is it the case that there is no evidence that unauthorized peripherals are being blocked before establishing a connection? - - Verify the value of the "maxrepeat" option in "/etc/security/pwquality.conf" with the following command: - -$ grep maxrepeat /etc/security/pwquality.conf + + +To properly set the permissions of /etc/audit/, run the command: +$ sudo chmod 0640 /etc/audit/ -maxrepeat = - Is it the case that the value of "maxrepeat" is set to more than "<sub idref="var_password_pam_maxrepeat" />" or is commented out? +To properly set the permissions of /etc/audit/rules.d/, run the command: +$ sudo chmod 0640 /etc/audit/rules.d/ + Is it the case that ? - - Verify that the ipv6 loopback interface has required rules in order: -$ iptables -L INPUT -v -n - Is it the case that ipv6 loopback traffic is not configured? + + The runtime status of the kernel.core_uses_pid kernel parameter can be queried +by running the following command: +$ sysctl kernel.core_uses_pid +0. + Is it the case that the returned line does not have a value of 0? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers" with the following command: + + Run the following command to determine if the abrt-plugin-rhtsupport package is installed: +$ rpm -q abrt-plugin-rhtsupport + Is it the case that the package is installed? + + + + Verify file systems that are used for removable media are mounted with the "nodev" option with the following command: -$ sudo auditctl -l | grep /etc/sudoers +$ sudo more /etc/fstab --w /etc/sudoers -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? +UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 + Is it the case that a file system found in "/etc/fstab" refers to removable media and it does not have the "nodev" option set? - + + To verify the boot loader superuser password has been set, run the following command: +$ sudo grep "^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$" /boot/efi/EFI/redhat/user.cfg +The output should be similar to: +GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.C4E08AC72FBFF7E837FD267BFAD7AEB3D42DDC +2C99F2A94DD5E2E75C2DC331B719FE55D9411745F82D1B6CFD9E927D61925F9BBDD1CFAA0080E0 +916F7AB46E0D.1302284FCCC52CD73BA3671C6C12C26FF50BA873293B24EE2A96EE3B57963E6D7 +0C83964B473EC8F93B07FE749AA6710269E904A9B08A6BBACB00A2D242AD828 + Is it the case that no password is set? + + + + To check if the system motd banner is compliant, +run the following command: +$ cat /etc/motd + Is it the case that it does not display the required banner? + + + -Run the following command to determine if the gssd_read_tmp SELinux boolean is enabled: -$ getsebool gssd_read_tmp +Run the following command to determine if the ftpd_anon_write SELinux boolean is disabled: +$ getsebool ftpd_anon_write If properly configured, the output should show the following: -gssd_read_tmp --> on - Is it the case that gssd_read_tmp is not enabled? +ftpd_anon_write --> off + Is it the case that ftpd_anon_write is not disabled? - - If the system is not using TLS, set the ldap_id_use_start_tls option -in /etc/sssd/sssd.conf to true. - Is it the case that the 'ldap_id_use_start_tls' option is not set to 'true'? + + To check the group ownership of /etc/ssh/*_key, +run the command: +$ ls -lL /etc/ssh/*_key +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/ssh/*_key does not have a group owner of root? - - To ensure logs are sent to a remote host, examine the file -/etc/rsyslog.conf. -If using UDP, a line similar to the following should be present: - *.* @ -If using TCP, a line similar to the following should be present: - *.* @@ -If using RELP, a line similar to the following should be present: - *.* :omrelp: - Is it the case that no evidence that the audit logs are being off-loaded to another system or media? + + +Run the following command to determine if the piranha_lvs_can_network_connect SELinux boolean is disabled: +$ getsebool piranha_lvs_can_network_connect +If properly configured, the output should show the following: +piranha_lvs_can_network_connect --> off + Is it the case that piranha_lvs_can_network_connect is not disabled? - - -Verify that the shadow password suite configuration is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. - -Check the hashing algorithm that is being used to hash passwords with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "usermod" command with the following command: -$ sudo grep -i ENCRYPT_METHOD /etc/login.defs +$ sudo auditctl -l | grep usermod -ENCRYPT_METHOD - Is it the case that ENCRYPT_METHOD is not set to <sub idref="var_password_hashing_algorithm" />? +-a always,exit -F path=/usr/bin/usermod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-usermod + Is it the case that the command does not return a line, or the line is commented out? - - To check the permissions of /etc/http/conf, -run the command: -$ ls -l /etc/http/conf -If properly configured, the output should indicate the following permissions: --rwxr-x--- - Is it the case that ? + + To check that the psacct service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled psacct +Output should indicate the psacct service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled psacct disabled + +Run the following command to verify psacct is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active psacct + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the psacct is masked, run the following command: +$ sudo systemctl show psacct | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "psacct" is loaded and not masked? - - Display the contents of the file /etc/systemd/logind.conf: -cat /etc/systemd/logind.conf -Ensure that there is a section [login] which contains the -configuration StopIdleSessionSec=. - Is it the case that the option is not configured? + + To check if compression is enabled or set correctly, run the +following command: +$ sudo grep Compression /etc/ssh/sshd_config +If configured properly, output should be no or delayed. + Is it the case that it is commented out, or is not set to no or delayed? - - To find world-writable files, run the following command: -$ sudo find / -xdev -type f -perm -002 - Is it the case that there is output? + + System executables are stored in the following directories by default: +/bin +/sbin +/usr/bin +/usr/sbin +/usr/local/bin +/usr/local/sbin +To find system executables directories that are group-writable or +world-writable, run the following command for each directory DIR +which contains system executables: +$ sudo find -L DIR -perm /022 -type d + Is it the case that any of these files are group-writable or world-writable? - - Verify the nodev option is configured for the /tmp mount point, - run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . nodev . . . - - Is it the case that the "/tmp" file system does not have the "nodev" option set? + + To check that SELinux is not disabled at boot time; +Check that no boot entry disables selinux: +sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that disables SELinux. + Is it the case that SELinux is disabled at boot time? - - To determine if the system is configured to audit calls to the -removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + + Verify the operating system requires re-authentication +when using the "sudo" command to elevate privileges, run the following command: +sudo grep -ri '^Defaults.*timestamp_timeout' /etc/sudoers /etc/sudoers.d +The output should be: +/etc/sudoers:Defaults timestamp_timeout=0 or "timestamp_timeout" is set to a positive number. +If conflicting results are returned, this is a finding. + Is it the case that timestamp_timeout is not set with the appropriate value for sudo? + + + + Run the following command to determine open ports: +# ss -4tuln +Run the following command to determine firewall rules: +# iptables -L INPUT -v -n +For each port identified in the audit which does not have a firewall +rule, add rule for accepting or denying inbound connections +# iptables -A INPUT -p --dport -m state --state NEW -j ACCEPT + Is it the case that open ports are denied connection? + + + + Run the following command to determine if the freeradius package is installed: $ rpm -q freeradius + Is it the case that the package is installed? + + + -Run the following command to determine if the httpd_tty_comm SELinux boolean is disabled: -$ getsebool httpd_tty_comm +Run the following command to determine if the httpd_can_connect_ldap SELinux boolean is disabled: +$ getsebool httpd_can_connect_ldap If properly configured, the output should show the following: -httpd_tty_comm --> off - Is it the case that httpd_tty_comm is not disabled? +httpd_can_connect_ldap --> off + Is it the case that httpd_can_connect_ldap is not disabled? - - To check the ownership of /etc/ssh/sshd_config, -run the command: -$ ls -lL /etc/ssh/sshd_config -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/ssh/sshd_config does not have an owner of root? + + Verify the audit tools are owned by "root" to prevent any unauthorized access, deletion, or modification. + +Check the owner of each audit tool by running the following command: + +$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + +root /sbin/auditctl +root /sbin/aureport +root /sbin/ausearch +root /sbin/autrace +root /sbin/auditd +root /sbin/rsyslogd +root /sbin/augenrules + Is it the case that any audit tools are not owned by root? - - To check the group ownership of /etc/passwd-, -run the command: -$ ls -lL /etc/passwd- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/passwd- does not have a group owner of root? + + Run the following command to determine if the subscription-manager package is installed: $ rpm -q subscription-manager + Is it the case that the package is not installed? - + + Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. + +Determine the location of the tmux script with the following command: + +$ sudo grep tmux /etc/bashrc /etc/profile.d/* + +/etc/profile.d/tmux.sh: case "$name" in (sshd|login) exec tmux ;; esac + +Review the tmux script by using the following example: + +$ cat /etc/profile.d/tmux.sh + +if [ "$PS1" ]; then +parent=$(ps -o ppid= -p $$) +name=$(ps -o comm= -p $parent) +case "$name" in (sshd|login) exec tmux ;; esac +fi + +If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. + +Determine if tmux is currently running with the following command: + +$ sudo ps all | grep tmux | grep -v grep + Is it the case that the command does not produce output? + + + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STACKPROTECTOR /boot/config.* + $ grep CONFIG_UNMAP_KERNEL_AT_EL0 /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - -Run the following command to determine if the postfix_local_write_mail_spool SELinux boolean is enabled: -$ getsebool postfix_local_write_mail_spool -If properly configured, the output should show the following: -postfix_local_write_mail_spool --> on - Is it the case that postfix_local_write_mail_spool is not enabled? + + Verify the nosuid option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . nosuid . . . + + Is it the case that the "/boot" file system does not have the "nosuid" option set? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "kmod" command with the following command: + + Verify that the system is not accepting "rsyslog" messages from other systems unless it is +documented as a log aggregation server. +Display the contents of the rsyslog configuration files: +find /etc -maxdepth 2 -regex '/etc/rsyslog\(\.conf\|\.d\/.*\.conf\)' -exec cat '{}' \; -$ sudo auditctl -l | grep kmod +If any of the below lines are found, ask to see the documentation for the system being used +for log aggregation: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-kmod - Is it the case that the command does not return a line, or the line is commented out? +If using legacy syntax: +$ModLoad imtcp +$InputTCPServerRun port +$ModLoad imudp +$UDPServerRun port +$ModLoad imrelp +$InputRELPServerRun port + +If using RainerScript syntax: +module(load="imtcp") +module(load="imudp") +input(type="imtcp" port="514") +input(type="imudp" port="514") + + Is it the case that rsyslog accepts remote messages and is not documented as a log aggregation system? - - To check the password warning age, run the command: -$ grep PASS_WARN_AGE /etc/login.defs -The DoD requirement is 7. - Is it the case that it is not set to the required value? + + Verify the audit system prevents unauthorized changes with the following command: + +$ sudo grep "^\s*[^#]" /etc/audit/audit.rules | tail -1 +-e 2 + + Is it the case that the audit system is not set to be immutable by adding the "-e 2" option to the end of "/etc/audit/audit.rules"? - - Run the following command to determine if the net-snmp package is installed: -$ rpm -q net-snmp - Is it the case that the package is installed? + + To check that the rdisc service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled rdisc +Output should indicate the rdisc service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rdisc disabled + +Run the following command to verify rdisc is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rdisc + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the rdisc is masked, run the following command: +$ sudo systemctl show rdisc | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "rdisc" is loaded and not masked? - + -Run the following command to determine if the use_fusefs_home_dirs SELinux boolean is disabled: -$ getsebool use_fusefs_home_dirs +Run the following command to determine if the mozilla_plugin_use_spice SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_spice If properly configured, the output should show the following: -use_fusefs_home_dirs --> off - Is it the case that use_fusefs_home_dirs is not disabled? +mozilla_plugin_use_spice --> off + Is it the case that mozilla_plugin_use_spice is not disabled? - - -Run the following command to determine if the unconfined_chrome_sandbox_transition SELinux boolean is enabled: -$ getsebool unconfined_chrome_sandbox_transition -If properly configured, the output should show the following: -unconfined_chrome_sandbox_transition --> on - Is it the case that unconfined_chrome_sandbox_transition is not enabled? + + Run the following command to determine if the rsyslog-gnutls package is installed: +$ rpm -q rsyslog-gnutls + Is it the case that the package is installed? - - -If the system is configured to prevent the loading of the tipc kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + To check that the certmonger service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled certmonger +Output should indicate the certmonger service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled certmonger disabled -These lines can also instruct the module loading system to ignore the tipc kernel module via blacklist keyword. +Run the following command to verify certmonger is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active certmonger + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the certmonger is masked, run the following command: +$ sudo systemctl show certmonger | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "certmonger" is loaded and not masked? + + + + To determine if the system is configured to audit calls to the +fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r tipc /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Inspect /etc/audit/audisp-remote.conf and locate the following line to -determine if the system is configured to perform a correct action according to the policy: -$ sudo grep -i network_failure_action /etc/audit/audisp-remote.conf -The output should return: -network_failure_action = - Is it the case that the system is not configured to switch to single user mode for corrective action? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECCOMP /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to ensure the default FORWARD policy is DROP: -grep ":FORWARD" /etc/sysconfig/iptables -The output should be similar to the following: -$ sudo grep ":FORWARD" /etc/sysconfig/iptables -:FORWARD DROP [0:0 - Is it the case that the default policy for the FORWARD chain is not set to DROP? + + + +Run the following command to determine the current status of the +ufw service: +$ sudo systemctl is-active ufw +If the service is running, it should return the following: active + Is it the case that the service is not enabled? - - Run the following command to determine if the talk package is installed: -$ rpm -q talk - Is it the case that the package is installed? + + +Run the following command to determine if the cron_system_cronjob_use_shares SELinux boolean is disabled: +$ getsebool cron_system_cronjob_use_shares +If properly configured, the output should show the following: +cron_system_cronjob_use_shares --> off + Is it the case that cron_system_cronjob_use_shares is not disabled? - - To check if pam_namespace.so is required for user login, run the following command: -$ grep pam_namespace.so /etc/pam.d/login -The output should return the following uncommented: -session required pam_namespace.so - Is it the case that pam_namespace.so is not required or is commented out? + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. + +Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: + +$ sudo grep disk_error_action /etc/audit/auditd.conf + +disk_error_action = + +If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. + Is it the case that there is no evidence of appropriate action? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open system call with O_CREAT flag. + + To check that the dovecot service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled dovecot +Output should indicate the dovecot service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled dovecot disabled -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: +Run the following command to verify dovecot is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active dovecot -$ sudo grep -r open /etc/audit/rules.d +If the service is not running the command will return the following output: +inactive -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +The service will also be masked, to check that the dovecot is masked, run the following command: +$ sudo systemctl show dovecot | grep "LoadState\|UnitFileState" -$ sudo grep open /etc/audit/audit.rules +If the service is masked the command will return the following outputs: -The output should be the following: +LoadState=masked --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine if the system is configured to audit accesses to -/var/log/audit directory, run the following command: -$ sudo grep "dir=/var/log/audit" /etc/audit/audit.rules -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? +UnitFileState=masked + Is it the case that the "dovecot" is loaded and not masked? - - To ensure the system is configured to ignore the Ctrl-Alt-Del sequence, -run the following command: -$ gsettings get org.gnome.settings-daemon.plugins.media-keys logout -$ grep logout /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/settings-daemon/plugins/media-keys/logout - Is it the case that GNOME3 is configured to reboot when Ctrl-Alt-Del is pressed? + + To check the group ownership of /usr/bin/sudo, +run the command: +$ ls -lL /usr/bin/sudo +If properly configured, the output should indicate the following group-owner: + + Is it the case that /usr/bin/sudo does not have a group owner of <sub idref="var_sudo_dedicated_group" />? - + -Run the following command to determine if the samba_run_unconfined SELinux boolean is disabled: -$ getsebool samba_run_unconfined +Run the following command to determine if the postgresql_can_rsync SELinux boolean is disabled: +$ getsebool postgresql_can_rsync If properly configured, the output should show the following: -samba_run_unconfined --> off - Is it the case that samba_run_unconfined is not disabled? +postgresql_can_rsync --> off + Is it the case that postgresql_can_rsync is not disabled? - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Run the following command to determine if the xinetd package is installed: +$ rpm -q xinetd + Is it the case that the package is installed? - + -Run the following command to determine if the git_cgi_use_cifs SELinux boolean is disabled: -$ getsebool git_cgi_use_cifs -If properly configured, the output should show the following: -git_cgi_use_cifs --> off - Is it the case that git_cgi_use_cifs is not disabled? + + +To determine if firewalld is configured to allow access + +on port 22/tcp, run the following command(s): + firewall-cmd --list-ports + + +to ssh + firewall-cmd --list-services + +If firewalld is configured to allow access through the firewall, something similar to the following will be output: + +If it is a service: +ssh + + +If it is a port: +22/tcp + + Is it the case that sshd service is not enabled in the proper firewalld zone? - - Review the contents of the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf -files to ensure appropriate logging is set. In addition, run the following command: -ls -l /var/log/ -and verify that the log files are logging information - Is it the case that no logging is configured? + + The runtime status of the kernel.dmesg_restrict kernel parameter can be queried +by running the following command: +$ sysctl kernel.dmesg_restrict +1. + + Is it the case that the correct value is not returned? - + -Run the following command to determine if the virt_rw_qemu_ga_data SELinux boolean is disabled: -$ getsebool virt_rw_qemu_ga_data +Run the following command to determine if the logging_syslogd_run_nagios_plugins SELinux boolean is disabled: +$ getsebool logging_syslogd_run_nagios_plugins If properly configured, the output should show the following: -virt_rw_qemu_ga_data --> off - Is it the case that virt_rw_qemu_ga_data is not disabled? - - - - To determine that AIDE is verifying extended file attributes, run the following command: -$ grep xattrs /etc/aide.conf -Verify that the xattrs option is added to the correct ruleset. - Is it the case that the xattrs option is missing or not added to the correct ruleset? +logging_syslogd_run_nagios_plugins --> off + Is it the case that logging_syslogd_run_nagios_plugins is not disabled? - + -Run the following command to determine if the ftpd_connect_all_unreserved SELinux boolean is disabled: -$ getsebool ftpd_connect_all_unreserved +Run the following command to determine if the openvpn_can_network_connect SELinux boolean is disabled: +$ getsebool openvpn_can_network_connect If properly configured, the output should show the following: -ftpd_connect_all_unreserved --> off - Is it the case that ftpd_connect_all_unreserved is not disabled? +openvpn_can_network_connect --> off + Is it the case that openvpn_can_network_connect is not disabled? - - To verify that binaries cannot be directly executed from removable media, run the following command: -$ grep -v noexec /etc/fstab -The resulting output will show partitions which do not have the noexec flag. Verify all partitions -in the output are not removable media. - Is it the case that removable media partitions are present? + + To check that virtual syscalls are disabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls. + Is it the case that vsyscalls are enabled? - - Verify the noexec option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . noexec . . . + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-keysign" command with the following command: - Is it the case that the "/boot" file system does not have the "noexec" option set? +$ sudo auditctl -l | grep ssh-keysign + +-a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-keysign + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the mailx package is installed: $ rpm -q mailx - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PANIC_TIMEOUT /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - The following command will locate the mount points related to local devices: -$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) - -The following command will show files which do not belong to a valid user: -$ sudo find MOUNTPOINT -xdev -nouser 2>/dev/null - -Replace MOUNTPOINT by the mount points listed by the fist command. + + To verify that the DConf User profile is configured correctly, run the following +command: -No files without a valid user should be located. - Is it the case that files exist that are not owned by a valid user? +$ cat /etc/dconf/profile/user +The output should show the following: +user-db:user +system-db:local +system-db:site +system-db:distro + Is it the case that DConf User profile does not exist or is not configured correctly? - - To check if pam_pwquality.so is enabled in password-auth, run the following command: -$ grep pam_pwquality /etc/pam.d/password-auth -The output should be similar to the following: -password requisite pam_pwquality.so - Is it the case that pam_pwquality.so is not enabled in password-auth? + + + +Run the following command to determine the current status of the +ntpd service: +$ sudo systemctl is-active ntpd +If the service is running, it should return the following: active + Is it the case that ? - - Run the following command to determine if the dovecot package is installed: -$ rpm -q dovecot - Is it the case that the package is installed? + + +Run the following command to determine if the dbadm_read_user_files SELinux boolean is disabled: +$ getsebool dbadm_read_user_files +If properly configured, the output should show the following: +dbadm_read_user_files --> off + Is it the case that dbadm_read_user_files is not disabled? - - To determine if the system is configured to audit successful calls -to the lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - The ftp package can be removed with the following command: $ sudo yum erase ftp - Is it the case that ? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfacl" command with the following command: - -$ sudo auditctl -l | grep setfacl - --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? - - - + -Run the following command to determine if the sge_domain_can_network_connect SELinux boolean is disabled: -$ getsebool sge_domain_can_network_connect +Run the following command to determine if the ssh_sysadm_login SELinux boolean is disabled: +$ getsebool ssh_sysadm_login If properly configured, the output should show the following: -sge_domain_can_network_connect --> off - Is it the case that sge_domain_can_network_connect is not disabled? +ssh_sysadm_login --> off + Is it the case that ssh_sysadm_login is not disabled? - - Run the following command to determine if the cyrus-imapd package is installed: -$ rpm -q cyrus-imapd - Is it the case that the package is installed? + + To view the root user's PATH, run the following command: +$ sudo env | grep PATH +If correctly configured, the PATH must: use vendor default settings, +have no empty entries, and have no entries beginning with a character +other than a slash (/). + Is it the case that any of these conditions are not met? - - To check the ownership of /var/log, -run the command: -$ ls -lL /var/log -If properly configured, the output should indicate the following owner: -root - Is it the case that /var/log does not have an owner of root? + + To ensure the GUI does not allow user administratrion capabilities to all users, +run the following command: +$ gsettings get org.gnome.desktop.lockdown user-administration-disabled +If properly configured, the output should be true. +To ensure that users cannot enable user administration, run the following: +$ grep user-administration /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/desktop/lockdown/user-administration-disabled + Is it the case that user administration is not configured or disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "crontab" command with the following command: + + The following command will list which files on the system have permissions different from what +is expected by the RPM database: +$ rpm -Va | awk '{ if (substr($0,2,1)=="M") print $NF }' + Is it the case that there is output? + + + + Ensure that CGI backup scripts are not left on the production web server. +This check is limited to CGI/interactive content and not static HTML. -$ sudo auditctl -l | grep crontab +Search for backup copies of CGI scripts on the web server or ask the Web +Administrator if they keep backup copies of CGI scripts on the web server. --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -k privileged-crontab - Is it the case that the command does not return a line, or the line is commented out? +Common backup file extensions are: *.bak, *.old, *.temp, *.tmp, *.backup, +*.??0. This would also apply to .jsp files. + +On Red Hat Enterprise Linux, run the following commands to find backup +scripts: +find / name "*.bak" -print +find / name "*.*" -print +find / name "*.old" -print + Is it the case that If fileos with these extensions have no relationship with web activity, +such as backup batch file for operating system utility, and they are +not accessible by the web application, this is not a finding. + +If files with these extensions are found in either the document +directory or the home directory of the web server, this is +a finding. + +If files with these extensions are stored in a repository (not in the +document root) as backups for the web server? - + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_COMPAT_VDSO /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes spec_store_bypass_disable=, +in /etc/default/grub. If it includes spectre_v2=on, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spec_store_bypass_disable=.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spectre_v2=on.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*spec_store_bypass_disable=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*spectre_v2=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'spec_store_bypass_disable=' +$ sudo grubby --info=ALL | grep args | grep -v 'spectre_v2=on' The command should not return any output. - Is it the case that SSB is not configured appropriately? + Is it the case that spectre_v2 mitigation is not enforced? - + -Run the following command to determine if the tor_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool tor_bind_all_unreserved_ports +Run the following command to determine if the named_tcp_bind_http_port SELinux boolean is disabled: +$ getsebool named_tcp_bind_http_port If properly configured, the output should show the following: -tor_bind_all_unreserved_ports --> off - Is it the case that tor_bind_all_unreserved_ports is not disabled? +named_tcp_bind_http_port --> off + Is it the case that named_tcp_bind_http_port is not disabled? - - The runtime status of the net.ipv4.conf.all.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_source_route -0. - - Is it the case that the correct value is not returned? + + To determine if negation is used to define commands users are allowed to execute using sudo, run the following command: +$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,!\n][^,\n]+,)*\s*(?:\([^\)]+\))?\s*(?!\s*\()(!\S+).*' /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that /etc/sudoers file contains rules that define the set of allowed commands using negation? - - Verify that sshd isn't configured to ignore the system wide cryptographic policy. + + To verify whether audispd plugin off-loads audit records onto a different +system or media from the system being audited, run the following command: -Check that the CRYPTO_POLICY variable is not set or is commented out in the -/etc/sysconfig/sshd. +$ sudo grep -i remote_server /etc/audit/audisp-remote.conf -Run the following command: +The output should return something similar to where REMOTE_SYSTEM +is an IP address or hostname: +remote_server = REMOTE_SYSTEM -$ sudo grep CRYPTO_POLICY /etc/sysconfig/sshd - Is it the case that the CRYPTO_POLICY variable is set or is not commented out in the /etc/sysconfig/sshd? +Determine which partition the audit records are being written to with the +following command: + +$ sudo grep log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log + +Check the size of the partition that audit records are written to with the +following command and verify whether it is sufficiently large: + +$ sudo df -h /var/log/audit/ +/dev/sda2 24G 10.4G 13.6G 43% /var/log/audit + Is it the case that audispd is not sending logs to a remote system and the local partition has inadequate space? - - Run the following command to determine if the libselinux package is installed: $ rpm -q libselinux - Is it the case that the package is not installed? + + Run the following command to determine if the tuned package is installed: +$ rpm -q tuned + Is it the case that the package is installed? - + + To ensure LoginGraceTime is set correctly, run the following command: +$ sudo grep LoginGraceTime /etc/ssh/sshd_config +If properly configured, the output should be: +LoginGraceTime +If the option is set to a number greater than 0, then the unauthenticated session will be disconnected +after the configured number seconds. + Is it the case that it is commented out or not configured properly? + + + -Run the following command to determine if the pcp_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool pcp_bind_all_unreserved_ports +Run the following command to determine if the logwatch_can_network_connect_mail SELinux boolean is disabled: +$ getsebool logwatch_can_network_connect_mail If properly configured, the output should show the following: -pcp_bind_all_unreserved_ports --> off - Is it the case that pcp_bind_all_unreserved_ports is not disabled? +logwatch_can_network_connect_mail --> off + Is it the case that logwatch_can_network_connect_mail is not disabled? - - To check the permissions of /etc/passwd-, -run the command: -$ ls -l /etc/passwd- -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/passwd- does not have unix mode -rw-r--r--? + + To check for virtual console entries which permit root login, run the +following command: +$ sudo grep ^vc/[0-9] /etc/securetty +If any output is returned, then root logins over virtual console devices is permitted. + Is it the case that root login over virtual console devices is permitted? - + -Run the following command to determine if the spamd_enable_home_dirs SELinux boolean is enabled: -$ getsebool spamd_enable_home_dirs +Run the following command to determine if the git_cgi_use_cifs SELinux boolean is disabled: +$ getsebool git_cgi_use_cifs If properly configured, the output should show the following: -spamd_enable_home_dirs --> on - Is it the case that spamd_enable_home_dirs is not enabled? +git_cgi_use_cifs --> off + Is it the case that git_cgi_use_cifs is not disabled? - - To verify that OpenSSL uses the system crypto policy, check out that the OpenSSL config file -/etc/pki/tls/openssl.cnf contains the [ crypto_policy ] section with the -.include /etc/crypto-policies/back-ends/opensslcnf.config directive: + + Verify Red Hat Enterprise Linux 8 security patches and updates are installed and up to date. +Updates are required to be applied with a frequency determined by organizational policy. -$ sudo grep '\.include\s* /etc/crypto-policies/back-ends/opensslcnf.config$' /etc/pki/tls/openssl.cnf. - Is it the case that the OpenSSL config file doesn't contain the whole section, -or the section doesn't contain the <pre>.include /etc/crypto-policies/back-ends/opensslcnf.config</pre> directive? - - - - If network services are using the xinetd service, this is not applicable. -To check that the xinetd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled xinetd -Output should indicate the xinetd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled xinetd disabled +Obtain the list of available package security updates from Red Hat. The URL for updates is https://access.redhat.com/errata-search/. +It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. -Run the following command to verify xinetd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active xinetd -If the service is not running the command will return the following output: -inactive +Check that the available package security updates have been installed on the system with the following command: -The service will also be masked, to check that the xinetd is masked, run the following command: -$ sudo systemctl show xinetd | grep "LoadState\|UnitFileState" +$ sudo yum history list | more -If the service is masked the command will return the following outputs: +Loaded plugins: langpacks, product-id, subscription-manager +ID | Command line | Date and time | Action(s) | Altered +------------------------------------------------------------------------------- +70 | install aide | 2020-03-05 10:58 | Install | 1 +69 | update -y | 2020-03-04 14:34 | Update | 18 EE +68 | install vlc | 2020-02-21 17:12 | Install | 21 +67 | update -y | 2020-02-21 17:04 | Update | 7 EE -LoadState=masked -UnitFileState=masked - Is it the case that the "xinetd" is loaded and not masked? - - - - Run the following command to determine if the usbguard package is installed: $ rpm -q usbguard - Is it the case that the package is not installed? +Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. + Is it the case that Red Hat Enterprise Linux 8 is in non-compliance with the organizational patching policy? - - To check the ownership of /var/log/messages, -run the command: -$ ls -lL /var/log/messages -If properly configured, the output should indicate the following owner: -root - Is it the case that /var/log/messages does not have an owner of root? + + +Run the following command to determine if the global_ssp SELinux boolean is disabled: +$ getsebool global_ssp +If properly configured, the output should show the following: +global_ssp --> off + Is it the case that global_ssp is not disabled? - - Verify the nosuid option is configured for the /tmp mount point, - run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . nosuid . . . + + Verify that Red Hat Enterprise Linux 8 enforces a minimum -character password length with the following command: - Is it the case that the "/tmp" file system does not have the "nosuid" option set? - - - - To check the group ownership of /boot/grub2/user.cfg, -run the command: -$ ls -lL /boot/grub2/user.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/grub2/user.cfg does not have a group owner of root? - - - - To verify that kernel parameter 'crypto.fips_enabled' is set properly, run the following command: -sysctl crypto.fips_enabled -The output should contain the following: -crypto.fips_enabled = 1 - Is it the case that crypto.fips_enabled is not 1? +$ grep minlen /etc/security/pwquality.conf + +minlen = + Is it the case that the command does not return a "minlen" value of "<sub idref="var_password_pam_minlen" />" or greater, does not return a line, or the line is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_ACPI_CUSTOM_METHOD /boot/config.* + $ grep CONFIG_SECURITY /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - To ensure the X Windows package group is removed, run the following command: -$ rpm -qi xorg-x11-server-common -The output should be: -package xorg-x11-server-common is not installed - Is it the case that the X Windows package group or xorg-x11-server-common has not be removed? + + +Run the following command to determine if the use_samba_home_dirs SELinux boolean is disabled: +$ getsebool use_samba_home_dirs +If properly configured, the output should show the following: +use_samba_home_dirs --> off + Is it the case that use_samba_home_dirs is not disabled? - - The runtime status of the kernel.modules_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.modules_disabled -1. + + To verify the operating system prevents non-privileged users from executing +privileged functions to include disabling, circumventing, or altering +implemented security safeguards/countermeasures, run the following +command: +$ sudo semanage login -l +All administrators must be mapped to the sysadm_u or staff_u +users with the appropriate domains (sysadm_t and staff_t). - Is it the case that the correct value is not returned? +All authorized non-administrative +users must be mapped to the user_u role or the appropriate domain +(user_t). + Is it the case that non-admin users are not confined correctly? - - Run the following command to check the mode of the httpd log -directory: -$ ls -l /var/log/ | grep httpd -Log directory must be mode 0700 or less permissive. - Is it the case that it is more permissive? + + The group-owner of all log files written by rsyslog should be +root. +These log files are determined by the second part of each Rule line in +/etc/rsyslog.conf and typically all appear in /var/log. +To see the group-owner of a given log file, run the following command: +$ ls -l LOGFILE + Is it the case that the group-owner is not correct? - + + To verify that each web content directory has an index.html file, +run the following command: +$ sudo find `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` -name index.html +The output should return an index.html file for every +DocumentRoot that is set. + Is it the case that it is not? + + + -Run the following command to determine if the virt_use_execmem SELinux boolean is disabled: -$ getsebool virt_use_execmem +Run the following command to determine if the glance_api_can_network SELinux boolean is disabled: +$ getsebool glance_api_can_network If properly configured, the output should show the following: -virt_use_execmem --> off - Is it the case that virt_use_execmem is not disabled? +glance_api_can_network --> off + Is it the case that glance_api_can_network is not disabled? - - To ensure ClientAliveInterval is set correctly, run the following command: -$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config -If properly configured, the output should be: -ClientAliveCountMax -For SSH earlier than v8.2, a ClientAliveCountMax value of 0 causes a timeout precisely when -the ClientAliveInterval is set. Starting with v8.2, a value of 0 disables the timeout -functionality completely. -If the option is set to a number greater than 0, then the session will be disconnected after -ClientAliveInterval * ClientAliveCountMax seconds without receiving a keep alive message. - Is it the case that it is commented out or not configured properly? + + To check the permissions of /boot/Sysem.map-*, +run the command: +$ ls -l /boot/Sysem.map-* +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that ? - - To verify that the log_config_module exists in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep log_config_module /etc/httpd/conf/httpd.conf -The output should return: -<IfModule log_config_module> - Is it the case that it is not? + + To check the permissions of /etc/issue, +run the command: +$ ls -l /etc/issue +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/issue does not have unix mode -rw-r--r--? - - - -Run the following command to determine the current status of the -chronyd service: -$ sudo systemctl is-active chronyd -If the service is running, it should return the following: active - Is it the case that the chronyd process is not running? + + Run the following command to determine if the telnet-server package is installed: +$ rpm -q telnet-server + Is it the case that the package is installed? - - Verify that rules for unsuccessful calls of the open_by_handle_at syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + +If the system is configured to prevent the loading of the cramfs kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - If the system is 64 bit then also add the following lines: +These lines can also instruct the module loading system to ignore the cramfs kernel module via blacklist keyword. - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? - - - - The ypbind package can be removed with the following command: $ sudo yum erase ypbind - Is it the case that ? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r cramfs /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - -Run the following command to determine if the httpd_ssi_exec SELinux boolean is disabled: -$ getsebool httpd_ssi_exec -If properly configured, the output should show the following: -httpd_ssi_exec --> off - Is it the case that httpd_ssi_exec is not disabled? + + Verify the umask setting is configured correctly in the /etc/profile file +or scripts within /etc/profile.d directory with the following command: +$ grep "umask" /etc/profile* +umask + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", +or the "umask" parameter is missing or is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_ARM64_SW_TTBR0_PAN /boot/config.* + $ grep CONFIG_HARDENED_USERCOPY_FALLBACK /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the krb5-server package is installed: $ rpm -q krb5-server - Is it the case that the package is installed? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "userhelper" command with the following command: + +$ sudo auditctl -l | grep userhelper + +-a always,exit -F path=/usr/bin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -k privileged-userhelper + Is it the case that the command does not return a line, or the line is commented out? - - To check that the ntpdate service is disabled in system boot configuration, + + +Run the following command to determine if the daemons_dump_core SELinux boolean is disabled: +$ getsebool daemons_dump_core +If properly configured, the output should show the following: +daemons_dump_core --> off + Is it the case that daemons_dump_core is not disabled? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the openat system call. + +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? + + + + To check that the rpcsvcgssd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled ntpdate -Output should indicate the ntpdate service has either not been installed, +$ sudo systemctl is-enabled rpcsvcgssd +Output should indicate the rpcsvcgssd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ntpdate disabled +$ sudo systemctl is-enabled rpcsvcgssd disabled -Run the following command to verify ntpdate is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ntpdate +Run the following command to verify rpcsvcgssd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rpcsvcgssd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the ntpdate is masked, run the following command: -$ sudo systemctl show ntpdate | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rpcsvcgssd is masked, run the following command: +$ sudo systemctl show rpcsvcgssd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "ntpdate" is loaded and not masked? + Is it the case that the "rpcsvcgssd" is loaded and not masked? - - -Run the following command to determine if the openvpn_enable_homedirs SELinux boolean is disabled: -$ getsebool openvpn_enable_homedirs -If properly configured, the output should show the following: -openvpn_enable_homedirs --> off - Is it the case that openvpn_enable_homedirs is not disabled? + + Verify Red Hat Enterprise Linux 8 disables network management of the chrony daemon with the following command: +$ grep -w cmdport /etc/chrony.conf +cmdport 0 + Is it the case that the "cmdport" option is not set to "0", is commented out, or is missing? - - Verify the system commands contained in the following directories are group-owned by "root", or a required system account, with the following command: + + Verify that yum verifies the signature of local packages prior to install with the following command: -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ! -group root -exec ls -l {} \; - Is it the case that any system commands are returned and is not group-owned by a required system account? +$ grep localpkg_gpgcheck /etc/yum.conf + +localpkg_gpgcheck=1 + +If "localpkg_gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. + Is it the case that there is no process to validate certificates for local packages that is approved by the organization? - - To determine if the system is configured to audit calls to the -renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To ensure the gdm package group is removed, run the following command: -$ rpm -qi gdm -The output should be: -package gdm is not installed - Is it the case that gdm has not been removed? + + To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: + +$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To verify the nodev option is configured for all NFS mounts, run -the following command: -$ mount | grep nfs -All NFS mounts should show the nodev setting in parentheses. This -is not applicable if NFS is not implemented. - Is it the case that the setting does not show? + + To determine if use_pty has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\buse_pty\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that use_pty is not enabled in sudo? - - To check the ownership of /etc/cron.d, -run the command: -$ ls -lL /etc/cron.d -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.d does not have an owner of root? + + +Run the following command to determine if the git_system_use_cifs SELinux boolean is disabled: +$ getsebool git_system_use_cifs +If properly configured, the output should show the following: +git_system_use_cifs --> off + Is it the case that git_system_use_cifs is not disabled? - - To check the permissions of /etc/ssh/sshd_config, -run the command: -$ ls -l /etc/ssh/sshd_config -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/ssh/sshd_config does not have unix mode -rw-------? + + +Run the following command to determine if the httpd_graceful_shutdown SELinux boolean is enabled: +$ getsebool httpd_graceful_shutdown +If properly configured, the output should show the following: +httpd_graceful_shutdown --> on + Is it the case that httpd_graceful_shutdown is not enabled? - - To determine how the SSH daemon's PermitEmptyPasswords option is set, run the following command: + + To verify the number of rounds for the password hashing algorithm is configured, run the following command: +$ sudo grep rounds /etc/pam.d/password-auth +The output should show the following match: +password sufficient pam_unix.so sha512 rounds= + Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + + + To determine how the SSH daemon's HostbasedAuthentication option is set, run the following command: -$ sudo grep -i PermitEmptyPasswords /etc/ssh/sshd_config +$ sudo grep -i HostbasedAuthentication /etc/ssh/sshd_config If a line indicating no is returned, then the required value is set. Is it the case that the required value is not set? - - Run the following command to check if the line is present: -grep pam_wheel /etc/pam.d/su -The output should contain the following line: -auth required pam_wheel.so use_uid - Is it the case that the line is not in the file or it is commented? + + To verify that McAfee Endpoint Security for Linux is +running, run the following command: +$ sudo ps -ef | grep -i mfetpd + Is it the case that virus scanning software is not running? - - To verify that there are no .shosts files -on the system, run the following command: -$ sudo find / -name '.shosts' - Is it the case that .shosts files exist? + + Storing logs remotely protects the integrity of the data from local attacks. +Run the following command to verify that journald is forwarding logs to a remote host. + +grep "^\sForwardToSyslog" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf + + +and it should return + +ForwardToSyslog=yes + + Is it the case that is commented out or not configured correctly? - - To verify the audispd plugin off-loads audit records onto a different system or -media from the system being audited, run the following command: -$ sudo grep -i remote_server /etc/audit/audisp-remote.conf -The output should return something similar to -remote_server = - Is it the case that audispd is not sending logs to a remote system? + + +Run the following command to determine if the samba_domain_controller SELinux boolean is disabled: +$ getsebool samba_domain_controller +If properly configured, the output should show the following: +samba_domain_controller --> off + Is it the case that samba_domain_controller is not disabled? - + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open_by_handle_at system call with O_CREAT flag. + +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r open_by_handle_at /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? + + + + To verify that a nftables table exists, run the following command: +$ sudo nft list tables +Output should include a list of nftables similar to: + + table inet filter + + Is it the case that a nftables table does not exist? + + + + To check the permissions of /etc/crontab, +run the command: +$ ls -l /etc/crontab +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/crontab does not have unix mode -rw-------? + + + -Run the following command to determine if the irc_use_any_tcp_ports SELinux boolean is disabled: -$ getsebool irc_use_any_tcp_ports + +Run the following command to determine the current status of the +usbguard service: +$ sudo systemctl is-active usbguard +If the service is running, it should return the following: active + Is it the case that the service is not enabled? + + + + +Run the following command to determine if the selinuxuser_share_music SELinux boolean is disabled: +$ getsebool selinuxuser_share_music If properly configured, the output should show the following: -irc_use_any_tcp_ports --> off - Is it the case that irc_use_any_tcp_ports is not disabled? +selinuxuser_share_music --> off + Is it the case that selinuxuser_share_music is not disabled? - - Inspect the list of enabled firewall ports and verify they are configured correctly by running -the following command: - -$ sudo firewall-cmd --list-all + + To determine if the system is configured to audit calls to the +removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Ask the System Administrator for the site or program Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA). Verify the services allowed by the firewall match the PPSM CLSA. - Is it the case that there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), or there are no firewall rules configured? + Is it the case that no line is returned? - - To verify if the OpenSSH server uses defined ciphers in the Crypto Policy, run: -$ grep -Po '(-oCiphers=\S+)' /etc/crypto-policies/back-ends/opensshserver.config -and verify that the line matches: --oCiphers= - Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? + + To obtain a list of all users and the content of their shadow password field, run the command: +$ sudo readarray -t systemaccounts +Verify if all accounts are locked. + Is it the case that system accounts are not locked? - - Run the following command to determine if the geolite2-city package is installed: -$ rpm -q geolite2-city - Is it the case that the package is installed? + + Run the following command to ensure the TMOUT value is configured for all users +on the system: + +$ sudo grep TMOUT /etc/profile /etc/profile.d/*.sh + +The output should return the following: +TMOUT= + Is it the case that value of TMOUT is not less than or equal to expected setting? + + + + To determine if the system is configured to audit successful calls +to the chown system call, run the following command: +$ sudo grep "chown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine if the system is configured to audit account changes, -run the following command: -auditctl -l | grep -E '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)' -If the system is configured to watch for account changes, lines should be returned for -each file specified (and with perm=wa for each). - Is it the case that the system is not configured to audit account changes? + + Verify the system commands contained in the following directories are owned by "root" with the following command: + +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin ! -user root -exec ls -l {} \; + Is it the case that any system commands are found to not be owned by root? - - To ensure TLS is configured with trust certificates, run the following command: -$ grep cert /etc/nslcd.conf - Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + To ensure the user list is disabled, run the following command: +$ grep disable-user-list /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot enable displaying the user list, run the following: +$ grep disable-user-list /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/disable-user-list + Is it the case that disable-user-list has not been configured or is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the ftruncate system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r ftruncate /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + + To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: -$ sudo grep ftruncate /etc/audit/audit.rules +$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config -The output should be the following: +If a line indicating yes is returned, then the required value is set. --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the required value is not set? - - Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/password-auth file -and is configured to prohibit password reuse for a minimum of -generations. - -Verify the "/etc/pam.d/password-auth" file with the following command: + + To check if the system login banner is compliant, +run the following command: +$ cat /etc/issue + Is it the case that it does not display the required banner? + + + + Storing logs with compression can help avoid filling the system disk. +Run the following command to verify that journald is compressing logs. -$ grep pam_pwhistory.so /etc/pam.d/password-auth -password pam_pwhistory.so use_authtok remember= +grep "^\sCompress" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf -Verify the "/etc/security/pwhistory.conf" file using the following command: +and it should return -$ grep remember /etc/security/pwhistory.conf -remember = +Compress=yes -The pam_pwhistory.so "remember" option must be configured only in one file. - Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in -/etc/pam.d/password-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set -with a value less than "<sub idref="var_password_pam_remember" />"? + Is it the case that is commented out or not configured correctly? - + + +Run the following command to determine if the virt_use_samba SELinux boolean is disabled: +$ getsebool virt_use_samba +If properly configured, the output should show the following: +virt_use_samba --> off + Is it the case that virt_use_samba is not disabled? + + + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLUB_DEBUG /boot/config.* + $ grep CONFIG_DEBUG_FS /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - The document, DoDI 8500.01, establishes the policy on the use of DoD -information systems. It requires the use of a standard Notice and Consent Banner -and standard text to be included in user agreements. The banner should be set -to the following: - Is it the case that it is not display the required banner? + + To check the permissions of /etc/issue.net, +run the command: +$ ls -l /etc/issue.net +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/issue.net does not have unix mode -rw-r--r--? - - -If the system is configured to prevent the loading of the mac80211 kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the mac80211 kernel module via blacklist keyword. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "gpasswd" command with the following command: -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r mac80211 /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - -To properly set the permissions of /etc/audit/, run the command: -$ sudo chmod 0640 /etc/audit/ +$ sudo auditctl -l | grep gpasswd -To properly set the permissions of /etc/audit/rules.d/, run the command: -$ sudo chmod 0640 /etc/audit/rules.d/ - Is it the case that ? +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-gpasswd + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the virt_use_xserver SELinux boolean is disabled: -$ getsebool virt_use_xserver -If properly configured, the output should show the following: -virt_use_xserver --> off - Is it the case that virt_use_xserver is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes spec_store_bypass_disable=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spec_store_bypass_disable=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*spec_store_bypass_disable=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'spec_store_bypass_disable=' +The command should not return any output. + Is it the case that SSB is not configured appropriately? - - To ensure that users cannot change session idle and lock settings, run the following: -$ grep 'lock-delay' /etc/dconf/db/local.d/locks/* -If properly configured, the output should return: -/org/gnome/desktop/screensaver/lock-delay - Is it the case that GNOME3 session settings are not locked or configured properly? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chacl" command with the following command: + +$ sudo auditctl -l | grep chacl + +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit attempts to -alter time via the /etc/localtime file, run the following -command: -$ sudo auditctl -l | grep "watch=/etc/localtime" -If the system is configured to audit this activity, it will return a line. - Is it the case that the system is not configured to audit time changes? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "umount" command with the following command: + +$ sudo auditctl -l | grep umount + +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-umount + Is it the case that the command does not return a line, or the line is commented out? - - To verify that root's primary group is zero run the following command: - - grep '^root:' /etc/passwd | cut -d : -f 4 + + To determine how the SSH daemon's StrictModes option is set, run the following command: -The command should return: +$ sudo grep -i StrictModes /etc/ssh/sshd_config -0 +If a line indicating yes is returned, then the required value is set. - Is it the case that root has a primary gid not equal to zero? + Is it the case that the required value is not set? - + -Run the following command to determine if the zebra_write_config SELinux boolean is disabled: -$ getsebool zebra_write_config +Run the following command to determine if the antivirus_can_scan_system SELinux boolean is enabled: +$ getsebool antivirus_can_scan_system If properly configured, the output should show the following: -zebra_write_config --> off - Is it the case that zebra_write_config is not disabled? +antivirus_can_scan_system --> on + Is it the case that antivirus_can_scan_system is not enabled? - - The tftp package can be removed with the following command: $ sudo yum erase tftp - Is it the case that ? + + To determine if the system is configured to audit successful calls +to the unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the ownership of /etc/passwd, -run the command: -$ ls -lL /etc/passwd -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/passwd does not have an owner of root? + + Run the following command to determine if the krb5-workstation package is installed: +$ rpm -q krb5-workstation + Is it the case that the package is installed? - + -Run the following command to determine if the virt_use_fusefs SELinux boolean is disabled: -$ getsebool virt_use_fusefs +Run the following command to determine if the httpd_can_network_connect SELinux boolean is disabled: +$ getsebool httpd_can_network_connect If properly configured, the output should show the following: -virt_use_fusefs --> off - Is it the case that virt_use_fusefs is not disabled? +httpd_can_network_connect --> off + Is it the case that httpd_can_network_connect is not disabled? - - -Check if SSSD allows cached authentications with the following command: + + Verify that Red Hat Enterprise Linux 8 does not have unauthorized IP tunnels configured. -$ sudo grep cache_credentials /etc/sssd/sssd.conf -cache_credentials = true -If "cache_credentials" is set to "false" or is missing no further checks are required. +# yum list installed libreswan +libreswan.x86-64 3.20-5.el7_4 -To verify that SSSD expires offline credentials, run the following command: -$ sudo grep offline_credentials_expiration /etc/sssd/sssd.conf -If configured properly, output should be -offline_credentials_expiration = 1 - Is it the case that it does not exist or is not configured properly? - - - - -If the system is configured to prevent the loading of the cramfs kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the cramfs kernel module via blacklist keyword. +If "libreswan" is installed, check to see if the "IPsec" service is active with the following command: -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r cramfs /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - -Run the following command to determine if the httpd_can_network_connect_cobbler SELinux boolean is disabled: -$ getsebool httpd_can_network_connect_cobbler -If properly configured, the output should show the following: -httpd_can_network_connect_cobbler --> off - Is it the case that httpd_can_network_connect_cobbler is not disabled? +# systemctl status ipsec +ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec +Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) +Active: inactive (dead) + + +If the "IPsec" service is active, check for configured IPsec connections (conn), perform the following: +grep -rni conn /etc/ipsec.conf /etc/ipsec.d/ +Verify any returned results for organizational approval. + Is it the case that the IPSec tunnels are not approved? - - Verify it by running the following command: -$ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + + To check that the sysstat service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled sysstat +Output should indicate the sysstat service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled sysstat disabled -/sbin/auditctl root -/sbin/aureport root -/sbin/ausearch root -/sbin/autrace root -/sbin/auditd root -/sbin/audispd root -/sbin/augenrules root +Run the following command to verify sysstat is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active sysstat +If the service is not running the command will return the following output: +inactive -If the command does not return all the above lines, the missing ones -need to be added. +The service will also be masked, to check that the sysstat is masked, run the following command: +$ sudo systemctl show sysstat | grep "LoadState\|UnitFileState" -Run the following command to correct the permissions of the missing -entries: -$ sudo chown root [audit_tool] +If the service is masked the command will return the following outputs: -Replace "[audit_tool]" with each audit tool not owned by root. - Is it the case that ? - - - - The runtime status of the net.ipv6.conf.default.autoconf kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.autoconf -0. +LoadState=masked - Is it the case that the correct value is not returned? +UnitFileState=masked + Is it the case that the "sysstat" is loaded and not masked? - - -Run the following command to determine if the httpd_run_preupgrade SELinux boolean is disabled: -$ getsebool httpd_run_preupgrade -If properly configured, the output should show the following: -httpd_run_preupgrade --> off - Is it the case that httpd_run_preupgrade is not disabled? + + To check the permissions of /usr/bin/sudo, +run the command: +$ ls -l /usr/bin/sudo +If properly configured, the output should indicate the following permissions: +---s--x--- + Is it the case that /usr/bin/sudo does not have unix mode ---s--x---? - + -Run the following command to determine if the wine_mmap_zero_ignore SELinux boolean is disabled: -$ getsebool wine_mmap_zero_ignore +Run the following command to determine if the httpd_can_network_connect_cobbler SELinux boolean is disabled: +$ getsebool httpd_can_network_connect_cobbler If properly configured, the output should show the following: -wine_mmap_zero_ignore --> off - Is it the case that wine_mmap_zero_ignore is not disabled? +httpd_can_network_connect_cobbler --> off + Is it the case that httpd_can_network_connect_cobbler is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-agent" command with the following command: - -$ sudo auditctl -l | grep ssh-agent + + Verify the noexec option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . noexec . . . --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent - Is it the case that the command does not return a line, or the line is commented out? - - - - To find the location of the AIDE database file, run the following command: -$ sudo ls -l DBDIR/database_file_name - Is it the case that there is no database file? - - - - To verify that FIPS mode is enabled properly, run the following command: -fips-mode-setup --check -The output should contain the following: -FIPS mode is enabled. -To verify that the cryptographic policy has been configured correctly, run the -following command: -$ update-crypto-policies --show -The output should return . - Is it the case that FIPS mode is not enabled? + Is it the case that the "/var/log" file system does not have the "noexec" option set? - - The following command will list which files on the system have file hashes different from what -is expected by the RPM database. -$ rpm -Va --noconfig | awk '$1 ~ /..5/' - Is it the case that there is output? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_IA32_EMULATION /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the sendmail package is installed: -$ rpm -q sendmail - Is it the case that the package is installed? + + Verify the nosuid option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . nosuid . . . + + Is it the case that the "/tmp" file system does not have the "nosuid" option set? - - Run the following command to determine if the logrotate package is installed: $ rpm -q logrotate - Is it the case that the package is not installed? + + Verify the nosuid option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . nosuid . . . + + Is it the case that the "/var/log/audit" file system does not have the "nosuid" option set? - + -Run the following command to determine if the samba_load_libgfapi SELinux boolean is disabled: -$ getsebool samba_load_libgfapi +Run the following command to determine if the logrotate_use_nfs SELinux boolean is disabled: +$ getsebool logrotate_use_nfs If properly configured, the output should show the following: -samba_load_libgfapi --> off - Is it the case that samba_load_libgfapi is not disabled? - - - - Verify Red Hat Enterprise Linux 8 for PKI-based authentication has valid certificates by constructing a -certification path (which includes status information) to an accepted trust anchor. - -Check that the system has a valid DoD root CA installed with the following command: - -$ sudo openssl x509 -text -in /etc/sssd/pki/sssd_auth_ca_db.pem - -Certificate: -Data: -Version: 3 (0x2) -Serial Number: 1 (0x1) -Signature Algorithm: sha256WithRSAEncryption -Issuer: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 -Validity -Not Before: Mar 20 18:46:41 2012 GMT -Not After : Dec 30 18:46:41 2029 GMT -Subject: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 -Subject Public Key Info: -Public Key Algorithm: rsaEncryption - Is it the case that root CA file is not a DoD-issued certificate with a valid date and installed in the /etc/sssd/pki/sssd_auth_ca_db.pem location? +logrotate_use_nfs --> off + Is it the case that logrotate_use_nfs is not disabled? - - Run the following command to determine if the nginx package is installed: -$ rpm -q nginx + + Run the following command to determine if the libreport-plugin-logger package is installed: +$ rpm -q libreport-plugin-logger Is it the case that the package is installed? - - -Run the following command to determine if the ftpd_full_access SELinux boolean is disabled: -$ getsebool ftpd_full_access -If properly configured, the output should show the following: -ftpd_full_access --> off - Is it the case that ftpd_full_access is not disabled? + + To check the permissions of /etc/http/conf/*, +run the command: +$ ls -l /etc/http/conf/* +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/http/conf/* does not have unix mode -rw-r-----? - - Verify the site's network diagram and visually check the web server, to -ensure that the private web server is located on a separate controlled -access subnet and is not part of the public DMZ that houses the public -web servers. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_chkpwd" command with the following command: -In addition, the private web server needs to be isolated via a controlled -access mechanism from the local general population lan. - Is it the case that the private web server is not on a separate controlled access subnet? - - - - To check the ownership of /etc/cron.weekly, -run the command: -$ ls -lL /etc/cron.weekly -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.weekly does not have an owner of root? +$ sudo auditctl -l | grep unix_chkpwd + +-a always,exit -F path=/usr/bin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_chkpwd + Is it the case that the command does not return a line, or the line is commented out? - + To determine if the system is configured to audit calls to the -lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit/audit.* +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - If the system is not configured to audit time changes, this is a finding. -If the system is 64-bit only, this is not applicable -ocil: | -To determine if the system is configured to audit calls to the -stime system call, run the following command: -$ sudo grep "stime" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PROC_KCORE /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the selinuxuser_postgresql_connect_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_postgresql_connect_enabled +If properly configured, the output should show the following: +selinuxuser_postgresql_connect_enabled --> off + Is it the case that selinuxuser_postgresql_connect_enabled is not disabled? - - To check which SSH protocol version is allowed, check version of -openssh-server with following command: -$ rpm -qi openssh-server | grep Version -Versions equal to or higher than 7.4 have deprecated the RhostsRSAAuthentication option. -If version is lower than 7.4, run the following command to check configuration: -To determine how the SSH daemon's RhostsRSAAuthentication option is set, run the following command: - -$ sudo grep -i RhostsRSAAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? + + To verify that SSSD is configured to run as user sssd, run the following command: +$ sudo grep -r '\buser\b' /etc/sssd +If configured properly, output should similar to /etc/sssd/conf.d/ospp.conf:user = sssd. +Sanity of SSSD configuration in general can be checked using $ sudo sssctl config-check + Is it the case that it does not exist or is not configured properly? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the truncate system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r truncate /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep truncate /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? + + Review the contents of the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf +files to ensure appropriate logging is set. In addition, run the following command: +ls -l /var/log/ +and verify that the log files are logging information + Is it the case that no logging is configured? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes audit_backlog_limit=8192, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit_backlog_limit=8192.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*audit_backlog_limit=8192.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'audit_backlog_limit=8192' -The command should not return any output. - Is it the case that audit backlog limit is not configured? + + Inspect the file /etc/sysconfig/iptables to determine +the default policy for the INPUT chain. It should be set to DROP: +$ sudo grep ":INPUT" /etc/sysconfig/iptables + Is it the case that the default policy for the INPUT chain is not set to DROP? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RETPOLINE /boot/config.* + $ grep CONFIG_SECURITY_YAMA /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers.d/" with the following command: - -$ sudo auditctl -l | grep/etc/sudoers.d - --w /etc/sudoers.d/ -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + + To verify the boot loader superuser account has been set, run the following +command: +sudo grep -A1 "superusers" /boot/grub2/grub.cfg +The output should show the following: +set superusers="superusers-account" +export superusers +where superusers-account is the actual account name different from common names like root, +admin, or administrator and different from any other existing user name. + Is it the case that superuser account is not set or is set to root, admin, administrator or any other existing user name? - - Verify file systems that are used for removable media are mounted with the "nodev" option with the following command: - -$ sudo more /etc/fstab - -UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 - Is it the case that a file system found in "/etc/fstab" refers to removable media and it does not have the "nodev" option set? + + +Run the following command to determine if the dhcpd_use_ldap SELinux boolean is disabled: +$ getsebool dhcpd_use_ldap +If properly configured, the output should show the following: +dhcpd_use_ldap --> off + Is it the case that dhcpd_use_ldap is not disabled? - - If the system uses IPv6, this is not applicable. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chage" command with the following command: -If the system is configured to prevent the usage of the ipv6 on -network interfaces, it will contain a line of the form: -net.ipv6.conf.default.disable_ipv6 = 1 -Such lines may be inside any file in the /etc/sysctl.d directory. -This permits insertion of the IPv6 kernel module (which other parts of the -system expect to be present), but otherwise keeps network interfaces -from using IPv6. Run the following command to search for such lines in all -files in /etc/sysctl.d: -$ grep -r ipv6 /etc/sysctl.d - Is it the case that the ipv6 support is disabled by default on network interfaces? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes vsyscall=none, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*vsyscall=none.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*vsyscall=none.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'vsyscall=none' -The command should not return any output. - Is it the case that vsyscalls are enabled? +$ sudo auditctl -l | grep chage + +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage + Is it the case that the command does not return a line, or the line is commented out? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_LIST /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the wine_mmap_zero_ignore SELinux boolean is disabled: +$ getsebool wine_mmap_zero_ignore +If properly configured, the output should show the following: +wine_mmap_zero_ignore --> off + Is it the case that wine_mmap_zero_ignore is not disabled? - - To check that no password hashes are stored in -/etc/passwd, run the following command: -awk '!/\S:x|\*/ {print}' /etc/passwd -If it produces any output, then a password hash is -stored in /etc/passwd. - Is it the case that any stored hashes are found in /etc/passwd? + + To verify that all user initialization files have a mode of 0740 or +less permissive, run the following command: +$ sudo find /home -type f -name '\.*' \( -perm -0002 -o -perm -0020 \) +There should be no output. + Is it the case that they are not 0740 or more permissive? - - -Run the following command to determine if the ftpd_use_passive_mode SELinux boolean is disabled: -$ getsebool ftpd_use_passive_mode -If properly configured, the output should show the following: -ftpd_use_passive_mode --> off - Is it the case that ftpd_use_passive_mode is not disabled? + + To verify .netrc file in interactive user home directory is +not group or world accessible", run the following command: +$ sudo ls -lLR /home/USER/.netrc + Is it the case that the group and world permissions are incorrect? - - Verify the usrquota option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . usrquota . . . + + To verify that the installed operating system is supported, run +the following command: - Is it the case that the "/home" file system does not have the "usrquota" option set? +$ grep -i "red hat" /etc/redhat-release + +Red Hat Enterprise Linux 8 + Is it the case that the installed operating system is not supported? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the sanlock_use_nfs SELinux boolean is disabled: -$ getsebool sanlock_use_nfs -If properly configured, the output should show the following: -sanlock_use_nfs --> off - Is it the case that sanlock_use_nfs is not disabled? + + To determine if the system is configured to audit unsuccessful calls +to the fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the mcelog_client SELinux boolean is disabled: -$ getsebool mcelog_client -If properly configured, the output should show the following: -mcelog_client --> off - Is it the case that mcelog_client is not disabled? + + Run the following command to determine if the McAfeeTP package is installed: $ rpm -q McAfeeTP + Is it the case that the package is not installed? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BUG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/gshadow-, +run the command: +$ ls -lL /etc/gshadow- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/gshadow- does not have an owner of root? - - Check that no boot image file is specified in /etc/zipl.conf: -grep -R "^image\s*=" /etc/zipl.conf -No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL. - Is it the case that a non BLS boot entry is configured? + + To verify Certmap is enabled in SSSD, run the following command: +$ sudo cat /etc/sssd/sssd.conf +If configured properly, output should contain section like the following + +[certmap/testing.test/rule_name] +matchrule =<SAN>.*EDIPI@mil +maprule = (userCertificate;binary={cert!bin}) +domains = testing.test + + Is it the case that Certmap is not configured in SSSD? - - Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: + + Verify that a separate file system/partition has been created for /srv with the following command: -$ sudo grep -w space_left /etc/audit/auditd.conf +$ mountpoint /srv -space_left = % - Is it the case that the value of the "space_left" keyword is not set to <sub idref="var_auditd_space_left_percentage" />% of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. If the "space_left" value is not configured to the correct value? + Is it the case that "/srv is not a mountpoint" is returned? - - -Run the following command to determine if the nfsd_anon_write SELinux boolean is disabled: -$ getsebool nfsd_anon_write -If properly configured, the output should show the following: -nfsd_anon_write --> off - Is it the case that nfsd_anon_write is not disabled? + + To check the group ownership of /etc/gshadow, +run the command: +$ ls -lL /etc/gshadow +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/gshadow does not have a group owner of root? - + -Run the following command to determine if the xdm_exec_bootloader SELinux boolean is disabled: -$ getsebool xdm_exec_bootloader +Run the following command to determine if the squid_use_tproxy SELinux boolean is disabled: +$ getsebool squid_use_tproxy If properly configured, the output should show the following: -xdm_exec_bootloader --> off - Is it the case that xdm_exec_bootloader is not disabled? +squid_use_tproxy --> off + Is it the case that squid_use_tproxy is not disabled? - - To check that the avahi-daemon service is disabled in system boot configuration, + + Run the following command to determine if the setroubleshoot-plugins package is installed: +$ rpm -q setroubleshoot-plugins + Is it the case that the package is installed? + + + + Locate the directories containing the CGI scripts. These directories should be +language-specific (e.g., PERL, ASP, JS, JSP, etc.). Examine the file permissions +on the directories using the following command: +ls -l directories +Anonymous FTP users must not have access to these directories. + Is it the case that it is not? + + + + To check that the vsftpd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled avahi-daemon -Output should indicate the avahi-daemon service has either not been installed, +$ sudo systemctl is-enabled vsftpd +Output should indicate the vsftpd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled avahi-daemon disabled +$ sudo systemctl is-enabled vsftpd disabled -Run the following command to verify avahi-daemon is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active avahi-daemon +Run the following command to verify vsftpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active vsftpd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the avahi-daemon is masked, run the following command: -$ sudo systemctl show avahi-daemon | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the vsftpd is masked, run the following command: +$ sudo systemctl show vsftpd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "avahi-daemon" is loaded and not masked? + Is it the case that the "vsftpd" is loaded and not masked? - - Run the following command to Verify that the sudoers security policy is configured to use the invoking user's password for privilege escalation: - sudo cvtsudoers -f sudoers /etc/sudoers | grep -E '^Defaults !?(rootpw|targetpw|runaspw)' -or if cvtsudoers not supported: - sudo find /etc/sudoers /etc/sudoers.d \( \! -name '*~' -a \! -name '*.*' \) -exec grep -E --with-filename '^[[:blank:]]*Defaults[[:blank:]](.*[[:blank:]])?!?\b(rootpw|targetpw|runaspw)' -- {} \; -If no results are returned, this is a finding. -If conflicting results are returned, this is a finding. -If "Defaults !targetpw" is not defined, this is a finding. -If "Defaults !rootpw" is not defined, this is a finding. -If "Defaults !runaspw" is not defined, this is a finding. - Is it the case that invoke user passwd when using sudo? + + To ensure the MaxAuthTries parameter is set, run the following command: +$ sudo grep MaxAuthTries /etc/ssh/sshd_config +If properly configured, output should be: +MaxAuthTries + Is it the case that it is commented out or not configured properly? - + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STRICT_MODULE_RWX /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + -Run the following command to determine if the mysql_connect_any SELinux boolean is disabled: -$ getsebool mysql_connect_any +Run the following command to determine if the secadm_exec_content SELinux boolean is enabled: +$ getsebool secadm_exec_content If properly configured, the output should show the following: -mysql_connect_any --> off - Is it the case that mysql_connect_any is not disabled? +secadm_exec_content --> on + Is it the case that secadm_exec_content is not enabled? - - Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server - Is it the case that the package is installed? + + Verify the noexec option is configured for the /var mount point, + run the following command: + $ sudo mount | grep '\s/var\s' + . . . /var . . . noexec . . . + + Is it the case that the "/var" file system does not have the "noexec" option set? - - Run the following command to determine if the vsftpd package is installed: -$ rpm -q vsftpd - Is it the case that the package is installed? + + To check the ownership of /var/log, +run the command: +$ ls -lL /var/log +If properly configured, the output should indicate the following owner: +root + Is it the case that /var/log does not have an owner of root? - + -Run the following command to determine if the kerberos_enabled SELinux boolean is enabled: -$ getsebool kerberos_enabled +Run the following command to determine if the httpd_run_preupgrade SELinux boolean is disabled: +$ getsebool httpd_run_preupgrade If properly configured, the output should show the following: -kerberos_enabled --> on - Is it the case that kerberos_enabled is not enabled? +httpd_run_preupgrade --> off + Is it the case that httpd_run_preupgrade is not disabled? - - Verify that Red Hat Enterprise Linux 8 disables the use of user namespaces with the following commands: + + +Run the following command to determine if the xserver_execmem SELinux boolean is disabled: +$ getsebool xserver_execmem +If properly configured, the output should show the following: +xserver_execmem --> off + Is it the case that xserver_execmem is not disabled? + + + + Check group owners of the system audit logs. -Note: User namespaces are used primarily for Linux containers. If containers are in use, this requirement is not applicable. +First, determine where the audit log file is located. -The runtime status of the user.max_user_namespaces kernel parameter can be queried -by running the following command: -$ sysctl user.max_user_namespaces -0. +$ sudo grep -iw ^log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log - Is it the case that the correct value is not returned? +The log_file option specifies the audit log file path. +If the log_file option isn't defined, check all files within /var/log/audit directory. + + +Then, determine the audit log group by running the following command: +$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf + + +Then, check that the audit log file is owned by the correct group. +Run the following command to display the owner of the audit log file: + +$ sudo stat -c "%n %G" log_file + + +The audit log file must be owned by the log_group or by root if the log_group is not specified. + Is it the case that audit log files are owned by incorrect group? - - To obtain a list of all users and the content of their shadow password field, run the command: -$ sudo readarray -t systemaccounts -Verify if all accounts are locked. - Is it the case that system accounts are not locked? + + Run the following command to determine if the httpd package is installed: +$ rpm -q httpd + Is it the case that the package is installed? - - -Run the following command to determine if the mailman_use_fusefs SELinux boolean is disabled: -$ getsebool mailman_use_fusefs -If properly configured, the output should show the following: -mailman_use_fusefs --> off - Is it the case that mailman_use_fusefs is not disabled? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd with the following command: + +$ sudo auditctl -l | grep -E '(/etc/shadow)' + +-w /etc/shadow -p wa -k identity + Is it the case that command does not return a line, or the line is commented out? - - To check if the system motd banner is compliant, -run the following command: -$ cat /etc/motd - Is it the case that it does not display the required banner? + + To determine how the SSH daemon's PermitUserEnvironment option is set, run the following command: + +$ sudo grep -i PermitUserEnvironment /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine if the system is configured to audit calls to the -rename system call, run the following command: -$ sudo grep "rename" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_ALL /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + The runtime status of the kernel.pid_max kernel parameter can be queried +by running the following command: +$ sysctl kernel.pid_max +65536. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the mount_anyfile SELinux boolean is enabled: -$ getsebool mount_anyfile -If properly configured, the output should show the following: -mount_anyfile --> on - Is it the case that mount_anyfile is not enabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEVKMEM /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - System executables are stored in the following directories by default: -/bin -/sbin -/usr/bin -/usr/local/bin -/usr/local/sbin -/usr/sbin -For each of these directories, run the following command to find files -not owned by root: -$ sudo find -L DIR/ ! -user root -type d -exec chown root {} \; - Is it the case that any system executables directories are found to not be owned by root? + + To check the group ownership of /boot/grub2/grub.cfg, +run the command: +$ ls -lL /boot/grub2/grub.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/grub2/grub.cfg does not have a group owner of root? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudoedit" command with the following command: + +$ sudo auditctl -l | grep sudoedit + +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudoedit + Is it the case that the command does not return a line, or the line is commented out? - - To verify the boot loader superuser password has been set, run the following command: -$ sudo grep "^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$" /boot/efi/EFI/redhat/user.cfg -The output should be similar to: -GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.C4E08AC72FBFF7E837FD267BFAD7AEB3D42DDC -2C99F2A94DD5E2E75C2DC331B719FE55D9411745F82D1B6CFD9E927D61925F9BBDD1CFAA0080E0 -916F7AB46E0D.1302284FCCC52CD73BA3671C6C12C26FF50BA873293B24EE2A96EE3B57963E6D7 -0C83964B473EC8F93B07FE749AA6710269E904A9B08A6BBACB00A2D242AD828 - Is it the case that no password is set? + + +Run the following command to determine if the gluster_anon_write SELinux boolean is disabled: +$ getsebool gluster_anon_write +If properly configured, the output should show the following: +gluster_anon_write --> off + Is it the case that gluster_anon_write is not disabled? - + -Run the following command to determine if the httpd_enable_ftp_server SELinux boolean is disabled: -$ getsebool httpd_enable_ftp_server +Run the following command to determine if the virt_read_qemu_ga_data SELinux boolean is disabled: +$ getsebool virt_read_qemu_ga_data If properly configured, the output should show the following: -httpd_enable_ftp_server --> off - Is it the case that httpd_enable_ftp_server is not disabled? +virt_read_qemu_ga_data --> off + Is it the case that virt_read_qemu_ga_data is not disabled? - - Verify that Red Hat Enterprise Linux 8 's INACTIVE conforms to site policy (no more than 30 days) with the following command: + + To determine if the system is configured to audit calls to the +unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -$ sudo awk -F: '$7 > 30 {print $1 " " $7}' /etc/shadow - Is it the case that the value of INACTIVE is greater than the expected value or is -1? + Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity rules for the root account. + + Verify that the default umask for all local interactive users is "077". -Check if root user is required to use complex passwords with the following command: +Identify the locations of all local interactive user home directories by looking at the "/etc/passwd" file. -$ grep enforce_for_root /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +Check all local interactive user initialization files for interactive users with the following command: -/etc/security/pwquality.conf:enforce_for_root - Is it the case that "enforce_for_root" is commented or missing? +Note: The example is for a system that is configured to create users home directories in the "/home" directory. + +# grep -ri umask /home/ + +/home/smithj/.bash_history:grep -i umask /etc/bashrc /etc/csh.cshrc /etc/profile +/home/smithj/.bash_history:grep -i umask /etc/login.defs + Is it the case that any local interactive user initialization files are found to have a umask statement that sets a value less restrictive than "077"? - - -Run the following command to determine if the user_exec_content SELinux boolean is enabled: -$ getsebool user_exec_content -If properly configured, the output should show the following: -user_exec_content --> on - Is it the case that user_exec_content is not enabled? + + Run the following command to determine if the aide package is installed: $ rpm -q aide + Is it the case that the package is not installed? - - To verify the assigned home directory of all interactive users is group- -owned by that users primary GID, run the following command: -# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) - Is it the case that the group ownership is incorrect? + + Verify the nosuid option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . nosuid . . . + + Is it the case that the "/home" file system does not have the "nosuid" option set? - - Verify the value of the "minclass" option in "/etc/security/pwquality.conf" with the following command: - -$ grep minclass /etc/security/pwquality.conf + + -minclass = - Is it the case that the value of "minclass" is set to less than "<sub idref="var_password_pam_minclass" />" or is commented out? +Run the following command to determine the current status of the +auditd service: +$ sudo systemctl is-active auditd +If the service is running, it should return the following: active + Is it the case that the auditd service is not running? - + + To verify that rsyslog's Forwarding Output Module has CA certificate +configured for its TLS connections to remote server, run the following command: +$ grep DefaultNetstreamDriverCAFile /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should include record similar to +global(DefaultNetstreamDriverCAFile="/etc/pki/tls/cert.pem") +where the path to the CA file (/etc/pki/tls/cert.pem in case above) must point to the correct CA certificate. + Is it the case that CA certificate for rsyslog remote logging via TLS is not set? + + + + Run the following command to determine if the pcsc-lite package is installed: $ rpm -q pcsc-lite + Is it the case that the package is not installed? + + + -Run the following command to determine if the global_ssp SELinux boolean is disabled: -$ getsebool global_ssp +Run the following command to determine if the smbd_anon_write SELinux boolean is disabled: +$ getsebool smbd_anon_write If properly configured, the output should show the following: -global_ssp --> off - Is it the case that global_ssp is not disabled? +smbd_anon_write --> off + Is it the case that smbd_anon_write is not disabled? - + -Run the following command to determine if the ksmtuned_use_cifs SELinux boolean is disabled: -$ getsebool ksmtuned_use_cifs +Run the following command to determine if the git_session_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool git_session_bind_all_unreserved_ports If properly configured, the output should show the following: -ksmtuned_use_cifs --> off - Is it the case that ksmtuned_use_cifs is not disabled? +git_session_bind_all_unreserved_ports --> off + Is it the case that git_session_bind_all_unreserved_ports is not disabled? - - To determine if the system is configured to audit successful calls -to the fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit.* + + To determine if the system is configured to audit calls to the +create_module system call, run the following command: +$ sudo grep "create_module" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes page_poison=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*page_poison=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*page_poison=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'page_poison=1' -The command should not return any output. - Is it the case that page allocator poisoning is not enabled? + + To verify /etc/system-fips exists, run the following command: +ls -l /etc/system-fips +The output should be similar to the following: +-rw-r--r--. 1 root root 36 Nov 26 11:31 /etc/system-fips + Is it the case that /etc/system-fips does not exist? - - -Run the following command to determine if the guest_exec_content SELinux boolean is disabled: -$ getsebool guest_exec_content -If properly configured, the output should show the following: -guest_exec_content --> off - Is it the case that guest_exec_content is not disabled? + + Run the following command to determine if the libcap-ng-utils package is installed: $ rpm -q libcap-ng-utils + Is it the case that the package is not installed? - - Run the following command to ensure postfix accepts mail messages from only the local system: -$ grep inet_interfaces /etc/postfix/main.cf -If properly configured, the output should show only . - Is it the case that it does not? + + Verify that the system is integrated with a centralized authentication mechanism +such as as Active Directory, Kerberos, Directory Server, etc. that has +automated account mechanisms in place. + Is it the case that the system is not using a centralized authentication mechanism, or it is not automated? - - Run the following command to determine if the openscap-scanner package is installed: $ rpm -q openscap-scanner - Is it the case that the package is not installed? + + Verify the operating system audits activities performed during nonlocal +maintenance and diagnostic sessions. Run the following command: +$ sudo auditctl -l | grep sudo.log +-w /var/log/sudo.log -p wa -k maintenance + + Is it the case that Audit rule is not present? - - Locate the directories containing the CGI scripts. These directories should be -language-specific (e.g., PERL, ASP, JS, JSP, etc.). Examine the file permissions -on the directories using the following command: -ls -l directories -Anonymous FTP users must not have access to these directories. - Is it the case that it is not? + + Verify Red Hat Enterprise Linux 8 is securely comparing internal information system clocks at a regular interval with an NTP server with the following command: +$ sudo grep maxpoll /etc/ntp.conf /etc/chrony.conf +server [ntp.server.name] iburst maxpoll . + Is it the case that "maxpoll" has not been set to the value of "<sub idref="var_time_service_set_maxpoll" />", is commented out, or is missing? - - To ensure ClientAliveInterval is set correctly, run the following command: - -$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config - -If properly configured, the output should be: -ClientAliveCountMax 0 + + To check for legacy lines in /etc/passwd, run the following command: + grep '^\+' /etc/passwd +The command should not return any output. + Is it the case that the file contains legacy lines? + + + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules +The output has to be exactly as follows: +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access + Is it the case that the file does not exist or the content differs? + + + + +Run the following command to determine if the mmap_low_allowed SELinux boolean is disabled: +$ getsebool mmap_low_allowed +If properly configured, the output should show the following: +mmap_low_allowed --> off + Is it the case that mmap_low_allowed is not disabled? + + + + In order to be sure that the databases are up-to-date, run the +dconf update +command as the administrator. + Is it the case that The system-wide dconf databases are up-to-date with regards to respective keyfiles? + + + + -In this case, the SSH timeout occurs precisely when -the ClientAliveInterval is set. - Is it the case that it is commented out or not configured properly? +Run the following command to determine the current status of the +cron service: +$ sudo systemctl is-active cron +If the service is running, it should return the following: active + Is it the case that ? - - To check the permissions of /etc/gshadow-, -run the command: -$ ls -l /etc/gshadow- -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/gshadow- does not have unix mode ----------? + + To verify that Linux Audit logging is enabled for the USBGuard daemon, +run the following command: +$ sudo grep AuditBackend /etc/usbguard/usbguard-daemon.conf +The output should be +AuditBackend=LinuxAudit + Is it the case that AuditBackend is not set to LinuxAudit? @@ -377890,683 +378067,770 @@ If a line indicating yes is returned, then the required value is set. Is it the case that the required value is not set? - - To ensure a login warning banner is enabled, run the following: -$ grep banner-message-enable /etc/dconf/db/gdm.d/* -If properly configured, the output should be true. -To ensure a login warning banner is locked and cannot be changed by a user, run the following: -$ grep banner-message-enable /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/banner-message-enable. - Is it the case that it is not? - - - - Verify emergency accounts have been provisioned with an expiration date of 72 hours. - -For every emergency account, run the following command to obtain its account aging and expiration information: - -$ sudo chage -l emergency_account_name - -Verify each of these accounts has an expiration date set within 72 hours or as documented. - Is it the case that any emergency accounts have no expiration date set or do not expire within 72 hours? + + To find the location of the AIDE database file, run the following command: +$ sudo ls -l DBDIR/database_file_name + Is it the case that there is no database file? - - To check the group ownership of /etc/group, -run the command: -$ ls -lL /etc/group -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/group does not have a group owner of root? + + +Run the following command to determine if the openvpn_enable_homedirs SELinux boolean is disabled: +$ getsebool openvpn_enable_homedirs +If properly configured, the output should show the following: +openvpn_enable_homedirs --> off + Is it the case that openvpn_enable_homedirs is not disabled? - + -Run the following command to determine if the mozilla_plugin_bind_unreserved_ports SELinux boolean is disabled: -$ getsebool mozilla_plugin_bind_unreserved_ports +Run the following command to determine if the puppetmaster_use_db SELinux boolean is disabled: +$ getsebool puppetmaster_use_db If properly configured, the output should show the following: -mozilla_plugin_bind_unreserved_ports --> off - Is it the case that mozilla_plugin_bind_unreserved_ports is not disabled? +puppetmaster_use_db --> off + Is it the case that puppetmaster_use_db is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules -The output has to be exactly as follows: -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access - Is it the case that the file does not exist or the content differs? + + To determine if the system is configured to audit successful calls +to the openat system call, run the following command: +$ sudo grep "openat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify that yum verifies the signature of packages from a repository prior to install with the following command: - -$ grep gpgcheck /etc/yum.conf + + +Run the following command to determine if the polipo_use_nfs SELinux boolean is disabled: +$ getsebool polipo_use_nfs +If properly configured, the output should show the following: +polipo_use_nfs --> off + Is it the case that polipo_use_nfs is not disabled? + + + + Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: -gpgcheck=1 +$ sudo grep audit /etc/security/faillock.conf -If "gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. - Is it the case that there is no process to validate certificates that is approved by the organization? +audit + Is it the case that the "audit" option is not set, is missing or commented out? - - -Run the following command to determine if the nis_enabled SELinux boolean is disabled: -$ getsebool nis_enabled -If properly configured, the output should show the following: -nis_enabled --> off - Is it the case that nis_enabled is not disabled? + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 limits the number of concurrent sessions to -"" for all -accounts and/or account types with the following command: -$ grep -r -s maxlogins /etc/security/limits.conf /etc/security/limits.d/*.conf -/etc/security/limits.conf:* hard maxlogins 10 -This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. - Is it the case that the "maxlogins" item is missing, commented out, or the value is set greater -than "<sub idref="var_accounts_max_concurrent_login_sessions" />" and -is not documented with the Information System Security Officer (ISSO) as an -operational requirement for all domains that have the "maxlogins" item -assigned'? + + Run the following command to determine if the pigz package is installed: +$ rpm -q pigz + Is it the case that the package is installed? - - Run the following command to determine the current status of the dnf-automatic timer: $ sudo systemctl is-active dnf-automatic.timer If the timer is running, it should return the following: active - Is it the case that the dnf-automatic.timer is not enabled? + + To verify all files and directories contained in interactive user home +directory, excluding local initialization files, have a mode of 0750, +run the following command: +$ sudo ls -lLR /home/USER + Is it the case that home directory files or folders have incorrect permissions? - - To ensure that users cannot disable the screensaver idle inactivity setting, run the following: -$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled - Is it the case that idle-activation-enabled is not locked? + + To verify that the audit system collects unauthorized file accesses, run the following commands: +$ sudo grep EACCES /etc/audit/audit.rules +$ sudo grep EPERM /etc/audit/audit.rules + Is it the case that 32-bit and 64-bit system calls to creat, open, openat, open_by_handle_at, truncate, and ftruncate are not audited during EACCES and EPERM? - - To check the ownership of /boot/grub2/grub.cfg, + + To check the ownership of /etc/shadow, run the command: -$ ls -lL /boot/grub2/grub.cfg +$ ls -lL /etc/shadow If properly configured, the output should indicate the following owner: root - Is it the case that /boot/grub2/grub.cfg does not have an owner of root? + Is it the case that /etc/shadow does not have an owner of root? - - Inspect the file /etc/firewalld/firewalld.conf to determine -the default zone for the firewalld. It should be set to DefaultZone=drop: -$ sudo grep DefaultZone /etc/firewalld/firewalld.conf - Is it the case that the default zone is not set to DROP? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one lower-case character. + +Check the value for "lcredit" with the following command: + +$ sudo grep lcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:lcredit = -1 + Is it the case that the value of "lcredit" is a positive number or is commented out? - - Verify Red Hat Enterprise Linux 8 enforces a delay of at least seconds between console logon prompts following a failed logon attempt with the following command: - -$ sudo grep -i "FAIL_DELAY" /etc/login.defs -FAIL_DELAY - Is it the case that the value of "FAIL_DELAY" is not set to "<sub idref="var_accounts_fail_delay" />" or greater, or the line is commented out? + + Run the following command to determine if the cups package is installed: +$ rpm -q cups + Is it the case that the package is installed? - - To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: + + +Run the following command to determine if the xguest_use_bluetooth SELinux boolean is disabled: +$ getsebool xguest_use_bluetooth +If properly configured, the output should show the following: +xguest_use_bluetooth --> off + Is it the case that xguest_use_bluetooth is not disabled? + + + + Check that AIDE is properly configured to protect the integrity of the +audit tools by running the following command: -$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config +# sudo cat /etc/aide.conf | grep /usr/sbin/au -If a line indicating yes is returned, then the required value is set. +/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512 - Is it the case that the required value is not set? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "reboot" command with the following command: -$ sudo auditctl -l | grep reboot --a always,exit -F path=/reboot -F perm=x -F auid>=1000 -F auid!=unset -k privileged-reboot - Is it the case that the command does not return a line, or the line is commented out? +/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512 + + +If AIDE is configured properly to protect the integrity of the audit tools, +all lines listed above will be returned from the command. + +If one or more lines are missing, this is a finding. + Is it the case that integrity checks of the audit tools are missing or incomplete? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "restorecon" command with the following command: + + Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: -$ sudo auditctl -l | grep restorecon +$ sudo grep audit /etc/security/faillock.conf --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -k privileged-restorecon - Is it the case that the command does not return a line, or the line is commented out? +audit + Is it the case that the "audit" option is not set, is missing or commented out? - - -Run the following command to determine if the zabbix_can_network SELinux boolean is disabled: -$ getsebool zabbix_can_network -If properly configured, the output should show the following: -zabbix_can_network --> off - Is it the case that zabbix_can_network is not disabled? + + To verify all files and directories in interactive user home directory are +group-owned by a group the user is a member of, run the +following command: +$ sudo ls -lLR /home/USER + Is it the case that the group ownership is incorrect? - - To check the permissions of /etc/shadow-, -run the command: -$ ls -l /etc/shadow- -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/shadow- does not have unix mode ----------? + + Verify Red Hat Enterprise Linux 8 is configured to lock the root account after +unsuccessful logon attempts with the command: + + +$ grep even_deny_root /etc/security/faillock.conf +even_deny_root + Is it the case that the "even_deny_root" option is not set, is missing or commented out? - - To ensure all GIDs referenced in /etc/passwd are defined in /etc/group, -run the following command: -$ sudo pwck -qr -There should be no output. - Is it the case that GIDs referenced in /etc/passwd are returned as not defined in /etc/group? + + To determine if the system is configured to audit unsuccessful calls +to the fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To view the root user's PATH, run the following command: -$ sudo env | grep PATH -If correctly configured, the PATH must: use vendor default settings, -have no empty entries, and have no entries beginning with a character -other than a slash (/). - Is it the case that any of these conditions are not met? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes slab_nomerge=yes, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slab_nomerge=yes.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*slab_nomerge=yes.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'slab_nomerge=yes' +The command should not return any output. + Is it the case that merging of slabs with similar size is enabled? - - Verify the nosuid option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . nosuid . . . + + - Is it the case that the "/home" file system does not have the "nosuid" option set? +Run the following command to determine the current status of the +pcscd service: +$ sudo systemctl is-active pcscd +If the service is running, it should return the following: active + Is it the case that the pcscd service is not enabled? - - Run the following command to determine if the rsyslog package is installed: $ rpm -q rsyslog - Is it the case that the package is not installed? + + To check the ownership of /etc/cron.hourly, +run the command: +$ ls -lL /etc/cron.hourly +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.hourly does not have an owner of root? - - The runtime status of the net.ipv4.conf.all.send_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.send_redirects -0. + + If the system uses IPv6, this is not applicable. - Is it the case that the correct value is not returned? +If the system is configured to prevent the usage of the ipv6 on +network interfaces, it will contain a line of the form: +net.ipv6.conf.default.disable_ipv6 = 1 +Such lines may be inside any file in the /etc/sysctl.d directory. +This permits insertion of the IPv6 kernel module (which other parts of the +system expect to be present), but otherwise keeps network interfaces +from using IPv6. Run the following command to search for such lines in all +files in /etc/sysctl.d: +$ grep -r ipv6 /etc/sysctl.d + Is it the case that the ipv6 support is disabled by default on network interfaces? - - Verify the noexec option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . noexec . . . + + To check that the httpd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled httpd +Output should indicate the httpd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled httpd disabled - Is it the case that the "/var/log" file system does not have the "noexec" option set? +Run the following command to verify httpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active httpd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the httpd is masked, run the following command: +$ sudo systemctl show httpd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "httpd" is loaded and not masked? - - To determine if the system is configured to audit successful calls -to the removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify all local initialization files for interactive users are owned by the +primary user, run the following command: +$ sudo ls -al /home/USER/.* +The user initialization files should be owned by USER. + Is it the case that they are not? - - -Run the following command to determine if the logadm_exec_content SELinux boolean is enabled: -$ getsebool logadm_exec_content -If properly configured, the output should show the following: -logadm_exec_content --> on - Is it the case that logadm_exec_content is not enabled? + + Verify Red Hat Enterprise Linux 8 for PKI-based authentication has valid certificates by constructing a +certification path (which includes status information) to an accepted trust anchor. + +Check that the system has a valid DoD root CA installed with the following command: + +$ sudo openssl x509 -text -in /etc/sssd/pki/sssd_auth_ca_db.pem + +Certificate: +Data: +Version: 3 (0x2) +Serial Number: 1 (0x1) +Signature Algorithm: sha256WithRSAEncryption +Issuer: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 +Validity +Not Before: Mar 20 18:46:41 2012 GMT +Not After : Dec 30 18:46:41 2029 GMT +Subject: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 +Subject Public Key Info: +Public Key Algorithm: rsaEncryption + Is it the case that root CA file is not a DoD-issued certificate with a valid date and installed in the /etc/sssd/pki/sssd_auth_ca_db.pem location? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RANDOMIZE_BASE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that Audit Daemon is configured to resolve all uid, gid, syscall, +architecture, and socket address information before writing the event to disk, +run the following command: +$ sudo grep log_format /etc/audit/auditd.conf +The output should return the following: +log_format = ENRICHED + Is it the case that log_format isn't set to ENRICHED? - - -Run the following command to determine if the git_cgi_use_nfs SELinux boolean is disabled: -$ getsebool git_cgi_use_nfs -If properly configured, the output should show the following: -git_cgi_use_nfs --> off - Is it the case that git_cgi_use_nfs is not disabled? + + The following command will list which files on the system have ownership different from what +is expected by the RPM database: +$ rpm -Va | rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }' + Is it the case that there is output? - - To check the permissions of /etc/at.allow, -run the command: -$ ls -l /etc/at.allow -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/at.allow does not have unix mode -rw-------? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules +The output has to be exactly as follows: +## Unsuccessful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change + Is it the case that the file does not exist or the content differs? - - Verify that Red Hat Enterprise Linux 8 loads the driver with the following command: + + Verify the NX (no-execution) bit flag is set on the system. -$ grep card_drivers /etc/opensc.conf +Check that the no-execution bit flag is set with the following commands: -card_drivers = ; - Is it the case that "<sub idref="var_smartcard_drivers" />" is not listed as a card driver, or there is no line returned for "card_drivers"? - - - - To verify that BIND uses the system crypto policy, check out that the BIND config file -/etc/named.conf contains the include "/etc/crypto-policies/back-ends/bind.config"; -directive: -$ sudo grep 'include "/etc/crypto-policies/back-ends/bind.config";' /etc/named.conf -Verify that the directive is at the bottom of the options section of the config file. - Is it the case that BIND is installed and the BIND config file doesn't contain the -<pre>include "/etc/crypto-policies/back-ends/bind.config";</pre> directive? +$ sudo dmesg | grep NX + +[ 0.000000] NX (Execute Disable) protection: active + +If "dmesg" does not show "NX (Execute Disable) protection" active, check the cpuinfo settings with the following command: + +$ sudo grep flags /proc/cpuinfo +flags : fpu vme de pse tsc ms nx rdtscp lm constant_ts + +The output should contain the "nx" flag. + Is it the case that NX is disabled? - - The following command will discover and print world-writable directories that -are not group owned by a system account, given the assumption that only system -accounts have a gid lower than 1000. Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -gid +999 -print - Is it the case that there is output? + + To check if pam_pwquality.so is enabled in password-auth, run the following command: +$ grep pam_pwquality /etc/pam.d/password-auth +The output should be similar to the following: +password requisite pam_pwquality.so + Is it the case that pam_pwquality.so is not enabled in password-auth? - - -Run the following command to determine if the named_write_master_zones SELinux boolean is disabled: -$ getsebool named_write_master_zones -If properly configured, the output should show the following: -named_write_master_zones --> off - Is it the case that named_write_master_zones is not disabled? + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -Run the following command to determine if the virt_use_usb SELinux boolean is disabled: -$ getsebool virt_use_usb +Run the following command to determine if the telepathy_connect_all_ports SELinux boolean is disabled: +$ getsebool telepathy_connect_all_ports If properly configured, the output should show the following: -virt_use_usb --> off - Is it the case that virt_use_usb is not disabled? +telepathy_connect_all_ports --> off + Is it the case that telepathy_connect_all_ports is not disabled? - - Verify the system-wide shared library directories are group-owned by "root" with the following command: + + To verify that TLS is configured properly in +/etc/httpd/conf.modules.d/ssl.conf, run the following command: +$ grep -i "sslengine\|sslprotocol" /etc/httpd/conf.d/ssl.conf +The output should return the following: -$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -group root -type d -exec stat -c "%n %G" '{}' \; +SSLEngine on +SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 -If any system-wide shared library directory is returned and is not group-owned by a required system account, this is a finding. - Is it the case that any system-wide shared library directory is returned and is not group-owned by a required system account? + Is it the case that it is not? - - The runtime status of the kernel.core_pattern kernel parameter can be queried -by running the following command: -$ sysctl kernel.core_pattern -|/bin/false. - - Is it the case that the returned line does not have a value of "|/bin/false", or a line is not -returned and the need for core dumps is not documented with the Information -System Security Officer (ISSO) as an operational requirement? + + +Run the following command to determine if the tor_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool tor_bind_all_unreserved_ports +If properly configured, the output should show the following: +tor_bind_all_unreserved_ports --> off + Is it the case that tor_bind_all_unreserved_ports is not disabled? - - To verify that Linux Audit logging is enabled for the USBGuard daemon, + + If network services are using the xinetd service, this is not applicable. + +To check that the xinetd service is disabled in system boot configuration, run the following command: -$ sudo grep AuditBackend /etc/usbguard/usbguard-daemon.conf -The output should be -AuditBackend=LinuxAudit - Is it the case that AuditBackend is not set to LinuxAudit? - - - - The group-owner of all log files written by rsyslog should be -root. -These log files are determined by the second part of each Rule line in -/etc/rsyslog.conf and typically all appear in /var/log. -To see the group-owner of a given log file, run the following command: -$ ls -l LOGFILE - Is it the case that the group-owner is not correct? - - - - To determine if NOPASSWD or !authenticate have been configured for -sudo, run the following command: -$ sudo grep -ri "nopasswd\|\!authenticate" /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that nopasswd and/or !authenticate is enabled in sudo? +$ sudo systemctl is-enabled xinetd +Output should indicate the xinetd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled xinetd disabled + +Run the following command to verify xinetd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active xinetd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the xinetd is masked, run the following command: +$ sudo systemctl show xinetd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "xinetd" is loaded and not masked? - - To verify the number of rounds for the password hashing algorithm is configured, run the following command: -$ sudo grep rounds /etc/pam.d/password-auth -The output should show the following match: -password sufficient pam_unix.so sha512 rounds= - Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + Run the following command to determine if the audit package is installed: $ rpm -q audit + Is it the case that the audit package is not installed? - - To determine how the SSH daemon's Banner option is set, run the following command: - -$ sudo grep -i Banner /etc/ssh/sshd_config - -If a line indicating /etc/issue is returned, then the required value is set. - - Is it the case that the required value is not set? + + To ensure the system is configured to mask the Ctrl-Alt-Del sequence, Check +that the ctrl-alt-del.target is masked and not active with the following +command: +sudo systemctl status ctrl-alt-del.target +The output should indicate that the target is masked and not active. It +might resemble following output: +ctrl-alt-del.target +Loaded: masked (/dev/null; bad) +Active: inactive (dead) + Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed? - - Verify that a separate file system/partition has been created for /var/log/audit with the following command: - -$ mountpoint /var/log/audit - - Is it the case that "/var/log/audit is not a mountpoint" is returned? + + Run the following command and verify that time sources are only configured with server directive: +# grep -E "^(server|pool)" /etc/chrony.conf +A line with the appropriate server should be returned, any line returned starting with pool is a finding. + Is it the case that an authoritative remote time server is not configured or configured with pool directive? - + -Run the following command to determine if the kdumpgui_run_bootloader SELinux boolean is disabled: -$ getsebool kdumpgui_run_bootloader +Run the following command to determine if the glance_use_fusefs SELinux boolean is disabled: +$ getsebool glance_use_fusefs If properly configured, the output should show the following: -kdumpgui_run_bootloader --> off - Is it the case that kdumpgui_run_bootloader is not disabled? +glance_use_fusefs --> off + Is it the case that glance_use_fusefs is not disabled? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_KEXEC /boot/config.* + $ grep CONFIG_SLAB_FREELIST_RANDOM /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify the umask setting is configured correctly in the /etc/bashrc file with the following command: - -$ sudo grep "umask" /etc/bashrc + + To check the permissions of /boot/efi/EFI/redhat/grub.cfg, run the command: +$ sudo ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following +permissions: -rwx------ + Is it the case that it does not? + + + + To determine if the system is configured to audit unsuccessful calls +to the fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -umask - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? + Is it the case that no line is returned? - - To ensure smart card authentication on the login screen is enabled, run the following command: -$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot disable smart card authentication on the login screen, run the following: -$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/enable-smartcard-authentication - Is it the case that enable-smartcard-authentication has not been configured or is disabled? + + Run the following command to determine the current status of the dnf-automatic timer: $ sudo systemctl is-active dnf-automatic.timer If the timer is running, it should return the following: active + Is it the case that the dnf-automatic.timer is not enabled? - - -Run the following command to determine if the httpd_read_user_content SELinux boolean is disabled: -$ getsebool httpd_read_user_content -If properly configured, the output should show the following: -httpd_read_user_content --> off - Is it the case that httpd_read_user_content is not disabled? + + Verify that a separate file system/partition has been created for /boot with the following command: + +$ mountpoint /boot + + Is it the case that "/boot is not a mountpoint" is returned? - - Determine where the audit logs are stored with the following command: + + To check that the quota_nld service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled quota_nld +Output should indicate the quota_nld service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled quota_nld disabled -$ sudo grep -iw log_file /etc/audit/auditd.conf +Run the following command to verify quota_nld is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active quota_nld -log_file = /var/log/audit/audit.log +If the service is not running the command will return the following output: +inactive -Determine the owner of the audit log directory by using the output of the above command -(default: "/var/log/audit/"). Run the following command with the correct audit log directory -path: +The service will also be masked, to check that the quota_nld is masked, run the following command: +$ sudo systemctl show quota_nld | grep "LoadState\|UnitFileState" -$ sudo ls -ld /var/log/audit +If the service is masked the command will return the following outputs: -drwx------ 2 root root 23 Jun 11 11:56 /var/log/audit +LoadState=masked -The audit log directory must be owned by "root" - Is it the case that the directory is not owned by root? +UnitFileState=masked + Is it the case that the "quota_nld" is loaded and not masked? - - To determine if env_reset has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\benv_reset\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that env_reset is not enabled in sudo? + + +Run the following command to determine if the virt_sandbox_use_audit SELinux boolean is enabled: +$ getsebool virt_sandbox_use_audit +If properly configured, the output should show the following: +virt_sandbox_use_audit --> on + Is it the case that virt_sandbox_use_audit is not enabled? - - Verify that a separate file system/partition has been created for /boot with the following command: - -$ mountpoint /boot - - Is it the case that "/boot is not a mountpoint" is returned? + + To verify that web content directories should not be shared anonymously over +remote filesystems such as nfs and smb, inspect each instance +of DocumentRoot and serverRoot and verify that no entry in +/etc/fstab exists or no remote filesystem process is running for +any instance. +$ ps -ef | grep "nfs\|smb" + Is it the case that it is not? - - To check the ownership of /etc/cron.allow, -run the command: -$ ls -lL /etc/cron.allow -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.allow does not have an owner of root? + + To check on the age of McAfee virus definition files, run the following command: +$ sudo cd /opt/NAI/LinuxShield/engine/dat +$ sudo ls -la avvscan.dat avvnames.dat avvclean.dat + Is it the case that signatures are out of date? - - To check the ownership of /etc/shells, + + To check the permissions of /etc/cron.weekly, run the command: -$ ls -lL /etc/shells -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shells does not have an owner of root? +$ ls -l /etc/cron.weekly +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.weekly does not have unix mode -rwx------? - - -Run the following command to determine if the dbadm_manage_user_files SELinux boolean is disabled: -$ getsebool dbadm_manage_user_files -If properly configured, the output should show the following: -dbadm_manage_user_files --> off - Is it the case that dbadm_manage_user_files is not disabled? + + To ensure the user home directory is not group-writable or world-readable, run the following: +# ls -ld /home/USER + Is it the case that the user home directory is group-writable or world-readable? - + -Run the following command to determine if the mcelog_exec_scripts SELinux boolean is enabled: -$ getsebool mcelog_exec_scripts +Run the following command to determine if the selinuxuser_mysql_connect_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_mysql_connect_enabled If properly configured, the output should show the following: -mcelog_exec_scripts --> on - Is it the case that mcelog_exec_scripts is not enabled? - - - - Run the following command to determine if the quagga package is installed: -$ rpm -q quagga - Is it the case that the package is installed? +selinuxuser_mysql_connect_enabled --> off + Is it the case that selinuxuser_mysql_connect_enabled is not disabled? - - Verify an anti-virus solution is installed on the system. The anti-virus solution may be -bundled with an approved host-based security solution. - Is it the case that there is no anti-virus solution installed on the system? + + +Run the following command to determine if the httpd_run_stickshift SELinux boolean is disabled: +$ getsebool httpd_run_stickshift +If properly configured, the output should show the following: +httpd_run_stickshift --> off + Is it the case that httpd_run_stickshift is not disabled? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/tallylog" with the following command: - -$ sudo auditctl -l | grep /var/log/tallylog - --w /var/log/tallylog -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? + + To determine if !authenticate has not been configured for sudo, run the following command: +$ sudo grep -r \!authenticate /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that !authenticate is specified in the sudo config files? - + -Run the following command to determine if the smartmon_3ware SELinux boolean is disabled: -$ getsebool smartmon_3ware +Run the following command to determine if the irssi_use_full_network SELinux boolean is disabled: +$ getsebool irssi_use_full_network If properly configured, the output should show the following: -smartmon_3ware --> off - Is it the case that smartmon_3ware is not disabled? +irssi_use_full_network --> off + Is it the case that irssi_use_full_network is not disabled? - - To verify that the DConf User profile is configured correctly, run the following -command: + + Verify that the interactive user account passwords are using a strong +password hash with the following command: -$ cat /etc/dconf/profile/user -The output should show the following: -user-db:user -system-db:local -system-db:site -system-db:distro - Is it the case that DConf User profile does not exist or is not configured correctly? - - - - To verify that HBSS ACCM is installed, run the following command(s): -$ sudo ls /opt/McAfee/accm/bin/accm - Is it the case that the HBSS ACCM module is not installed? +$ sudo cut -d: -f2 /etc/shadow + +$6$kcOnRq/5$NUEYPuyL.wghQwWssXRcLRFiiru7f5JPV6GaJhNC2aK5F3PZpE/BCCtwrxRc/AInKMNX3CdMw11m9STiql12f/ + +Password hashes ! or * indicate inactive accounts not +available for logon and are not evaluated. + Is it the case that any interactive user password hash does not begin with "$6"? - - The runtime status of the net.ipv4.conf.all.forwarding kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.forwarding -0. -The ability to forward packets is only appropriate for routers. - Is it the case that IP forwarding value is "1" and the system is not router? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one special character with the following command: + +$ sudo grep ocredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +ocredit = + Is it the case that value of "ocredit" is a positive number or is commented out? - - To verify that Samba clients using mount.cifs must use packet signing, run the following command: -$ grep sec /etc/fstab -The output should show either krb5i or ntlmv2i in use. - Is it the case that it does not? + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep '\bat\b' /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? - - To verify the number of rounds for the password hashing algorithm is configured, run the following command: -$ sudo grep rounds /etc/pam.d/system-auth -The output should show the following match: -password sufficient pam_unix.so sha512 rounds= - Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + To ensure a login warning banner is enabled, run the following: +$ grep banner-message-enable /etc/dconf/db/gdm.d/* +If properly configured, the output should be true. +To ensure a login warning banner is locked and cannot be changed by a user, run the following: +$ grep banner-message-enable /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/banner-message-enable. + Is it the case that it is not? - - Run the following command to determine if the freeradius package is installed: $ rpm -q freeradius - Is it the case that the package is installed? + + To determine how the SSH daemon's IgnoreRhosts option is set, run the following command: + +$ sudo grep -i IgnoreRhosts /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine if the system is configured to audit unsuccessful calls -to the setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To check the status of the idle screen lock activation, run the following command: - Is it the case that no line is returned? +$ gsettings get org.gnome.desktop.screensaver lock-enabled +If properly configured, the output should be true. +To ensure that users cannot change how long until the screensaver locks, run the following: +$ grep lock-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled + Is it the case that screensaver locking is not enabled and/or has not been set or configured correctly? - - To determine if the system is configured to audit calls to the -unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Verify that DNS servers have been configured properly, perform the following: +$ sudo grep nameserver /etc/resolv.conf + Is it the case that less than two lines are returned that are not commented out? - - Verify that Promiscuous mode of an interface is disabled, run the following command: -$ ip link | grep PROMISC - Is it the case that any network device is in promiscuous mode? + + +Run the following command to determine if the ftpd_use_fusefs SELinux boolean is disabled: +$ getsebool ftpd_use_fusefs +If properly configured, the output should show the following: +ftpd_use_fusefs --> off + Is it the case that ftpd_use_fusefs is not disabled? - + -Run the following command to determine if the ssh_chroot_rw_homedirs SELinux boolean is disabled: -$ getsebool ssh_chroot_rw_homedirs +Run the following command to determine if the ksmtuned_use_cifs SELinux boolean is disabled: +$ getsebool ksmtuned_use_cifs If properly configured, the output should show the following: -ssh_chroot_rw_homedirs --> off - Is it the case that ssh_chroot_rw_homedirs is not disabled? +ksmtuned_use_cifs --> off + Is it the case that ksmtuned_use_cifs is not disabled? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one upper-case character. - -Check the value for "ucredit" with the following command: + + To ensure that XDMCP is disabled in /etc/gdm/custom.conf, run the following command: +grep -Pzo "\[xdmcp\]\nEnable=false" /etc/gdm/custom.conf +The output should return the following: -$ sudo grep ucredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +[xdmcp] +Enable=false -ucredit = -1 - Is it the case that the value of "ucredit" is a positive number or is commented out? + Is it the case that the Enable is not set to false or is missing in the xdmcp section of the /etc/gdm/custom.conf gdm configuration file? - + + To check the group ownership of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have a group owner of root? + + + -Run the following command to determine if the httpd_dbus_sssd SELinux boolean is disabled: -$ getsebool httpd_dbus_sssd +Run the following command to determine if the gluster_export_all_ro SELinux boolean is disabled: +$ getsebool gluster_export_all_ro If properly configured, the output should show the following: -httpd_dbus_sssd --> off - Is it the case that httpd_dbus_sssd is not disabled? +gluster_export_all_ro --> off + Is it the case that gluster_export_all_ro is not disabled? - - To check that virtual syscalls are disabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls. - Is it the case that vsyscalls are enabled? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules +The output has to be exactly as follows: +## Successful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete + Is it the case that the file does not exist or the content differs? - - Verify the nosuid option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . nosuid . . . - - Is it the case that the "/boot" file system does not have the "nosuid" option set? + + The file permissions for all log files written by rsyslog should +be set to 640, or more restrictive. These log files are determined by the +second part of each Rule line in /etc/rsyslog.conf and typically +all appear in /var/log. To see the permissions of a given log +file, run the following command: +$ ls -l LOGFILE +The permissions should be 640, or more restrictive. + Is it the case that the permissions are not correct? - - -Run the following command to get the current configured value for secure_mode_insmod -SELinux boolean: -$ getsebool secure_mode_insmod -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that secure_mode_insmod is not set as expected? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING_ZERO /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 audits the execution of privileged functions. + + +Verify that the shadow password suite configuration is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. -Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: +Check the hashing algorithm that is being used to hash passwords with the following command: -$ sudo grep execve /etc/audit/audit.rules +$ sudo grep -i ENCRYPT_METHOD /etc/login.defs -The output should be the following: +ENCRYPT_METHOD + Is it the case that ENCRYPT_METHOD is not set to <sub idref="var_password_hashing_algorithm" />? + + + + Verify that a separate file system/partition has been created for /home with the following command: +$ mountpoint /home --a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid --a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - Is it the case that the command does not return all lines, or the lines are commented out? + Is it the case that "/home is not a mountpoint" is returned? - - Verify the value of the "maxclassrepeat" option in "/etc/security/pwquality.conf" with the following command: - -$ grep maxclassrepeat /etc/security/pwquality.conf + + To check the ownership of /etc/crontab, +run the command: +$ ls -lL /etc/crontab +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/crontab does not have an owner of root? + + + + To verify that SSSD expires known SSH host keys, run the following command: +$ sudo grep ssh_known_hosts_timeout /etc/sssd/sssd.conf +If configured properly, output should be +ssh_known_hosts_timeout = + Is it the case that it does not exist or is not configured properly? + + + + To determine if the system is configured to audit calls to the +chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -maxclassrepeat = - Is it the case that the value of "maxclassrepeat" is set to "0", more than "<sub idref="var_password_pam_maxclassrepeat" />" or is commented out? + Is it the case that no line is returned? @@ -378576,229 +378840,133 @@ The command should return a matching output. Is it the case that noexec is not enabled in sudo? - - -Run the following command to determine if the cron_can_relabel SELinux boolean is disabled: -$ getsebool cron_can_relabel -If properly configured, the output should show the following: -cron_can_relabel --> off - Is it the case that cron_can_relabel is not disabled? - - - - To verify the boot loader superuser account has been set, run the following -command: -sudo grep -A1 "superusers" /boot/grub2/grub.cfg -The output should show the following: -set superusers="superusers-account" -export superusers -where superusers-account is the actual account name different from common names like root, -admin, or administrator and different from any other existing user name. - Is it the case that superuser account is not set or is set to root, admin, administrator or any other existing user name? + + Verify that Red Hat Enterprise Linux 8 set the days of warning before a password expires to + or more for users with a +password: + +$ sudo awk -F: '$6 || $6 == "" {print $1}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? - - Interview the SA or web administrator to see where the public web server -is logically located in the data center. Review the site network diagram -to see how the web server is connected to the LAN. Visually check the web -server hardware connections to see if it conforms to the site network -diagram. - Is it the case that the web server is not isolated in an accredited DoD DMZ Extension? + + To check the ownership of /etc/motd, +run the command: +$ ls -lL /etc/motd +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/motd does not have an owner of root? - + -Run the following command to determine if the staff_use_svirt SELinux boolean is disabled: -$ getsebool staff_use_svirt -If properly configured, the output should show the following: -staff_use_svirt --> off - Is it the case that staff_use_svirt is not disabled? - - - - Open browser window and browse to the appropriate site. Before entry to the -site, you should be presented with the server's PKI credentials. Review -these credentials for authenticity. +To check that the telnet service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig telnet --list +Output should indicate the telnet service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig telnet --list -For DoD, find an entry which cites: +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. -Issuer: -CN = -DOD CLASS 3 CA-3 -OU = PKI -OU = DoD -O = U.S. Government -C = US +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. - Is it the case that it is not? - - - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules -The output has to be exactly as follows: -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification - Is it the case that the file does not exist or the content differs? - - - - To verify that acquiring, saving, and processing core dumps is disabled, run the -following command: -$ systemctl status systemd-coredump.socket -The output should be similar to: -● systemd-coredump.socket - Loaded: masked (Reason: Unit systemd-coredump.socket is masked.) - Active: inactive (dead) ... +telnet off - Is it the case that unit systemd-coredump.socket is not masked or running? - - - - Only FIPS-approved key exchange algorithms must be used. To verify that only FIPS-approved -key exchange algorithms are in use, run the following command: -$ sudo grep -i kexalgorithms /etc/crypto-policies/back-ends/opensshserver.config -The output should contain only following algorithms (or a subset) in the exact order: -CRYPTO_POLICY='-oKexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512' - Is it the case that KexAlgorithms option is commented out, contains non-approved algorithms, or the FIPS-approved algorithms are not in the exact order? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postdrop" command with the following command: +To check that the telnet socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled telnet +Output should indicate the telnet socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled telnetdisabled -$ sudo auditctl -l | grep postdrop +Run the following command to verify telnet is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active telnet --a always,exit -F path=/usr/bin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postdrop - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine if the system is configured to audit successful calls -to the chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the socket is not running the command will return the following output: +inactive - Is it the case that no line is returned? +The socket will also be masked, to check that the telnet is masked, run the following command: +$ sudo systemctl show telnet | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - - To check that the httpd service is disabled in system boot configuration, + + To check that the autofs service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled httpd -Output should indicate the httpd service has either not been installed, +$ sudo systemctl is-enabled autofs +Output should indicate the autofs service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled httpd disabled +$ sudo systemctl is-enabled autofs disabled -Run the following command to verify httpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active httpd +Run the following command to verify autofs is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active autofs If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the httpd is masked, run the following command: -$ sudo systemctl show httpd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the autofs is masked, run the following command: +$ sudo systemctl show autofs | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "httpd" is loaded and not masked? - - - - -Run the following command to determine if the exim_read_user_files SELinux boolean is disabled: -$ getsebool exim_read_user_files -If properly configured, the output should show the following: -exim_read_user_files --> off - Is it the case that exim_read_user_files is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STRICT_KERNEL_WRX /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + Is it the case that the "autofs" is loaded and not masked? - + -Run the following command to determine if the gluster_anon_write SELinux boolean is disabled: -$ getsebool gluster_anon_write +Run the following command to determine if the mcelog_exec_scripts SELinux boolean is enabled: +$ getsebool mcelog_exec_scripts If properly configured, the output should show the following: -gluster_anon_write --> off - Is it the case that gluster_anon_write is not disabled? +mcelog_exec_scripts --> on + Is it the case that mcelog_exec_scripts is not enabled? - + To determine if the system is configured to audit successful calls -to the fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit.* +to the fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify Certmap is enabled in SSSD, run the following command: -$ sudo cat /etc/sssd/sssd.conf -If configured properly, output should contain section like the following - -[certmap/testing.test/rule_name] -matchrule =<SAN>.*EDIPI@mil -maprule = (userCertificate;binary={cert!bin}) -domains = testing.test - - Is it the case that Certmap is not configured in SSSD? - - - - -Run the following command to determine if the httpd_can_sendmail SELinux boolean is disabled: -$ getsebool httpd_can_sendmail -If properly configured, the output should show the following: -httpd_can_sendmail --> off - Is it the case that httpd_can_sendmail is not disabled? - - - - To verify if the OpenSSH client uses defined Cipher suite in the Crypto Policy, run: -$ grep -i ciphers /etc/crypto-policies/back-ends/openssh.config -and verify that the line matches: -Ciphers - Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - - - To determine if the system is configured to audit calls to the -init_module system call, run the following command: -$ sudo grep "init_module" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -chown system call, run the following command: -$ sudo grep "chown" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nodev option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . nodev . . . - Is it the case that no line is returned? + Is it the case that the "/dev/shm" file system does not have the "nodev" option set? + + + + Only FIPS-approved MACs should be used. To verify that only FIPS-approved +MACs are in use, run the following command: +$ sudo grep -i macs /etc/ssh/sshd_config +The output should contain only those MACs which are FIPS-approved. Any use of other +ciphers or algorithms will result in the module entering the non-FIPS mode of +operation. + Is it the case that MACs option is commented out or not using FIPS-approved hash algorithms? @@ -378811,567 +378979,445 @@ If the service is running, it should return the following: active Is it the case that ? - - To check the ownership of /etc/ssh/*_key, + + To check the group ownership of /etc/crontab, run the command: -$ ls -lL /etc/ssh/*_key -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/crontab +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/ssh/*_key does not have an owner of root? - - - - Run the following command to determine the current status of the logrotate timer: $ sudo systemctl is-active logrotate.timer If the timer is running, it should return the following: active - Is it the case that logrotate timer is not enabled? - - - - -Run the following command to determine if the selinuxuser_direct_dri_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_direct_dri_enabled -If properly configured, the output should show the following: -selinuxuser_direct_dri_enabled --> off - Is it the case that selinuxuser_direct_dri_enabled is not disabled? - - - - -Run the following command to determine if the fenced_can_ssh SELinux boolean is disabled: -$ getsebool fenced_can_ssh -If properly configured, the output should show the following: -fenced_can_ssh --> off - Is it the case that fenced_can_ssh is not disabled? + Is it the case that /etc/crontab does not have a group owner of root? - + -Run the following command to determine if the gluster_export_all_ro SELinux boolean is disabled: -$ getsebool gluster_export_all_ro +Run the following command to determine if the rsync_export_all_ro SELinux boolean is disabled: +$ getsebool rsync_export_all_ro If properly configured, the output should show the following: -gluster_export_all_ro --> off - Is it the case that gluster_export_all_ro is not disabled? +rsync_export_all_ro --> off + Is it the case that rsync_export_all_ro is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BINFMT_MISC /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To ensure sshd limits the users who can log in, run the following: +pre>$ sudo grep -rPi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$' /etc/ssh/sshd_config* +If properly configured, the output should be a list of usernames and/or +groups allowed to log in to this system. + Is it the case that sshd does not limit the users who can log in? - - First, check whether the password is defined in either /boot/grub2/user.cfg or -/boot/grub2/grub.cfg. -Run the following commands: -$ sudo grep '^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$' /boot/grub2/user.cfg -$ sudo grep '^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$' /boot/grub2/grub.cfg - + + The file /etc/at.deny should not exist. +This can be checked by running the following -Second, check that a superuser is defined in /boot/grub2/grub.cfg. -$ sudo grep '^[\s]*set[\s]+superusers=("?)[a-zA-Z_]+\1$' /boot/grub2/grub.cfg - Is it the case that it does not produce any output? - - - - -Run the following command to determine if the httpd_use_fusefs SELinux boolean is disabled: -$ getsebool httpd_use_fusefs -If properly configured, the output should show the following: -httpd_use_fusefs --> off - Is it the case that httpd_use_fusefs is not disabled? - - - - -Run the following command to determine if the git_cgi_enable_homedirs SELinux boolean is disabled: -$ getsebool git_cgi_enable_homedirs -If properly configured, the output should show the following: -git_cgi_enable_homedirs --> off - Is it the case that git_cgi_enable_homedirs is not disabled? - - - - Run the following command to determine if the libreport-plugin-logger package is installed: -$ rpm -q libreport-plugin-logger - Is it the case that the package is installed? - - - - To check if authentication is required for emergency mode, run the following command: -$ grep sulogin /usr/lib/systemd/system/emergency.service -The output should be similar to the following, and the line must begin with -ExecStart and /usr/lib/systemd/systemd-sulogin-shell. - ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency +stat /etc/at.deny -Then, check if the emergency target requires the emergency service: -Run the following command: -$ sudo grep Requires /usr/lib/systemd/system/emergency.target -The output should be the following: -Requires=emergency.service +and the output should be -Then, check if there is no custom emergency target configured in systemd configuration. -Run the following command: -$ sudo grep -r emergency.target /etc/systemd/system/ -The output should be empty. +stat: cannot stat `/etc/at.deny': No such file or directory -Then, check if there is no custom emergency service configured in systemd configuration. -Run the following command: -$ sudo grep -r emergency.service /etc/systemd/system/ -The output should be empty. - Is it the case that the output is different? - - - - -Run the following command to determine if the selinuxuser_execheap SELinux boolean is disabled: -$ getsebool selinuxuser_execheap -If properly configured, the output should show the following: -selinuxuser_execheap --> off - Is it the case that selinuxuser_execheap is not disabled? + Is it the case that the file /etc/at.deny exists? - - Run the following command to check if the group exists: -grep /etc/group -The output should contain the following line: -:x: - Is it the case that group exists and has no user members? + + To verify that cryptography policy has been configured correctly, run the +following command: +$ update-crypto-policies --show +The output should return . +Run the command to check if the policy is correctly applied: +$ update-crypto-policies --is-applied +The output should be The configured policy is applied. +Moreover, check if settings for selected crypto policy are as expected. +List all libraries for which it holds that their crypto policies do not have symbolic link in /etc/crypto-policies/back-ends. +$ ls -l /etc/crypto-policies/back-ends/ | grep '^[^l]' | tail -n +2 | awk -F' ' '{print $NF}' | awk -F'.' '{print $1}' | sort +Subsequently, check if matching libraries have drop in files in the /etc/crypto-policies/local.d directory. +$ ls /etc/crypto-policies/local.d/ | awk -F'-' '{print $1}' | uniq | sort +Outputs of two previous commands should match. + Is it the case that cryptographic policy is not configured or is configured incorrectly? - - -Run the following command to determine if the authlogin_radius SELinux boolean is disabled: -$ getsebool authlogin_radius -If properly configured, the output should show the following: -authlogin_radius --> off - Is it the case that authlogin_radius is not disabled? + + Run the following command and verify remote server is configured properly: +# grep -E "^(server|pool)" /etc/chrony.conf + Is it the case that a remote time server is not configured? - - Verify the system commands contained in the following directories are owned by "root" with the following command: + + Verify that interactive users on the system have a home directory assigned with the following command: -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin ! -user root -exec ls -l {} \; - Is it the case that any system commands are found to not be owned by root? - - - - To verify if the OpenSSL uses defined Crypto Policy, run: -$ grep 'Ciphersuites' /etc/crypto-policies/back-ends/opensslcnf.config | tail -n 1 -and verify that the line matches -Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 - Is it the case that Crypto Policy for OpenSSL is not configured according to CC requirements? +$ sudo awk -F: '($3>=1000)&&($7 !~ /nologin/){print $1, $3, $6}' /etc/passwd + +Inspect the output and verify that all interactive users (normally users with a UID greater than 1000) have a home directory defined. + Is it the case that users home directory is not defined? - - Run the following command to determine open ports: -# ss -4tuln -Run the following command to determine firewall rules: -# iptables -L INPUT -v -n -For each port identified in the audit which does not have a firewall -rule, add rule for accepting or denying inbound connections -# iptables -A INPUT -p --dport -m state --state NEW -j ACCEPT - Is it the case that open ports are denied connection? + + To determine if the system is configured to audit calls to the +umount2 system call, run the following command: +$ sudo grep "umount2" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: + + To verify that null passwords cannot be used, run the following command: -$ sudo grep audit /etc/security/faillock.conf +$ grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth -audit - Is it the case that the "audit" option is not set, is missing or commented out? - - - - To determine if the system is configured to audit changes to its network configuration, -run the following command: -auditctl -l | grep -E '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)' -If the system is configured to watch for network configuration changes, a line should be returned for -each file specified (and perm=wa should be indicated for each). - Is it the case that the system is not configured to audit changes of the network configuration? - - - - To verify the sec option is configured for all NFS mounts, run the following command: -$ grep "sec=" /etc/exports -All configured NFS exports should show the sec=krb5:krb5i:krb5p setting in parentheses. -This is not applicable if NFS is not implemented. - Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? +If this produces any output, it may be possible to log into accounts +with empty passwords. Remove any instances of the nullok option to +prevent logins with empty passwords. + Is it the case that NULL passwords can be used? - - -Run the following command to determine if the glance_use_fusefs SELinux boolean is disabled: -$ getsebool glance_use_fusefs -If properly configured, the output should show the following: -glance_use_fusefs --> off - Is it the case that glance_use_fusefs is not disabled? + + To verify the operating system implements cryptography to protect the integrity of +remote ldap access sessions, run the following command: +$ sudo grep ldap_tls_cacertdir /etc/sssd/sssd.conf +The output should return the following with a correctly configured CA cert path: +ldap_tls_cacertdir /path/to/tls/cacert + Is it the case that the TLS CA cert is not configured? - - The rsh package can be removed with the following command: $ sudo yum erase rsh - Is it the case that ? + + To determine how the SSH daemon's PermitEmptyPasswords option is set, run the following command: + +$ sudo grep -i PermitEmptyPasswords /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to determine if the tmpreaper_use_nfs SELinux boolean is disabled: -$ getsebool tmpreaper_use_nfs +Run the following command to determine if the ftpd_use_cifs SELinux boolean is disabled: +$ getsebool ftpd_use_cifs If properly configured, the output should show the following: -tmpreaper_use_nfs --> off - Is it the case that tmpreaper_use_nfs is not disabled? +ftpd_use_cifs --> off + Is it the case that ftpd_use_cifs is not disabled? - - -Run the following command to determine if the postgresql_can_rsync SELinux boolean is disabled: -$ getsebool postgresql_can_rsync -If properly configured, the output should show the following: -postgresql_can_rsync --> off - Is it the case that postgresql_can_rsync is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to boot to the command line: +$ systemctl get-default +multi-user.target + Is it the case that the system default target is not set to "multi-user.target" and the Information System Security Officer (ISSO) lacks a documented requirement for a graphical user interface? - - To determine if the system is configured to audit successful calls -to the lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify the audispd plugin encrypts audit records off-loaded onto a different +system or media from the system being audited, run the following command: - Is it the case that no line is returned? - - - - Run the following command to determine if the libreport-plugin-rhtsupport package is installed: -$ rpm -q libreport-plugin-rhtsupport - Is it the case that the package is installed? +$ sudo grep -i transport /etc/audit/audisp-remote.conf +The output should return the following: +transport = KRB5 + Is it the case that audispd is not encrypting audit records when sent over the network? - - Inspect each <Directory> instance and verify that either -FollowSymLinks does not exist, or -Options SymLinksIfOwnerMatchDisable is configured properly. - Is it the case that it is not? + + Verify the nodev option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . nodev . . . + + Is it the case that the "/home" file system does not have the "nodev" option set? - - The runtime status of the net.ipv4.conf.default.rp_filter kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.rp_filter -1. + + Verify the system-wide shared library files are group-owned by "root" with the following command: - Is it the case that the correct value is not returned? +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -group root -exec ls -l {} \; + Is it the case that any system wide shared library file is returned and is not group-owned by a required system account? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42.rules -The output has to be exactly as follows: -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## the following rule files copied to /etc/audit/rules.d: -## -## 10-base-config.rules, 11-loginuid.rules, -## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, -## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, -## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, -## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, -## 30-ospp-v42-5-perm-change-failed.rules, -## 30-ospp-v42-5-perm-change-success.rules, -## 30-ospp-v42-6-owner-change-failed.rules, -## 30-ospp-v42-6-owner-change-success.rules -## -## original copies may be found in /usr/share/audit/sample-rules/ - - -## User add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch passwd and -## shadow for writes --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - -## User enable and disable. This is entirely handled by pam. - -## Group add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch group and -## gshadow for writes --a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify --a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify - - -## Use of special rights for config changes. This would be use of setuid -## programs that relate to user accts. This is not all setuid apps because -## requirements are only for ones that affect system configuration. --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group" with the following command: -## Privilege escalation via su or sudo. This is entirely handled by pam. +$ sudo auditctl -l | grep -E '(/etc/group)' -## Watch for configuration changes to privilege escalation. --a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes --a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes +-w /etc/group -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open system call. -## Audit log access --a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail -## Attempts to Alter Process and Session Initiation Information --a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -## Attempts to modify MAC controls --a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy +$ sudo grep -r open /etc/audit/rules.d -## Software updates. This is entirely handled by rpm. +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -## System start and shutdown. This is entirely handled by systemd +$ sudo grep open /etc/audit/audit.rules -## Kernel Module loading. This is handled in 43-module-load.rules +The output should be the following: -## Application invocation. The requirements list an optional requirement -## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to -## state results from that policy. This would be handled entirely by -## that daemon. - Is it the case that the file does not exist or the content differs? +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - - The file /etc/cron.deny should not exist. -This can be checked by runnig the following + + To check that the screen locks immediately when activated, run the following command: +$ gsettings get org.gnome.desktop.screensaver lock-delay +If properly configured, the output should be 'uint32 '. + Is it the case that the screensaver lock delay is missing, or is set to a value greater than <sub idref="var_screensaver_lock_delay" />? + + + + To check the group ownership of /boot/grub2/user.cfg, +run the command: +$ ls -lL /boot/grub2/user.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/grub2/user.cfg does not have a group owner of root? + + + + To check that the oddjobd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled oddjobd +Output should indicate the oddjobd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled oddjobd disabled -stat /etc/cron.deny +Run the following command to verify oddjobd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active oddjobd -and the output should be +If the service is not running the command will return the following output: +inactive -stat: cannot stat `/etc/cron.deny': No such file or directory +The service will also be masked, to check that the oddjobd is masked, run the following command: +$ sudo systemctl show oddjobd | grep "LoadState\|UnitFileState" - Is it the case that the file /etc/cron.deny exists? - - - - To determine if the system is configured to audit calls to the -mount system call, run the following command: -$ sudo grep "mount" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. +If the service is masked the command will return the following outputs: - Is it the case that no line is returned? +LoadState=masked + +UnitFileState=masked + Is it the case that the "oddjobd" is loaded and not masked? - - Run the following command to determine if the audit package is installed: $ rpm -q audit - Is it the case that the audit package is not installed? + + Run the following command to determine if the openldap-clients package is installed: +$ rpm -q openldap-clients + Is it the case that the package is installed? - - To verify that no .java and .jpp files exist, run the -following command: -find / -name *.java -o -name *.jpp -The output should not return any .java or .jpp files - Is it the case that it is not? + + +Run the following command to determine if the lsmd_plugin_connect_any SELinux boolean is disabled: +$ getsebool lsmd_plugin_connect_any +If properly configured, the output should show the following: +lsmd_plugin_connect_any --> off + Is it the case that lsmd_plugin_connect_any is not disabled? - + -Run the following command to determine if the xserver_execmem SELinux boolean is disabled: -$ getsebool xserver_execmem +Run the following command to determine if the httpd_unified SELinux boolean is disabled: +$ getsebool httpd_unified If properly configured, the output should show the following: -xserver_execmem --> off - Is it the case that xserver_execmem is not disabled? +httpd_unified --> off + Is it the case that httpd_unified is not disabled? - - To verify that auditing of privileged command use is configured, run the following command -to search privileged commands in relevant partitions and check if they are covered by auditd -rules: + + Verify Red Hat Enterprise Linux 8 audits execution as another user. -FILTER_NODEV=$(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -PARTITIONS=$(findmnt -n -l -k -it $FILTER_NODEV | grep -Pv "noexec|nosuid" | awk '{ print $1 }') -for PARTITION in $PARTITIONS; do - for PRIV_CMD in $(find "${PARTITION}" -xdev -perm /6000 -type f 2>/dev/null); do - grep -qr "${PRIV_CMD}" /etc/audit/rules.d /etc/audit/audit.rules && - printf "OK: ${PRIV_CMD}\n" || printf "WARNING - rule not found for: ${PRIV_CMD}\n" - done -done +Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: -The output should not contain any WARNING. - Is it the case that any setuid or setgid programs doesn't have a line in the audit rules? +$ sudo grep execve /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation +-a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset-k user_emulation + Is it the case that the command does not return all lines, or the lines are commented out? - + + Verify that only the "root" account has a UID "0" assignment with the +following command: +$ awk -F: '$3 == 0 {print $1}' /etc/passwd +root + Is it the case that any accounts other than "root" have a UID of "0"? + + + -To ensure the login warning banner text is properly set, run the following: -$ grep banner-message-text /etc/dconf/db/gdm.d/* -If properly configured, the proper banner text will appear. -To ensure the login warning banner text is locked and cannot be changed by a user, run the following: -$ grep banner-message-text /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/banner-message-text. - Is it the case that it does not? +Run the following command to determine if the polipo_connect_all_unreserved SELinux boolean is disabled: +$ getsebool polipo_connect_all_unreserved +If properly configured, the output should show the following: +polipo_connect_all_unreserved --> off + Is it the case that polipo_connect_all_unreserved is not disabled? - - Verify the noexec option is configured for the /tmp mount point, + + To check the system for the existence of any .forward files, +run the following command: +$ sudo find /home -xdev -name .forward + Is it the case that any .forward files exist? + + + + Verify the usrquota option is configured for the /home mount point, run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . noexec . . . + $ sudo mount | grep '\s/home\s' + . . . /home . . . usrquota . . . - Is it the case that the "/tmp" file system does not have the "noexec" option set? + Is it the case that the "/home" file system does not have the "usrquota" option set? - + +Run the following command to determine if the mozilla_plugin_bind_unreserved_ports SELinux boolean is disabled: +$ getsebool mozilla_plugin_bind_unreserved_ports +If properly configured, the output should show the following: +mozilla_plugin_bind_unreserved_ports --> off + Is it the case that mozilla_plugin_bind_unreserved_ports is not disabled? + + + + Storing logs with persistent storage ensures they are available after a reboot or system crash. +Run the command below to verify that logs are being persistently stored to disk. +grep "^\sStorage" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf -To determine if firewalld is configured to allow access - -on port 22/tcp, run the following command(s): - firewall-cmd --list-ports - - -to ssh - firewall-cmd --list-services - -If firewalld is configured to allow access through the firewall, something similar to the following will be output: - -If it is a service: -ssh +and it should return -If it is a port: -22/tcp +Storage=persistent - Is it the case that sshd service is not enabled in the proper firewalld zone? + Is it the case that is commented out or not configured correctly? - - -Run the following command to determine if the swift_can_network SELinux boolean is disabled: -$ getsebool swift_can_network -If properly configured, the output should show the following: -swift_can_network --> off - Is it the case that swift_can_network is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to prevent unrestricted mail relaying, +run the following command: +$ sudo postconf -n smtpd_client_restrictions + Is it the case that the "smtpd_client_restrictions" parameter contains any entries other than "permit_mynetworks" and "reject"? - - Verify that local initialization files do not execute world-writable programs with the following command: - -Note: The example will be for a system that is configured to create user home directories in the "/home" directory. - -$ sudo find /home -perm -002 -type f -name ".[^.]*" -exec ls -ld {} \; - Is it the case that any local initialization files are found to reference world-writable files? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEFAULT_MMAP_MIN_ADDR /boot/config.* + + For each kernel installed, a line with value "65536" should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify if LogLevel is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i loglevel /etc/httpd/conf/httpd.conf -The command should return the following: -LogLevel warn - Is it the case that it is not? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudo" command with the following command: + +$ sudo auditctl -l | grep sudo + +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudo + Is it the case that the command does not return a line, or the line is commented out? - - To verify the openldap-servers package is not installed, run the -following command: -$ rpm -q openldap-servers -The output should show the following: -package openldap-servers is not installed - Is it the case that it does not? + + To check the group ownership of /etc/issue.net, +run the command: +$ ls -lL /etc/issue.net +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/issue.net does not have a group owner of root? - - To check that SELinux is not disabled at boot time; -Check that no boot entry disables selinux: -sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that disables SELinux. - Is it the case that SELinux is disabled at boot time? + + To check the group ownership of /etc/at.allow, +run the command: +$ ls -lL /etc/at.allow +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/at.allow does not have a group owner of root? - - To determine if the system is configured to audit unsuccessful calls -to the fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit.* + + To determine if the system is configured to audit calls to the +fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + Run the following command to determine the current status of the -chronyd service: -$ sudo systemctl is-active chronyd -If the service is running, it should return the following: active - - -Run the following command to determine the current status of the -ntpd service: -$ sudo systemctl is-active ntpd +postfix service: +$ sudo systemctl is-active postfix If the service is running, it should return the following: active - Is it the case that ? + Is it the case that the system is not a cross domain solution and the service is not enabled? - - In order to be sure that the databases are up-to-date, run the -dconf update -command as the administrator. - Is it the case that The system-wide dconf databases are up-to-date with regards to respective keyfiles? + + +Run the following command to determine if the entropyd_use_audio SELinux boolean is disabled: +$ getsebool entropyd_use_audio +If properly configured, the output should show the following: +entropyd_use_audio --> off + Is it the case that entropyd_use_audio is not disabled? - - The runtime status of the net.ipv6.conf.default.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_redirects -0. + + Verify Red Hat Enterprise Linux 8 removes all software components after updated versions have been installed. - Is it the case that the correct value is not returned? + +$ grep clean_requirements_on_remove /etc/yum.conf +clean_requirements_on_remove=1 + Is it the case that '"clean_requirements_on_remove" is not set to "1"'? - - -Run the following command to determine if the httpd_builtin_scripting SELinux boolean is disabled: -$ getsebool httpd_builtin_scripting -If properly configured, the output should show the following: -httpd_builtin_scripting --> off - Is it the case that httpd_builtin_scripting is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "kmod" command with the following command: + +$ sudo auditctl -l | grep kmod + +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-kmod + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the ownership of /var/log/syslog, +run the command: +$ ls -lL /var/log/syslog +If properly configured, the output should indicate the following owner: +syslog + Is it the case that /var/log/syslog does not have an owner of syslog? - - To determine if the system is configured to audit unsuccessful calls -to the lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit.* + + To determine if the system is configured to audit calls to the +chown system call, run the following command: +$ sudo grep "chown" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? + + + + To check the ownership of /etc/shells, +run the command: +$ ls -lL /etc/shells +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/shells does not have an owner of root? + + + + The runtime status of the net.ipv6.conf.all.forwarding kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.forwarding +0. +The ability to forward packets is only appropriate for routers. + Is it the case that IP forwarding value is "1" and the system is not router? @@ -379383,287 +379429,665 @@ BrowseAllow none Is it the case that printer browsing is not disabled? - - The runtime status of the net.ipv4.tcp_rfc1337 kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.tcp_rfc1337 -1. + + To ensure the screensaver is configured to be blank, run the following command: +$ gsettings get org.gnome.desktop.screensaver picture-uri +If properly configured, the output should be ''. - Is it the case that the correct value is not returned? +To ensure that users cannot set the screensaver background, run the following: +$ grep picture-uri /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/picture-uri + Is it the case that it is not set or configured properly? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes audit=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*audit=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'audit=1' -The command should not return any output. - Is it the case that auditing is not enabled at boot time? + + +Run the following command to determine if the webadm_manage_user_files SELinux boolean is disabled: +$ getsebool webadm_manage_user_files +If properly configured, the output should show the following: +webadm_manage_user_files --> off + Is it the case that webadm_manage_user_files is not disabled? - - The runtime status of the fs.suid_dumpable kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.log_martians kernel parameter can be queried by running the following command: -$ sysctl fs.suid_dumpable -0. +$ sysctl net.ipv4.conf.all.log_martians +1. Is it the case that the correct value is not returned? - - The runtime status of the net.ipv4.conf.all.route_localnet kernel parameter can be queried + + The runtime status of the net.ipv4.conf.default.shared_media kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.route_localnet +$ sysctl net.ipv4.conf.default.shared_media 0. Is it the case that the correct value is not returned? - - The runtime status of the net.ipv6.conf.all.max_addresses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.max_addresses -1. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the mpd_use_cifs SELinux boolean is disabled: +$ getsebool mpd_use_cifs +If properly configured, the output should show the following: +mpd_use_cifs --> off + Is it the case that mpd_use_cifs is not disabled? - - The runtime status of the net.ipv4.conf.all.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_redirects -0. - - Is it the case that the correct value is not returned? + + Make sure that /boot/bootmap is newer than /boot/loader/entries/*.conf +and /etc/zipl.conf: +find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap +No line should be returned, if a line is returned /boot/bootmap is outdated and needs to be regenerated. + Is it the case that the bootmap is outdated? - - Run the following command to determine if the fapolicyd package is installed: $ rpm -q fapolicyd - Is it the case that the fapolicyd package is not installed? + + Run the following command to determine if the geolite2-city package is installed: +$ rpm -q geolite2-city + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: - -$ sudo grep disk_error_action /etc/audit/auditd.conf - -disk_error_action = - -If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. - Is it the case that there is no evidence of appropriate action? + + For each private key stored on the system, use the following command: +$ sudo ssh-keygen -y -f /path/to/file +If the contents of the key are displayed, this is a finding. + Is it the case that no ssh private key is accessible without a passcode? - - Verify that rules for unsuccessful calls of the open syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + +Run the following command to determine if the sanlock_use_samba SELinux boolean is disabled: +$ getsebool sanlock_use_samba +If properly configured, the output should show the following: +sanlock_use_samba --> off + Is it the case that sanlock_use_samba is not disabled? + + + + +Run the following command to determine if the httpd_can_check_spam SELinux boolean is disabled: +$ getsebool httpd_can_check_spam +If properly configured, the output should show the following: +httpd_can_check_spam --> off + Is it the case that httpd_can_check_spam is not disabled? + + + + +If the system is configured to prevent the loading of the iwlmvm kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - If the system is 64 bit then also add the following lines: +These lines can also instruct the module loading system to ignore the iwlmvm kernel module via blacklist keyword. - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r iwlmvm /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - To determine if the system is configured to audit unsuccessful calls -to the fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify the sec option is configured for all NFS mounts, run the following command: +$ mount | grep "sec=" +All NFS mounts should show the sec=krb5:krb5i:krb5p setting in parentheses. +This is not applicable if NFS is not implemented. + Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? + + + + To ensure the failed password attempt policy is configured correctly, run the following command: - Is it the case that no line is returned? +$ grep fail_interval /etc/security/faillock.conf +The output should show fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. + Is it the case that the "fail_interval" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_fail_interval" />" +or less (but not "0"), the line is commented out, or the line is missing? - - Inspect the password section of /etc/pam.d/password-auth -and ensure that the pam_unix.so module includes the argument -sha512: -$ grep sha512 /etc/pam.d/password-auth - Is it the case that it does not? + + Verify the umask setting is configured correctly in the /etc/bashrc file with the following command: + +$ sudo grep "umask" /etc/bashrc + +umask + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? - + -Run the following command to determine if the glance_api_can_network SELinux boolean is disabled: -$ getsebool glance_api_can_network +Run the following command to determine if the abrt_handle_event SELinux boolean is disabled: +$ getsebool abrt_handle_event If properly configured, the output should show the following: -glance_api_can_network --> off - Is it the case that glance_api_can_network is not disabled? +abrt_handle_event --> off + Is it the case that abrt_handle_event is not disabled? - + -Run the following command to determine if the varnishd_connect_any SELinux boolean is disabled: -$ getsebool varnishd_connect_any +Run the following command to determine if the selinuxuser_tcp_server SELinux boolean is disabled: +$ getsebool selinuxuser_tcp_server If properly configured, the output should show the following: -varnishd_connect_any --> off - Is it the case that varnishd_connect_any is not disabled? +selinuxuser_tcp_server --> off + Is it the case that selinuxuser_tcp_server is not disabled? - - - -Run the following command to determine the current status of the -crond service: -$ sudo systemctl is-active crond -If the service is running, it should return the following: active - Is it the case that ? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_KEY /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check the permissions of /var/log/syslog, -run the command: -$ ls -l /var/log/syslog -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /var/log/syslog does not have unix mode -rw-r-----? + + Run the following command to determine if the libselinux package is installed: $ rpm -q libselinux + Is it the case that the package is not installed? - - Verify the operating system routinely checks the baseline configuration for unauthorized changes. + + System executables are stored in the following directories by default: +/bin +/sbin +/usr/bin +/usr/local/bin +/usr/local/sbin +/usr/sbin +For each of these directories, run the following command to find files +not owned by root: +$ sudo find -L DIR/ ! -user root -type d -exec chown root {} \; + Is it the case that any system executables directories are found to not be owned by root? + + + + To verify all files and directories in a local interactive user's +home directory have a valid owner, run the following command: +$ sudo ls -lLR /home/USER + Is it the case that the user ownership is incorrect? + + + + To check that the sshd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled sshd +Output should indicate the sshd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled sshd disabled -To determine that periodic AIDE execution has been scheduled, run the following command: -$ grep aide /etc/crontab -The output should return something similar to the following: -05 4 * * * root /usr/sbin/aide --check +Run the following command to verify sshd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active sshd -NOTE: The usage of special cron times, such as @daily or @weekly, is acceptable. - Is it the case that AIDE is not configured to scan periodically? +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the sshd is masked, run the following command: +$ sudo systemctl show sshd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "sshd" is loaded and not masked? - - To check the group ownership of /etc/cron.weekly, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes iommu=force, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*iommu=force.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*iommu=force.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'iommu=force' +The command should not return any output. + Is it the case that I/OMMU is not activated? + + + + To determine if the system is configured to audit successful calls +to the rename system call, run the following command: +$ sudo grep "rename" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + +Run the following command to determine if the daemons_use_tty SELinux boolean is disabled: +$ getsebool daemons_use_tty +If properly configured, the output should show the following: +daemons_use_tty --> off + Is it the case that daemons_use_tty is not disabled? + + + + Run the following command to determine if the geolite2-country package is installed: +$ rpm -q geolite2-country + Is it the case that the package is installed? + + + + Check the root home directory for a .mozilla directory. If +one exists, ensure browsing is limited to local service administration. + Is it the case that this is not the case? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STACKPROTECTOR_STRONG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the group ownership of /etc/shadow, run the command: -$ ls -lL /etc/cron.weekly +$ ls -lL /etc/shadow If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/cron.weekly does not have a group owner of root? + Is it the case that /etc/shadow does not have a group owner of root? - - Run the following command to determine if the tftp-server package is installed: -$ rpm -q tftp-server + + Run the following command to determine if the abrt-plugin-sosreport package is installed: +$ rpm -q abrt-plugin-sosreport Is it the case that the package is installed? - - To verify if CustomLog is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i customlog /etc/httpd/conf/httpd.conf -The output should return the following: -CustomLog "logs/access_log" combined - Is it the case that it is not? + + To verify if the OpenSSH Client uses defined Crypto Policy, run: +$ cat /etc/ssh/ssh_config.d/02-ospp.conf +and verify that the line matches +Match final all +RekeyLimit 512M 1h +GSSAPIAuthentication no +Ciphers aes256-ctr,aes256-cbc,aes128-ctr,aes128-cbc +PubkeyAcceptedKeyTypes ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 +MACs hmac-sha2-512,hmac-sha2-256 +KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 + Is it the case that Crypto Policy for OpenSSH Client is not configured according to CC requirements? - - To check that the slapd service is disabled in system boot configuration, + + To determine if the system is configured to audit changes to its SELinux +configuration files, run the following command: +$ sudo auditctl -l | grep "dir=/usr/share/selinux" +If the system is configured to watch for changes to its SELinux +configuration, a line should be returned (including +perm=wa indicating permissions that are watched). + Is it the case that the system is not configured to audit attempts to change the MAC policy? + + + + The runtime status of the net.ipv4.conf.default.secure_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.secure_redirects +0. + + Is it the case that the correct value is not returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_GCC_PLUGIN_LATENT_ENTROPY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + +Run the following command to determine if the ksmtuned_use_nfs SELinux boolean is disabled: +$ getsebool ksmtuned_use_nfs +If properly configured, the output should show the following: +ksmtuned_use_nfs --> off + Is it the case that ksmtuned_use_nfs is not disabled? + + + + To check the current idle time-out value, run the following command: +$ gsettings get org.gnome.desktop.session idle-delay +If properly configured, the output should be 'uint32 '. +To ensure that users cannot change the screensaver inactivity timeout setting, run the following: +$ grep idle-delay /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/session/idle-delay + Is it the case that idle-delay is set to 0 or a value greater than <sub idref="inactivity_timeout_value" />? + + + + To ensure logs are sent to a remote host, examine the file +/etc/rsyslog.conf. +If using UDP, a line similar to the following should be present: + *.* @ +If using TCP, a line similar to the following should be present: + *.* @@ +If using RELP, a line similar to the following should be present: + *.* :omrelp: + Is it the case that no evidence that the audit logs are being off-loaded to another system or media? + + + + +Run the following command to determine if the httpd_enable_cgi SELinux boolean is disabled: +$ getsebool httpd_enable_cgi +If properly configured, the output should show the following: +httpd_enable_cgi --> off + Is it the case that httpd_enable_cgi is not disabled? + + + + To check the system for the existence of any .netrc files, run the following command: -$ sudo systemctl is-enabled slapd -Output should indicate the slapd service has either not been installed, +$ sudo find /home -xdev -name .netrc + Is it the case that any .netrc files exist? + + + + To check that the tftp service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled tftp +Output should indicate the tftp service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled slapd disabled +$ sudo systemctl is-enabled tftp disabled -Run the following command to verify slapd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active slapd +Run the following command to verify tftp is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active tftp If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the slapd is masked, run the following command: -$ sudo systemctl show slapd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the tftp is masked, run the following command: +$ sudo systemctl show tftp | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "slapd" is loaded and not masked? + Is it the case that the "tftp" is loaded and not masked? - + + Inspect /etc/audit/audisp-remote.conf and locate the following line to +determine if the system is configured to perform a correct action according to the policy: +$ sudo grep -i network_failure_action /etc/audit/audisp-remote.conf +The output should return: +network_failure_action = + Is it the case that the system is not configured to switch to single user mode for corrective action? + + + + Verify the operating system is not configured to bypass password requirements for privilege +escalation. Check the configuration of the "/etc/pam.d/sudo" file with the following command: +$ sudo grep pam_succeed_if /etc/pam.d/sudo + Is it the case that system is configured to bypass password requirements for privilege escalation? + + + + Review the web site to determine if HTTP and HTTPs are used in accordance with +well known ports (e.g., 80 and 443) or those ports and services as registered +and approved for use by the DoD PPSM. + +To configure firewalld to allow http access, run the following command(s): +firewall-cmd --permanent --add-service=http +Then run the following command to load the newly created rule(s): +firewall-cmd --reload + +To configure firewalld to allow https access, run the following command(s): +firewall-cmd --permanent --add-service=https +Then run the following command to load the newly created rule(s): +firewall-cmd --reload + Is it the case that it is not? + + + +Run the following command to determine if the virt_use_sanlock SELinux boolean is disabled: +$ getsebool virt_use_sanlock +If properly configured, the output should show the following: +virt_use_sanlock --> off + Is it the case that virt_use_sanlock is not disabled? + + + + Run the following command to check if the line is present: +grep pam_wheel /etc/pam.d/su +The output should contain the following line: +auth required pam_wheel.so use_uid group= + Is it the case that the line is not in the file or it is commented? + + + + To ensure all GIDs referenced in /etc/passwd are defined in /etc/group, +run the following command: +$ sudo pwck -qr +There should be no output. + Is it the case that GIDs referenced in /etc/passwd are returned as not defined in /etc/group? + + + + Verify the audit tools are group-owned by "root" to prevent any unauthorized access, deletion, or modification. -Run the following command to determine the current status of the -auditd service: -$ sudo systemctl is-active auditd -If the service is running, it should return the following: active - Is it the case that the auditd service is not running? +Check the group-owner of each audit tool by running the following command: + +$ sudo stat -c "%G %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + +root /sbin/auditctl +root /sbin/aureport +root /sbin/ausearch +root /sbin/autrace +root /sbin/auditd +root /sbin/rsyslogd +root /sbin/augenrules + Is it the case that any audit tools are not group-owned by root? - - Verify file systems that are used for removable media are mounted with the "nosuid" option with the following command: + + To verify that repo_gpgcheck is configured properly, run the following +command: +$ grep repo_gpgcheck /etc/yum.conf +The output should return something similar to: +repo_gpgcheck=1 + Is it the case that gpgcheck is not enabled or configured correctly to verify repository metadata? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open system call with O_CREAT flag. -$ sudo more /etc/fstab +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: -UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 - Is it the case that file system found in "/etc/fstab" refers to removable media and it does not have the "nosuid" option set? +$ sudo grep -r open /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - + + The runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_pinfo +0. + + Is it the case that the correct value is not returned? + + + -If the system is configured to prevent the loading of the iwlmvm kernel module, +If the system is configured to prevent the loading of the sctp kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the iwlmvm kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the sctp kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r iwlmvm /etc/modprobe.conf /etc/modprobe.d +$ grep -r sctp /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Enter the following commands: - -grep Action /etc/httpd/conf/httpd.conf -grep AddHandler /etc/httpd/conf/httpd.conf - Is it the case that either of these exist and they configure csh, or any other shell as a viewer for documents? + + Run the following command to determine if the iprutils package is installed: +$ rpm -q iprutils + Is it the case that the package is installed? - - Verify that the default umask for all local interactive users is "077". - -Identify the locations of all local interactive user home directories by looking at the "/etc/passwd" file. - -Check all local interactive user initialization files for interactive users with the following command: - -Note: The example is for a system that is configured to create users home directories in the "/home" directory. + + Run the following command to ensure the default FORWARD policy is DROP: +grep ":FORWARD" /etc/sysconfig/iptables +The output should be similar to the following: +$ sudo grep ":FORWARD" /etc/sysconfig/iptables +:FORWARD DROP [0:0 + Is it the case that the default policy for the FORWARD chain is not set to DROP? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "init" command with the following command: -# grep -ri umask /home/ +$ sudo auditctl -l | grep init -/home/smithj/.bash_history:grep -i umask /etc/bashrc /etc/csh.cshrc /etc/profile -/home/smithj/.bash_history:grep -i umask /etc/login.defs - Is it the case that any local interactive user initialization files are found to have a umask statement that sets a value less restrictive than "077"? +-a always,exit -F path=/init -F perm=x -F auid>=1000 -F auid!=unset -k privileged-init + Is it the case that the command does not return a line, or the line is commented out? - + + Run the following command to determine if the cron package is installed: +$ rpm -q cron + Is it the case that the package is installed? + + + + To check for legacy lines in /etc/shadow, run the following command: + grep '^\+' /etc/shadow +The command should not return any output. + Is it the case that the file contains legacy lines? + + + + +Run the following command to determine if the nfs_export_all_ro SELinux boolean is enabled: +$ getsebool nfs_export_all_ro +If properly configured, the output should show the following: +nfs_export_all_ro --> on + Is it the case that nfs_export_all_ro is not enabled? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + To determine if the system is configured to audit successful calls -to the unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit.* +to the truncate system call, run the following command: +$ sudo grep "truncate" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? + + + + To ensure the system is configured to ignore the Ctrl-Alt-Del sequence, +run the following command: +$ gsettings get org.gnome.settings-daemon.plugins.media-keys logout +$ grep logout /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/settings-daemon/plugins/media-keys/logout + Is it the case that GNOME3 is configured to reboot when Ctrl-Alt-Del is pressed? + + + + Run the following command to determine if the vsftpd package is installed: +$ rpm -q vsftpd + Is it the case that the package is installed? + + + + To verify that acquiring, saving, and processing core dumps is disabled, run the +following command: +$ systemctl status systemd-coredump.socket +The output should be similar to: +● systemd-coredump.socket + Loaded: masked (Reason: Unit systemd-coredump.socket is masked.) + Active: inactive (dead) ... + + Is it the case that unit systemd-coredump.socket is not masked or running? + + + + To verify that rsyslog's Forwarding Output Module is configured +to use TLS for logging to remote server, run the following command: +$ grep omfwd /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should include record similar to +action(type="omfwd" protocol="tcp" Target="<remote system>" port="6514" + StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name" streamdriver.CheckExtendedKeyPurpose="on") + +where the <remote system> present in the configuration line above must be a valid IP address or a host name of the remote logging server. + Is it the case that omfwd is not configured with gtls and AuthMode? + + + + +Run the following command to determine if the httpd_manage_ipa SELinux boolean is disabled: +$ getsebool httpd_manage_ipa +If properly configured, the output should show the following: +httpd_manage_ipa --> off + Is it the case that httpd_manage_ipa is not disabled? + + + + To check the group ownership of /var/log/syslog, +run the command: +$ ls -lL /var/log/syslog +If properly configured, the output should indicate the following group-owner: +adm + Is it the case that /var/log/syslog does not have a group owner of adm? + + + + +Run the following command to determine if the gpg_web_anon_write SELinux boolean is disabled: +$ getsebool gpg_web_anon_write +If properly configured, the output should show the following: +gpg_web_anon_write --> off + Is it the case that gpg_web_anon_write is not disabled? + + + + +Run the following command to determine if the fcron_crond SELinux boolean is disabled: +$ getsebool fcron_crond +If properly configured, the output should show the following: +fcron_crond --> off + Is it the case that fcron_crond is not disabled? + + + + Run the following command to ensure postfix routes mail to this system: +$ grep relayhost /etc/postfix/main.cf +If properly configured, the output should show only . + Is it the case that it is not? @@ -379674,361 +380098,415 @@ export SSH_USE_STRONG_RNG=32 Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - To determine if the system is configured to audit successful calls -to the chown system call, run the following command: -$ sudo grep "chown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the ownership of /etc/cron.daily, +run the command: +$ ls -lL /etc/cron.daily +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.daily does not have an owner of root? - - -To properly set the group owner of /etc/audit/, run the command: -$ sudo chgrp root /etc/audit/ + + To determine how the SSH daemon's X11UseLocalhost option is set, run the following command: -To properly set the group owner of /etc/audit/rules.d/, run the command: -$ sudo chgrp root /etc/audit/rules.d/ - Is it the case that ? +$ sudo grep -i X11UseLocalhost /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + Is it the case that the display proxy is listening on wildcard address? - - To ensure LDAP is configured to use TLS for all transactions, run the following command: -$ grep start_tls /etc/pam_ldap.conf -The result should contain: -ssl start_tls - Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + To determine if umask has been configured for sudo with the appropriate value, +run the following command: +$ sudo grep -ri '^Defaults.*umask=' /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that umask is not set with the appropriate value for sudo? - - The runtime status of the vm.mmap_min_addr kernel parameter can be queried -by running the following command: -$ sysctl vm.mmap_min_addr -65536. + + - Is it the case that the correct value is not returned? +Run the following command to determine the current status of the +fapolicyd service: +$ sudo systemctl is-active fapolicyd +If the service is running, it should return the following: active + Is it the case that the service is not enabled? - - Run the following command to determine if the rsh-server package is installed: -$ rpm -q rsh-server - Is it the case that the package is installed? + + Check that the symlink exists and target the correct Kerberos crypto policy, with the following command: +file /etc/krb5.conf.d/crypto-policies +If command ouput shows the following line, Kerberos is configured to use the system-wide crypto policy. +/etc/krb5.conf.d/crypto-policies: symbolic link to /etc/crypto-policies/back-ends/krb5.config + Is it the case that the symlink does not exist or points to a different target? - - To check the group ownership of /etc/gshadow-, -run the command: -$ ls -lL /etc/gshadow- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/gshadow- does not have a group owner of root? + + To verify the assigned home directory of all interactive users is group- +owned by that users primary GID, run the following command: +# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) + Is it the case that the group ownership is incorrect? - - To check the group ownership of /etc/crontab, -run the command: -$ ls -lL /etc/crontab -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/crontab does not have a group owner of root? + + Run the following command to determine if the gssproxy package is installed: +$ rpm -q gssproxy + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 is configured to limit the "pwquality" retry option to . - + + Run the following command to determine if the sendmail package is installed: +$ rpm -q sendmail + Is it the case that the package is installed? + + + + The runtime status of the kernel.perf_cpu_time_max_percent kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_cpu_time_max_percent +1. -Check for the use of the "pwquality" retry option in the pwquality.conf file with the following command: -$ grep retry /etc/security/pwquality.conf - Is it the case that the value of "retry" is set to "0" or greater than "<sub idref="var_password_pam_retry" />", or is missing? + Is it the case that the correct value is not returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HIBERNATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit successful calls +to the fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEFAULT_MMAP_MIN_ADDR /boot/config.* - - For each kernel installed, a line with value "65536" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/ssh/sshd_config, +run the command: +$ ls -lL /etc/ssh/sshd_config +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/ssh/sshd_config does not have an owner of root? - - Verify the nodev option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . nodev . . . - - Is it the case that the "/boot" file system does not have the "nodev" option set? + + To check if pam_pwquality.so is enabled in system-auth, run the following command: +$ grep pam_pwquality /etc/pam.d/system-auth +The output should be similar to the following: +password requisite pam_pwquality.so + Is it the case that pam_pwquality.so is not enabled in system-auth? - + -Run the following command to determine if the rsync_anon_write SELinux boolean is disabled: -$ getsebool rsync_anon_write -If properly configured, the output should show the following: -rsync_anon_write --> off - Is it the case that rsync_anon_write is not disabled? +If the system is configured to prevent the loading of the atm kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the atm kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r atm /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_chkpwd" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setsebool" command with the following command: -$ sudo auditctl -l | grep unix_chkpwd +$ sudo auditctl -l | grep setsebool --a always,exit -F path=/usr/bin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_chkpwd +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -k privileged Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the staff_exec_content SELinux boolean is enabled: -$ getsebool staff_exec_content +Run the following command to determine if the sge_domain_can_network_connect SELinux boolean is disabled: +$ getsebool sge_domain_can_network_connect If properly configured, the output should show the following: -staff_exec_content --> on - Is it the case that staff_exec_content is not enabled? - - - - To ensure that wireless network notification is disabled, run the following command: -$ gsettings get org.gnome.nm-applet suppress-wireless-networks-available -If properly configured, the output should be true. -To ensure that users cannot enable wireless notification, run the following: -$ grep wireless-networks-available /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/nm-applet/suppress-wireless-networks-available - Is it the case that wireless network notification is enabled and not disabled? +sge_domain_can_network_connect --> off + Is it the case that sge_domain_can_network_connect is not disabled? - - Verify the NX (no-execution) bit flag is set on the system. - -Check that the no-execution bit flag is set with the following commands: + + To verify the password reuse setting is compliant, run the following command: +$ grep remember /etc/pam.d/system-auth +The output should show the following at the end of the line: +remember= -$ sudo dmesg | grep NX -[ 0.000000] NX (Execute Disable) protection: active +In newer systems, the pam_pwhistory PAM module options can also be set in +"/etc/security/pwhistory.conf" file. Use the following command to verify: +$ grep remember /etc/security/pwhistory.conf +remember = -If "dmesg" does not show "NX (Execute Disable) protection" active, check the cpuinfo settings with the following command: +The pam_pwhistory remember option must be configured only in one file. + Is it the case that the value of remember is not equal to or greater than the expected value? + + + + To verify that a remote NTP service is configured for time synchronization, +open the following file: -$ sudo grep flags /proc/cpuinfo -flags : fpu vme de pse tsc ms nx rdtscp lm constant_ts +/etc/chrony.conf in the case the system in question is +configured to use the chronyd as the NTP daemon (default setting) +/etc/ntp.conf in the case the system in question is configured +to use the ntpd as the NTP daemon -The output should contain the "nx" flag. - Is it the case that NX is disabled? +In the file, there should be a section similar to the following: +server ntpserver + Is it the case that this is not the case? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_SG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/http/conf.modules.d/*, +run the command: +$ ls -l /etc/http/conf.modules.d/* +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/http/conf.modules.d/* does not have unix mode -rw-r-----? - - Verify that core dumps are disabled for all users, run the following command: -$ grep core /etc/security/limits.conf -* hard core 0 - Is it the case that the "core" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core"? + + +Run the following command to determine if the postgresql_selinux_unconfined_dbadm SELinux boolean is enabled: +$ getsebool postgresql_selinux_unconfined_dbadm +If properly configured, the output should show the following: +postgresql_selinux_unconfined_dbadm --> on + Is it the case that postgresql_selinux_unconfined_dbadm is not enabled? - + -Run the following command to determine if the samba_enable_home_dirs SELinux boolean is disabled: -$ getsebool samba_enable_home_dirs +Run the following command to determine if the httpd_can_sendmail SELinux boolean is disabled: +$ getsebool httpd_can_sendmail If properly configured, the output should show the following: -samba_enable_home_dirs --> off - Is it the case that samba_enable_home_dirs is not disabled? +httpd_can_sendmail --> off + Is it the case that httpd_can_sendmail is not disabled? - - Verify Red Hat Enterprise Linux 8 is securely comparing internal information system clocks at a regular interval with an NTP server with the following command: -$ sudo grep maxpoll /etc/ntp.conf /etc/chrony.conf -server [ntp.server.name] iburst maxpoll . - Is it the case that "maxpoll" has not been set to the value of "<sub idref="var_time_service_set_maxpoll" />", is commented out, or is missing? + + Run the following command to check the mode of the system audit logs: +$ sudo grep -iw log_file /etc/audit/auditd.conf +log_file=/var/log/audit/audit.log +$ sudo stat -c "%n %a" /var/log/audit/* +$ sudo ls -l /var/log/audit +Audit logs must be mode 0640 or less permissive. + Is it the case that any permissions are more permissive? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: - -$ sudo grep disk_error_action /etc/audit/auditd.conf - -disk_error_action = HALT - -If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. - Is it the case that there is no evidence of appropriate action? + + Run the following command to determine if the cronie-anacron package is installed: +$ rpm -q cronie-anacron + Is it the case that the package is installed? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_COMPAT_BRK /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /boot/grub2/user.cfg, +run the command: +$ ls -l /boot/grub2/user.cfg +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /boot/grub2/user.cfg does not have unix mode -rw-------? - - Verify the noauto option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . noauto . . . + + To determine if env_reset has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\benv_reset\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that env_reset is not enabled in sudo? + + + + +Run the following command to determine if the httpd_sys_script_anon_write SELinux boolean is disabled: +$ getsebool httpd_sys_script_anon_write +If properly configured, the output should show the following: +httpd_sys_script_anon_write --> off + Is it the case that httpd_sys_script_anon_write is not disabled? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "restorecon" command with the following command: - Is it the case that the "/boot" file system does not have the "noauto" option set? +$ sudo auditctl -l | grep restorecon + +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -k privileged-restorecon + Is it the case that the command does not return a line, or the line is commented out? - - To verify if ErrorLog is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i errorlog /etc/httpd/conf/httpd.conf -The output should return the following: -ErrorLog "logs/error_log" - Is it the case that it is not? + + To verify that McAfee HIPS is installed, run the following command(s): +$ rpm -q MFEhiplsm + Is it the case that the HBSS HIPS module is not installed? - - To check the minimum password length, run the command: -$ grep PASS_MIN_LEN /etc/login.defs -The DoD requirement is 15. - Is it the case that it is not set to the required value? + + +Run the following command to determine if the selinuxuser_execheap SELinux boolean is disabled: +$ getsebool selinuxuser_execheap +If properly configured, the output should show the following: +selinuxuser_execheap --> off + Is it the case that selinuxuser_execheap is not disabled? - - Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep -w admin_space_left /etc/audit/auditd.conf - -admin_space_left = % - -If the value of the "admin_space_left" keyword is not set to % of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is taking action if the allocated storage is about to reach capacity. - Is it the case that the "admin_space_left" value is not configured to the correct value? + + To verify that SSSD's in-memory cache expires after a day, run the following command: +$ sudo grep memcache_timeout /etc/sssd/sssd.conf +If configured properly, output should be memcache_timeout = . + Is it the case that it does not exist or is not configured properly? - - Verify the system-wide shared library directories are owned by "root" with the following command: + + The runtime status of the fs.suid_dumpable kernel parameter can be queried +by running the following command: +$ sysctl fs.suid_dumpable +0. -$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -user root -type d -exec stat -c "%n %U" '{}' \; - Is it the case that any system-wide shared library directory is not owned by root? + Is it the case that the correct value is not returned? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: + + If IPv6 is disabled, this is not applicable. -$ sudo auditctl -l | grep +Inspect the file /etc/sysconfig/ip6tables to determine +the default policy for the INPUT chain. It should be set to DROP: +$ sudo grep ":INPUT" /etc/sysconfig/ip6tables + Is it the case that the default policy for the INPUT chain is not set to DROP? + + + + Verify the noexec option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . noexec . . . --w -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the "/tmp" file system does not have the "noexec" option set? - - -Run the following command to determine if the xend_run_qemu SELinux boolean is enabled: -$ getsebool xend_run_qemu -If properly configured, the output should show the following: -xend_run_qemu --> on - Is it the case that xend_run_qemu is not enabled? + + To determine if the system is configured to audit calls to the +rename system call, run the following command: +$ sudo grep "rename" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the samba_share_fusefs SELinux boolean is disabled: -$ getsebool samba_share_fusefs -If properly configured, the output should show the following: -samba_share_fusefs --> off - Is it the case that samba_share_fusefs is not disabled? + + To check the group ownership of /etc/cron.monthly, +run the command: +$ ls -lL /etc/cron.monthly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.monthly does not have a group owner of root? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine how many logs the system is configured to retain after rotation: -$ sudo grep num_logs /etc/audit/auditd.conf -num_logs = 5 - Is it the case that the system log file retention has not been properly configured? + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlinkat system call. + +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r unlinkat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep unlinkat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete + Is it the case that the command does not return a line, or the line is commented out? - - To verify that the interface(s) follow site policy for zone assignment run the -following command: -$ sudo nmcli -t connection show | awk -F: '{if($4){print $4}}' | while read INT; -do firewall-cmd --get-active-zones | grep -B1 $INT; done -If your have to assign an interface to the appropriate zone run the following command: -$ sudo firewall-cmd --zone= --change-interface= - Is it the case that Your system accepts all incoming packets for unnecessary services and ports? + + To check the permissions of /var/log/syslog, +run the command: +$ ls -l /var/log/syslog +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /var/log/syslog does not have unix mode -rw-r-----? - - Run the following command to determine if the pcsc-lite package is installed: $ rpm -q pcsc-lite - Is it the case that the package is not installed? + + Verify that the files and directories of each instance of Alias, +ScriptAlias, and ScriptAliasMatch that exist +have the correct file and directory permissions applied. + Is it the case that it is not? - - To verify that automatic logins are disabled, run the following command: -$ grep -Pzoi "^\[daemon]\\nautomaticlogin.*" /etc/gdm/custom.conf -The output should show the following: -[daemon] -AutomaticLoginEnable=false - Is it the case that GDM allows users to automatically login? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-1-create-success.rules +The output has to be exactly as follows: +## Successful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create + Is it the case that the file does not exist or the content differs? - - The following command will list which files on the system have permissions different from what -is expected by the RPM database: -$ rpm -Va | awk '{ if (substr($0,2,1)=="M") print $NF }' - Is it the case that there is output? + + +Run the following command to determine if the ftpd_full_access SELinux boolean is disabled: +$ getsebool ftpd_full_access +If properly configured, the output should show the following: +ftpd_full_access --> off + Is it the case that ftpd_full_access is not disabled? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine how much data the system will retain in each audit log file: -$ sudo grep max_log_file /etc/audit/auditd.conf -max_log_file = 6 - Is it the case that the system audit data threshold has not been properly configured? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfiles" command with the following command: + +$ sudo auditctl -l | grep setfiles + +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update + Is it the case that the command does not return a line, or the line is commented out? - - To verify the assigned home directory of all interactive user home directories -have a mode of 0750 or less permissive, run the following command: -$ sudo ls -l /home -Inspect the output for any directories with incorrect permissions. - Is it the case that they are more permissive? + + Run the following command to determine if the tar package is installed: $ rpm -q tar + Is it the case that the package is not installed? - - To ensure the default password is not set, run the following command: -$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep -E 'public|private' -There should be no output. - Is it the case that the default SNMP passwords public and private have not been changed or removed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_BUG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the krb5-workstation package is installed: -$ rpm -q krb5-workstation - Is it the case that the package is installed? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules +The output has to be exactly as follows: +## Successful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification + Is it the case that the file does not exist or the content differs? - - Determine if there is a process for the uploading of files to the web site. -This process should include the requirement for the use of a secure encrypted -logon and secure encrypted connection. If the remote users are uploading files -without utilizing approved encryption methods, this is a finding. - Is it the case that it is not? + + +Run the following command to determine if the httpd_use_nfs SELinux boolean is disabled: +$ getsebool httpd_use_nfs +If properly configured, the output should show the following: +httpd_use_nfs --> off + Is it the case that httpd_use_nfs is not disabled? - + To determine if the system is configured to audit successful calls to the openat system call, run the following command: $ sudo grep "openat" /etc/audit.* @@ -380037,1467 +380515,1371 @@ If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the telepathy_connect_all_ports SELinux boolean is disabled: -$ getsebool telepathy_connect_all_ports -If properly configured, the output should show the following: -telepathy_connect_all_ports --> off - Is it the case that telepathy_connect_all_ports is not disabled? + + To check the group ownership of /etc/cron.weekly, +run the command: +$ ls -lL /etc/cron.weekly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.weekly does not have a group owner of root? - - To check that audit is enabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't enable audit. - Is it the case that auditing is not enabled at boot time? + + The following command will discover and print world-writable directories that are not owned by +a system account, given the assumption that only system accounts have a uid lower than 500. +Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -uid +1000 -print + Is it the case that there is output? - - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postqueue" command with the following command: -Run the following command to determine the current status of the -nftables service: -$ sudo systemctl is-active nftables -If the service is running, it should return the following: active - Is it the case that the "nftables" service is disabled, masked, or not started.? +$ sudo auditctl -l | grep postqueue + +-a always,exit -F path=/usr/bin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postqueue + Is it the case that the command does not return a line, or the line is commented out? - - Verify the operating system encrypts audit records off-loaded onto a different system -or media from the system being audited with the following commands: + + Determine if there is a process for the uploading of files to the web site. +This process should include the requirement for the use of a secure encrypted +logon and secure encrypted connection. If the remote users are uploading files +without utilizing approved encryption methods, this is a finding. + Is it the case that it is not? + + + + To check that the mdmonitor service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled mdmonitor +Output should indicate the mdmonitor service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled mdmonitor disabled -$ sudo grep -i '$ActionSendStreamDriverMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf +Run the following command to verify mdmonitor is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active mdmonitor -The output should be: +If the service is not running the command will return the following output: +inactive -/etc/rsyslog.conf:$ActionSendStreamDriverMode 1 - Is it the case that rsyslogd ActionSendStreamDriverMode is not set to 1? +The service will also be masked, to check that the mdmonitor is masked, run the following command: +$ sudo systemctl show mdmonitor | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "mdmonitor" is loaded and not masked? - - Run the following command: -# grep ^\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf -Verify the output matches: -$FileCreateMode 0640 -Should a site policy dictate less restrictive permissions, ensure to follow -said policy. - Is it the case that $FileCreateMode is not set or is more permissive than 0640? + + The following command will discover and print world-writable directories that +are not owned by root. Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -uid +0 -print + Is it the case that there are world-writable directories not owned by root? - + + Verify that the SA and ISSO (at a minimum) are notified when the audit storage volume is full. + +Check which action Red Hat Enterprise Linux 8 takes when the audit storage volume is full with the following command: + +$ sudo grep max_log_file_action /etc/audit/auditd.conf +max_log_file_action = + Is it the case that the value of the "max_log_file_action" option is set to "ignore", "rotate", or "suspend", or the line is commented out? + + + -Run the following command to determine if the postgresql_selinux_transmit_client_label SELinux boolean is disabled: -$ getsebool postgresql_selinux_transmit_client_label +Run the following command to determine if the virt_sandbox_use_mknod SELinux boolean is disabled: +$ getsebool virt_sandbox_use_mknod If properly configured, the output should show the following: -postgresql_selinux_transmit_client_label --> off - Is it the case that postgresql_selinux_transmit_client_label is not disabled? +virt_sandbox_use_mknod --> off + Is it the case that virt_sandbox_use_mknod is not disabled? - - Run the following command to determine if the samba package is installed: -$ rpm -q samba - Is it the case that the package is installed? + + To verify the home directory ownership, run the following command: +# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) + Is it the case that the user ownership is incorrect? - - To verify the local initialization files of all local interactive users are group- -owned by the appropriate user, inspect the primary group of the respective -users in /etc/passwd and verify all initialization files under the -respective users home directory. Check the group owner of all local interactive users -initialization files. - Is it the case that they are not? + + The runtime status of the net.ipv6.conf.all.accept_ra kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra +0. + + Is it the case that the correct value is not returned? - + +To check that the systemd-journal-remote.socket socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled systemd-journal-remote.socket +Output should indicate the systemd-journal-remote.socket socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled systemd-journal-remote.socketdisabled -Run the following command to determine the current status of the -syslog-ng service: -$ sudo systemctl is-active syslog-ng -If the service is running, it should return the following: active - Is it the case that the "syslog-ng" service is disabled, masked, or not started.? +Run the following command to verify systemd-journal-remote.socket is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active systemd-journal-remote.socket + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the systemd-journal-remote.socket is masked, run the following command: +$ sudo systemctl show systemd-journal-remote.socket | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the systemd-journal-remote socket is not masked? - - Verify that Red Hat Enterprise Linux 8 has configured the minimum time period between password changes for each user account is one day or greater with the following command: + + Run the following command to check if the line is present: +grep pam_wheel /etc/pam.d/su +The output should contain the following line: +auth required pam_wheel.so use_uid + Is it the case that the line is not in the file or it is commented? + + + + Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: -$ sudo awk -F: '$4 < 1 {print $1 " " $4}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? +$ sudo grep -w space_left /etc/audit/auditd.conf + +space_left = % + Is it the case that the value of the "space_left" keyword is not set to <sub idref="var_auditd_space_left_percentage" />% of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. If the "space_left" value is not configured to the correct value? - - Run the following command to see what the max sessions number is: -$ sudo grep MaxSessions /etc/ssh/sshd_config -If properly configured, the output should be: -MaxSessions - Is it the case that MaxSessions is not configured or not configured correctly? + + To ensure that WIFI connections caanot be created, run the following command: +$ gsettings get org.gnome.nm-applet disable-wifi-create +If properly configured, the output should be true. +To ensure that users cannot enable WIFI connection creation, run the following: +$ grep wifi-create /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/nm-applet/disable-wifi-create + Is it the case that WIFI connections can be created through GNOME? - + -Run the following command to determine if the zarafa_setrlimit SELinux boolean is disabled: -$ getsebool zarafa_setrlimit +Run the following command to determine if the minidlna_read_generic_user_content SELinux boolean is disabled: +$ getsebool minidlna_read_generic_user_content If properly configured, the output should show the following: -zarafa_setrlimit --> off - Is it the case that zarafa_setrlimit is not disabled? +minidlna_read_generic_user_content --> off + Is it the case that minidlna_read_generic_user_content is not disabled? - - Run the following command to determine if the sssd package is installed: $ rpm -q sssd - Is it the case that the package is not installed? + + To check the permissions of /etc/ssh/*_key, +run the command: +$ ls -l /etc/ssh/*_key +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/ssh/*_key does not have unix mode -rw-------? - - Run the following command to check if the line is present: -grep pam_wheel /etc/pam.d/su -The output should contain the following line: -auth required pam_wheel.so use_uid group= - Is it the case that the line is not in the file or it is commented? + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Ensure there are no unconfined daemons running on the system, -the following command should produce no output: -$ sudo ps -eZ | grep "unconfined_service_t" - Is it the case that There are unconfined daemons running on the system? + + +Run the following command to determine if the zabbix_can_network SELinux boolean is disabled: +$ getsebool zabbix_can_network +If properly configured, the output should show the following: +zabbix_can_network --> off + Is it the case that zabbix_can_network is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the openat system call. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the renameat system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r openat /etc/audit/rules.d +$ sudo grep -r renameat /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep openat /etc/audit/audit.rules +$ sudo grep renameat /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete Is it the case that the command does not return a line, or the line is commented out? - - - -Run the following command to determine the current status of the -cron service: -$ sudo systemctl is-active cron -If the service is running, it should return the following: active - Is it the case that ? - - - - -Run the following command to determine if the selinuxuser_execmod SELinux boolean is enabled: -$ getsebool selinuxuser_execmod -If properly configured, the output should show the following: -selinuxuser_execmod --> on - Is it the case that selinuxuser_execmod is not enabled? - - - - - -Run the following command to determine the current status of the -ufw service: -$ sudo systemctl is-active ufw -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - Verify Red Hat Enterprise Linux 8 is configured to lock an account after -unsuccessful logon attempts with the command: + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd" with the following command: +$ sudo auditctl -l | grep -E '(/etc/passwd)' -$ grep 'deny =' /etc/security/faillock.conf -deny = . - Is it the case that the "deny" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_deny" />" -or less (but not "0"), is missing or commented out? - - - - -Run the following command to determine if the virt_sandbox_use_audit SELinux boolean is enabled: -$ getsebool virt_sandbox_use_audit -If properly configured, the output should show the following: -virt_sandbox_use_audit --> on - Is it the case that virt_sandbox_use_audit is not enabled? +-w /etc/passwd -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_MERGE_DEFAULT /boot/config.* + $ grep CONFIG_RETPOLINE /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - - Is it the case that the package is not installed? - - - - -Run the following command to determine if the httpd_can_connect_ftp SELinux boolean is disabled: -$ getsebool httpd_can_connect_ftp -If properly configured, the output should show the following: -httpd_can_connect_ftp --> off - Is it the case that httpd_can_connect_ftp is not disabled? - - - - Run the following command to determine if the geolite2-country package is installed: -$ rpm -q geolite2-country - Is it the case that the package is installed? - - - - -Run the following command to determine if the virt_use_samba SELinux boolean is disabled: -$ getsebool virt_use_samba -If properly configured, the output should show the following: -virt_use_samba --> off - Is it the case that virt_use_samba is not disabled? - - - - To determine if the system is configured to audit successful calls -to the fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/tallylog" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep /var/log/tallylog + +-w /var/log/tallylog -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - The runtime status of the net.ipv6.conf.default.max_addresses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.max_addresses -1. - - Is it the case that the correct value is not returned? + + To verify that kernel parameter 'crypto.fips_enabled' is set properly, run the following command: +sysctl crypto.fips_enabled +The output should contain the following: +crypto.fips_enabled = 1 + Is it the case that crypto.fips_enabled is not 1? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "userhelper" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "semanage" command with the following command: -$ sudo auditctl -l | grep userhelper +$ sudo auditctl -l | grep semanage --a always,exit -F path=/usr/bin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -k privileged-userhelper +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update Is it the case that the command does not return a line, or the line is commented out? - - To determine if the users are allowed to run commands as root, run the following commands: -$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*[^\(\s]' /etc/sudoers /etc/sudoers.d/ -and -$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*\([\w\s]*\b(root|ALL)\b[\w\s]*\)' /etc/sudoers /etc/sudoers.d/ -Both commands should return no output. - Is it the case that /etc/sudoers file contains rules that allow non-root users to run commands as root? + + To ensure write permissions are disabled for group and other + for each element in root's path, run the following command: +# ls -ld DIR + Is it the case that group or other write permissions exist? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow" with the following command: - -$ sudo auditctl -l | grep -E '(/etc/gshadow)' - --w /etc/gshadow -p wa -k identity - -If the command does not return a line, or the line is commented out, this is a finding. - Is it the case that the system is not configured to audit account changes? + + To verify the nosuid option is configured for all NFS mounts, run +the following command: +$ mount | grep nfs +All NFS mounts should show the nosuid setting in parentheses. This +is not applicable if NFS is not implemented. + Is it the case that the setting does not show? - - -Run the following command to determine if the cluster_can_network_connect SELinux boolean is disabled: -$ getsebool cluster_can_network_connect -If properly configured, the output should show the following: -cluster_can_network_connect --> off - Is it the case that cluster_can_network_connect is not disabled? + + To ensure that the GUI power settings are not active, run the following command: +$ gsettings get org.gnome.settings-daemon.plugins.power active +If properly configured, the output should be false. +To ensure that users cannot enable the power settings, run the following: +$ grep power /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/settings-daemon/plugins/power/active + Is it the case that power settings are enabled and are not disabled? - - The runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.arp_ignore -. - - Is it the case that the correct value is not returned? + + To ensure ClientAliveInterval is set correctly, run the following command: +$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveCountMax +For SSH earlier than v8.2, a ClientAliveCountMax value of 0 causes a timeout precisely when +the ClientAliveInterval is set. Starting with v8.2, a value of 0 disables the timeout +functionality completely. +If the option is set to a number greater than 0, then the session will be disconnected after +ClientAliveInterval * ClientAliveCountMax seconds without receiving a keep alive message. + Is it the case that it is commented out or not configured properly? - - To check that the cups service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled cups -Output should indicate the cups service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cups disabled - -Run the following command to verify cups is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cups - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the cups is masked, run the following command: -$ sudo systemctl show cups | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "cups" is loaded and not masked? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEBUG_WX /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.accept_local kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.router_solicitations +$ sysctl net.ipv4.conf.all.accept_local 0. Is it the case that the correct value is not returned? - - Verify the nodev option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . nodev . . . - - Is it the case that the "/var/log/audit" file system does not have the "nodev" option set? + + The existence of the file /etc/hosts.equiv or a file named +.rhosts inside a user home directory indicates the presence +of an Rsh trust relationship. + Is it the case that these files exist? - - To verify ExecShield is enabled on 64-bit Red Hat Enterprise Linux 8 systems, -run the following command: -$ dmesg | grep '[NX|DX]*protection' -The output should not contain 'disabled by kernel command line option'. -Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes noexec=off, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*noexec=off.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*noexec=off.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'noexec=off' -The command should not return any output. - Is it the case that ExecShield is not supported by the hardware, is not enabled, or has been disabled by the kernel configuration.? + + To determine if the system is configured to audit calls to the +fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 disables core dump backtraces by issuing the following command: - -$ grep -i process /etc/systemd/coredump.conf - -ProcessSizeMax=0 - Is it the case that the "ProcessSizeMax" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling automount-open +If properly configured, the output for automount-openshould be false. +To ensure that users cannot enable automount opening in GNOME3, run the following: +$ grep 'automount-open' /etc/dconf/db/local.d/locks/* +If properly configured, the output for automount-open should be /org/gnome/desktop/media-handling/automount-open + Is it the case that GNOME automounting is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -$ sudo cat /etc/audit/rules.d/11-loginuid.rules -The output has to be exactly as follows: -## Make the loginuid immutable. This prevents tampering with the auid. ---loginuid-immutable - Is it the case that the file does not exist or the content differs? + + Run the following command to verify that SSH client is configured to use 32 bytes of entropy: +grep SSH_USE_STRONG_RNG /etc/profile.d/cc-ssh-strong-rng.csh +It should return the following output: +setenv SSH_USE_STRONG_RNG 32. + Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - To determine how the SSH daemon's HostbasedAuthentication option is set, run the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open_by_handle_at system call with O_TRUNC_WRITE flag. -$ sudo grep -i HostbasedAuthentication /etc/ssh/sshd_config +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: -If a line indicating no is returned, then the required value is set. +$ sudo grep -r open_by_handle_at /etc/audit/rules.d - Is it the case that the required value is not set? +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - Make sure that the kernel is not disabling SMAP with the following -commands. -grep -q nosmap /boot/config-`uname -r` -If the command returns a line, it means that SMAP is being disabled. - Is it the case that the kernel is configured to disable SMAP? + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Run the following command to ensure that /var/tmp is configured as a -polyinstantiated directory: -$ sudo grep /var/tmp /etc/security/namespace.conf -The output should return the following: -/var/tmp /var/tmp/tmp-inst/ level root,adm - Is it the case that is not configured? + + To determine if the system is configured to audit calls to the +init_module system call, run the following command: +$ sudo grep "init_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +finit_module system call, run the following command: +$ sudo grep "finit_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +delete_module system call, run the following command: +$ sudo grep "delete_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To check for virtual console entries which permit root login, run the -following command: -$ sudo grep ^vc/[0-9] /etc/securetty -If any output is returned, then root logins over virtual console devices is permitted. - Is it the case that root login over virtual console devices is permitted? + + Inspect all instances of DocumentRoot and Alias. No +robots.txt file should exist. + Is it the case that it is not? - - Verify the nodev option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . nodev . . . - - Is it the case that the "/var" file system does not have the "nodev" option set? + + Run the following command to determine if the rpcbind package is installed: +$ rpm -q rpcbind + Is it the case that the package is installed? - - -Run the following command to determine if the container_connect_any SELinux boolean is disabled: -$ getsebool container_connect_any -If properly configured, the output should show the following: -container_connect_any --> off - Is it the case that container_connect_any is not disabled? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling autorun-never +If properly configured, the output for autorun-nevershould be true. +To ensure that users cannot enable autorun in GNOME3, run the following: +$ grep 'autorun-never' /etc/dconf/db/local.d/locks/* +If properly configured, the output for autorun-never should be /org/gnome/desktop/media-handling/autorun-never + Is it the case that GNOME autorun is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open system call with O_TRUNC_WRITE flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + + Verify the nodev option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . nodev . . . -$ sudo grep open /etc/audit/audit.rules + Is it the case that the "/var/tmp" file system does not have the "nodev" option set? + + + + The owner of all log files written by rsyslog should be -The output should be the following: +root. --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +These log files are determined by the second part of each Rule line in +/etc/rsyslog.conf and typically all appear in /var/log. +To see the owner of a given log file, run the following command: +$ ls -l LOGFILE + Is it the case that the owner is not correct? - - Run the following command to determine open ports: -# ss -6tuln -Run the following command to determine firewall rules: -# ip6tables -L INPUT -v -n -For each port identified in the audit which does not have a firewall -rule, add rule for accepting or denying inbound connections -# ip6tables -A INPUT -p \ --dport \ -m state --state NEW -j ACCEPT - Is it the case that open ports are denied connection? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes l1tf=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*l1tf=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*l1tf=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'l1tf=' +The command should not return any output. + Is it the case that l1tf mitigations are not configured appropriately? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the ftruncate system call, run the following command: +$ sudo grep "ftruncate" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setsebool" command with the following command: - -$ sudo auditctl -l | grep setsebool - --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -k privileged - Is it the case that the command does not return a line, or the line is commented out? + + +Run the following command to determine if the samba_run_unconfined SELinux boolean is disabled: +$ getsebool samba_run_unconfined +If properly configured, the output should show the following: +samba_run_unconfined --> off + Is it the case that samba_run_unconfined is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules -The output has to be exactly as follows: -## Successful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete - Is it the case that the file does not exist or the content differs? + + +Run the following command to determine if the zoneminder_anon_write SELinux boolean is disabled: +$ getsebool zoneminder_anon_write +If properly configured, the output should show the following: +zoneminder_anon_write --> off + Is it the case that zoneminder_anon_write is not disabled? - + -Run the following command to determine if the dbadm_read_user_files SELinux boolean is disabled: -$ getsebool dbadm_read_user_files +Run the following command to determine if the mailman_use_fusefs SELinux boolean is disabled: +$ getsebool mailman_use_fusefs If properly configured, the output should show the following: -dbadm_read_user_files --> off - Is it the case that dbadm_read_user_files is not disabled? +mailman_use_fusefs --> off + Is it the case that mailman_use_fusefs is not disabled? - - The following command will list which files on the system have ownership different from what -is expected by the RPM database: -$ rpm -Va | rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }' - Is it the case that there is output? + + To verify that smart cards are enabled in SSSD, run the following command: +$ sudo grep pam_cert_auth /etc/sssd/sssd.conf +If configured properly, output should be +pam_cert_auth = True + + +To verify that smart cards are enabled in PAM files, run the following command: +$ sudo grep -e "auth.*pam_sss\.so.*\(allow_missing_name\|try_cert_auth\)" /etc/pam.d/smartcard-auth /etc/pam.d/system-auth +If configured properly, output should be + +/etc/pam.d/smartcard-auth:auth sufficient pam_sss.so allow_missing_name +/etc/pam.d/system-auth:auth [success=done authinfo_unavail=ignore ignore=ignore default=die] pam_sss.so try_cert_auth + + Is it the case that smart cards are not enabled in SSSD? - + -Run the following command to determine if the mozilla_plugin_use_spice SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_spice +Run the following command to determine if the kdumpgui_run_bootloader SELinux boolean is disabled: +$ getsebool kdumpgui_run_bootloader If properly configured, the output should show the following: -mozilla_plugin_use_spice --> off - Is it the case that mozilla_plugin_use_spice is not disabled? - - - - Run the following command to determine if the crypto-policies package is installed: $ rpm -q crypto-policies - Is it the case that the package is not installed? +kdumpgui_run_bootloader --> off + Is it the case that kdumpgui_run_bootloader is not disabled? - - To ensure that the system prevents messages from being shown when three unsuccessful logon -attempts occur, run the following command: -$ grep silent /etc/security/faillock.conf -The output should show silent. - Is it the case that the system shows messages when three unsuccessful logon attempts occur? + + To ensure the X Windows package group is removed, run the following command: +$ rpm -qi xorg-x11-server-common +The output should be: +package xorg-x11-server-common is not installed + Is it the case that the X Windows package group or xorg-x11-server-common has not be removed? - + -Run the following command to determine if the httpd_can_check_spam SELinux boolean is disabled: -$ getsebool httpd_can_check_spam +Run the following command to determine if the xdm_bind_vnc_tcp_port SELinux boolean is disabled: +$ getsebool xdm_bind_vnc_tcp_port If properly configured, the output should show the following: -httpd_can_check_spam --> off - Is it the case that httpd_can_check_spam is not disabled? +xdm_bind_vnc_tcp_port --> off + Is it the case that xdm_bind_vnc_tcp_port is not disabled? - - To verify that Audit Daemon is configured to include local events, run the -following command: -$ sudo grep local_events /etc/audit/auditd.conf -The output should return the following: -local_events = yes - Is it the case that local_events isn't set to yes? + + Run the following command to determine if the ypserv package is installed: +$ rpm -q ypserv + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chacl" command with the following command: - -$ sudo auditctl -l | grep chacl - --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? + + To verify insecure file locking has been disabled, run the following command: +$ grep insecure_locks /etc/exports + Is it the case that there is output? - - The runtime status of the net.ipv4.conf.all.arp_filter kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.arp_filter -. + + To determine if the system is configured to audit successful calls +to the renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the correct value is not returned? + Is it the case that no line is returned? - - Run the following command to determine if the audispd-plugins package is installed: $ rpm -q audispd-plugins - Is it the case that the package is not installed? + + The following command will list which files on the system have file hashes different from what +is expected by the RPM database. +$ rpm -Va --noconfig | awk '$1 ~ /..5/' + Is it the case that there is output? - - Verify that a separate file system/partition has been created for /var with the following command: - -$ mountpoint /var - - Is it the case that "/var is not a mountpoint" is returned? + + To verify if LogLevel is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i loglevel /etc/httpd/conf/httpd.conf +The command should return the following: +LogLevel warn + Is it the case that it is not? - - Storing logs with persistent storage ensures they are available after a reboot or system crash. -Run the command below to verify that logs are being persistently stored to disk. - -grep "^\sStorage" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf - - -and it should return + + Verify that a separate file system/partition has been created for /var/tmp with the following command: -Storage=persistent +$ mountpoint /var/tmp - Is it the case that is commented out or not configured correctly? + Is it the case that "/var/tmp is not a mountpoint" is returned? - + -Determine the audit log group by running the following command: - -$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf +Verify that the libuser is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. -Then, check that all directories within the /var/log/audit directory are owned by the group specified as log_group or by root if the log_group is not specified. -Run the following command: +Check the hashing algorithm that is being used to hash passwords with the following command: -$ sudo find /var/log/audit -type d -printf "%p %g\n" +$ sudo grep -i crypt_style /etc/libuser.conf -All listed directories must be owned by the log_group or by root if the log_group is not specified. - Is it the case that there is a directory owned by different group? +crypt_style = sha512 + Is it the case that crypt_style is not set to sha512? - - To check that the sysstat service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled sysstat -Output should indicate the sysstat service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled sysstat disabled + + Verify that the IPSec service uses the system crypto policy. -Run the following command to verify sysstat is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active sysstat +If the ipsec service is not installed is not applicable. -If the service is not running the command will return the following output: -inactive +Check to see if the "IPsec" service is active with the following command: -The service will also be masked, to check that the sysstat is masked, run the following command: -$ sudo systemctl show sysstat | grep "LoadState\|UnitFileState" +$ systemctl status ipsec -If the service is masked the command will return the following outputs: +ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec +Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) +Active: inactive (dead) -LoadState=masked +If the "IPsec" service is active, check to see if it is using the system crypto policy with the following command: -UnitFileState=masked - Is it the case that the "sysstat" is loaded and not masked? - - - - The runtime status of the net.ipv4.conf.default.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.accept_redirects -0. +$ sudo grep include /etc/ipsec.conf /etc/ipsec.d/*.conf - Is it the case that the correct value is not returned? +/etc/ipsec.conf:include /etc/crypto-policies/back-ends/libreswan.config + Is it the case that the "IPsec" service is active and the ipsec configuration file does not contain does not contain <tt>include /etc/crypto-policies/back-ends/libreswan.config</tt>? - - Verify the audit system is configured to take an appropriate action when the internal event queue is full: -$ sudo grep -i overflow_action /etc/audit/auditd.conf + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "poweroff" command with the following command: -The output should contain overflow_action = syslog +$ sudo auditctl -l | grep poweroff -If the value of the "overflow_action" option is not set to syslog, -single, halt or the line is commented out, ask the System Administrator -to indicate how the audit logs are off-loaded to a different system or media. - Is it the case that auditd overflow action is not set correctly? +-a always,exit -F path=/poweroff -F perm=x -F auid>=1000 -F auid!=unset -k privileged-poweroff + Is it the case that the command does not return a line, or the line is commented out? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlinkat system call. + + Verify "firewalld" is configured to employ a deny-all, allow-by-exception policy for allowing connections to other systems with the following commands: -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: +$ sudo firewall-cmd --state -$ sudo grep -r unlinkat /etc/audit/rules.d +running -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +$ sudo firewall-cmd --get-active-zones -$ sudo grep unlinkat /etc/audit/audit.rules +[custom] +interfaces: ens33 -The output should be the following: +$ sudo firewall-cmd --info-zone=[custom] | grep target --a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? +target: DROP + Is it the case that no zones are active on the interfaces or if the target is set to a different option other than "DROP"? - - The runtime status of the kernel.pid_max kernel parameter can be queried -by running the following command: -$ sysctl kernel.pid_max -65536. + + Verify that Red Hat Enterprise Linux 8 enforces a -day maximum password lifetime for new user accounts by running the following command: - Is it the case that the correct value is not returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_NOTIFIERS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +$ grep -i pass_max_days /etc/login.defs + +PASS_MAX_DAYS + Is it the case that the "PASS_MAX_DAYS" parameter value is greater than "<sub idref="var_accounts_maximum_age_login_defs" />", or commented out? - + -Run the following command to determine if the httpd_enable_homedirs SELinux boolean is disabled: -$ getsebool httpd_enable_homedirs +Run the following command to determine if the exim_can_connect_db SELinux boolean is disabled: +$ getsebool exim_can_connect_db If properly configured, the output should show the following: -httpd_enable_homedirs --> off - Is it the case that httpd_enable_homedirs is not disabled? - - - - Ensure that debug-shell service is not enabled with the following command: -grep systemd\.debug-shell=1 /boot/grub2/grubenv /etc/default/grub -If the command returns a line, it means that debug-shell service is being enabled. - Is it the case that the comand returns a line? +exim_can_connect_db --> off + Is it the case that exim_can_connect_db is not disabled? - + -Run the following command to determine if the condor_tcp_network_connect SELinux boolean is disabled: -$ getsebool condor_tcp_network_connect +Run the following command to determine if the auditadm_exec_content SELinux boolean is enabled: +$ getsebool auditadm_exec_content If properly configured, the output should show the following: -condor_tcp_network_connect --> off - Is it the case that condor_tcp_network_connect is not disabled? - - - - Verify the noexec option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . noexec . . . - - Is it the case that the "/var/tmp" file system does not have the "noexec" option set? - - - - The runtime status of the net.ipv4.conf.default.log_martians kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.log_martians -1. - - Is it the case that the correct value is not returned? +auditadm_exec_content --> on + Is it the case that auditadm_exec_content is not enabled? - - To verify the nodev option is configured for non-root local partitions, run the following command: -$ sudo mount | grep '^/dev\S* on /\S' | grep --invert-match 'nodev' -The output shows local non-root partitions mounted without the nodev option, and there should be no output at all. - - Is it the case that some mounts appear among output lines? + + To determine if the system is configured to make login UIDs immutable, run +one of the following commands. +If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), run the following: +sudo grep immutable /etc/audit/rules.d/*.rules +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, run the following command: +sudo grep immutable /etc/audit/audit.rules +The following line should be returned: +--loginuid-immutable + Is it the case that the system is not configured to make login UIDs immutable? - - -Run the following command to determine if the pppd_for_user SELinux boolean is disabled: -$ getsebool pppd_for_user -If properly configured, the output should show the following: -pppd_for_user --> off - Is it the case that pppd_for_user is not disabled? + + Run the following command to determine if the mailx package is installed: $ rpm -q mailx + Is it the case that the package is not installed? - - To check the ownership of /etc/shadow, -run the command: -$ ls -lL /etc/shadow -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shadow does not have an owner of root? + + Run the following command to determine if the systemd-journal-remote package is installed: $ rpm -q systemd-journal-remote + Is it the case that the package is not installed? - - To determine if the system is configured to audit calls to the -unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the creat system call, run the following command: +$ sudo grep "creat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that HBSS PA is installed, run the following command(s): -$ sudo ls /opt/McAfee/auditengine/bin/auditmanager - Is it the case that the HBSS PA module is not installed? + + Check the system partitions to determine if they are encrypted with the following command: +blkid + +Output will be similar to: +/dev/sda1: UUID=" ab12c3de-4f56-789a-8f33-3850cc8ce3a2 +" TYPE="crypto_LUKS" +/dev/sda2: UUID=" bc98d7ef-6g54-321h-1d24-9870de2ge1a2 +" TYPE="crypto_LUKS" + +The boot partition and pseudo-file systems, such as /proc, /sys, and tmpfs, +are not required to use disk encryption and are not a finding. + Is it the case that partitions do not have a type of crypto_LUKS? - + + Determine where the audit logs are stored with the following command: + +$ sudo grep -iw log_file /etc/audit/auditd.conf + +log_file = /var/log/audit/audit.log + +Determine the owner of the audit log directory by using the output of the above command +(default: "/var/log/audit/"). Run the following command with the correct audit log directory +path: + +$ sudo ls -ld /var/log/audit + +drwx------ 2 root root 23 Jun 11 11:56 /var/log/audit + +The audit log directory must be owned by "root" + Is it the case that the directory is not owned by root? + + + -Run the following command to determine if the use_lpd_server SELinux boolean is disabled: -$ getsebool use_lpd_server +Run the following command to determine if the zarafa_setrlimit SELinux boolean is disabled: +$ getsebool zarafa_setrlimit If properly configured, the output should show the following: -use_lpd_server --> off - Is it the case that use_lpd_server is not disabled? +zarafa_setrlimit --> off + Is it the case that zarafa_setrlimit is not disabled? - - Verify the operating system requires re-authentication -when using the "sudo" command to elevate privileges, run the following command: -sudo grep -ri '^Defaults.*timestamp_timeout' /etc/sudoers /etc/sudoers.d -The output should be: -/etc/sudoers:Defaults timestamp_timeout=0 or "timestamp_timeout" is set to a positive number. -If conflicting results are returned, this is a finding. - Is it the case that timestamp_timeout is not set with the appropriate value for sudo? + + Verify that rules for unsuccessful calls of the openat syscall are in the order shown below. + + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. + + -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + If the system is 64 bit then also add the following lines: + + -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? - - To check if the installed Operating System is 64-bit, run the following command: -$ uname -m -The output should be one of the following: x86_64, aarch64, ppc64le or s390x. -If the output is i686 or i386 the operating system is 32-bit. -Check if the installed CPU supports 64-bit operating systems by running the following command: -$ lscpu | grep "CPU op-mode" -If the output contains 64bit, the CPU supports 64-bit operating systems. - Is it the case that the installed operating sytem is 32-bit but the CPU supports operation in 64-bit? + + Verify "nftables" is configured to allow rate limits on any connection to the system with the following command: + +Verify "firewalld" has "nftables" set as the default backend: + +$ sudo grep -i firewallbackend /etc/firewalld/firewalld.conf + +# FirewallBackend +FirewallBackend=nftables + Is it the case that the "nftables" is not set as the "firewallbackend"? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: + + -$ sudo auditctl -l | grep -E '(/etc/security/opasswd)' +Run the following command to determine the current status of the +chronyd service: +$ sudo systemctl is-active chronyd +If the service is running, it should return the following: active --w /etc/security/opasswd -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + +Run the following command to determine the current status of the +ntpd service: +$ sudo systemctl is-active ntpd +If the service is running, it should return the following: active + Is it the case that ? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BUG_ON_DATA_CORRUPTION /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify the audispd's syslog plugin is active, run the following command: +$ sudo grep active /etc/audit/plugins.d/syslog.conf +If the plugin is active, the output will show yes. + Is it the case that it is not activated? - - The runtime status of the net.ipv4.tcp_syncookies kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.tcp_syncookies -1. + + Verify the system-wide shared library directories are group-owned by "root" with the following command: - Is it the case that the correct value is not returned? +$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -group root -type d -exec stat -c "%n %G" '{}' \; + +If any system-wide shared library directory is returned and is not group-owned by a required system account, this is a finding. + Is it the case that any system-wide shared library directory is returned and is not group-owned by a required system account? - - To verify if the OpenSSH Client uses defined Crypto Policy, run: -$ cat /etc/ssh/ssh_config.d/02-ospp.conf -and verify that the line matches -Match final all -RekeyLimit 512M 1h -GSSAPIAuthentication no -Ciphers aes256-ctr,aes256-cbc,aes128-ctr,aes128-cbc -PubkeyAcceptedKeyTypes ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -MACs hmac-sha2-512,hmac-sha2-256 -KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 - Is it the case that Crypto Policy for OpenSSH Client is not configured according to CC requirements? + + Run the following command to determine if the dovecot package is installed: +$ rpm -q dovecot + Is it the case that the package is installed? - - To verify that SSSD expires known SSH host keys, run the following command: -$ sudo grep ssh_known_hosts_timeout /etc/sssd/sssd.conf -If configured properly, output should be -ssh_known_hosts_timeout = - Is it the case that it does not exist or is not configured properly? + + To verify if GnuTLS uses defined DoD-approved TLS Crypto Policy, run: +$ sudo grep +'+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' +/etc/crypto-policies/back-ends/gnutls.config and verify that a match exists. + Is it the case that cryptographic policy for gnutls is not configured or is configured incorrectly? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the openat system call with O_TRUNC_WRITE flag. + + Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/password-auth file +and is configured to prohibit password reuse for a minimum of +generations. -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: +Verify the "/etc/pam.d/password-auth" file with the following command: -$ sudo grep -r openat /etc/audit/rules.d +$ grep pam_pwhistory.so /etc/pam.d/password-auth +password pam_pwhistory.so use_authtok remember= -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep openat /etc/audit/audit.rules +Verify the "/etc/security/pwhistory.conf" file using the following command: -The output should be the following: +$ grep remember /etc/security/pwhistory.conf +remember = --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +The pam_pwhistory.so "remember" option must be configured only in one file. + Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in +/etc/pam.d/password-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set +with a value less than "<sub idref="var_password_pam_remember" />"? - - Verify the system-wide shared library files are owned by "root" with the following command: - -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -user root -exec ls -l {} \; - Is it the case that any system wide shared library file is not owned by root? + + +Run the following command to determine if the httpd_dbus_avahi SELinux boolean is disabled: +$ getsebool httpd_dbus_avahi +If properly configured, the output should show the following: +httpd_dbus_avahi --> off + Is it the case that httpd_dbus_avahi is not disabled? - + + To ensure the system is configured to ignore the Ctrl-Alt-Del setting, +enter the following command: +$ sudo grep -i ctrlaltdelburstaction /etc/systemd/system.conf +The output should return: +CtrlAltDelBurstAction=none + Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed more than 7 times in 2 seconds.? + + + Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes pti=on, +in /etc/default/grub. If it includes audit_backlog_limit=8192, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*pti=on.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit_backlog_limit=8192.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*pti=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*audit_backlog_limit=8192.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'pti=on' +$ sudo grubby --info=ALL | grep args | grep -v 'audit_backlog_limit=8192' The command should not return any output. - Is it the case that Kernel page-table isolation is not enabled? + Is it the case that audit backlog limit is not configured? - + -Run the following command to determine if the mozilla_read_content SELinux boolean is disabled: -$ getsebool mozilla_read_content +Run the following command to determine if the use_nfs_home_dirs SELinux boolean is disabled: +$ getsebool use_nfs_home_dirs If properly configured, the output should show the following: -mozilla_read_content --> off - Is it the case that mozilla_read_content is not disabled? +use_nfs_home_dirs --> off + Is it the case that use_nfs_home_dirs is not disabled? - - Run the following command and verify remote server is configured properly: -# grep -E "^(server|pool)" /etc/chrony.conf - Is it the case that a remote time server is not configured? + + +Run the following command to determine if the virt_sandbox_use_sys_admin SELinux boolean is disabled: +$ getsebool virt_sandbox_use_sys_admin +If properly configured, the output should show the following: +virt_sandbox_use_sys_admin --> off + Is it the case that virt_sandbox_use_sys_admin is not disabled? - - Check that AIDE is properly configured to protect the integrity of the -audit tools by running the following command: - -# sudo cat /etc/aide.conf | grep /usr/sbin/au - -/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512 - - - -/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512 - + + Verify file systems that are used for removable media are mounted with the "nosuid" option with the following command: -If AIDE is configured properly to protect the integrity of the audit tools, -all lines listed above will be returned from the command. +$ sudo more /etc/fstab -If one or more lines are missing, this is a finding. - Is it the case that integrity checks of the audit tools are missing or incomplete? - - - - Run the following command to verify that SSH client is configured to use 32 bytes of entropy: -grep SSH_USE_STRONG_RNG /etc/profile.d/cc-ssh-strong-rng.csh -It should return the following output: -setenv SSH_USE_STRONG_RNG 32. - Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - - - -Run the following command to determine if the mmap_low_allowed SELinux boolean is disabled: -$ getsebool mmap_low_allowed -If properly configured, the output should show the following: -mmap_low_allowed --> off - Is it the case that mmap_low_allowed is not disabled? +UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 + Is it the case that file system found in "/etc/fstab" refers to removable media and it does not have the "nosuid" option set? - + -Run the following command to determine if the tor_can_network_relay SELinux boolean is disabled: -$ getsebool tor_can_network_relay +Run the following command to determine if the mpd_use_nfs SELinux boolean is disabled: +$ getsebool mpd_use_nfs If properly configured, the output should show the following: -tor_can_network_relay --> off - Is it the case that tor_can_network_relay is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_X86_VSYSCALL_EMULATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STRICT_MODULE_RWX /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +mpd_use_nfs --> off + Is it the case that mpd_use_nfs is not disabled? - - -To check that the rsh service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rsh --list -Output should indicate the rsh service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rsh --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. + + Verify the TFTP daemon is configured to operate in secure mode. -rsh off +Check if a TFTP server is installed with the following command: -To check that the rsh socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rsh -Output should indicate the rsh socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rshdisabled +$ rpm -qa | grep tftp -Run the following command to verify rsh is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rsh -If the socket is not running the command will return the following output: -inactive +If a TFTP server is not installed, this is Not Applicable. -The socket will also be masked, to check that the rsh is masked, run the following command: -$ sudo systemctl show rsh | grep "LoadState\|UnitFileState" -If the socket is masked the command will return the following outputs: +If a TFTP server is installed, verify TFTP is configured by with +the -s option by running the following command: -LoadState=masked +grep "server_args" /etc/xinetd.d/tftp +server_args = -s + Is it the case that '"server_args" line does not have a "-s" option, and a subdirectory is not assigned'? + + + + Verify the nosuid option is configured for the /boot/efi mount point, + run the following command: + $ sudo mount | grep '\s/boot/efi\s' + . . . /boot/efi . . . nosuid . . . -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that the "/boot/efi" file system does not have the "nosuid" option set? - - To check that the saslauthd service is disabled in system boot configuration, + + To check that the atd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled saslauthd -Output should indicate the saslauthd service has either not been installed, +$ sudo systemctl is-enabled atd +Output should indicate the atd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled saslauthd disabled +$ sudo systemctl is-enabled atd disabled -Run the following command to verify saslauthd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active saslauthd +Run the following command to verify atd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active atd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the saslauthd is masked, run the following command: -$ sudo systemctl show saslauthd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the atd is masked, run the following command: +$ sudo systemctl show atd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "saslauthd" is loaded and not masked? - - - - To verify if SSLVerifyClient is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i sslverifyclient /etc/httpd/conf/httpd.conf -The command should return the following: -SSLVerifyClient require - Is it the case that it is not? - - - - -Run the following command to determine if the virt_read_qemu_ga_data SELinux boolean is disabled: -$ getsebool virt_read_qemu_ga_data -If properly configured, the output should show the following: -virt_read_qemu_ga_data --> off - Is it the case that virt_read_qemu_ga_data is not disabled? + Is it the case that the "atd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -delete_module system call, run the following command: -$ sudo grep "delete_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep + +-w -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the openshift_use_nfs SELinux boolean is disabled: -$ getsebool openshift_use_nfs -If properly configured, the output should show the following: -openshift_use_nfs --> off - Is it the case that openshift_use_nfs is not disabled? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine how many logs the system is configured to retain after rotation: +$ sudo grep num_logs /etc/audit/auditd.conf +num_logs = 5 + Is it the case that the system log file retention has not been properly configured? - - To check that the dhcpd service is disabled in system boot configuration, + + To check that the ypserv service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled dhcpd -Output should indicate the dhcpd service has either not been installed, +$ sudo systemctl is-enabled ypserv +Output should indicate the ypserv service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled dhcpd disabled +$ sudo systemctl is-enabled ypserv disabled -Run the following command to verify dhcpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active dhcpd +Run the following command to verify ypserv is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ypserv If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the dhcpd is masked, run the following command: -$ sudo systemctl show dhcpd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the ypserv is masked, run the following command: +$ sudo systemctl show ypserv | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "dhcpd" is loaded and not masked? + Is it the case that the "ypserv" is loaded and not masked? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pam_timestamp_check" command with the following command: - -$ sudo auditctl -l | grep pam_timestamp_check - --a always,exit -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pam_timestamp_check - Is it the case that the command does not return a line, or the line is commented out? + + To verify the LDAP client backend demands a valid certificate from the server in +remote LDAP access sessions, run the following command: +$ sudo grep ldap_tls_reqcert /etc/sssd/sssd.conf +The output should return the following: +ldap_tls_reqcert = demand + Is it the case that the TLS reqcert is not set to demand? - - To verify that each web content directory has an index.html file, -run the following command: -$ sudo find `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` -name index.html -The output should return an index.html file for every -DocumentRoot that is set. + + To verify if ErrorLog is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i errorlog /etc/httpd/conf/httpd.conf +The output should return the following: +ErrorLog "logs/error_log" Is it the case that it is not? - - Run the following command to determine if the tar package is installed: $ rpm -q tar - Is it the case that the package is not installed? + + To verify that is configured +as the smart card driver, run the following command: +$ grep force_card_driver /etc/opensc.conf +The output should return something similar to: +force_card_driver = ; + Is it the case that the smart card driver is not configured correctly? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd" with the following command: - -$ sudo auditctl -l | grep -E '(/etc/passwd)' - --w /etc/passwd -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + + +Run the following command to determine if the collectd_tcp_network_connect SELinux boolean is disabled: +$ getsebool collectd_tcp_network_connect +If properly configured, the output should show the following: +collectd_tcp_network_connect --> off + Is it the case that collectd_tcp_network_connect is not disabled? - - To determine if the system is configured to audit calls to the -fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine how the SSH daemon's PermitRootLogin option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config + +If a line indicating prohibit-password is returned, then the required value is set. + Is it the case that it is commented out or not configured properly? - - To check the permissions of /etc/http/conf/*, -run the command: -$ ls -l /etc/http/conf/* -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/http/conf/* does not have unix mode -rw-r-----? + + +Run the following command to determine if the cobbler_anon_write SELinux boolean is disabled: +$ getsebool cobbler_anon_write +If properly configured, the output should show the following: +cobbler_anon_write --> off + Is it the case that cobbler_anon_write is not disabled? - - -If the system is configured to prevent the loading of the firewire-core kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + Verify it by running the following command: +$ stat -c "%n %G" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules -These lines can also instruct the module loading system to ignore the firewire-core kernel module via blacklist keyword. +/sbin/auditctl root +/sbin/aureport root +/sbin/ausearch root +/sbin/autrace root +/sbin/auditd root +/sbin/audispd root +/sbin/augenrules root -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r firewire-core /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - The runtime status of the fs.protected_hardlinks kernel parameter can be queried -by running the following command: -$ sysctl fs.protected_hardlinks -1. - Is it the case that the correct value is not returned? - - - - -If the system is configured to prevent the loading of the rds kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. +If the command does not return all the above lines, the missing ones +need to be added. -These lines can also instruct the module loading system to ignore the rds kernel module via blacklist keyword. +Run the following command to correct the permissions of the missing +entries: +$ sudo chown :root [audit_tool] -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r rds /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? +Replace "[audit_tool]" with each audit tool not group-owned by root. + Is it the case that ? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + -Run the following command to determine if the httpd_dbus_avahi SELinux boolean is disabled: -$ getsebool httpd_dbus_avahi +Run the following command to determine if the httpd_can_network_connect_db SELinux boolean is disabled: +$ getsebool httpd_can_network_connect_db If properly configured, the output should show the following: -httpd_dbus_avahi --> off - Is it the case that httpd_dbus_avahi is not disabled? +httpd_can_network_connect_db --> off + Is it the case that httpd_can_network_connect_db is not disabled? - - -Run the following command to determine if the xserver_clients_write_xshm SELinux boolean is disabled: -$ getsebool xserver_clients_write_xshm -If properly configured, the output should show the following: -xserver_clients_write_xshm --> off - Is it the case that xserver_clients_write_xshm is not disabled? + + The runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra_rtr_pref +0. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the collectd_tcp_network_connect SELinux boolean is disabled: -$ getsebool collectd_tcp_network_connect -If properly configured, the output should show the following: -collectd_tcp_network_connect --> off - Is it the case that collectd_tcp_network_connect is not disabled? + + Inspect the system to determine if intrusion detection software has been installed. +Verify this intrusion detection software is active. + Is it the case that no host-based intrusion detection tools are installed? - - To check the ownership of /etc/crontab, + + Verify the nosuid option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . nosuid . . . + + Is it the case that the "/var/tmp" file system does not have the "nosuid" option set? + + + + To check the permissions of /etc/passwd, run the command: -$ ls -lL /etc/crontab -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/crontab does not have an owner of root? +$ ls -l /etc/passwd +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/passwd does not have unix mode -rw-r--r--? - - To check that the vsftpd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled vsftpd -Output should indicate the vsftpd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled vsftpd disabled - -Run the following command to verify vsftpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active vsftpd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the vsftpd is masked, run the following command: -$ sudo systemctl show vsftpd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: + + Check whether the maximum time period for existing passwords is restricted to days with the following commands: -LoadState=masked +$ sudo awk -F: '$5 > 60 {print $1 " " $5}' /etc/shadow -UnitFileState=masked - Is it the case that the "vsftpd" is loaded and not masked? +$ sudo awk -F: '$5 <= 0 {print $1 " " $5}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? - - To ensure there are no read-write users, run the following command: -$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep 'rwuser' -There should be no output. - Is it the case that there are users who can write to SNMP values? + + To determine if requiretty has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\brequiretty\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that requiretty is not enabled in sudo? - - To determine if the system is configured to audit successful calls -to the renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the noauto option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . noauto . . . - Is it the case that no line is returned? + Is it the case that the "/boot" file system does not have the "noauto" option set? - - To check on the age of McAfee virus definition files, run the following command: -$ sudo cd /opt/NAI/LinuxShield/engine/dat -$ sudo ls -la avvscan.dat avvnames.dat avvclean.dat - Is it the case that signatures are out of date? + + +Run the following command to determine if the conman_can_network SELinux boolean is disabled: +$ getsebool conman_can_network +If properly configured, the output should show the following: +conman_can_network --> off + Is it the case that conman_can_network is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open_by_handle_at system call with O_CREAT flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open_by_handle_at /etc/audit/rules.d + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: -$ sudo grep open_by_handle_at /etc/audit/audit.rules +$ sudo grep disk_full_action /etc/audit/auditd.conf -The output should be the following: +disk_full_action = --a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. + Is it the case that there is no evidence of appropriate action? - - Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services - Is it the case that the iptables-services package is installed? + + To check the permissions of /etc/shells, +run the command: +$ ls -l /etc/shells +If properly configured, the output should indicate the following permissions: +0644 + Is it the case that /etc/shells does not have unix mode 0644? - - - -Run the following command to determine the current status of the -iptables service: -$ sudo systemctl is-active iptables -If the service is running, it should return the following: active - Is it the case that ? + + To verify that McAfee Runtime Libraries (MFErt) and Linux Agent (MFEcma) +are installed, run the following command(s): +$ rpm -q MFEcma +$ rpm -q MFErt + Is it the case that the HBSS HIPS module is not installed? - - To determine if the system is configured to audit calls to the -fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra_defrtr +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Check to see if Online Certificate Status Protocol (OCSP) -is enabled and using the proper digest value on the system with the following command: -$ sudo grep certificate_verification /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf | grep -v "^#" -If configured properly, output should look like - - certificate_verification = ocsp_dgst= + + Verify that rules for unsuccessful calls of the open_by_handle_at syscall are in the order shown below. - Is it the case that certificate_verification in sssd is not configured? - - - - To check that the rhnsd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rhnsd -Output should indicate the rhnsd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rhnsd disabled + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. -Run the following command to verify rhnsd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rhnsd + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -If the service is not running the command will return the following output: -inactive + If the system is 64 bit then also add the following lines: -The service will also be masked, to check that the rhnsd is masked, run the following command: -$ sudo systemctl show rhnsd | grep "LoadState\|UnitFileState" + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_BUG_ON_DATA_CORRUPTION /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Run the following command to determine if the bind package is installed: +$ rpm -q bind + Is it the case that the package is installed? + + + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow" with the following command: -If the service is masked the command will return the following outputs: +$ sudo auditctl -l | grep -E '(/etc/gshadow)' -LoadState=masked +-w /etc/gshadow -p wa -k identity -UnitFileState=masked - Is it the case that the "rhnsd" is loaded and not masked? +If the command does not return a line, or the line is commented out, this is a finding. + Is it the case that the system is not configured to audit account changes? - + -Run the following command to determine if the selinuxuser_postgresql_connect_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_postgresql_connect_enabled +Run the following command to determine if the smartmon_3ware SELinux boolean is disabled: +$ getsebool smartmon_3ware If properly configured, the output should show the following: -selinuxuser_postgresql_connect_enabled --> off - Is it the case that selinuxuser_postgresql_connect_enabled is not disabled? +smartmon_3ware --> off + Is it the case that smartmon_3ware is not disabled? - - To determine how the SSH daemon's X11UseLocalhost option is set, run the following command: - -$ sudo grep -i X11UseLocalhost /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - Is it the case that the display proxy is listening on wildcard address? + + Run the following command to determine if the net-snmp package is installed: +$ rpm -q net-snmp + Is it the case that the package is installed? - - The file /etc/at.deny should not exist. -This can be checked by running the following - -stat /etc/at.deny - -and the output should be - -stat: cannot stat `/etc/at.deny': No such file or directory - - Is it the case that the file /etc/at.deny exists? + + +Run the following command to determine if the cron_userdomain_transition SELinux boolean is enabled: +$ getsebool cron_userdomain_transition +If properly configured, the output should show the following: +cron_userdomain_transition --> on + Is it the case that cron_userdomain_transition is not enabled? - - To check that the smb service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled smb -Output should indicate the smb service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled smb disabled - -Run the following command to verify smb is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active smb - -If the service is not running the command will return the following output: -inactive + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING_NO_SANITY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify the noexec option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . noexec . . . -The service will also be masked, to check that the smb is masked, run the following command: -$ sudo systemctl show smb | grep "LoadState\|UnitFileState" + Is it the case that the "/var/log/audit" file system does not have the "noexec" option set? + + + + Make sure that the kernel is not disabling SMEP with the following +commands. +grep -q nosmep /boot/config-`uname -r` +If the command returns a line, it means that SMEP is being disabled. + Is it the case that the kernel is configured to disable SMEP? + + + + Verify that yum verifies the signature of packages from a repository prior to install with the following command: -If the service is masked the command will return the following outputs: +$ grep gpgcheck /etc/yum.conf -LoadState=masked +gpgcheck=1 -UnitFileState=masked - Is it the case that the "smb" is loaded and not masked? +If "gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. + Is it the case that there is no process to validate certificates that is approved by the organization? - - To ensure that users cannot change how long until the screensaver locks, run the following: -$ grep lock-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled - Is it the case that screensaver locking is not locked? + + Verify the audit tools are protected from unauthorized access, deletion, or modification by checking the permissive mode. + +Check the octal permission of each audit tool by running the following command: + +$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + Is it the case that any of these files have more permissive permissions than 0755? - - Run the following command to see if there are some keytabs -that would potentially allow the use of Kerberos by system daemons. -$ ls -la /etc/*.keytab -The expected result is -ls: cannot access '/etc/*.keytab': No such file or directory - Is it the case that a keytab file is present on the system? + + The ypbind package can be removed with the following command: $ sudo yum erase ypbind + Is it the case that ? - - The runtime status of the net.ipv6.conf.all.forwarding kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.forwarding -0. -The ability to forward packets is only appropriate for routers. - Is it the case that IP forwarding value is "1" and the system is not router? + + To verify the system is not configured to use a boot loader on removable media, +check that the grub configuration file has the set root command in each menu +entry with the following commands: +$ sudo grep -cw menuentry /boot/efi/EFI/redhat/grub.cfg +Note that the -c option for the grep command will print +only the count of menuentry occurrences. This number should match +the number of occurrences reported by the following command: +$ sudo grep "set root='hd0" /boot/efi/EFI/redhat/grub.cfg +The output should return something similar to: +set root='hd0,msdos1' +usb0, cd, fd0, etc. are some examples of removeable +media which should not exist in the lines: +set root='hd0,msdos1' + Is it the case that it is not? - - To check the ownership of /etc/gshadow-, + + To check the ownership of /etc/ssh/*_key, run the command: -$ ls -lL /etc/gshadow- +$ ls -lL /etc/ssh/*_key If properly configured, the output should indicate the following owner: root - Is it the case that /etc/gshadow- does not have an owner of root? + Is it the case that /etc/ssh/*_key does not have an owner of root? - - Inspect the file /etc/sysconfig/iptables to determine -the default policy for the INPUT chain. It should be set to DROP: -$ sudo grep ":INPUT" /etc/sysconfig/iptables - Is it the case that the default policy for the INPUT chain is not set to DROP? + + Make sure that the kernel is not disabling SMAP with the following +commands. +grep -q nosmap /boot/config-`uname -r` +If the command returns a line, it means that SMAP is being disabled. + Is it the case that the kernel is configured to disable SMAP? @@ -381525,168 +381907,139 @@ UnitFileState=masked Is it the case that the "kdump" is loaded and not masked? - + - -Run the following command to determine the current status of the -ntp service: -$ sudo systemctl is-active ntp -If the service is running, it should return the following: active - Is it the case that ? - - - - To verify all files and directories in interactive user home directory are -group-owned by a group the user is a member of, run the -following command: -$ sudo ls -lLR /home/USER - Is it the case that the group ownership is incorrect? - - - - To check the group ownership of /etc/ssh/*_key, -run the command: -$ ls -lL /etc/ssh/*_key -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/*_key does not have a group owner of root? +Run the following command to determine if the httpd_builtin_scripting SELinux boolean is disabled: +$ getsebool httpd_builtin_scripting +If properly configured, the output should show the following: +httpd_builtin_scripting --> off + Is it the case that httpd_builtin_scripting is not disabled? - + -Run the following command to determine if the daemons_use_tcp_wrapper SELinux boolean is disabled: -$ getsebool daemons_use_tcp_wrapper +Run the following command to determine if the httpd_can_connect_ftp SELinux boolean is disabled: +$ getsebool httpd_can_connect_ftp If properly configured, the output should show the following: -daemons_use_tcp_wrapper --> off - Is it the case that daemons_use_tcp_wrapper is not disabled? +httpd_can_connect_ftp --> off + Is it the case that httpd_can_connect_ftp is not disabled? - - To check that the zebra service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled zebra -Output should indicate the zebra service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled zebra disabled - -Run the following command to verify zebra is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active zebra - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the zebra is masked, run the following command: -$ sudo systemctl show zebra | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "newgrp" command with the following command: -LoadState=masked +$ sudo auditctl -l | grep newgrp -UnitFileState=masked - Is it the case that the "zebra" is loaded and not masked? +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -k privileged-newgrp + Is it the case that the command does not return a line, or the line is commented out? - - Verify that a separate file system/partition has been created for /var/log with the following command: - -$ mountpoint /var/log - - Is it the case that "/var/log is not a mountpoint" is returned? + + To check the ownership of /etc/cron.d, +run the command: +$ ls -lL /etc/cron.d +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.d does not have an owner of root? - - If the system does not have SELinux enabled and enforcing a targeted policy, or if the -pam_faillock.so module is not configured for use, this requirement is not applicable. - -Verify the location of the non-default tally directory for the pam_faillock.so module with -the following command: - -$ sudo grep -w dir /etc/security/faillock.conf - -dir = /var/log/faillock - -Check the security context type of the non-default tally directory with the following command: - -$ sudo ls -Zd /var/log/faillock - -unconfined_u:object_r:faillog_t:s0 /var/log/faillock - Is it the case that the security context type of the non-default tally directory is not "faillog_t"? + + +Run the following command to determine if the authlogin_nsswitch_use_ldap SELinux boolean is disabled: +$ getsebool authlogin_nsswitch_use_ldap +If properly configured, the output should show the following: +authlogin_nsswitch_use_ldap --> off + Is it the case that authlogin_nsswitch_use_ldap is not disabled? - - The runtime status of the net.ipv4.conf.default.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.accept_source_route -0. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the prosody_bind_http_port SELinux boolean is disabled: +$ getsebool prosody_bind_http_port +If properly configured, the output should show the following: +prosody_bind_http_port --> off + Is it the case that prosody_bind_http_port is not disabled? - + -Run the following command to determine if the git_session_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool git_session_bind_all_unreserved_ports +Run the following command to determine if the cluster_manage_all_files SELinux boolean is disabled: +$ getsebool cluster_manage_all_files If properly configured, the output should show the following: -git_session_bind_all_unreserved_ports --> off - Is it the case that git_session_bind_all_unreserved_ports is not disabled? +cluster_manage_all_files --> off + Is it the case that cluster_manage_all_files is not disabled? - - To check the ownership of /etc/issue, + + Verify the value of the "difok" option in "/etc/security/pwquality.conf" with the following command: + +$ sudo grep difok /etc/security/pwquality.conf + +difok = + Is it the case that the value of "difok" is set to less than "<sub idref="var_password_pam_difok" />", or is commented out? + + + + To check the ownership of /etc/cron.weekly, run the command: -$ ls -lL /etc/issue +$ ls -lL /etc/cron.weekly If properly configured, the output should indicate the following owner: root - Is it the case that /etc/issue does not have an owner of root? - - - - Run the following command to determine if the talk-server package is installed: -$ rpm -q talk-server - Is it the case that the package is installed? + Is it the case that /etc/cron.weekly does not have an owner of root? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_HASH /boot/config.* + $ grep CONFIG_REFCOUNT_FULL /boot/config.* - For each kernel installed, a line with value "" should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Find the list of alias maps used by the Postfix mail server: -$ sudo postconf alias_maps -Query the Postfix alias maps for an alias for the postmaster user: -$ sudo postmap -q postmaster hash:/etc/aliases -The output should return root. - Is it the case that the alias is not set or is not root? + + To ensure that system location tracking is not active, run the following command: +$ gsettings get org.gnome.system.location enabled +$ gsettings get org.gnome.clocks geolocation +If properly configured, the output should be false. +To ensure that users cannot enable system location tracking, run the following: +$ grep location /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/system/location/enabled and /org/gnome/clocks/geolocation. + Is it the case that geolocation is enabled and not disabled? - - Verify Red Hat Enterprise Linux 8 disables the chrony daemon from acting as a server with the following command: -$ grep -w port /etc/chrony.conf -port 0 - Is it the case that the "port" option is not set to "0", is commented out, or is missing? + + Verify that temporary accounts have been provisioned with an expiration date +of 72 hours. For every temporary account, run the following command to +obtain its account aging and expiration information: +$ sudo chage -l temporary_account_name +Verify each of these accounts has an expiration date set within 72 hours or +as documented. + Is it the case that any temporary accounts have no expiration date set or do not expire within 72 hours? - + + Run the following command to determine if the nss-tools package is installed: $ rpm -q nss-tools + Is it the case that the package is not installed? + + + -Run the following command to determine if the abrt_handle_event SELinux boolean is disabled: -$ getsebool abrt_handle_event +Run the following command to determine if the ssh_keysign SELinux boolean is disabled: +$ getsebool ssh_keysign If properly configured, the output should show the following: -abrt_handle_event --> off - Is it the case that abrt_handle_event is not disabled? +ssh_keysign --> off + Is it the case that ssh_keysign is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RANDOMIZE_MEMORY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/gshadow, +run the command: +$ ls -l /etc/gshadow +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/gshadow does not have unix mode ----------? @@ -381709,388 +382062,468 @@ The output has to be exactly as follows: Is it the case that the file does not exist or the content differs? - - To determine if the system is configured to audit calls to the -settimeofday system call, run the following command: -$ sudo grep "settimeofday" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check that the snmpd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled snmpd +Output should indicate the snmpd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled snmpd disabled - Is it the case that no line is returned? - - - - Verify it by running the following command: -$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules +Run the following command to verify snmpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active snmpd -/sbin/auditctl 755 -/sbin/aureport 755 -/sbin/ausearch 755 -/sbin/autrace 755 -/sbin/auditd 755 -/sbin/audispd 755 -/sbin/augenrules 755 +If the service is not running the command will return the following output: +inactive +The service will also be masked, to check that the snmpd is masked, run the following command: +$ sudo systemctl show snmpd | grep "LoadState\|UnitFileState" -If the command does not return all the above lines, the missing ones -need to be added. +If the service is masked the command will return the following outputs: -Run the following command to correct the permissions of the missing -entries: -$ sudo chmod 0755 [audit_tool] +LoadState=masked -Replace "[audit_tool]" with the audit tool that does not have the -correct permissions. - Is it the case that ? - - - - Run the following command to determine if the telnet-server package is installed: -$ rpm -q telnet-server - Is it the case that the package is installed? - - - - Run the following command to determine if the openldap-clients package is installed: -$ rpm -q openldap-clients - Is it the case that the package is installed? +UnitFileState=masked + Is it the case that the "snmpd" is loaded and not masked? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To obtain a listing of all users, their UIDs, and their shells, run the command: +$ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd +Identify the system accounts from this listing. These will primarily be the accounts with UID +numbers less than 1000, other than root. + Is it the case that any system account other than root has a login shell? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-3-access-success.rules -The output has to be exactly as follows: -## Successful file access (any other opens) This has to go last. -## These next two are likely to result in a whole lot of events --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access - Is it the case that the file does not exist or the content differs? + + To determine if the users are allowed to run commands as root, run the following commands: +$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*[^\(\s]' /etc/sudoers /etc/sudoers.d/ +and +$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*\([\w\s]*\b(root|ALL)\b[\w\s]*\)' /etc/sudoers /etc/sudoers.d/ +Both commands should return no output. + Is it the case that /etc/sudoers file contains rules that allow non-root users to run commands as root? - - To determine how the SSH daemon's X11Forwarding option is set, run the following command: - -$ sudo grep -i X11Forwarding /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? + + +Run the following command to determine if the cron_can_relabel SELinux boolean is disabled: +$ getsebool cron_can_relabel +If properly configured, the output should show the following: +cron_can_relabel --> off + Is it the case that cron_can_relabel is not disabled? - - Verify the pam_faillock.so module is present in the "/etc/pam.d/password-auth" file: + + Only strong KEX algorithms should be used. To verify that only strong +KexAlgorithms are in use, run the following command: +$ sudo grep -i kexalgorithms /etc/ssh/sshd_config +The output should contain only those KexAlgorithms which are strong, namely, -$ sudo grep pam_faillock.so /etc/pam.d/password-auth - -auth required pam_faillock.so preauth -auth required pam_faillock.so authfail -account required pam_faillock.so - Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/password-auth" file with the "preauth" line listed before pam_unix.so? + Is it the case that KexAlgorithms option is commented out or not using strong hash algorithms? - - Run the following command and verify that time sources are only configured with server directive: -# grep -E "^(server|pool)" /etc/chrony.conf -A line with the appropriate server should be returned, any line returned starting with pool is a finding. - Is it the case that an authoritative remote time server is not configured or configured with pool directive? + + To check the permissions of /etc/gshadow-, +run the command: +$ ls -l /etc/gshadow- +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/gshadow- does not have unix mode ----------? - + -Run the following command to determine if the sge_use_nfs SELinux boolean is disabled: -$ getsebool sge_use_nfs +Run the following command to determine if the git_cgi_enable_homedirs SELinux boolean is disabled: +$ getsebool git_cgi_enable_homedirs If properly configured, the output should show the following: -sge_use_nfs --> off - Is it the case that sge_use_nfs is not disabled? +git_cgi_enable_homedirs --> off + Is it the case that git_cgi_enable_homedirs is not disabled? - - To determine if the system is configured to audit successful calls -to the rename system call, run the following command: -$ sudo grep "rename" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pt_chown" command with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep pt_chown + +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pt_chown + Is it the case that the command does not return a line, or the line is commented out? - - To check that the quota_nld service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled quota_nld -Output should indicate the quota_nld service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled quota_nld disabled + + Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: -Run the following command to verify quota_nld is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active quota_nld +$ sudo grep -w admin_space_left /etc/audit/auditd.conf -If the service is not running the command will return the following output: -inactive +admin_space_left = % -The service will also be masked, to check that the quota_nld is masked, run the following command: -$ sudo systemctl show quota_nld | grep "LoadState\|UnitFileState" +If the value of the "admin_space_left" keyword is not set to % of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is taking action if the allocated storage is about to reach capacity. + Is it the case that the "admin_space_left" value is not configured to the correct value? + + + + To verify that McAfee VirusScan Enterprise for Linux is installed +and running, run the following command(s): +$ sudo systemctl status nails +$ rpm -q McAfeeVSEForLinux + Is it the case that virus scanning software is not installed or running? + + + + Verify the audit log directories have a correct mode or less permissive mode. -If the service is masked the command will return the following outputs: +Find the location of the audit logs: -LoadState=masked +$ sudo grep "^log_file" /etc/audit/auditd.conf -UnitFileState=masked - Is it the case that the "quota_nld" is loaded and not masked? - - - - To determine how the SSH daemon's PrintLastLog option is set, run the following command: -$ sudo grep -i PrintLastLog /etc/ssh/sshd_config -If a line indicating yes is returned, then the required value is set. +Run the following command to check the mode of the system audit logs: - Is it the case that the required value is not set? - - - - To verify all accounts have unique names, run the following command: -$ sudo getent passwd | awk -F: '{ print $1}' | uniq -d -No output should be returned. - Is it the case that a line is returned? +$ sudo stat -c "%a %n" [audit_log_directory] + +Replace "[audit_log_directory]" to the correct audit log directory path, by default this location is "/var/log/audit". + + +The correct permissions are 0700 + Is it the case that audit logs have a more permissive mode? - + -Run the following command to determine if the ftpd_connect_db SELinux boolean is disabled: -$ getsebool ftpd_connect_db +Run the following command to determine if the gitosis_can_sendmail SELinux boolean is disabled: +$ getsebool gitosis_can_sendmail If properly configured, the output should show the following: -ftpd_connect_db --> off - Is it the case that ftpd_connect_db is not disabled? +gitosis_can_sendmail --> off + Is it the case that gitosis_can_sendmail is not disabled? - - To verify that SSSD is configured for PAM services, run the following command: -$ sudo grep services /etc/sssd/sssd.conf -If configured properly, output should be similar to -services = pam - Is it the case that it does not exist or 'pam' is not added to the 'services' option under the 'sssd' section? + + To verify that USB hubs will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +One of the output lines should be +allow with-interface match-all { 09:00:* } + Is it the case that USB devices of class 9 are not authorized? - - To determine if the system is configured to audit unsuccessful calls -to the fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that the Dracut FIPS module is enabled, run the following command: +grep "add_dracutmodules" /etc/dracut.conf.d/40-fips.conf +The output should look like this: +add_dracutmodules+=" fips " + Is it the case that the Dracut FIPS module is not enabled? + + + + The runtime status of the net.ipv4.conf.all.send_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.send_redirects +0. + + Is it the case that the correct value is not returned? + + + + +Run the following command to determine if the virt_use_usb SELinux boolean is disabled: +$ getsebool virt_use_usb +If properly configured, the output should show the following: +virt_use_usb --> off + Is it the case that virt_use_usb is not disabled? + + + + +If the system is configured to prevent the loading of the firewire-core kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the firewire-core kernel module via blacklist keyword. +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r firewire-core /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Verify users are provided with feedback on when account accesses last occurred with the following command: + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLAB_FREELIST_HARDENED /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postdrop" command with the following command: -$ sudo grep pam_lastlog /etc/pam.d/postlogin +$ sudo auditctl -l | grep postdrop -session [default=1] pam_lastlog.so showfailed - Is it the case that "pam_lastlog.so" is not properly configured in "/etc/pam.d/postlogin" file? +-a always,exit -F path=/usr/bin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postdrop + Is it the case that the command does not return a line, or the line is commented out? - - Inspect /etc/audit/audisp-remote.conf and locate the following line to -determine if the system is configured to either send to syslog, switch to single user mode, -or halt when the disk is full: -$ sudo grep -i disk_full_action /etc/audit/audisp-remote.conf -The output should return something similar to: -disk_full_action = single -Acceptable values also include syslog and halt. - Is it the case that the system is not configured to switch to single user mode for corrective action? + + +Run the following command to determine if the xserver_clients_write_xshm SELinux boolean is disabled: +$ getsebool xserver_clients_write_xshm +If properly configured, the output should show the following: +xserver_clients_write_xshm --> off + Is it the case that xserver_clients_write_xshm is not disabled? - - Run the following command to determine if the cronie-anacron package is installed: -$ rpm -q cronie-anacron - Is it the case that the package is installed? + + To verify that FIPS mode is enabled properly, run the following command: +fips-mode-setup --check +The output should contain the following: +FIPS mode is enabled. +To verify that the cryptographic policy has been configured correctly, run the +following command: +$ update-crypto-policies --show +The output should return . + Is it the case that FIPS mode is not enabled? - + -Run the following command to determine if the cron_system_cronjob_use_shares SELinux boolean is disabled: -$ getsebool cron_system_cronjob_use_shares +Run the following command to determine if the xdm_write_home SELinux boolean is disabled: +$ getsebool xdm_write_home If properly configured, the output should show the following: -cron_system_cronjob_use_shares --> off - Is it the case that cron_system_cronjob_use_shares is not disabled? +xdm_write_home --> off + Is it the case that xdm_write_home is not disabled? - + -Run the following command to determine if the selinuxuser_rw_noexattrfile SELinux boolean is disabled: -$ getsebool selinuxuser_rw_noexattrfile +Run the following command to determine if the nis_enabled SELinux boolean is disabled: +$ getsebool nis_enabled If properly configured, the output should show the following: -selinuxuser_rw_noexattrfile --> off - Is it the case that selinuxuser_rw_noexattrfile is not disabled? +nis_enabled --> off + Is it the case that nis_enabled is not disabled? - - Inspect /proc/cmdline for any instances of selinux=0 -in the kernel boot arguments. Presence of selinux=0 indicates -that SELinux is disabled at boot time. - -If it would be disabled anywhere, make sure to enable it via a -MachineConfig object. - Is it the case that SELinux is disabled at boot time? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLUB_DEBUG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + + Run the following command to determine if the libpwquality package is installed: +$ rpm -q libpwquality + Is it the case that the package is not installed? + + + -Run the following command to determine if the xguest_exec_content SELinux boolean is disabled: -$ getsebool xguest_exec_content +Run the following command to determine if the condor_tcp_network_connect SELinux boolean is disabled: +$ getsebool condor_tcp_network_connect If properly configured, the output should show the following: -xguest_exec_content --> off - Is it the case that xguest_exec_content is not disabled? +condor_tcp_network_connect --> off + Is it the case that condor_tcp_network_connect is not disabled? - - To determine if the system is configured to audit successful calls -to the fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit.* + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + + To determine if the system is configured to audit changes to its SELinux +configuration files, run the following command: +$ sudo auditctl -l | grep "dir=/etc/selinux" +If the system is configured to watch for changes to its SELinux +configuration, a line should be returned (including +perm=wa indicating permissions that are watched). + Is it the case that the system is not configured to audit attempts to change the MAC policy? + + + + To ensure disable and restart on the login screen are disabled, run the following command: +$ grep disable-restart-buttons /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot enable disable and restart on the login screen, run the following: +$ grep disable-restart-buttons /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/disable-restart-buttons + Is it the case that disable-restart-buttons has not been configured or is not disabled? + + + -Run the following command to determine if the openvpn_run_unconfined SELinux boolean is disabled: -$ getsebool openvpn_run_unconfined +Run the following command to determine if the login_console_enabled SELinux boolean is enabled: +$ getsebool login_console_enabled If properly configured, the output should show the following: -openvpn_run_unconfined --> off - Is it the case that openvpn_run_unconfined is not disabled? +login_console_enabled --> on + Is it the case that login_console_enabled is not enabled? - + + To check if UsePrivilegeSeparation is enabled or set correctly, run the +following command: +$ sudo grep UsePrivilegeSeparation /etc/ssh/sshd_config +If configured properly, output should be . + Is it the case that it is commented out or is not enabled? + + + -To check that the telnet service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig telnet --list -Output should indicate the telnet service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig telnet --list +Run the following command to determine if the cluster_can_network_connect SELinux boolean is disabled: +$ getsebool cluster_can_network_connect +If properly configured, the output should show the following: +cluster_can_network_connect --> off + Is it the case that cluster_can_network_connect is not disabled? + + + + Verify the Red Hat Enterprise Linux 8 "fapolicyd" employs a deny-all, permit-by-exception policy. -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. +Check that "fapolicyd" is in enforcement mode with the following command: -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. +$ sudo grep permissive /etc/fapolicyd/fapolicyd.conf -telnet off +permissive = 0 -To check that the telnet socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled telnet -Output should indicate the telnet socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled telnetdisabled +Check that fapolicyd employs a deny-all policy on system mounts with the following commands: -Run the following command to verify telnet is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active telnet +For RHEL 8.5 systems and older: +$ sudo tail /etc/fapolicyd/fapolicyd.rules -If the socket is not running the command will return the following output: -inactive +For RHEL 8.6 systems and newer: +$ sudo tail /etc/fapolicyd/compiled.rules -The socket will also be masked, to check that the telnet is masked, run the following command: -$ sudo systemctl show telnet | grep "LoadState\|UnitFileState" +allow exe=/usr/bin/python3.7 : ftype=text/x-python +deny_audit perm=any pattern=ld_so : all +deny perm=any all : all + Is it the case that fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception policy? + + + + Ensure that Red Hat Enterprise Linux 8 verifies correct operation of security functions. -If the socket is masked the command will return the following outputs: +Check if "SELinux" is active and in "" mode with the following command: -LoadState=masked +$ sudo getenforce -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that SELINUX is not set to enforcing? - - To determine if the system is configured to make login UIDs immutable, run -one of the following commands. -If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), run the following: -sudo grep immutable /etc/audit/rules.d/*.rules -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, run the following command: -sudo grep immutable /etc/audit/audit.rules -The following line should be returned: ---loginuid-immutable - Is it the case that the system is not configured to make login UIDs immutable? + + Verify Red Hat Enterprise Linux 8 enforces 24 hours/1 day as the minimum password lifetime for new user accounts. + +Check for the value of "PASS_MIN_DAYS" in "/etc/login.defs" with the following command: + +$ grep -i pass_min_days /etc/login.defs + +PASS_MIN_DAYS + Is it the case that the "PASS_MIN_DAYS" parameter value is not "<sub idref="var_accounts_minimum_age_login_defs" />" or greater, or is commented out? - - To determine that periodic AIDE execution has been scheduled, run the following command: - -$ grep aide /etc/crontab -The output should return something similar to the following: -05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost -The email address that the notifications are sent to can be changed by overriding -. - Is it the case that AIDE has not been configured or has not been configured to notify personnel of scan details? + + +Run the following command to determine if the unconfined_mozilla_plugin_transition SELinux boolean is enabled: +$ getsebool unconfined_mozilla_plugin_transition +If properly configured, the output should show the following: +unconfined_mozilla_plugin_transition --> on + Is it the case that unconfined_mozilla_plugin_transition is not enabled? - - To determine whether OpenSSL is wrapped by a shell function that ensures that every invocation -uses a SP800-90A compliant entropy source, -make sure that the /etc/profile.d/openssl-rand.sh file contents exactly match those -that are included in the rule's description. - Is it the case that there is no <tt>/etc/profile.d/openssl-rand.sh</tt> file, or its contents don't match those in the description? + + To verify if the mod_perl is installed, run the following command: +$ rpm -qa | grep mod_perl +If the mod_perl module is installed, verify that PerlSwitches -T +is enabled in /etc/httpd/conf.d/perl.conf by running the following +command: +$ grep -i "PerlSwitches -T" /etc/httpd/conf.d/perl.conf +The output should return uncommented: +PerlSwitches -T + Is it the case that it is not? - - Verify the nodev option is configured for the /dev/shm mount point, + + Inspect /etc/login.defs and ensure that if eihter +SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS +are set, they must have the minimum value of 5000. + Is it the case that it does not? + + + + Run the following command to determine if the scap-security-guide package is installed: $ rpm -q scap-security-guide + Is it the case that the package is not installed? + + + + To check the group ownership of /etc/group-, +run the command: +$ ls -lL /etc/group- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/group- does not have a group owner of root? + + + + To determine if NOPASSWD has been configured for sudo, run the following command: +$ sudo grep -ri nopasswd /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that nopasswd is specified in the sudo config files? + + + + Verify the noexec option is configured for the /home mount point, run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . nodev . . . + $ sudo mount | grep '\s/home\s' + . . . /home . . . noexec . . . - Is it the case that the "/dev/shm" file system does not have the "nodev" option set? + Is it the case that the "/home" file system does not have the "noexec" option set? - - To check that the abrtd service is disabled in system boot configuration, + + To check that the qpidd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled abrtd -Output should indicate the abrtd service has either not been installed, +$ sudo systemctl is-enabled qpidd +Output should indicate the qpidd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled abrtd disabled +$ sudo systemctl is-enabled qpidd disabled -Run the following command to verify abrtd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active abrtd +Run the following command to verify qpidd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active qpidd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the abrtd is masked, run the following command: -$ sudo systemctl show abrtd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the qpidd is masked, run the following command: +$ sudo systemctl show qpidd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "abrtd" is loaded and not masked? + Is it the case that the "qpidd" is loaded and not masked? - - To determine if logfile has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults\s*\blogfile\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that logfile is not enabled in sudo? + + To check the group ownership of /etc/shadow-, +run the command: +$ ls -lL /etc/shadow- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/shadow- does not have a group owner of root? - - To check for legacy lines in /etc/passwd, run the following command: - grep '^\+' /etc/passwd -The command should not return any output. - Is it the case that the file contains legacy lines? + + To verify the local initialization files of all local interactive users are group- +owned by the appropriate user, inspect the primary group of the respective +users in /etc/passwd and verify all initialization files under the +respective users home directory. Check the group owner of all local interactive users +initialization files. + Is it the case that they are not? @@ -382102,1225 +382535,1557 @@ The output should return the following: Is it the case that is not configured? - - To check that the atd service is disabled in system boot configuration, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes page_poison=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*page_poison=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*page_poison=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'page_poison=1' +The command should not return any output. + Is it the case that page allocator poisoning is not enabled? + + + + To check that the cpupower service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled atd -Output should indicate the atd service has either not been installed, +$ sudo systemctl is-enabled cpupower +Output should indicate the cpupower service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled atd disabled +$ sudo systemctl is-enabled cpupower disabled -Run the following command to verify atd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active atd +Run the following command to verify cpupower is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cpupower If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the atd is masked, run the following command: -$ sudo systemctl show atd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the cpupower is masked, run the following command: +$ sudo systemctl show cpupower | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "atd" is loaded and not masked? + Is it the case that the "cpupower" is loaded and not masked? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-1-create-success.rules -The output has to be exactly as follows: -## Successful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create - Is it the case that the file does not exist or the content differs? + + To determine if the system is configured to audit calls to the +rmdir system call, run the following command: +$ sudo grep "rmdir" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +rename system call, run the following command: +$ sudo grep "rename" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To ensure that users cannot change session idle and lock settings, run the following: -$ grep 'idle-delay' /etc/dconf/db/local.d/locks/* -If properly configured, the output should return: -/org/gnome/desktop/session/idle-delay - Is it the case that idle-delay is not locked? + + +Run the following command to determine if the exim_read_user_files SELinux boolean is disabled: +$ getsebool exim_read_user_files +If properly configured, the output should show the following: +exim_read_user_files --> off + Is it the case that exim_read_user_files is not disabled? - - To ensure the screensaver is configured to be blank, run the following command: -$ gsettings get org.gnome.desktop.screensaver picture-uri -If properly configured, the output should be ''. - -To ensure that users cannot set the screensaver background, run the following: -$ grep picture-uri /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/picture-uri - Is it the case that it is not set or configured properly? + + To verify the sec option is configured for all NFS mounts, run the following command: +$ grep "sec=" /etc/exports +All configured NFS exports should show the sec=krb5:krb5i:krb5p setting in parentheses. +This is not applicable if NFS is not implemented. + Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? - - -Run the following command to determine if the pppd_can_insmod SELinux boolean is disabled: -$ getsebool pppd_can_insmod -If properly configured, the output should show the following: -pppd_can_insmod --> off - Is it the case that pppd_can_insmod is not disabled? + + The runtime status of the net.ipv6.conf.default.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_redirects +0. + + Is it the case that the correct value is not returned? - - To determine how the SSH daemon's PermitRootLogin option is set, run the following command: - -$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config + + The runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_defrtr +0. -If a line indicating prohibit-password is returned, then the required value is set. - Is it the case that it is commented out or not configured properly? + Is it the case that the correct value is not returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_FS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +The output has to be exactly as follows: +## Unsuccessful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change + Is it the case that the file does not exist or the content differs? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one lower-case character. - -Check the value for "lcredit" with the following command: + + Verify the nodev option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . nodev . . . -$ sudo grep lcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + Is it the case that the "/tmp" file system does not have the "nodev" option set? + + + + Interview the SA or web administrator to see where the public web server +is logically located in the data center. Review the site network diagram +to see how the web server is connected to the LAN. Visually check the web +server hardware connections to see if it conforms to the site network +diagram. + Is it the case that the web server is not isolated in an accredited DoD DMZ Extension? + + + + Run the following command to determine if the opensc package is installed: $ rpm -q opensc + Is it the case that the package is not installed? + + + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -/etc/security/pwquality.conf:lcredit = -1 - Is it the case that the value of "lcredit" is a positive number or is commented out? + Is it the case that no line is returned? - + -Run the following command to determine if the ssh_keysign SELinux boolean is disabled: -$ getsebool ssh_keysign +Run the following command to determine if the mcelog_server SELinux boolean is disabled: +$ getsebool mcelog_server If properly configured, the output should show the following: -ssh_keysign --> off - Is it the case that ssh_keysign is not disabled? +mcelog_server --> off + Is it the case that mcelog_server is not disabled? - - To verify the 389-ds-base package is not installed, run the -following command: -$ rpm -q 389-ds-base -The output should show the following: -package 389-ds-base is not installed - Is it the case that the package is installed? + + Run the following command to see if there are some keytabs +that would potentially allow the use of Kerberos by system daemons. +$ ls -la /etc/*.keytab +The expected result is +ls: cannot access '/etc/*.keytab': No such file or directory + Is it the case that a keytab file is present on the system? - - Verify the assigned home directories of all interactive users on the system exist with the following command: + + Make sure that the kernel is configured to trust the CPU RNG by following +commands. To check if the option was correctly configured at kernel compile +time, run the following command: +grep -q CONFIG_RANDOM_TRUST_CPU=y /boot/config-`uname -r` +If the command outputs: +CONFIG_RANDOM_TRUST_CPU=y, +it means that the option is compiled into the kernel. Make sure that the +option is not overridden through a boot parameter: +sudo grep 'kernelopts.*random\.trust_cpu=off.*' /boot/grub2/grubenv +The command should not return any output. If the option is not compiled into +the kernel, check that the option is configured through boot parameter. +Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes random.trust_cpu=on, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*random.trust_cpu=on.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*random.trust_cpu=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'random.trust_cpu=on' +The command should not return any output. + Is it the case that the kernel is not configured to trust the CPU RNG? + + + + Verify Red Hat Enterprise Linux 8 initiates a session lock after 15 minutes of inactivity. -$ sudo pwck -r +Check the value of the system inactivity timeout with the following command: -user 'mailnull': directory 'var/spool/mqueue' does not exist +$ grep -i lock-after-time /etc/tmux.conf -The output should not return any interactive users. - Is it the case that users home directory does not exist? +set -g lock-after-time 900 + +Then, verify that the /etc/tmux.conf file can be read by other users than root: + +$ sudo ls -al /etc/tmux.conf + Is it the case that "lock-after-time" is not set to "900" or less in the global tmux configuration file to enforce session lock after inactivity? - - The file permissions for all log files written by rsyslog should -be set to 640, or more restrictive. These log files are determined by the -second part of each Rule line in /etc/rsyslog.conf and typically -all appear in /var/log. To see the permissions of a given log -file, run the following command: -$ ls -l LOGFILE -The permissions should be 640, or more restrictive. - Is it the case that the permissions are not correct? + + To ensure that remote access requires credentials, run the following command: +$ gsettings get org.gnome.Vino authentication-methods +If properly configured, the output should be false. +To ensure that users cannot disable credentials for remote access, run the following: +$ grep authentication-methods /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/Vino/authentication-methods + Is it the case that wireless network notification is enabled and not disabled? - - The runtime status of the kernel.dmesg_restrict kernel parameter can be queried + + +Run the following command to determine if the logging_syslogd_use_tty SELinux boolean is enabled: +$ getsebool logging_syslogd_use_tty +If properly configured, the output should show the following: +logging_syslogd_use_tty --> on + Is it the case that logging_syslogd_use_tty is not enabled? + + + + The runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter can be queried by running the following command: -$ sysctl kernel.dmesg_restrict -1. +$ sysctl net.ipv6.conf.all.accept_ra_pinfo +0. Is it the case that the correct value is not returned? - - Find if logging is applied to the FTP daemon. + + To determine if the system is configured to audit successful calls +to the fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -Procedures: + Is it the case that no line is returned? + + + + +If the system is configured to prevent the loading of the tipc kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -If vsftpd is started by xinetd the following command will indicate the xinetd.d startup file: -$ grep vsftpd /etc/xinetd.d/* -$ grep server_args vsftpd xinetd.d startup file -This will indicate the vsftpd config file used when starting through xinetd. -If the server_args line is missing or does not include the vsftpd configuration file, then the default config file (/etc/vsftpd/vsftpd.conf) is used. -$ sudo grep xferlog_enable vsftpd config file - Is it the case that xferlog_enable is missing, or is not set to yes? +These lines can also instruct the module loading system to ignore the tipc kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r tipc /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - Verify that the files and directories of each instance of Alias, -ScriptAlias, and ScriptAliasMatch that exist -have the correct file and directory permissions applied. - Is it the case that it is not? + + +Run the following command to determine if the tmpreaper_use_nfs SELinux boolean is disabled: +$ getsebool tmpreaper_use_nfs +If properly configured, the output should show the following: +tmpreaper_use_nfs --> off + Is it the case that tmpreaper_use_nfs is not disabled? - - To check that the rpcsvcgssd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rpcsvcgssd -Output should indicate the rpcsvcgssd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rpcsvcgssd disabled + + Run the following command to determine if the sssd-ipa package is installed: $ rpm -q sssd-ipa + Is it the case that the package is not installed? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_KEXEC /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify that rules for unsuccessful calls of the open syscall are in the order shown below. -Run the following command to verify rpcsvcgssd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rpcsvcgssd + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. -If the service is not running the command will return the following output: -inactive + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -The service will also be masked, to check that the rpcsvcgssd is masked, run the following command: -$ sudo systemctl show rpcsvcgssd | grep "LoadState\|UnitFileState" + If the system is 64 bit then also add the following lines: -If the service is masked the command will return the following outputs: + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? + + + + The runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.router_solicitations +0. -LoadState=masked + Is it the case that the correct value is not returned? + + + + Verify the system-wide shared library directories are owned by "root" with the following command: -UnitFileState=masked - Is it the case that the "rpcsvcgssd" is loaded and not masked? +$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -user root -type d -exec stat -c "%n %U" '{}' \; + Is it the case that any system-wide shared library directory is not owned by root? - + + To determine if the system is configured to audit calls to the +fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + -Run the following command to determine if the xen_use_nfs SELinux boolean is disabled: -$ getsebool xen_use_nfs +Run the following command to determine if the httpd_enable_homedirs SELinux boolean is disabled: +$ getsebool httpd_enable_homedirs If properly configured, the output should show the following: -xen_use_nfs --> off - Is it the case that xen_use_nfs is not disabled? +httpd_enable_homedirs --> off + Is it the case that httpd_enable_homedirs is not disabled? - + -Run the following command to determine if the xguest_connect_network SELinux boolean is disabled: -$ getsebool xguest_connect_network +Run the following command to determine if the selinuxuser_direct_dri_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_direct_dri_enabled If properly configured, the output should show the following: -xguest_connect_network --> off - Is it the case that xguest_connect_network is not disabled? +selinuxuser_direct_dri_enabled --> off + Is it the case that selinuxuser_direct_dri_enabled is not disabled? - - To ensure that XDMCP is disabled in /etc/gdm/custom.conf, run the following command: -grep -Pzo "\[xdmcp\]\nEnable=false" /etc/gdm/custom.conf -The output should return the following: + + To check which SSH protocol version is allowed, check version of openssh-server with following command: -[xdmcp] -Enable=false +$ rpm -qi openssh-server | grep Version - Is it the case that the Enable is not set to false or is missing in the xdmcp section of the /etc/gdm/custom.conf gdm configuration file? +Versions equal to or higher than 7.4 only allow Protocol 2. +If version is lower than 7.4, run the following command to check configuration: +$ sudo grep Protocol /etc/ssh/sshd_config +If configured properly, output should be Protocol 2 + Is it the case that it is commented out or is not set correctly to Protocol 2? - - Verify that cron is logging to rsyslog, -run the following command: -grep -rni "cron\.\*" /etc/rsyslog.* -cron.* /var/log/cron - Is it the case that cron is not logging to rsyslog? + + To determine if the system is configured to audit successful calls +to the setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine how the SSH daemon's IgnoreRhosts option is set, run the following command: + + Verify the system commands contained in the following directories are group-owned by "root", or a required system account, with the following command: -$ sudo grep -i IgnoreRhosts /etc/ssh/sshd_config +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ! -group root -exec ls -l {} \; + Is it the case that any system commands are returned and is not group-owned by a required system account? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chsh" command with the following command: -If a line indicating yes is returned, then the required value is set. +$ sudo auditctl -l | grep chsh - Is it the case that the required value is not set? +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chsh + Is it the case that the command does not return a line, or the line is commented out? - - Verify that Red Hat Enterprise Linux 8 set the days of warning before a password expires to - or more for users with a -password: + + +Run the following command to determine if the httpd_can_connect_mythtv SELinux boolean is disabled: +$ getsebool httpd_can_connect_mythtv +If properly configured, the output should show the following: +httpd_can_connect_mythtv --> off + Is it the case that httpd_can_connect_mythtv is not disabled? + + + + Run the following command to determine if the logrotate package is installed: $ rpm -q logrotate + Is it the case that the package is not installed? + + + + To determine if the system is configured to audit successful calls +to the lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -$ sudo awk -F: '$6 || $6 == "" {print $1}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? + Is it the case that no line is returned? - + + Verify the grpquota option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . grpquota . . . + + Is it the case that the "/home" file system does not have the "grpquota" option set? + + + + To ensure the gdm package group is removed, run the following command: +$ rpm -qi gdm +The output should be: +package gdm is not installed + Is it the case that gdm has not been removed? + + + -Run the following command to determine if the samba_export_all_ro SELinux boolean is disabled: -$ getsebool samba_export_all_ro +Run the following command to determine if the httpd_read_user_content SELinux boolean is disabled: +$ getsebool httpd_read_user_content If properly configured, the output should show the following: -samba_export_all_ro --> off - Is it the case that samba_export_all_ro is not disabled? +httpd_read_user_content --> off + Is it the case that httpd_read_user_content is not disabled? - - To check that the screen locks immediately when activated, run the following command: -$ gsettings get org.gnome.desktop.screensaver lock-delay -If properly configured, the output should be 'uint32 '. - Is it the case that the screensaver lock delay is missing, or is set to a value greater than <sub idref="var_screensaver_lock_delay" />? + + The file /etc/cron.allow should exist. +This can be checked by running the following command: + +stat /etc/cron.allow + +and the output should list the file. + Is it the case that the file /etc/cron.allow does not exist? - - -To properly set the owner of /etc/audit/, run the command: -$ sudo chown root /etc/audit/ + + Run the following command to determine if the nginx package is installed: +$ rpm -q nginx + Is it the case that the package is installed? + + + + Verify the operating system routinely checks the baseline configuration for unauthorized changes. -To properly set the owner of /etc/audit/rules.d/, run the command: -$ sudo chown root /etc/audit/rules.d/ - Is it the case that ? +To determine that periodic AIDE execution has been scheduled, run the following command: +$ grep aide /etc/crontab +The output should return something similar to the following: +05 4 * * * root /usr/sbin/aide --check + +NOTE: The usage of special cron times, such as @daily or @weekly, is acceptable. + Is it the case that AIDE is not configured to scan periodically? - - To check the group ownership of /etc/motd, + + To check the group ownership of /etc/issue, run the command: -$ ls -lL /etc/motd +$ ls -lL /etc/issue If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/motd does not have a group owner of root? + Is it the case that /etc/issue does not have a group owner of root? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SCHED_STACK_END_CHECK /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services + Is it the case that the iptables-services package is installed? - - To check the permissions of /etc/motd, -run the command: -$ ls -l /etc/motd -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/motd does not have unix mode -rw-r--r--? + + +Run the following command to determine if the logging_syslogd_can_sendmail SELinux boolean is disabled: +$ getsebool logging_syslogd_can_sendmail +If properly configured, the output should show the following: +logging_syslogd_can_sendmail --> off + Is it the case that logging_syslogd_can_sendmail is not disabled? - - To ensure the MaxAuthTries parameter is set, run the following command: -$ sudo grep MaxAuthTries /etc/ssh/sshd_config -If properly configured, output should be: -MaxAuthTries - Is it the case that it is commented out or not configured properly? + + To ensure that users cannot change how long until the screensaver locks, run the following: +$ grep lock-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled + Is it the case that screensaver locking is not locked? - - Run the following command to determine if the avahi-autoipd package is installed: -$ rpm -q avahi-autoipd - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_can_network_relay SELinux boolean is disabled: +$ getsebool httpd_can_network_relay +If properly configured, the output should show the following: +httpd_can_network_relay --> off + Is it the case that httpd_can_network_relay is not disabled? - - Verify that Red Hat Enterprise Linux 8 generates an audit record for all uses of the "umount" and system call. -To determine if the system is configured to audit calls to the -"umount" system call, run the following command: -$ sudo grep "umount" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line like the following. --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -k privileged-umount - Is it the case that the command does not return a line, or the line is commented out? + + To check the screensaver mandatory use status, run the following command: +$ gsettings get org.gnome.desktop.screensaver idle-activation-enabled +If properly configured, the output should be true. +To ensure that users cannot disable the screensaver idle inactivity setting, run the following: +$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled + Is it the case that idle-activation-enabled is not enabled or configured? - - To check the group ownership of /etc/shadow-, -run the command: -$ ls -lL /etc/shadow- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shadow- does not have a group owner of root? + + The runtime status of the kernel.perf_event_max_sample_rate kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_event_max_sample_rate +1. + + Is it the case that the correct value is not returned? - - Run the following command to determine if the tmux package is installed: $ rpm -q tmux - Is it the case that the package is not installed? + + To determine if the system is configured to audit calls to the +settimeofday system call, run the following command: +$ sudo grep "settimeofday" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the value of the umask, run the following command: -$ grep umask /etc/init.d/functions -The output should show . - Is it the case that it does not? + + To determine if the system is configured to audit accesses to +/var/log/audit directory, run the following command: +$ sudo grep "dir=/var/log/audit" /etc/audit/audit.rules +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - Verify that authselect is enabled by running -authselect current -If authselect is enabled on the system, the output should show the ID of the profile which is currently in use. - Is it the case that authselect is not used to manage user authentication setup on the system? + + Verify that a separate file system/partition has been created for /opt with the following command: + +$ mountpoint /opt + + Is it the case that "/opt is not a mountpoint" is returned? - - Verify the umask setting is configured correctly in the /etc/profile file -or scripts within /etc/profile.d directory with the following command: -$ grep "umask" /etc/profile* -umask - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", -or the "umask" parameter is missing or is commented out? + + +Run the following command to determine if the postgresql_selinux_users_ddl SELinux boolean is enabled: +$ getsebool postgresql_selinux_users_ddl +If properly configured, the output should show the following: +postgresql_selinux_users_ddl --> on + Is it the case that postgresql_selinux_users_ddl is not enabled? + + + + Verify that sshd isn't configured to ignore the system wide cryptographic policy. + +Check that the CRYPTO_POLICY variable is not set or is commented out in the +/etc/sysconfig/sshd. + +Run the following command: + +$ sudo grep CRYPTO_POLICY /etc/sysconfig/sshd + Is it the case that the CRYPTO_POLICY variable is set or is not commented out in the /etc/sysconfig/sshd? + + + + +Run the following command to determine if the xend_run_blktap SELinux boolean is enabled: +$ getsebool xend_run_blktap +If properly configured, the output should show the following: +xend_run_blktap --> on + Is it the case that xend_run_blktap is not enabled? - - To determine whether sudo command includes configuration files from the appropriate directory, -run the following command: -$ sudo grep -rP '^[#@]include(dir)?' /etc/sudoers /etc/sudoers.d -If only the line /etc/sudoers:#includedir /etc/sudoers.d is returned, then the drop-in include configuration is set correctly. -Any other line returned is a finding. - Is it the case that the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?? + + To ensure the default password is not set, run the following command: +$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep -E 'public|private' +There should be no output. + Is it the case that the default SNMP passwords public and private have not been changed or removed? - - To verify that Audit Daemon is configured to resolve all uid, gid, syscall, -architecture, and socket address information before writing the event to disk, -run the following command: -$ sudo grep log_format /etc/audit/auditd.conf -The output should return the following: -log_format = ENRICHED - Is it the case that log_format isn't set to ENRICHED? + + + +Run the following command to determine the current status of the +chronyd service: +$ sudo systemctl is-active chronyd +If the service is running, it should return the following: active + Is it the case that the chronyd process is not running? - - The runtime status of the net.ipv4.icmp_echo_ignore_broadcasts kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.icmp_echo_ignore_broadcasts -1. - - Is it the case that the correct value is not returned? + + To check the permissions of /etc/motd, +run the command: +$ ls -l /etc/motd +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/motd does not have unix mode -rw-r--r--? - - -Run the following command to determine if the httpd_execmem SELinux boolean is disabled: -$ getsebool httpd_execmem -If properly configured, the output should show the following: -httpd_execmem --> off - Is it the case that httpd_execmem is not disabled? + + To check that all boot entries extend the backlog limit; +Check that all boot entries extend the log events queue: +sudo grep -L "^options\s+.*\baudit_backlog_limit=8192\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that does not extend the log events queue. + Is it the case that audit backlog limit is not configured? - - To verify if password complexities are only enforce on local users, run the following command: -$ grep local_users_only /etc/security/pwquality.conf -The output should return local_users_only uncommented. - Is it the case that local_users_only is not uncommented or configured correctly? + + +Run the following command to determine if the virt_transition_userdomain SELinux boolean is disabled: +$ getsebool virt_transition_userdomain +If properly configured, the output should show the following: +virt_transition_userdomain --> off + Is it the case that virt_transition_userdomain is not disabled? - - Run the following command to determine if the dnf-plugin-subscription-manager package is installed: $ rpm -q dnf-plugin-subscription-manager - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLAB_MERGE_DEFAULT /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 enforces 24 hours/1 day as the minimum password lifetime for new user accounts. - -Check for the value of "PASS_MIN_DAYS" in "/etc/login.defs" with the following command: - -$ grep -i pass_min_days /etc/login.defs - -PASS_MIN_DAYS - Is it the case that the "PASS_MIN_DAYS" parameter value is not "<sub idref="var_accounts_minimum_age_login_defs" />" or greater, or is commented out? + + To verify that USB Human Interface Devices and hubs will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +The output lines should include +allow with-interface match-all { 03:*:* 09:00:* } + Is it the case that USB devices of class 3 and 9:00 are not authorized? - + To determine if the system is configured to audit successful calls -to the setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit.* +to the fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "mount" command with the following command: - -$ sudo auditctl -l | grep mount - --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-mount - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine the status and frequency of logrotate, run the following command: -$ sudo grep logrotate /var/log/cron* -If logrotate is configured properly, output should include references to -/etc/cron.daily. - Is it the case that logrotate is not configured to run daily? + + Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server + Is it the case that the package is not installed? - - System executables are stored in the following directories by default: -/bin -/sbin -/usr/bin -/usr/sbin -/usr/local/bin -/usr/local/sbin -To find system executables directories that are group-writable or -world-writable, run the following command for each directory DIR -which contains system executables: -$ sudo find -L DIR -perm /022 -type d - Is it the case that any of these files are group-writable or world-writable? + + Run the following command to determine if the samba package is installed: +$ rpm -q samba + Is it the case that the package is installed? - - To check if only local user are impacted by pam_faillock, run the following command: -$ grep local_users_only /etc/security/faillock.conf -The output should return local_users_only not commented. - Is it the case that local_users_only is not uncommented or configured correctly? + + To verify the 389-ds-base package is not installed, run the +following command: +$ rpm -q 389-ds-base +The output should show the following: +package 389-ds-base is not installed + Is it the case that the package is installed? - + -Run the following command to determine if the ftpd_use_fusefs SELinux boolean is disabled: -$ getsebool ftpd_use_fusefs +Run the following command to determine if the cobbler_can_network_connect SELinux boolean is disabled: +$ getsebool cobbler_can_network_connect If properly configured, the output should show the following: -ftpd_use_fusefs --> off - Is it the case that ftpd_use_fusefs is not disabled? +cobbler_can_network_connect --> off + Is it the case that cobbler_can_network_connect is not disabled? - + -Run the following command to determine if the cobbler_anon_write SELinux boolean is disabled: -$ getsebool cobbler_anon_write +Run the following command to determine if the virt_use_xserver SELinux boolean is disabled: +$ getsebool virt_use_xserver If properly configured, the output should show the following: -cobbler_anon_write --> off - Is it the case that cobbler_anon_write is not disabled? +virt_use_xserver --> off + Is it the case that virt_use_xserver is not disabled? - - To verify that web content directories should not be shared anonymously over -remote filesystems such as nfs and smb, inspect each instance -of DocumentRoot and serverRoot and verify that no entry in -/etc/fstab exists or no remote filesystem process is running for -any instance. -$ ps -ef | grep "nfs\|smb" - Is it the case that it is not? + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the openat system call with O_CREAT flag. + +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - To check the ownership of /var/log/syslog, -run the command: -$ ls -lL /var/log/syslog -If properly configured, the output should indicate the following owner: -syslog - Is it the case that /var/log/syslog does not have an owner of syslog? + + +Check if SSSD allows cached authentications with the following command: + +$ sudo grep cache_credentials /etc/sssd/sssd.conf +cache_credentials = true + +If "cache_credentials" is set to "false" or is missing no further checks are required. + +To verify that SSSD expires offline credentials, run the following command: +$ sudo grep offline_credentials_expiration /etc/sssd/sssd.conf +If configured properly, output should be +offline_credentials_expiration = 1 + Is it the case that it does not exist or is not configured properly? - - -Run the following command to determine if the nfs_export_all_rw SELinux boolean is enabled: -$ getsebool nfs_export_all_rw -If properly configured, the output should show the following: -nfs_export_all_rw --> on - Is it the case that nfs_export_all_rw is not enabled? + + To determine that AIDE is verifying extended file attributes, run the following command: +$ grep xattrs /etc/aide.conf +Verify that the xattrs option is added to the correct ruleset. + Is it the case that the xattrs option is missing or not added to the correct ruleset? - - -Run the following command to determine if the deny_ptrace SELinux boolean is disabled: -$ getsebool deny_ptrace -If properly configured, the output should show the following: -deny_ptrace --> off - Is it the case that deny_ptrace is not disabled? + + Verify the operating system encrypts audit records off-loaded onto a different system +or media from the system being audited with the following commands: + +$ sudo grep -i '$ActionSendStreamDriverMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf + +The output should be: + +/etc/rsyslog.conf:$ActionSendStreamDriverMode 1 + Is it the case that rsyslogd ActionSendStreamDriverMode is not set to 1? - - -Run the following command to determine if the samba_share_nfs SELinux boolean is disabled: -$ getsebool samba_share_nfs -If properly configured, the output should show the following: -samba_share_nfs --> off - Is it the case that samba_share_nfs is not disabled? + + To check the ownership of /boot/grub2/user.cfg, +run the command: +$ ls -lL /boot/grub2/user.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/grub2/user.cfg does not have an owner of root? - + -Run the following command to determine if the mcelog_foreground SELinux boolean is disabled: -$ getsebool mcelog_foreground +Run the following command to determine if the secure_mode SELinux boolean is disabled: +$ getsebool secure_mode If properly configured, the output should show the following: -mcelog_foreground --> off - Is it the case that mcelog_foreground is not disabled? - - - - To verify that USB Human Interface Devices will be authorized by the USBGuard daemon, -run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -The output lines should include -allow with-interface match-all { 03:*:* } - Is it the case that USB devices of class 3 are not authorized? - - - - To verify if the mod_perl is installed, run the following command: -$ rpm -qa | grep mod_perl -If the mod_perl module is installed, verify that PerlSwitches -T -is enabled in /etc/httpd/conf.d/perl.conf by running the following -command: -$ grep -i "PerlSwitches -T" /etc/httpd/conf.d/perl.conf -The output should return uncommented: -PerlSwitches -T - Is it the case that it is not? +secure_mode --> off + Is it the case that secure_mode is not disabled? - - Run the following command to determine if the postfix package is installed: $ rpm -q postfix - Is it the case that the package is not installed? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one numeric character be used. + +Check the value for "dcredit" with the following command: + +$ sudo grep dcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:dcredit = + Is it the case that the value of "dcredit" is a positive number or is commented out? - + Run the following command to determine the current status of the -ntpd service: -$ sudo systemctl is-active ntpd +iptables service: +$ sudo systemctl is-active iptables If the service is running, it should return the following: active Is it the case that ? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that execution of the command is being audited, run the following command: +$ sudo grep "path=/usr/sbin/seunshare" /etc/audit/audit.rules /etc/audit/rules.d/* +The output should return something similar to: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + Is it the case that ? - + + +Run the following command to determine if the xguest_exec_content SELinux boolean is disabled: +$ getsebool xguest_exec_content +If properly configured, the output should show the following: +xguest_exec_content --> off + Is it the case that xguest_exec_content is not disabled? + + + + +Run the following command to determine if the httpd_use_sasl SELinux boolean is disabled: +$ getsebool httpd_use_sasl +If properly configured, the output should show the following: +httpd_use_sasl --> off + Is it the case that httpd_use_sasl is not disabled? + + + To determine if the system is configured to audit calls to the -query_module system call, run the following command: -$ sudo grep "query_module" /etc/audit/audit.* +adjtimex system call, run the following command: +$ sudo grep "adjtimex" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To check which SSH protocol version is allowed, check version of openssh-server with following command: - -$ rpm -qi openssh-server | grep Version + + Using a non-privileged account, verify that users cannot modify or change +network settings with the nmcli command with the following command: +$ nmcli general permissions +The output should contain the following: +PERMISSION VALUE +org.freedesktop.NetworkManager.enable-disable-network auth +org.freedesktop.NetworkManager.enable-disable-wifi auth +org.freedesktop.NetworkManager.enable-disable-wwan auth +org.freedesktop.NetworkManager.enable-disable-wimax auth +org.freedesktop.NetworkManager.sleep-wake auth +org.freedesktop.NetworkManager.network-control auth +org.freedesktop.NetworkManager.wifi.share.protected auth +org.freedesktop.NetworkManager.wifi.share.open auth +org.freedesktop.NetworkManager.settings.modify.system auth +org.freedesktop.NetworkManager.settings.modify.own auth +org.freedesktop.NetworkManager.settings.modify.hostname auth +org.freedesktop.NetworkManager.settings.modify.global-dns auth +org.freedesktop.NetworkManager.reload auth +org.freedesktop.NetworkManager.checkpoint-rollback auth +org.freedesktop.NetworkManager.enable-disable-statistics auth +org.freedesktop.NetworkManager.enable-disable-connectivity-check auth +org.freedesktop.NetworkManager.wifi.scan auth -Versions equal to or higher than 7.4 only allow Protocol 2. -If version is lower than 7.4, run the following command to check configuration: -$ sudo grep Protocol /etc/ssh/sshd_config -If configured properly, output should be Protocol 2 - Is it the case that it is commented out or is not set correctly to Protocol 2? - - - - Run the following command to determine if the ntp package is installed: $ rpm -q ntp - Is it the case that the package is not installed? - - - - To check the permissions of /etc/shells, -run the command: -$ ls -l /etc/shells -If properly configured, the output should indicate the following permissions: -0644 - Is it the case that /etc/shells does not have unix mode 0644? - - - - To verify that a remote NTP service is configured for time synchronization, -open the following file: -/etc/ntp.conf -In the file, there should be a section similar to the following: -server ntpserver - Is it the case that this is not the case? + Is it the case that non-privileged users can modify or change network settings? - - To check the group ownership of /usr/bin/sudo, -run the command: -$ ls -lL /usr/bin/sudo -If properly configured, the output should indicate the following group-owner: + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - Is it the case that /usr/bin/sudo does not have a group owner of <sub idref="var_sudo_dedicated_group" />? +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: + +$ sudo grep disk_full_action /etc/audit/auditd.conf + +disk_full_action = + +If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. + Is it the case that there is no evidence of appropriate action? - - To ensure that remote access connections are encrypted, run the following command: -$ gsettings get org.gnome.Vino require-encrpytion -If properly configured, the output should be true. -To ensure that users cannot disable encrypted remote connections, run the following: -$ grep require-encryption /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/Vino/require-encryption - Is it the case that remote access connections are not encrypted? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_FORTIFY_SOURCE /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the webadm_manage_user_files SELinux boolean is disabled: -$ getsebool webadm_manage_user_files +Run the following command to determine if the fenced_can_network_connect SELinux boolean is disabled: +$ getsebool fenced_can_network_connect If properly configured, the output should show the following: -webadm_manage_user_files --> off - Is it the case that webadm_manage_user_files is not disabled? - - - - Run the following command to determine if the abrt-plugin-rhtsupport package is installed: -$ rpm -q abrt-plugin-rhtsupport - Is it the case that the package is installed? - - - - To ensure only SNMPv3 or newer is used, run the following command: -$ sudo grep 'rocommunity\|rwcommunity\|com2sec' /etc/snmp/snmpd.conf | grep -v "^#" -There should be no output. - Is it the case that there is output? +fenced_can_network_connect --> off + Is it the case that fenced_can_network_connect is not disabled? - - To find SGID files, run the following command: -$ sudo find / -xdev -type f -perm -2000 - Is it the case that there is output? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_RANDOMIZE_MEMORY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "shutdown" command with the following command: + + +To check that the rlogin service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rlogin --list +Output should indicate the rlogin service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rlogin --list -$ sudo auditctl -l | grep shutdown +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. --a always,exit -F path=/shutdown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-shutdown - Is it the case that the command does not return a line, or the line is commented out? +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. + +rlogin off + +To check that the rlogin socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rlogin +Output should indicate the rlogin socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rlogindisabled + +Run the following command to verify rlogin is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rlogin + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the rlogin is masked, run the following command: +$ sudo systemctl show rlogin | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - + Run the following command to determine the current status of the -sshd service: -$ sudo systemctl is-active sshd +systemd-journald service: +$ sudo systemctl is-active systemd-journald If the service is running, it should return the following: active - Is it the case that sshd service is disabled? + Is it the case that the systemd-journald service is not running? - - Verify that Red Hat Enterprise Linux 8 contains no duplicate User IDs (UIDs) for interactive users. + + To determine how the SSH daemon's GSSAPIAuthentication option is set, run the following command: -Check that the operating system contains no duplicate UIDs for interactive users with the following command: +$ sudo grep -i GSSAPIAuthentication /etc/ssh/sshd_config -$ sudo awk -F ":" 'list[$3]++{print $1, $3}' /etc/passwd - Is it the case that output is produced and the accounts listed are interactive user accounts? +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To check the group ownership of /etc/gshadow, -run the command: -$ ls -lL /etc/gshadow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/gshadow does not have a group owner of root? + + To ensure TLS is configured with trust certificates, run the following command: +$ grep cert /etc/nslcd.conf + Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? - - -Verify that the libuser is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. + + To check that the bluetooth service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled bluetooth +Output should indicate the bluetooth service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled bluetooth disabled -Check the hashing algorithm that is being used to hash passwords with the following command: +Run the following command to verify bluetooth is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active bluetooth -$ sudo grep -i crypt_style /etc/libuser.conf +If the service is not running the command will return the following output: +inactive -crypt_style = sha512 - Is it the case that crypt_style is not set to sha512? +The service will also be masked, to check that the bluetooth is masked, run the following command: +$ sudo systemctl show bluetooth | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "bluetooth" is loaded and not masked? - - Check whether the maximum time period for existing passwords is restricted to days with the following commands: + + Verify the value of the "maxrepeat" option in "/etc/security/pwquality.conf" with the following command: -$ sudo awk -F: '$5 > 60 {print $1 " " $5}' /etc/shadow +$ grep maxrepeat /etc/security/pwquality.conf -$ sudo awk -F: '$5 <= 0 {print $1 " " $5}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? +maxrepeat = + Is it the case that the value of "maxrepeat" is set to more than "<sub idref="var_password_pam_maxrepeat" />" or is commented out? - - To check that SLUB/SLAB poisoning is enabled, check all boot entries with following command; -sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that does not enable poisoning. - Is it the case that SLUB/SLAB poisoning is not enabled? + + Shared libraries are stored in the following directories: +/lib +/lib64 +/usr/lib +/usr/lib64 + +To find shared libraries that are group-writable or world-writable, +run the following command for each directory DIR which contains shared libraries: +$ sudo find -L DIR -perm /022 -type d + Is it the case that any of these files are group-writable or world-writable? - + + To check the ownership of /etc/group, +run the command: +$ ls -lL /etc/group +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/group does not have an owner of root? + + + -Run the following command to determine if the zoneminder_run_sudo SELinux boolean is disabled: -$ getsebool zoneminder_run_sudo +Run the following command to determine if the container_connect_any SELinux boolean is disabled: +$ getsebool container_connect_any If properly configured, the output should show the following: -zoneminder_run_sudo --> off - Is it the case that zoneminder_run_sudo is not disabled? +container_connect_any --> off + Is it the case that container_connect_any is not disabled? - - The runtime status of the kernel.perf_event_max_sample_rate kernel parameter can be queried -by running the following command: -$ sysctl kernel.perf_event_max_sample_rate -1. + + To ensure the X Windows package group is removed, run the following command: - Is it the case that the correct value is not returned? +$ rpm -qi xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-server-Xwayland + +For each package mentioned above you should receive following line: +package <package> is not installed + Is it the case that xorg related packages are not removed and run level is not correctly configured? - - To check the permissions of /etc/audit/rules.d/*.rules, -run the command: -$ ls -l /etc/audit/rules.d/*.rules -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/audit/rules.d/*.rules does not have unix mode -rw-r-----? + + Verify Red Hat Enterprise Linux 8 prevents the use of dictionary words for passwords with the following command: + +$ sudo grep dictcheck /etc/security/pwquality.conf /etc/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:dictcheck=1 + Is it the case that "dictcheck" does not have a value other than "0", or is commented out? - - The following command will discover and print world-writable directories that are not owned by -a system account, given the assumption that only system accounts have a uid lower than 500. -Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -uid +1000 -print - Is it the case that there is output? + + Run the following command to determine if the krb5-server package is installed: $ rpm -q krb5-server + Is it the case that the package is installed? - - To verify the nosuid option is configured for all NFS mounts, run -the following command: -$ mount | grep nfs -All NFS mounts should show the nosuid setting in parentheses. This -is not applicable if NFS is not implemented. - Is it the case that the setting does not show? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine if the system is configured correctly: +space_left SIZE_in_MB + Is it the case that the system is not configured a specfic size in MB to notify administrators of an issue? - - To check the group ownership of /var/log/syslog, -run the command: -$ ls -lL /var/log/syslog -If properly configured, the output should indicate the following group-owner: -adm - Is it the case that /var/log/syslog does not have a group owner of adm? + + To find SUID files, run the following command: +$ sudo find / -xdev -type f -perm -4000 + Is it the case that only authorized files appear in the output of the find command? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules -The output has to be exactly as follows: -## Successful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change - Is it the case that the file does not exist or the content differs? + + +Run the following command to determine if the sysadm_exec_content SELinux boolean is enabled: +$ getsebool sysadm_exec_content +If properly configured, the output should show the following: +sysadm_exec_content --> on + Is it the case that sysadm_exec_content is not enabled? - - The runtime status of the net.ipv4.conf.default.secure_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.secure_redirects -0. + + - Is it the case that the correct value is not returned? +Run the following command to determine the current status of the +sshd service: +$ sudo systemctl is-active sshd +If the service is running, it should return the following: active + Is it the case that sshd service is disabled? - + + Verify Red Hat Enterprise Linux 8 disables the chrony daemon from acting as a server with the following command: +$ grep -w port /etc/chrony.conf +port 0 + Is it the case that the "port" option is not set to "0", is commented out, or is missing? + + + -Run the following command to determine if the samba_export_all_rw SELinux boolean is disabled: -$ getsebool samba_export_all_rw +Run the following command to determine if the logadm_exec_content SELinux boolean is enabled: +$ getsebool logadm_exec_content If properly configured, the output should show the following: -samba_export_all_rw --> off - Is it the case that samba_export_all_rw is not disabled? +logadm_exec_content --> on + Is it the case that logadm_exec_content is not enabled? - - Run the following command to determine if the pigz package is installed: -$ rpm -q pigz - Is it the case that the package is installed? + + The document, DoDI 8500.01, establishes the policy on the use of DoD +information systems. It requires the use of a standard Notice and Consent Banner +and standard text to be included in user agreements. The banner should be set +to the following: + Is it the case that it is not display the required banner? - - The runtime status of the net.core.bpf_jit_harden kernel parameter can be queried -by running the following command: -$ sysctl net.core.bpf_jit_harden -2. + + To determine if the system is configured to audit unsuccessful calls +to the setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the correct value is not returned? + Is it the case that no line is returned? - - -Run the following command to determine if the racoon_read_shadow SELinux boolean is disabled: -$ getsebool racoon_read_shadow -If properly configured, the output should show the following: -racoon_read_shadow --> off - Is it the case that racoon_read_shadow is not disabled? + + Verify that core dumps are disabled for all users, run the following command: +$ grep core /etc/security/limits.conf +* hard core 0 + Is it the case that the "core" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core"? - - -Run the following command to determine if the abrt_anon_write SELinux boolean is disabled: -$ getsebool abrt_anon_write -If properly configured, the output should show the following: -abrt_anon_write --> off - Is it the case that abrt_anon_write is not disabled? + + If the system is not using TLS, set the ldap_id_use_start_tls option +in /etc/sssd/sssd.conf to true. + Is it the case that the 'ldap_id_use_start_tls' option is not set to 'true'? - - To verify if the OpenSSH client uses defined MACs in the Crypto Policy, run: -$ grep -i macs /etc/crypto-policies/back-ends/openssh.config -and verify that the line matches: -MACs - Is it the case that Crypto Policy for OpenSSH client is not configured correctly? + + Run the following command to determine if the syslog-ng-core package is installed: $ rpm -q syslog-ng-core + Is it the case that the package is not installed? - - -Run the following command to determine if the xdm_sysadm_login SELinux boolean is disabled: -$ getsebool xdm_sysadm_login -If properly configured, the output should show the following: -xdm_sysadm_login --> off - Is it the case that xdm_sysadm_login is not disabled? + + To verify if SSLVerifyClient is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i sslverifyclient /etc/httpd/conf/httpd.conf +The command should return the following: +SSLVerifyClient require + Is it the case that it is not? - + + Run the following command: +# grep ^\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf +Verify the output matches: +$FileCreateMode 0640 +Should a site policy dictate less restrictive permissions, ensure to follow +said policy. + Is it the case that $FileCreateMode is not set or is more permissive than 0640? + + + + To determine whether yum has been configured to disable +gpgcheck for any repos, inspect all files in +/etc/yum.repos.d and ensure the following does not appear in any +sections: +gpgcheck=0 +A value of 0 indicates that gpgcheck has been disabled for that repo. + Is it the case that GPG checking is disabled? + + + To determine if the system is configured to audit calls to the -fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit/audit.* +unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that Audit Daemon is configured to flush to disk after -every records, run the following command: -$ sudo grep freq /etc/audit/auditd.conf -The output should return the following: -freq = - Is it the case that freq isn't set to <sub idref="var_auditd_freq" />? + + +Run the following command to determine if the httpd_mod_auth_ntlm_winbind SELinux boolean is disabled: +$ getsebool httpd_mod_auth_ntlm_winbind +If properly configured, the output should show the following: +httpd_mod_auth_ntlm_winbind --> off + Is it the case that httpd_mod_auth_ntlm_winbind is not disabled? - + +If the system is configured to prevent the loading of the cfg80211 kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -Run the following command to determine the current status of the -sshd service: -$ sudo systemctl is-active sshd -If the service is running, it should return the following: active - Is it the case that ? +These lines can also instruct the module loading system to ignore the cfg80211 kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r cfg80211 /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - + -Run the following command to determine if the nagios_run_sudo SELinux boolean is disabled: -$ getsebool nagios_run_sudo +Run the following command to determine if the exim_manage_user_files SELinux boolean is disabled: +$ getsebool exim_manage_user_files If properly configured, the output should show the following: -nagios_run_sudo --> off - Is it the case that nagios_run_sudo is not disabled? +exim_manage_user_files --> off + Is it the case that exim_manage_user_files is not disabled? - - -Run the following command to determine if the cron_userdomain_transition SELinux boolean is enabled: -$ getsebool cron_userdomain_transition -If properly configured, the output should show the following: -cron_userdomain_transition --> on - Is it the case that cron_userdomain_transition is not enabled? + + To determine how the SSH daemon's PrintLastLog option is set, run the following command: + +$ sudo grep -i PrintLastLog /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - -Run the following command to determine if the haproxy_connect_any SELinux boolean is disabled: -$ getsebool haproxy_connect_any -If properly configured, the output should show the following: -haproxy_connect_any --> off - Is it the case that haproxy_connect_any is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes vsyscall=none, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*vsyscall=none.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*vsyscall=none.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'vsyscall=none' +The command should not return any output. + Is it the case that vsyscalls are enabled? - + -Run the following command to determine if the httpd_use_nfs SELinux boolean is disabled: -$ getsebool httpd_use_nfs +Run the following command to determine if the httpd_enable_ftp_server SELinux boolean is disabled: +$ getsebool httpd_enable_ftp_server If properly configured, the output should show the following: -httpd_use_nfs --> off - Is it the case that httpd_use_nfs is not disabled? - - - - To check for legacy lines in /etc/group, run the following command: - grep '^\+' /etc/group -The command should not return any output. - Is it the case that the file contains legacy lines? +httpd_enable_ftp_server --> off + Is it the case that httpd_enable_ftp_server is not disabled? - - To verify the home directory ownership, run the following command: -# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) - Is it the case that the user ownership is incorrect? + + To find world-writable files, run the following command: +$ sudo find / -xdev -type f -perm -002 + Is it the case that there is output? - - To determine how the SSH daemon's KerberosAuthentication option is set, run the following command: - -$ sudo grep -i KerberosAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. + + - Is it the case that the required value is not set? +Run the following command to determine the current status of the +rsyslog service: +$ sudo systemctl is-active rsyslog +If the service is running, it should return the following: active + Is it the case that the "rsyslog" service is disabled, masked, or not started.? - - To check the current idle time-out value, run the following command: -$ gsettings get org.gnome.desktop.session idle-delay -If properly configured, the output should be 'uint32 '. -To ensure that users cannot change the screensaver inactivity timeout setting, run the following: -$ grep idle-delay /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/session/idle-delay - Is it the case that idle-delay is set to 0 or a value greater than <sub idref="inactivity_timeout_value" />? + + Run the following command to check the mode of the httpd log +directory: +$ ls -l /var/log/ | grep httpd +Log directory must be mode 0700 or less permissive. + Is it the case that it is more permissive? - - To verify that USB Human Interface Devices and hubs will be authorized by the USBGuard daemon, + + To check that the ntpdate service is disabled in system boot configuration, run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -The output lines should include -allow with-interface match-all { 03:*:* 09:00:* } - Is it the case that USB devices of class 3 and 9:00 are not authorized? - - - - To check the group ownership of /boot/efi/EFI/redhat/grub.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have a group owner of root? +$ sudo systemctl is-enabled ntpdate +Output should indicate the ntpdate service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled ntpdate disabled + +Run the following command to verify ntpdate is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ntpdate + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the ntpdate is masked, run the following command: +$ sudo systemctl show ntpdate | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "ntpdate" is loaded and not masked? - - To verify if the OpenSSL uses defined TLS Crypto Policy, run: -$ grep -P '^(TLS\.)?MinProtocol' /etc/crypto-policies/back-ends/opensslcnf.config -and verify that the value is -TLSv1.2 - Is it the case that cryptographic policy for openssl is not configured or is configured incorrectly? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers.d/" with the following command: + +$ sudo auditctl -l | grep/etc/sudoers.d + +-w /etc/sudoers.d/ -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - - Verify the system-wide shared library files contained in the following directories have mode "755" or less permissive with the following command: - -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 -perm /022 -type f -exec ls -l {} \; - Is it the case that any system-wide shared library file is found to be group-writable or world-writable? + + +Run the following command to determine if the zoneminder_run_sudo SELinux boolean is disabled: +$ getsebool zoneminder_run_sudo +If properly configured, the output should show the following: +zoneminder_run_sudo --> off + Is it the case that zoneminder_run_sudo is not disabled? - - To check the permissions of /etc/cron.hourly, -run the command: -$ ls -l /etc/cron.hourly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.hourly does not have unix mode -rwx------? + + To determine whether OpenSSL is wrapped by a shell function that ensures that every invocation +uses a SP800-90A compliant entropy source, +make sure that the /etc/profile.d/openssl-rand.sh file contents exactly match those +that are included in the rule's description. + Is it the case that there is no <tt>/etc/profile.d/openssl-rand.sh</tt> file, or its contents don't match those in the description? - - To determine if negation is used to define commands users are allowed to execute using sudo, run the following command: -$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,!\n][^,\n]+,)*\s*(?:\([^\)]+\))?\s*(?!\s*\()(!\S+).*' /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that /etc/sudoers file contains rules that define the set of allowed commands using negation? + + +Run the following command to determine if the dbadm_exec_content SELinux boolean is enabled: +$ getsebool dbadm_exec_content +If properly configured, the output should show the following: +dbadm_exec_content --> on + Is it the case that dbadm_exec_content is not enabled? - + -Run the following command to determine if the domain_fd_use SELinux boolean is enabled: -$ getsebool domain_fd_use +Run the following command to determine if the cobbler_use_cifs SELinux boolean is disabled: +$ getsebool cobbler_use_cifs If properly configured, the output should show the following: -domain_fd_use --> on - Is it the case that domain_fd_use is not enabled? +cobbler_use_cifs --> off + Is it the case that cobbler_use_cifs is not disabled? - - Run the following command to determine if the policycoreutils-python-utils package is installed: $ rpm -q policycoreutils-python-utils - Is it the case that the package is not installed? + + Ensure that debug-shell service is not enabled with the following command: +grep systemd\.debug-shell=1 /boot/grub2/grubenv /etc/default/grub +If the command returns a line, it means that debug-shell service is being enabled. + Is it the case that the comand returns a line? - - To check that the qpidd service is disabled in system boot configuration, + + To verify the nodev option is configured for all NFS mounts, run +the following command: +$ mount | grep nfs +All NFS mounts should show the nodev setting in parentheses. This +is not applicable if NFS is not implemented. + Is it the case that the setting does not show? + + + + To check that the acpid service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled qpidd -Output should indicate the qpidd service has either not been installed, +$ sudo systemctl is-enabled acpid +Output should indicate the acpid service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled qpidd disabled +$ sudo systemctl is-enabled acpid disabled -Run the following command to verify qpidd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active qpidd +Run the following command to verify acpid is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active acpid If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the qpidd is masked, run the following command: -$ sudo systemctl show qpidd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the acpid is masked, run the following command: +$ sudo systemctl show acpid | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "qpidd" is loaded and not masked? + Is it the case that the "acpid" is loaded and not masked? - - Run the following command to determine if the opensc package is installed: $ rpm -q opensc - Is it the case that the package is not installed? + + To verify that Samba clients running smbclient must use packet signing, run the following command: +$ grep signing /etc/samba/smb.conf +The output should show: +client signing = mandatory + Is it the case that it is not? - - The reviewed should make a note of the name of the account being used for -the web service. This information may be needed later in the SRR. There -may also be other server services running related to the web server in -support of a particular web application, these passwords must be entrusted -to the SA or Web Manager as well. - -Query the SA or Web Manager to determine if they have the web service -password(s). - -NOTE: For installations that run as a service, or without a password, -the SA or Web Manager having an Admin account on the system would meet -the intent of this check. - Is it the case that the web server password(s) are not entrusted to the SA or Web Manager? + + +Run the following command to determine if the virt_use_rawip SELinux boolean is disabled: +$ getsebool virt_use_rawip +If properly configured, the output should show the following: +virt_use_rawip --> off + Is it the case that virt_use_rawip is not disabled? - - Verify the "/etc/security/faillock.conf" file is configured use a non-default faillock directory to ensure contents persist after reboot: + + Verify Red Hat Enterprise Linux 8 enables the user to initiate a session lock with the following command: -$ sudo grep 'dir =' /etc/security/faillock.conf +$ grep lock-command /etc/tmux.conf -dir = /var/log/faillock - Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? +set -g lock-command vlock + +Then, verify that the /etc/tmux.conf file can be read by other users than root: + +$ sudo ls -al /etc/tmux.conf + Is it the case that the "lock-command" is not set in the global settings to call "vlock"? - - To check that the nfs-server service is disabled in system boot configuration, + + +Run the following command to determine if the tftp_home_dir SELinux boolean is disabled: +$ getsebool tftp_home_dir +If properly configured, the output should show the following: +tftp_home_dir --> off + Is it the case that tftp_home_dir is not disabled? + + + + +Run the following command to determine if the tmpreaper_use_samba SELinux boolean is disabled: +$ getsebool tmpreaper_use_samba +If properly configured, the output should show the following: +tmpreaper_use_samba --> off + Is it the case that tmpreaper_use_samba is not disabled? + + + + To check that audit is enabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't enable audit. + Is it the case that auditing is not enabled at boot time? + + + + Run the following command to determine if the quagga package is installed: +$ rpm -q quagga + Is it the case that the package is installed? + + + + To verify that Audit Daemon is configured to include local events, run the +following command: +$ sudo grep local_events /etc/audit/auditd.conf +The output should return the following: +local_events = yes + Is it the case that local_events isn't set to yes? + + + + To check the value of the umask, run the following command: +$ grep umask /etc/init.d/functions +The output should show . + Is it the case that it does not? + + + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep usernetctl /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? + + + + To check that the rhnsd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled nfs-server -Output should indicate the nfs-server service has either not been installed, +$ sudo systemctl is-enabled rhnsd +Output should indicate the rhnsd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled nfs-server disabled +$ sudo systemctl is-enabled rhnsd disabled -Run the following command to verify nfs-server is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active nfs-server +Run the following command to verify rhnsd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rhnsd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the nfs-server is masked, run the following command: -$ sudo systemctl show nfs-server | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rhnsd is masked, run the following command: +$ sudo systemctl show rhnsd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "nfs-server" is loaded and not masked? + Is it the case that the "rhnsd" is loaded and not masked? - - Verify "firewalld" is configured to employ a deny-all, allow-by-exception policy for allowing connections to other systems with the following commands: - -$ sudo firewall-cmd --state - -running + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "su" command with the following command: -$ sudo firewall-cmd --get-active-zones +$ sudo auditctl -l | grep su -[custom] -interfaces: ens33 +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -k privileged-su + Is it the case that the command does not return a line, or the line is commented out? + + + + +Run the following command to determine if the icecast_use_any_tcp_ports SELinux boolean is disabled: +$ getsebool icecast_use_any_tcp_ports +If properly configured, the output should show the following: +icecast_use_any_tcp_ports --> off + Is it the case that icecast_use_any_tcp_ports is not disabled? + + + + Verify the pam_faillock.so module is present in the "/etc/pam.d/password-auth" file: -$ sudo firewall-cmd --info-zone=[custom] | grep target +$ sudo grep pam_faillock.so /etc/pam.d/password-auth -target: DROP - Is it the case that no zones are active on the interfaces or if the target is set to a different option other than "DROP"? +auth required pam_faillock.so preauth +auth required pam_faillock.so authfail +account required pam_faillock.so + Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/password-auth" file with the "preauth" line listed before pam_unix.so? - - To determine if the system is configured to audit unsuccessful calls -to the chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit.* + + To determine if the system is configured to audit successful calls +to the unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that clients cannot automatically update DNS records, perform the +following: +$ grep -i dhcp_hostname /etc/sysconfig/network-scripts/ifcfg-* +$ grep -rni "send host-name" /etc/dhclient.conf /etc/dhcp +The output should return no results. + Is it the case that client Dynamic DNS updates are not disabled? + + + + To determine how the SSH daemon's X11Forwarding option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i X11Forwarding /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - -To check that the systemd-journal-remote.socket socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled systemd-journal-remote.socket -Output should indicate the systemd-journal-remote.socket socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled systemd-journal-remote.socketdisabled + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "mount" command with the following command: -Run the following command to verify systemd-journal-remote.socket is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active systemd-journal-remote.socket +$ sudo auditctl -l | grep mount -If the socket is not running the command will return the following output: -inactive +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-mount + Is it the case that the command does not return a line, or the line is commented out? + + + + Run the following commands and verify output: -The socket will also be masked, to check that the systemd-journal-remote.socket is masked, run the following command: -$ sudo systemctl show systemd-journal-remote.socket | grep "LoadState\|UnitFileState" +# iptables -L INPUT -v -n | grep lo | grep ACCEPT -If the socket is masked the command will return the following outputs: -LoadState=masked +# iptables -L INPUT -v -n | grep 127.0.0.0\/8 | grep DROP -UnitFileState=masked - Is it the case that the systemd-journal-remote socket is not masked? + +# iptables -L OUTPUT -v -n | grep lo | grep ACCEPT + + Is it the case that loopback traffic is not configured? - + -Run the following command to determine if the piranha_lvs_can_network_connect SELinux boolean is disabled: -$ getsebool piranha_lvs_can_network_connect +Run the following command to determine if the mpd_enable_homedirs SELinux boolean is disabled: +$ getsebool mpd_enable_homedirs If properly configured, the output should show the following: -piranha_lvs_can_network_connect --> off - Is it the case that piranha_lvs_can_network_connect is not disabled? - - - - To check the group ownership of /etc/ssh/*.pub, -run the command: -$ ls -lL /etc/ssh/*.pub -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/*.pub does not have a group owner of root? - - - - To determine if umask has been configured for sudo with the appropriate value, -run the following command: -$ sudo grep -ri '^Defaults.*umask=' /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that umask is not set with the appropriate value for sudo? - - - - To determine if the system is configured to audit successful calls -to the unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To verify that USB hubs will be authorized by the USBGuard daemon, -run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -One of the output lines should be -allow with-interface match-all { 09:00:* } - Is it the case that USB devices of class 9 are not authorized? +mpd_enable_homedirs --> off + Is it the case that mpd_enable_homedirs is not disabled? @@ -383332,295 +384097,225 @@ TimedLoginEnable=false Is it the case that GDM allows a guest to login without credentials? - - Verify Red Hat Enterprise Linux 8 notifies the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep -w space_left_action /etc/audit/auditd.conf - -space_left_action = - -If the value of the "space_left_action" is not set to "", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. - Is it the case that there is no evidence that real-time alerts are configured on the system? - - - - -Run the following command to determine if the git_system_enable_homedirs SELinux boolean is disabled: -$ getsebool git_system_enable_homedirs -If properly configured, the output should show the following: -git_system_enable_homedirs --> off - Is it the case that git_system_enable_homedirs is not disabled? - - - - Verify that rules for unsuccessful calls of the openat syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - - If the system is 64 bit then also add the following lines: - - -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? - - - - To determine how the SSH daemon's UsePAM option is set, run the following command: - -$ sudo grep -i UsePAM /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? + + Run the following command to determine open ports: +# ss -6tuln +Run the following command to determine firewall rules: +# ip6tables -L INPUT -v -n +For each port identified in the audit which does not have a firewall +rule, add rule for accepting or denying inbound connections +# ip6tables -A INPUT -p \ --dport \ -m state --state NEW -j ACCEPT + Is it the case that open ports are denied connection? - - -Run the following command to determine if the logrotate_use_nfs SELinux boolean is disabled: -$ getsebool logrotate_use_nfs -If properly configured, the output should show the following: -logrotate_use_nfs --> off - Is it the case that logrotate_use_nfs is not disabled? + + To check the group ownership of /boot/efi/EFI/redhat/grub.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have a group owner of root? - - Check the system partitions to determine if they are encrypted with the following command: -blkid + + Verify that Red Hat Enterprise Linux 8 is configured to notify the SA and/or ISSO (at a minimum) in the event of an audit processing failure with the following command: -Output will be similar to: -/dev/sda1: UUID=" ab12c3de-4f56-789a-8f33-3850cc8ce3a2 -" TYPE="crypto_LUKS" -/dev/sda2: UUID=" bc98d7ef-6g54-321h-1d24-9870de2ge1a2 -" TYPE="crypto_LUKS" +$ sudo grep action_mail_acct /etc/audit/auditd.conf -The boot partition and pseudo-file systems, such as /proc, /sys, and tmpfs, -are not required to use disk encryption and are not a finding. - Is it the case that partitions do not have a type of crypto_LUKS? +action_mail_acct = + Is it the case that the value of the "action_mail_acct" keyword is not set to "<sub idref="var_auditd_action_mail_acct" />" and/or other accounts for security personnel, the "action_mail_acct" keyword is missing, or the retuned line is commented out, ask the system administrator to indicate how they and the ISSO are notified of an audit process failure. If there is no evidence of the proper personnel being notified of an audit processing failure? - - The runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter can be queried + + The runtime status of the kernel.modules_disabled kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.router_solicitations -0. +$ sysctl kernel.modules_disabled +1. Is it the case that the correct value is not returned? - - -Run the following command to determine if the unconfined_mozilla_plugin_transition SELinux boolean is enabled: -$ getsebool unconfined_mozilla_plugin_transition -If properly configured, the output should show the following: -unconfined_mozilla_plugin_transition --> on - Is it the case that unconfined_mozilla_plugin_transition is not enabled? + + Verify that cron is logging to rsyslog, +run the following command: +grep -rni "cron\.\*" /etc/rsyslog.* +cron.* /var/log/cron + Is it the case that cron is not logging to rsyslog? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_FORTIFY_SOURCE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Verify the nodev option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . nodev . . . + + Is it the case that the "/boot" file system does not have the "nodev" option set? - + -Run the following command to determine if the glance_use_execmem SELinux boolean is disabled: -$ getsebool glance_use_execmem +Run the following command to determine if the samba_create_home_dirs SELinux boolean is disabled: +$ getsebool samba_create_home_dirs If properly configured, the output should show the following: -glance_use_execmem --> off - Is it the case that glance_use_execmem is not disabled? +samba_create_home_dirs --> off + Is it the case that samba_create_home_dirs is not disabled? - + -Run the following command to determine if the selinuxuser_tcp_server SELinux boolean is disabled: -$ getsebool selinuxuser_tcp_server +Run the following command to determine if the xdm_exec_bootloader SELinux boolean is disabled: +$ getsebool xdm_exec_bootloader If properly configured, the output should show the following: -selinuxuser_tcp_server --> off - Is it the case that selinuxuser_tcp_server is not disabled? +xdm_exec_bootloader --> off + Is it the case that xdm_exec_bootloader is not disabled? - + -Run the following command to determine if the mplayer_execstack SELinux boolean is disabled: -$ getsebool mplayer_execstack +Run the following command to determine if the httpd_use_fusefs SELinux boolean is disabled: +$ getsebool httpd_use_fusefs If properly configured, the output should show the following: -mplayer_execstack --> off - Is it the case that mplayer_execstack is not disabled? +httpd_use_fusefs --> off + Is it the case that httpd_use_fusefs is not disabled? - - To check if UsePrivilegeSeparation is enabled or set correctly, run the -following command: -$ sudo grep UsePrivilegeSeparation /etc/ssh/sshd_config -If configured properly, output should be . - Is it the case that it is commented out or is not enabled? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "shutdown" command with the following command: + +$ sudo auditctl -l | grep shutdown + +-a always,exit -F path=/shutdown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-shutdown + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit changes to its SELinux -configuration files, run the following command: -$ sudo auditctl -l | grep "dir=/etc/selinux" -If the system is configured to watch for changes to its SELinux -configuration, a line should be returned (including -perm=wa indicating permissions that are watched). - Is it the case that the system is not configured to audit attempts to change the MAC policy? + + To verify the audispd plugin off-loads audit records onto a different system or +media from the system being audited, run the following command: +$ sudo grep -i remote_server /etc/audit/audisp-remote.conf +The output should return something similar to +remote_server = + Is it the case that audispd is not sending logs to a remote system? - + -Run the following command to determine if the virt_use_rawip SELinux boolean is disabled: -$ getsebool virt_use_rawip +Run the following command to determine if the selinuxuser_execmod SELinux boolean is enabled: +$ getsebool selinuxuser_execmod If properly configured, the output should show the following: -virt_use_rawip --> off - Is it the case that virt_use_rawip is not disabled? +selinuxuser_execmod --> on + Is it the case that selinuxuser_execmod is not enabled? - - Verify Red Hat Enterprise Linux 8 disables storing core dumps for all users by issuing the following command: - -$ grep -i storage /etc/systemd/coredump.conf + + The runtime status of the net.ipv4.ip_local_port_range kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.ip_local_port_range +32768 65535. -Storage=none - Is it the case that Storage is not set to none or is commented out and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? - - - - -Run the following command to determine if the postgresql_selinux_users_ddl SELinux boolean is enabled: -$ getsebool postgresql_selinux_users_ddl -If properly configured, the output should show the following: -postgresql_selinux_users_ddl --> on - Is it the case that postgresql_selinux_users_ddl is not enabled? - - - - To check for serial port entries which permit root login, -run the following command: -$ sudo grep ^ttyS/[0-9] /etc/securetty -If any output is returned, then root login over serial ports is permitted. - Is it the case that root login over serial ports is permitted? - - - - Only FIPS-approved MACs should be used. To verify that only FIPS-approved -MACs are in use, run the following command: -$ sudo grep -i macs /etc/ssh/sshd_config -The output should contain only those MACs which are FIPS-approved. Any use of other -ciphers or algorithms will result in the module entering the non-FIPS mode of -operation. - Is it the case that MACs option is commented out or not using FIPS-approved hash algorithms? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the dhcpd_use_ldap SELinux boolean is disabled: -$ getsebool dhcpd_use_ldap -If properly configured, the output should show the following: -dhcpd_use_ldap --> off - Is it the case that dhcpd_use_ldap is not disabled? + + To determine that periodic AIDE execution has been scheduled, run the following command: + +$ grep aide /etc/crontab +The output should return something similar to the following: +05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost +The email address that the notifications are sent to can be changed by overriding +. + Is it the case that AIDE has not been configured or has not been configured to notify personnel of scan details? - - The runtime status of the net.ipv6.conf.all.autoconf kernel parameter can be queried + + The runtime status of the net.ipv6.conf.default.accept_ra kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.autoconf +$ sysctl net.ipv6.conf.default.accept_ra 0. Is it the case that the correct value is not returned? - - -Run the following command to determine if the auditadm_exec_content SELinux boolean is enabled: -$ getsebool auditadm_exec_content -If properly configured, the output should show the following: -auditadm_exec_content --> on - Is it the case that auditadm_exec_content is not enabled? - - - - Run the following command to determine if the samba-common package is installed: $ rpm -q samba-common - Is it the case that the package is not installed? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes ipv6.disable=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*ipv6.disable=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*ipv6.disable=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'ipv6.disable=1' +The command should not return any output. + Is it the case that IPv6 is not disabled? - - -Run the following command to determine if the git_system_use_cifs SELinux boolean is disabled: -$ getsebool git_system_use_cifs -If properly configured, the output should show the following: -git_system_use_cifs --> off - Is it the case that git_system_use_cifs is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes slub_debug=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slub_debug=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*slub_debug=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'slub_debug=' +The command should not return any output. + Is it the case that SLUB/SLAB poisoning is not enabled? - - -Run the following command to determine if the named_tcp_bind_http_port SELinux boolean is disabled: -$ getsebool named_tcp_bind_http_port -If properly configured, the output should show the following: -named_tcp_bind_http_port --> off - Is it the case that named_tcp_bind_http_port is not disabled? + + The runtime status of the net.ipv4.conf.default.rp_filter kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.rp_filter +1. + + Is it the case that the correct value is not returned? - - To verify that packages comprising the available updates will be automatically installed by dnf-automatic, run the following command: -$ sudo grep apply_updates /etc/dnf/automatic.conf -The output should return the following: -apply_updates = yes - Is it the case that apply_updates is not set to yes? + + Run the following command to determine if the gnutls-utils package is installed: $ rpm -q gnutls-utils + Is it the case that the package is not installed? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the rename system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r rename /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep rename /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_LEGACY_PTYS /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify the audit system prevents unauthorized changes with the following command: - -$ sudo grep "^\s*[^#]" /etc/audit/audit.rules | tail -1 --e 2 + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the audit system is not set to be immutable by adding the "-e 2" option to the end of "/etc/audit/audit.rules"? + Is it the case that no line is returned? - + -Run the following command to determine if the rsync_full_access SELinux boolean is disabled: -$ getsebool rsync_full_access +Run the following command to determine if the abrt_anon_write SELinux boolean is disabled: +$ getsebool abrt_anon_write If properly configured, the output should show the following: -rsync_full_access --> off - Is it the case that rsync_full_access is not disabled? +abrt_anon_write --> off + Is it the case that abrt_anon_write is not disabled? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_VMAP_STACK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? @@ -383632,294 +384327,175 @@ cdrecord_read_content --> off Is it the case that cdrecord_read_content is not disabled? - - Verify that the interactive user account passwords are using a strong -password hash with the following command: - -$ sudo cut -d: -f2 /etc/shadow - -$6$kcOnRq/5$NUEYPuyL.wghQwWssXRcLRFiiru7f5JPV6GaJhNC2aK5F3PZpE/BCCtwrxRc/AInKMNX3CdMw11m9STiql12f/ + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size. -Password hashes ! or * indicate inactive accounts not -available for logon and are not evaluated. - Is it the case that any interactive user password hash does not begin with "$6"? - - - - -Run the following command to determine if the minidlna_read_generic_user_content SELinux boolean is disabled: -$ getsebool minidlna_read_generic_user_content -If properly configured, the output should show the following: -minidlna_read_generic_user_content --> off - Is it the case that minidlna_read_generic_user_content is not disabled? - - - - To check the group ownership of /etc/ssh/sshd_config, -run the command: -$ ls -lL /etc/ssh/sshd_config -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/sshd_config does not have a group owner of root? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudoedit" command with the following command: +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size with the following command: -$ sudo auditctl -l | grep sudoedit +$ sudo grep max_log_file_action /etc/audit/auditd.conf --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudoedit - Is it the case that the command does not return a line, or the line is commented out? +max_log_file_action = + Is it the case that the value of the "max_log_file_action" option is not "ROTATE", "SINGLE", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. If there is no evidence of appropriate action? - - -Run the following command to determine if the authlogin_nsswitch_use_ldap SELinux boolean is disabled: -$ getsebool authlogin_nsswitch_use_ldap -If properly configured, the output should show the following: -authlogin_nsswitch_use_ldap --> off - Is it the case that authlogin_nsswitch_use_ldap is not disabled? + + To ensure there are no read-write users, run the following command: +$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep 'rwuser' +There should be no output. + Is it the case that there are users who can write to SNMP values? - - The runtime status of the kernel.kexec_load_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.kexec_load_disabled -1. + + Verify Red Hat Enterprise Linux 8 is configured to limit the "pwquality" retry option to . - Is it the case that the correct value is not returned? - - - - Run the following command to determine if the rsync-daemon package is installed: -$ rpm -q rsync-daemon - Is it the case that the package is installed? - - - - To check the permissions of /etc/audit/auditd.conf, -run the command: -$ ls -l /etc/audit/auditd.conf -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/audit/auditd.conf does not have unix mode -rw-r-----? - - - - To verify that McAfee HIPS is installed, run the following command(s): -$ rpm -q MFEhiplsm - Is it the case that the HBSS HIPS module is not installed? - - - - Run the following command to determine if the sssd-ipa package is installed: $ rpm -q sssd-ipa - Is it the case that the package is not installed? - - - - The runtime status of the net.ipv6.conf.default.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_source_route -0. - Is it the case that the correct value is not returned? +Check for the use of the "pwquality" retry option in the pwquality.conf file with the following command: +$ grep retry /etc/security/pwquality.conf + Is it the case that the value of "retry" is set to "0" or greater than "<sub idref="var_password_pam_retry" />", or is missing? - - -To properly set the owner of /var/log/audit, run the command: -$ sudo chown root /var/log/audit - -To properly set the owner of /var/log/audit/*, run the command: -$ sudo chown root /var/log/audit/* - Is it the case that ? + + Run the following command to check if the group exists: +grep /etc/group +The output should contain the following line: +:x: + Is it the case that group exists and has no user members? - + -Run the following command to determine if the httpd_use_gpg SELinux boolean is disabled: -$ getsebool httpd_use_gpg +Run the following command to determine if the cvs_read_shadow SELinux boolean is disabled: +$ getsebool cvs_read_shadow If properly configured, the output should show the following: -httpd_use_gpg --> off - Is it the case that httpd_use_gpg is not disabled? +cvs_read_shadow --> off + Is it the case that cvs_read_shadow is not disabled? - - To ensure the system is configured to ignore the Ctrl-Alt-Del setting, -enter the following command: -$ sudo grep -i ctrlaltdelburstaction /etc/systemd/system.conf -The output should return: -CtrlAltDelBurstAction=none - Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed more than 7 times in 2 seconds.? + + Run the following command to see what the max sessions number is: +$ sudo grep MaxSessions /etc/ssh/sshd_config +If properly configured, the output should be: +MaxSessions + Is it the case that MaxSessions is not configured or not configured correctly? - - To ensure the tally directory is configured correctly, run the following command: -$ sudo grep 'dir =' /etc/security/faillock.conf -The output should show that dir is set to something other than "/var/run/faillock" - Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? + + To verify if the OpenSSH client uses defined Cipher suite in the Crypto Policy, run: +$ grep -i ciphers /etc/crypto-policies/back-ends/openssh.config +and verify that the line matches: +Ciphers + Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - To check the ownership of /boot/grub2/user.cfg, -run the command: -$ ls -lL /boot/grub2/user.cfg -If properly configured, the output should indicate the following owner: -root - Is it the case that /boot/grub2/user.cfg does not have an owner of root? + + +Run the following command to determine if the irc_use_any_tcp_ports SELinux boolean is disabled: +$ getsebool irc_use_any_tcp_ports +If properly configured, the output should show the following: +irc_use_any_tcp_ports --> off + Is it the case that irc_use_any_tcp_ports is not disabled? - - To check that the tftp service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled tftp -Output should indicate the tftp service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled tftp disabled - -Run the following command to verify tftp is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active tftp - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the tftp is masked, run the following command: -$ sudo systemctl show tftp | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "tftp" is loaded and not masked? + + To verify that the operating system protects against or limits the effects of DoS +attacks by ensuring implementation of rate-limiting measures +on impacted network interfaces, run the following command: +# grep 'net.ipv4.tcp_invalid_ratelimit' /etc/sysctl.conf /etc/sysctl.d/* +The command should output the following line: +/etc/sysctl.conf:net.ipv4.tcp_invalid_ratelimit = +The file where the line has been found can differ, but it must be either /etc/sysctl.conf +or a file located under the /etc/sysctl.d/ directory. + Is it the case that rate limiting of duplicate TCP acknowledgments is not configured? - - To determine if NOPASSWD has been configured for sudo, run the following command: -$ sudo grep -ri nopasswd /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that nopasswd is specified in the sudo config files? + + To ensure that the system prevents messages from being shown when three unsuccessful logon +attempts occur, run the following command: +$ grep silent /etc/security/faillock.conf +The output should show silent. + Is it the case that the system shows messages when three unsuccessful logon attempts occur? - + -Run the following command to determine if the webadm_read_user_files SELinux boolean is disabled: -$ getsebool webadm_read_user_files -If properly configured, the output should show the following: -webadm_read_user_files --> off - Is it the case that webadm_read_user_files is not disabled? +Run the following command to get the current configured value for secure_mode_insmod +SELinux boolean: +$ getsebool secure_mode_insmod +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that secure_mode_insmod is not set as expected? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_WX /boot/config.* + $ grep CONFIG_COMPAT_BRK /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - To check the ownership of /etc/cron.monthly, -run the command: -$ ls -lL /etc/cron.monthly -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.monthly does not have an owner of root? - - - - To determine if use_pty has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\buse_pty\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that use_pty is not enabled in sudo? - - - - To determine if the system is configured to audit changes to its SELinux -configuration files, run the following command: -$ sudo auditctl -l | grep "dir=/usr/share/selinux" -If the system is configured to watch for changes to its SELinux -configuration, a line should be returned (including -perm=wa indicating permissions that are watched). - Is it the case that the system is not configured to audit attempts to change the MAC policy? + + To verify that packages comprising the available updates will be automatically installed by dnf-automatic, run the following command: +$ sudo grep apply_updates /etc/dnf/automatic.conf +The output should return the following: +apply_updates = yes + Is it the case that apply_updates is not set to yes? - + -Run the following command to determine if the entropyd_use_audio SELinux boolean is disabled: -$ getsebool entropyd_use_audio +Run the following command to determine if the git_session_users SELinux boolean is disabled: +$ getsebool git_session_users If properly configured, the output should show the following: -entropyd_use_audio --> off - Is it the case that entropyd_use_audio is not disabled? - - - - To determine if !authenticate has not been configured for sudo, run the following command: -$ sudo grep -r \!authenticate /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that !authenticate is specified in the sudo config files? +git_session_users --> off + Is it the case that git_session_users is not disabled? - + -Run the following command to determine if the httpd_can_network_connect SELinux boolean is disabled: -$ getsebool httpd_can_network_connect +Run the following command to determine if the virt_use_nfs SELinux boolean is disabled: +$ getsebool virt_use_nfs If properly configured, the output should show the following: -httpd_can_network_connect --> off - Is it the case that httpd_can_network_connect is not disabled? +virt_use_nfs --> off + Is it the case that virt_use_nfs is not disabled? - - To verify that remote access methods are logging to rsyslog, -run the following command: -grep -rE '(auth.\*|authpriv.\*|daemon.\*)' /etc/rsyslog.* -The output should contain auth.*, authpriv.*, and daemon.* -pointing to a log file. - Is it the case that remote access methods are not logging to rsyslog? + + To verify that audit is configured for OSPP v4.2.1, run the following commands: +for file in "10-base-config" "11-loginuid" "30-ospp-v42" "43-module-load";do diff /etc/audit/rules.d/$file.rules /usr/share/doc/audit*/rules/$file.rules; done + +If the system is configured properly, no lines should be returned. + Is it the case that the files are not there or differ? - - To check that the ypserv service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled ypserv -Output should indicate the ypserv service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ypserv disabled - -Run the following command to verify ypserv is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ypserv - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the ypserv is masked, run the following command: -$ sudo systemctl show ypserv | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "ypserv" is loaded and not masked? + + To determine if the system is configured to audit attempts to +alter time via the /etc/localtime file, run the following +command: +$ sudo auditctl -l | grep "watch=/etc/localtime" +If the system is configured to audit this activity, it will return a line. + Is it the case that the system is not configured to audit time changes? - - To check the group ownership of /etc/at.allow, -run the command: -$ ls -lL /etc/at.allow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/at.allow does not have a group owner of root? + + +Run the following command to determine if the mozilla_read_content SELinux boolean is disabled: +$ getsebool mozilla_read_content +If properly configured, the output should show the following: +mozilla_read_content --> off + Is it the case that mozilla_read_content is not disabled? - + -Run the following command to determine if the gluster_export_all_rw SELinux boolean is disabled: -$ getsebool gluster_export_all_rw -If properly configured, the output should show the following: -gluster_export_all_rw --> off - Is it the case that gluster_export_all_rw is not disabled? + +Run the following command to determine the current status of the +sssd service: +$ sudo systemctl is-active sssd +If the service is running, it should return the following: active + Is it the case that the service is not enabled? @@ -383930,1110 +384506,1016 @@ permissions: -rw------- Is it the case that it does not? - - To verify that null passwords cannot be used, run the following command: - -$ grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth - -If this produces any output, it may be possible to log into accounts -with empty passwords. Remove any instances of the nullok option to -prevent logins with empty passwords. - Is it the case that NULL passwords can be used? - - - - The runtime status of the kernel.core_uses_pid kernel parameter can be queried -by running the following command: -$ sysctl kernel.core_uses_pid -0. - Is it the case that the returned line does not have a value of 0? - - - + -Run the following command to determine if the logging_syslogd_use_tty SELinux boolean is enabled: -$ getsebool logging_syslogd_use_tty +Run the following command to determine if the spamassassin_can_network SELinux boolean is disabled: +$ getsebool spamassassin_can_network If properly configured, the output should show the following: -logging_syslogd_use_tty --> on - Is it the case that logging_syslogd_use_tty is not enabled? +spamassassin_can_network --> off + Is it the case that spamassassin_can_network is not disabled? - - Verify the noexec option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . noexec . . . + + To verify the system is not configured to use a boot loader on removable media, +check that the grub configuration file has the set root command in each menu +entry with the following commands: +$ sudo grep -cw menuentry /boot/grub2/grub.cfg +Note that the -c option for the grep command will print +only the count of menuentry occurrences. This number should match +the number of occurrences reported by the following command: +$ sudo grep "set root='hd0" /boot/grub2/grub.cfg +The output should return something similar to: +set root='hd0,msdos1' +usb0, cd, fd0, etc. are some examples of removeable +media which should not exist in the lines: +set root='hd0,msdos1' + Is it the case that it is not? + + + + Check that Red Hat Enterprise Linux 8 has the packages for smart card support installed. - Is it the case that the "/home" file system does not have the "noexec" option set? +Run the following command to determine if the openssl-pkcs11 package is installed: +$ rpm -q openssl-pkcs11 + Is it the case that smartcard software is not installed? - + -Run the following command to determine if the polipo_connect_all_unreserved SELinux boolean is disabled: -$ getsebool polipo_connect_all_unreserved +Run the following command to determine if the samba_portmapper SELinux boolean is disabled: +$ getsebool samba_portmapper If properly configured, the output should show the following: -polipo_connect_all_unreserved --> off - Is it the case that polipo_connect_all_unreserved is not disabled? +samba_portmapper --> off + Is it the case that samba_portmapper is not disabled? - - Verify the value of the "difok" option in "/etc/security/pwquality.conf" with the following command: - -$ sudo grep difok /etc/security/pwquality.conf - -difok = - Is it the case that the value of "difok" is set to less than "<sub idref="var_password_pam_difok" />", or is commented out? + + To check the ownership of /boot/efi/EFI/redhat/grub.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one numeric character be used. - -Check the value for "dcredit" with the following command: + + To determine how the SSH daemon's AllowTcpForwarding option is set, run the following command: -$ sudo grep dcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +$ sudo grep -i AllowTcpForwarding /etc/ssh/sshd_config -/etc/security/pwquality.conf:dcredit = - Is it the case that the value of "dcredit" is a positive number or is commented out? +If a line indicating no is returned, then the required value is set. + Is it the case that The AllowTcpForwarding option exists and is disabled? - - # grep "^OPTIONS.*-u" /etc/sysconfig/chronyd | grep -v -e '-u\s*chrony\b' -returns no output - Is it the case that chronyd is not running under chrony user account? + + +Run the following command to determine if the virt_use_execmem SELinux boolean is disabled: +$ getsebool virt_use_execmem +If properly configured, the output should show the following: +virt_use_execmem --> off + Is it the case that virt_use_execmem is not disabled? - - Run the following command to determine if the rpcbind package is installed: -$ rpm -q rpcbind - Is it the case that the package is installed? + + +Run the following command to determine if the use_ecryptfs_home_dirs SELinux boolean is disabled: +$ getsebool use_ecryptfs_home_dirs +If properly configured, the output should show the following: +use_ecryptfs_home_dirs --> off + Is it the case that use_ecryptfs_home_dirs is not disabled? - - To check that the portreserve service is disabled in system boot configuration, + + To check that the netconsole service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled portreserve -Output should indicate the portreserve service has either not been installed, +$ sudo systemctl is-enabled netconsole +Output should indicate the netconsole service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled portreserve disabled +$ sudo systemctl is-enabled netconsole disabled -Run the following command to verify portreserve is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active portreserve +Run the following command to verify netconsole is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active netconsole If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the portreserve is masked, run the following command: -$ sudo systemctl show portreserve | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the netconsole is masked, run the following command: +$ sudo systemctl show netconsole | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "portreserve" is loaded and not masked? - - - - Run the following command to determine if the libreswan package is installed: $ rpm -q libreswan - Is it the case that the package is not installed? + Is it the case that the "netconsole" is loaded and not masked? - - The runtime status of the kernel.unprivileged_bpf_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.unprivileged_bpf_disabled -1. - - Is it the case that the correct value is not returned? + + To verify all squashing has been disabled, run the following command: +$ grep all_squash /etc/exports + Is it the case that there is output? - - Inspect all instances of DocumentRoot and Alias. No -robots.txt file should exist. - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_ARM64_SW_TTBR0_PAN /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check the ownership of /etc/issue.net, + + To check the group ownership of /etc/shells, run the command: -$ ls -lL /etc/issue.net -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/shells +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/issue.net does not have an owner of root? + Is it the case that /etc/shells does not have a group owner of root? - - The runtime status of the net.ipv4.conf.all.rp_filter parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.rp_filter -The output of the command should indicate either: -net.ipv4.conf.all.rp_filter = 1 -or: -net.ipv4.conf.all.rp_filter = 2 -The output of the command should not indicate: -net.ipv4.conf.all.rp_filter = 0 - -The preferable way how to assure the runtime compliance is to have -correct persistent configuration, and rebooting the system. + + Verify that all local interactive user initialization file executable search path statements do not contain statements that will reference a working directory other than user home directories with the following commands: -The persistent sysctl parameter configuration is performed by specifying the appropriate -assignment in any file located in the /etc/sysctl.d directory. -Verify that there is not any existing incorrect configuration by executing the following command: -$ grep -r '^\s*net.ipv4.conf.all.rp_filter\s*=' /etc/sysctl.conf /etc/sysctl.d -The command should not find any assignments other than: -net.ipv4.conf.all.rp_filter = 1 -or: -net.ipv4.conf.all.rp_filter = 2 +$ sudo grep -i path= /home/*/.* -Conflicting assignments are not allowed. - Is it the case that the net.ipv4.conf.all.rp_filter is not set to 1 or 2 or is configured to be 0? +/home/[localinteractiveuser]/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin + Is it the case that any local interactive user initialization files have executable search path statements that include directories outside of their home directory and is not documented with the ISSO as an operational requirement? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group" with the following command: + + Verify that Red Hat Enterprise Linux 8 enforces password complexity rules for the root account. -$ sudo auditctl -l | grep -E '(/etc/group)' +Check if root user is required to use complex passwords with the following command: --w /etc/group -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? +$ grep enforce_for_root /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:enforce_for_root + Is it the case that "enforce_for_root" is commented or missing? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PANIC_ON_OOPS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the nfs-utils package is installed: +$ rpm -q nfs-utils + Is it the case that the package is installed? - - Query the SA and the Web Manager to determine if a compiler is present on -the server. - Is it the case that the web server is part of an application suite and a comiler is needed -for installation, patching, and upgrading of the suite or if the compiler -is embedded and can't be removed without breaking the suite, document the -installation of the compiler with the ISSO/ISSM and verify that the compiler -is restricted to administrative users only. If documented and restricted to -administrative users, this is not a finding. - -If an undocumented compiler is present, and available to non-administrative -users? + + To check if authentication is required for single-user mode, run the following command: +$ grep sulogin /usr/lib/systemd/system/rescue.service +The output should be similar to the following, and the line must begin with +ExecStart and /usr/lib/systemd/systemd-sulogin-shell. + ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue + Is it the case that the output is different? - - To check that the cpupower service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled cpupower -Output should indicate the cpupower service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cpupower disabled - -Run the following command to verify cpupower is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cpupower - -If the service is not running the command will return the following output: -inactive + + To ensure LDAP is configured to use TLS for all transactions, run the following command: +$ grep start_tls /etc/pam_ldap.conf +The result should contain: +ssl start_tls + Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + + + Verify that Red Hat Enterprise Linux 8 disables the use of user namespaces with the following commands: -The service will also be masked, to check that the cpupower is masked, run the following command: -$ sudo systemctl show cpupower | grep "LoadState\|UnitFileState" +Note: User namespaces are used primarily for Linux containers. If containers are in use, this requirement is not applicable. -If the service is masked the command will return the following outputs: +The runtime status of the user.max_user_namespaces kernel parameter can be queried +by running the following command: +$ sysctl user.max_user_namespaces +0. -LoadState=masked + Is it the case that the correct value is not returned? + + + + The runtime status of the net.ipv6.conf.default.autoconf kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.autoconf +0. -UnitFileState=masked - Is it the case that the "cpupower" is loaded and not masked? + Is it the case that the correct value is not returned? - - To verify that SSSD is configured to run as user sssd, run the following command: -$ sudo grep -r '\buser\b' /etc/sssd -If configured properly, output should similar to /etc/sssd/conf.d/ospp.conf:user = sssd. -Sanity of SSSD configuration in general can be checked using $ sudo sssctl config-check - Is it the case that it does not exist or is not configured properly? + + +Run the following command to determine if the httpd_anon_write SELinux boolean is disabled: +$ getsebool httpd_anon_write +If properly configured, the output should show the following: +httpd_anon_write --> off + Is it the case that httpd_anon_write is not disabled? - - To determine how the SSH daemon's PermitUserEnvironment option is set, run the following command: - -$ sudo grep -i PermitUserEnvironment /etc/ssh/sshd_config + + Verify the "/etc/security/faillock.conf" file is configured use a non-default faillock directory to ensure contents persist after reboot: -If a line indicating no is returned, then the required value is set. +$ sudo grep 'dir =' /etc/security/faillock.conf - Is it the case that the required value is not set? +dir = /var/log/faillock + Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? - - To check that the mdmonitor service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled mdmonitor -Output should indicate the mdmonitor service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled mdmonitor disabled - -Run the following command to verify mdmonitor is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active mdmonitor - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the mdmonitor is masked, run the following command: -$ sudo systemctl show mdmonitor | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "mdmonitor" is loaded and not masked? + + +Run the following command to determine if the webadm_read_user_files SELinux boolean is disabled: +$ getsebool webadm_read_user_files +If properly configured, the output should show the following: +webadm_read_user_files --> off + Is it the case that webadm_read_user_files is not disabled? - - To verify the operating system prevents non-privileged users from executing -privileged functions to include disabling, circumventing, or altering -implemented security safeguards/countermeasures, run the following -command: -$ sudo semanage login -l -All administrators must be mapped to the sysadm_u or staff_u -users with the appropriate domains (sysadm_t and staff_t). - -All authorized non-administrative -users must be mapped to the user_u role or the appropriate domain -(user_t). - Is it the case that non-admin users are not confined correctly? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_LEGACY_VSYSCALL_EMULATE /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify the nosuid option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . nosuid . . . - - Is it the case that the "/var" file system does not have the "nosuid" option set? + + +Run the following command to determine if the cobbler_use_nfs SELinux boolean is disabled: +$ getsebool cobbler_use_nfs +If properly configured, the output should show the following: +cobbler_use_nfs --> off + Is it the case that cobbler_use_nfs is not disabled? - - To check the group ownership of /etc/shells, -run the command: -$ ls -lL /etc/shells -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shells does not have a group owner of root? + + +Run the following command to determine if the selinuxuser_execstack SELinux boolean is disabled: +$ getsebool selinuxuser_execstack +If properly configured, the output should show the following: +selinuxuser_execstack --> off + Is it the case that selinuxuser_execstack is not disabled? - - Determine if "sudoers" file restricts sudo access run the following commands: -$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* -$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\:ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* - Is it the case that either of the commands returned a line? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +$ sudo cat /etc/audit/rules.d/11-loginuid.rules +The output has to be exactly as follows: +## Make the loginuid immutable. This prevents tampering with the auid. +--loginuid-immutable + Is it the case that the file does not exist or the content differs? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECCOMP_FILTER /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/cron.allow, +run the command: +$ ls -l /etc/cron.allow +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/cron.allow does not have unix mode -rw-------? - - Verify that only the "root" account has a UID "0" assignment with the -following command: -$ awk -F: '$3 == 0 {print $1}' /etc/passwd -root - Is it the case that any accounts other than "root" have a UID of "0"? + + To ensure only SNMPv3 or newer is used, run the following command: +$ sudo grep 'rocommunity\|rwcommunity\|com2sec' /etc/snmp/snmpd.conf | grep -v "^#" +There should be no output. + Is it the case that there is output? - - The file /etc/cron.allow should exist. -This can be checked by running the following command: - -stat /etc/cron.allow - -and the output should list the file. - Is it the case that the file /etc/cron.allow does not exist? + + Run the following command to determine if the avahi package is installed: +$ rpm -q avahi + Is it the case that the package is installed? - + -If the system is configured to prevent the loading of the iwlwifi kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the iwlwifi kernel module via blacklist keyword. +Run the following command to determine if the gssd_read_tmp SELinux boolean is enabled: +$ getsebool gssd_read_tmp +If properly configured, the output should show the following: +gssd_read_tmp --> on + Is it the case that gssd_read_tmp is not enabled? + + + + The runtime status of the net.core.bpf_jit_harden kernel parameter can be queried +by running the following command: +$ sysctl net.core.bpf_jit_harden +2. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r iwlwifi /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + + To verify if the OpenSSL uses defined TLS Crypto Policy, run: +$ grep -P '^(TLS\.)?MinProtocol' /etc/crypto-policies/back-ends/opensslcnf.config +and verify that the value is +TLSv1.2 + Is it the case that cryptographic policy for openssl is not configured or is configured incorrectly? + + + To determine if the system is configured to audit calls to the -finit_module system call, run the following command: -$ sudo grep "finit_module" /etc/audit/audit.* +renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To check the ownership of /etc/shadow-, + + To verify that Samba clients using mount.cifs must use packet signing, run the following command: +$ grep sec /etc/fstab +The output should show either krb5i or ntlmv2i in use. + Is it the case that it does not? + + + + To check the permissions of /etc/audit/rules.d/*.rules, run the command: -$ ls -lL /etc/shadow- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shadow- does not have an owner of root? +$ ls -l /etc/audit/rules.d/*.rules +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/audit/rules.d/*.rules does not have unix mode -rw-r-----? - - Verify that GRUB_DISABLE_RECOVERY is set to true in /etc/default/grub to disable recovery boot. -Run the following command: - -$ sudo grep GRUB_DISABLE_RECOVERY /etc/default/grub - Is it the case that GRUB_DISABLE_RECOVERY is not set to true or is missing? + + Run the following command to determine if the dhcp-server package is installed: +$ rpm -q dhcp-server + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to notify the SA and/or ISSO (at a minimum) in the event of an audit processing failure with the following command: - -$ sudo grep action_mail_acct /etc/audit/auditd.conf + + The runtime status of the fs.protected_symlinks kernel parameter can be queried +by running the following command: +$ sysctl fs.protected_symlinks +1. -action_mail_acct = - Is it the case that the value of the "action_mail_acct" keyword is not set to "<sub idref="var_auditd_action_mail_acct" />" and/or other accounts for security personnel, the "action_mail_acct" keyword is missing, or the retuned line is commented out, ask the system administrator to indicate how they and the ISSO are notified of an audit process failure. If there is no evidence of the proper personnel being notified of an audit processing failure? + Is it the case that the correct value is not returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chcon" command with the following command: - -$ sudo auditctl -l | grep chcon + + The runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.arp_ignore +. --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the correct value is not returned? - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep usernetctl /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? + + Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: - -$ sudo grep disk_full_action /etc/audit/auditd.conf + + Verify the value of the "maxclassrepeat" option in "/etc/security/pwquality.conf" with the following command: -disk_full_action = +$ grep maxclassrepeat /etc/security/pwquality.conf -If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. - Is it the case that there is no evidence of appropriate action? +maxclassrepeat = + Is it the case that the value of "maxclassrepeat" is set to "0", more than "<sub idref="var_password_pam_maxclassrepeat" />" or is commented out? - - Verify "nftables" is configured to allow rate limits on any connection to the system with the following command: - -Verify "firewalld" has "nftables" set as the default backend: - -$ sudo grep -i firewallbackend /etc/firewalld/firewalld.conf - -# FirewallBackend -FirewallBackend=nftables - Is it the case that the "nftables" is not set as the "firewallbackend"? + + To check if the installed Operating System is 64-bit, run the following command: +$ uname -m +The output should be one of the following: x86_64, aarch64, ppc64le or s390x. +If the output is i686 or i386 the operating system is 32-bit. +Check if the installed CPU supports 64-bit operating systems by running the following command: +$ lscpu | grep "CPU op-mode" +If the output contains 64bit, the CPU supports 64-bit operating systems. + Is it the case that the installed operating sytem is 32-bit but the CPU supports operation in 64-bit? - - Verify the nosuid option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . nosuid . . . + + To determine if the system is configured to audit calls to the +finit_module system call, run the following command: +$ sudo grep "finit_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/var/log" file system does not have the "nosuid" option set? + Is it the case that no line is returned? - + -Run the following command to determine if the sysadm_exec_content SELinux boolean is enabled: -$ getsebool sysadm_exec_content +Run the following command to determine if the deny_ptrace SELinux boolean is disabled: +$ getsebool deny_ptrace If properly configured, the output should show the following: -sysadm_exec_content --> on - Is it the case that sysadm_exec_content is not enabled? - - - - To check the group ownership of /etc/issue, -run the command: -$ ls -lL /etc/issue -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/issue does not have a group owner of root? +deny_ptrace --> off + Is it the case that deny_ptrace is not disabled? - + -Run the following command to determine if the saslauthd_read_shadow SELinux boolean is disabled: -$ getsebool saslauthd_read_shadow +Run the following command to determine if the squid_connect_any SELinux boolean is disabled: +$ getsebool squid_connect_any If properly configured, the output should show the following: -saslauthd_read_shadow --> off - Is it the case that saslauthd_read_shadow is not disabled? - - - - To determine how the SSH daemon's X11Forwarding option is set, run the following command: - -$ sudo grep -i X11Forwarding /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_COMPAT_VDSO /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? +squid_connect_any --> off + Is it the case that squid_connect_any is not disabled? - - Run the following command to determine if the setroubleshoot-plugins package is installed: -$ rpm -q setroubleshoot-plugins + + Run the following command to determine if the rsh-server package is installed: +$ rpm -q rsh-server Is it the case that the package is installed? - - To verify that null passwords cannot be used, run the following command: -$ sudo awk -F: '!$2 {print $1}' /etc/shadow -If this produces any output, it may be possible to log into accounts -with empty passwords. - Is it the case that Blank or NULL passwords can be used? - - - - Verify that the IPSec service uses the system crypto policy. - -If the ipsec service is not installed is not applicable. - -Check to see if the "IPsec" service is active with the following command: - -$ systemctl status ipsec - -ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec -Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) -Active: inactive (dead) - -If the "IPsec" service is active, check to see if it is using the system crypto policy with the following command: - -$ sudo grep include /etc/ipsec.conf /etc/ipsec.d/*.conf - -/etc/ipsec.conf:include /etc/crypto-policies/back-ends/libreswan.config - Is it the case that the "IPsec" service is active and the ipsec configuration file does not contain does not contain <tt>include /etc/crypto-policies/back-ends/libreswan.config</tt>? - - - + -Run the following command to determine if the awstats_purge_apache_log_files SELinux boolean is disabled: -$ getsebool awstats_purge_apache_log_files +Run the following command to determine if the pcp_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool pcp_bind_all_unreserved_ports If properly configured, the output should show the following: -awstats_purge_apache_log_files --> off - Is it the case that awstats_purge_apache_log_files is not disabled? - - - - To ensure that system location tracking is not active, run the following command: -$ gsettings get org.gnome.system.location enabled -$ gsettings get org.gnome.clocks geolocation -If properly configured, the output should be false. -To ensure that users cannot enable system location tracking, run the following: -$ grep location /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/system/location/enabled and /org/gnome/clocks/geolocation. - Is it the case that geolocation is enabled and not disabled? +pcp_bind_all_unreserved_ports --> off + Is it the case that pcp_bind_all_unreserved_ports is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "init" command with the following command: - -$ sudo auditctl -l | grep init + + Verify Red Hat Enterprise Linux 8 enforces a delay of at least seconds between console logon prompts following a failed logon attempt with the following command: --a always,exit -F path=/init -F perm=x -F auid>=1000 -F auid!=unset -k privileged-init - Is it the case that the command does not return a line, or the line is commented out? +$ sudo grep -i "FAIL_DELAY" /etc/login.defs +FAIL_DELAY + Is it the case that the value of "FAIL_DELAY" is not set to "<sub idref="var_accounts_fail_delay" />" or greater, or the line is commented out? - - To check if compression is enabled or set correctly, run the -following command: -$ sudo grep Compression /etc/ssh/sshd_config -If configured properly, output should be no or delayed. - Is it the case that it is commented out, or is not set to no or delayed? + + To determine if the system is configured to audit unsuccessful calls +to the lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To verify that the audit system collects unauthorized file accesses, run the following commands: -$ sudo grep EACCES /etc/audit/audit.rules -$ sudo grep EPERM /etc/audit/audit.rules - Is it the case that 32-bit and 64-bit system calls to creat, open, openat, open_by_handle_at, truncate, and ftruncate are not audited during EACCES and EPERM? + + Display the contents of the file /etc/systemd/logind.conf: +cat /etc/systemd/logind.conf +Ensure that there is a section [login] which contains the +configuration StopIdleSessionSec=. + Is it the case that the option is not configured? - - -Run the following command to determine if the nagios_run_pnp4nagios SELinux boolean is disabled: -$ getsebool nagios_run_pnp4nagios -If properly configured, the output should show the following: -nagios_run_pnp4nagios --> off - Is it the case that nagios_run_pnp4nagios is not disabled? + + To verify that the interface(s) follow site policy for zone assignment run the +following command: +$ sudo nmcli -t connection show | awk -F: '{if($4){print $4}}' | while read INT; +do firewall-cmd --get-active-zones | grep -B1 $INT; done +If your have to assign an interface to the appropriate zone run the following command: +$ sudo firewall-cmd --zone= --change-interface= + Is it the case that Your system accepts all incoming packets for unnecessary services and ports? - - To find SUID files, run the following command: -$ sudo find / -xdev -type f -perm -4000 - Is it the case that only authorized files appear in the output of the find command? + + To verify the INACTIVE setting, run the following command: +$ grep "INACTIVE" /etc/default/useradd +The output should indicate the INACTIVE configuration option is set +to an appropriate integer as shown in the example below: +$ grep "INACTIVE" /etc/default/useradd +INACTIVE= + Is it the case that the value of INACTIVE is greater than the expected value or is -1? - - Run the following command to determine if the iprutils package is installed: -$ rpm -q iprutils - Is it the case that the package is installed? + + To determine if the system is configured to audit changes to its network configuration, +run the following command: +auditctl -l | grep -E '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)' +If the system is configured to watch for network configuration changes, a line should be returned for +each file specified (and perm=wa should be indicated for each). + Is it the case that the system is not configured to audit changes of the network configuration? - - To verify that cryptography policy has been configured correctly, run the -following command: -$ update-crypto-policies --show -The output should return . -Run the command to check if the policy is correctly applied: -$ update-crypto-policies --is-applied -The output should be The configured policy is applied. -Moreover, check if settings for selected crypto policy are as expected. -List all libraries for which it holds that their crypto policies do not have symbolic link in /etc/crypto-policies/back-ends. -$ ls -l /etc/crypto-policies/back-ends/ | grep '^[^l]' | tail -n +2 | awk -F' ' '{print $NF}' | awk -F'.' '{print $1}' | sort -Subsequently, check if matching libraries have drop in files in the /etc/crypto-policies/local.d directory. -$ ls /etc/crypto-policies/local.d/ | awk -F'-' '{print $1}' | uniq | sort -Outputs of two previous commands should match. - Is it the case that cryptographic policy is not configured or is configured incorrectly? + + Run the following command to determine if the openscap-scanner package is installed: $ rpm -q openscap-scanner + Is it the case that the package is not installed? - - Verify that Red Hat Enterprise Linux 8 enforces a -day maximum password lifetime for new user accounts by running the following command: - -$ grep -i pass_max_days /etc/login.defs - -PASS_MAX_DAYS - Is it the case that the "PASS_MAX_DAYS" parameter value is greater than "<sub idref="var_accounts_maximum_age_login_defs" />", or commented out? + + Inspect the mounts configured in /etc/exports. Each mount should specify a value +greater than UID_MAX and GID_MAX as defined in /etc/login.defs. + Is it the case that anonuid or anongid are not set to a value greater than UID_MAX (for anonuid) and GID_MAX (for anongid)? - - Verify the nosuid option is configured for the /boot/efi mount point, + + Verify the nosuid option is configured for the /var mount point, run the following command: - $ sudo mount | grep '\s/boot/efi\s' - . . . /boot/efi . . . nosuid . . . + $ sudo mount | grep '\s/var\s' + . . . /var . . . nosuid . . . - Is it the case that the "/boot/efi" file system does not have the "nosuid" option set? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes slab_nomerge=yes, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slab_nomerge=yes.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*slab_nomerge=yes.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'slab_nomerge=yes' -The command should not return any output. - Is it the case that merging of slabs with similar size is enabled? + Is it the case that the "/var" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_mod_auth_pam SELinux boolean is disabled: -$ getsebool httpd_mod_auth_pam +Run the following command to determine if the virt_rw_qemu_ga_data SELinux boolean is disabled: +$ getsebool virt_rw_qemu_ga_data If properly configured, the output should show the following: -httpd_mod_auth_pam --> off - Is it the case that httpd_mod_auth_pam is not disabled? +virt_rw_qemu_ga_data --> off + Is it the case that virt_rw_qemu_ga_data is not disabled? - - -Run the following command to determine if the daemons_dump_core SELinux boolean is disabled: -$ getsebool daemons_dump_core -If properly configured, the output should show the following: -daemons_dump_core --> off - Is it the case that daemons_dump_core is not disabled? + + To determine if the system is configured to audit calls to the +query_module system call, run the following command: +$ sudo grep "query_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + + To check if pam_namespace.so is required for user login, run the following command: +$ grep pam_namespace.so /etc/pam.d/login +The output should return the following uncommented: +session required pam_namespace.so + Is it the case that pam_namespace.so is not required or is commented out? + + + -Run the following command to determine if the mozilla_plugin_use_gps SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_gps +Run the following command to determine if the neutron_can_network SELinux boolean is disabled: +$ getsebool neutron_can_network If properly configured, the output should show the following: -mozilla_plugin_use_gps --> off - Is it the case that mozilla_plugin_use_gps is not disabled? +neutron_can_network --> off + Is it the case that neutron_can_network is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check if the system login banner is compliant, run the following command: +$ cat /etc/issue.net + Is it the case that it does not display the required banner? - - Run the following command to determine if the tuned package is installed: -$ rpm -q tuned - Is it the case that the package is installed? + + +Run the following command to determine if the unprivuser_use_svirt SELinux boolean is disabled: +$ getsebool unprivuser_use_svirt +If properly configured, the output should show the following: +unprivuser_use_svirt --> off + Is it the case that unprivuser_use_svirt is not disabled? - + -Run the following command to determine if the httpd_graceful_shutdown SELinux boolean is enabled: -$ getsebool httpd_graceful_shutdown -If properly configured, the output should show the following: -httpd_graceful_shutdown --> on - Is it the case that httpd_graceful_shutdown is not enabled? + +Run the following command to determine the current status of the +rngd service: +$ sudo systemctl is-active rngd +If the service is running, it should return the following: active + Is it the case that the "rngd" service is disabled, masked, or not started.? - - If IPv6 is disabled, this is not applicable. + + Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. +Determine the location of the tmux script with the following command: +$ sudo grep tmux /etc/bashrc /etc/profile.d/* -Run the following command to determine the current status of the -ip6tables service: -$ sudo systemctl is-active ip6tables -If the service is running, it should return the following: active - Is it the case that ? +/etc/profile.d/tmux.sh: case "$name" in (sshd|login) tmux ;; esac + +Review the tmux script by using the following example: + +$ cat /etc/profile.d/tmux.sh + +if [ "$PS1" ]; then +parent=$(ps -o ppid= -p $$) +name=$(ps -o comm= -p $parent) +case "$name" in (sshd|login) tmux ;; esac +fi + +If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. + +Determine if tmux is currently running with the following command: + +$ sudo ps all | grep tmux | grep -v grep + Is it the case that the command does not produce output? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_SHA512 /boot/config.* + $ grep CONFIG_LEGACY_VSYSCALL_NONE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the gnutls-utils package is installed: $ rpm -q gnutls-utils - Is it the case that the package is not installed? - - - - Run the following command to determine if the avahi package is installed: -$ rpm -q avahi - Is it the case that the package is installed? + + +Run the following command to determine if the kerberos_enabled SELinux boolean is enabled: +$ getsebool kerberos_enabled +If properly configured, the output should show the following: +kerberos_enabled --> on + Is it the case that kerberos_enabled is not enabled? - - To verify that Audit Daemon is configured to record the computer node -name in the audit events, run the following command: -$ sudo grep name_format /etc/audit/auditd.conf -The output should return the following: -name_format = - Is it the case that name_format isn't set to <sub idref="var_auditd_name_format" />? + + Verify Red Hat Enterprise Linux 8 audits the execution of privileged functions. + +Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: + +$ sudo grep execve /etc/audit/audit.rules + +The output should be the following: + + +-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid +-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + Is it the case that the command does not return all lines, or the lines are commented out? - - Verify that there are no shosts.equiv files on the system, run the following command: -$ find / -name shosts.equiv - Is it the case that shosts.equiv files exist? + + The runtime status of the net.ipv4.ip_forward kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.ip_forward +0. +The ability to forward packets is only appropriate for routers. + Is it the case that the correct value is not returned? - - Run the following command to verify that the MTA is not listening on -any non-loopback address (127.0.0.1 or ::1). -# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|::1):25\s' -Nothing should be returned - Is it the case that MTA is listening on any non-loopback address? + + The runtime status of the fs.protected_hardlinks kernel parameter can be queried +by running the following command: +$ sysctl fs.protected_hardlinks +1. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the cobbler_can_network_connect SELinux boolean is disabled: -$ getsebool cobbler_can_network_connect -If properly configured, the output should show the following: -cobbler_can_network_connect --> off - Is it the case that cobbler_can_network_connect is not disabled? + + To check for legacy lines in /etc/group, run the following command: + grep '^\+' /etc/group +The command should not return any output. + Is it the case that the file contains legacy lines? - - -Run the following command to determine if the polipo_session_users SELinux boolean is disabled: -$ getsebool polipo_session_users -If properly configured, the output should show the following: -polipo_session_users --> off - Is it the case that polipo_session_users is not disabled? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine how much data the system will retain in each audit log file: +$ sudo grep max_log_file /etc/audit/auditd.conf +max_log_file = 6 + Is it the case that the system audit data threshold has not been properly configured? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STACKPROTECTOR_STRONG /boot/config.* + $ grep CONFIG_DEBUG_NOTIFIERS /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-agent" command with the following command: -Run the following command to determine the current status of the -postfix service: -$ sudo systemctl is-active postfix -If the service is running, it should return the following: active - Is it the case that the system is not a cross domain solution and the service is not enabled? +$ sudo auditctl -l | grep ssh-agent + +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent + Is it the case that the command does not return a line, or the line is commented out? - - + + The runtime status of the net.ipv4.conf.all.arp_filter kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.arp_filter +. -Run the following command to determine the current status of the -usbguard service: -$ sudo systemctl is-active usbguard -If the service is running, it should return the following: active - Is it the case that the service is not enabled? + Is it the case that the correct value is not returned? - - To verify that clients cannot automatically update DNS records, perform the -following: -$ grep -i dhcp_hostname /etc/sysconfig/network-scripts/ifcfg-* -$ grep -rni "send host-name" /etc/dhclient.conf /etc/dhcp -The output should return no results. - Is it the case that client Dynamic DNS updates are not disabled? + + To check the ownership of /etc/shadow-, +run the command: +$ ls -lL /etc/shadow- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/shadow- does not have an owner of root? - - To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: - -$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? + + +Run the following command to determine if the telepathy_tcp_connect_generic_network_ports SELinux boolean is disabled: +$ getsebool telepathy_tcp_connect_generic_network_ports +If properly configured, the output should show the following: +telepathy_tcp_connect_generic_network_ports --> off + Is it the case that telepathy_tcp_connect_generic_network_ports is not disabled? - - To verify that McAfee Runtime Libraries (MFErt) and Linux Agent (MFEcma) -are installed, run the following command(s): -$ rpm -q MFEcma -$ rpm -q MFErt - Is it the case that the HBSS HIPS module is not installed? + + Run the following command to determine if the tmux package is installed: $ rpm -q tmux + Is it the case that the package is not installed? - - To verify that Samba clients running smbclient must use packet signing, run the following command: -$ grep signing /etc/samba/smb.conf -The output should show: -client signing = mandatory - Is it the case that it is not? + + +Run the following command to determine if the named_write_master_zones SELinux boolean is disabled: +$ getsebool named_write_master_zones +If properly configured, the output should show the following: +named_write_master_zones --> off + Is it the case that named_write_master_zones is not disabled? - + -To properly set the owner of /var/log/httpd, run the command: -$ sudo chown root /var/log/httpd - -To properly set the owner of /var/log/httpd/*, run the command: -$ sudo chown root /var/log/httpd/* - Is it the case that ? +Run the following command to determine if the xend_run_qemu SELinux boolean is enabled: +$ getsebool xend_run_qemu +If properly configured, the output should show the following: +xend_run_qemu --> on + Is it the case that xend_run_qemu is not enabled? - - Verify Red Hat Enterprise Linux 8 removes all software components after updated versions have been installed. - + + Find the list of alias maps used by the Postfix mail server: +$ sudo postconf alias_maps +Query the Postfix alias maps for an alias for the root user: +$ sudo postmap -q root hash:/etc/aliases +The output should return an alias. + Is it the case that the alias is not set? + + + + root password is not set + Is it the case that Perform the following to determine if a password is set for the +root user: +<pre># grep -Eq '^root:\$[0-9]' /etc/shadow || echo "root is locked"</pre> +No results should be returned. +Otherwise, run the following command and follow the prompts to set a +password for the root user: +<pre># passwd root</pre>? + + + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -$ grep clean_requirements_on_remove /etc/yum.conf -clean_requirements_on_remove=1 - Is it the case that '"clean_requirements_on_remove" is not set to "1"'? + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open system call. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the rename system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r open /etc/audit/rules.d +$ sudo grep -r rename /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep open /etc/audit/audit.rules +$ sudo grep rename /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_update" command with the following command: - -$ sudo auditctl -l | grep unix_update - --a always,exit -F path=/usr/bin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_update +-a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the vim-enhanced package is installed: $ rpm -q vim-enhanced - Is it the case that the package is not installed? - - - - Run the following command to check the mode of the system audit logs: -$ sudo grep -iw log_file /etc/audit/auditd.conf -log_file=/var/log/audit/audit.log -$ sudo stat -c "%n %a" /var/log/audit/* -$ sudo ls -l /var/log/audit -Audit logs must be mode 0640 or less permissive. - Is it the case that any permissions are more permissive? + + Run the following command to verify that the MTA is not listening on +any non-loopback address (127.0.0.1 or ::1). +# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|::1):25\s' +Nothing should be returned + Is it the case that MTA is listening on any non-loopback address? - - To check that the bluetooth service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled bluetooth -Output should indicate the bluetooth service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled bluetooth disabled - -Run the following command to verify bluetooth is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active bluetooth + + Verify the "umask" setting is configured correctly in the "/etc/csh.cshrc" file with the following command: -If the service is not running the command will return the following output: -inactive +$ grep umask /etc/csh.cshrc -The service will also be masked, to check that the bluetooth is masked, run the following command: -$ sudo systemctl show bluetooth | grep "LoadState\|UnitFileState" +umask 077 +umask 077 + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? + + + + Open browser window and browse to the appropriate site. Before entry to the +site, you should be presented with the server's PKI credentials. Review +these credentials for authenticity. -If the service is masked the command will return the following outputs: +For DoD, find an entry which cites: -LoadState=masked +Issuer: +CN = +DOD CLASS 3 CA-3 +OU = PKI +OU = DoD +O = U.S. Government +C = US -UnitFileState=masked - Is it the case that the "bluetooth" is loaded and not masked? + Is it the case that it is not? - - Verify that a separate file system/partition has been created for /opt with the following command: - -$ mountpoint /opt - - Is it the case that "/opt is not a mountpoint" is returned? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STACKPROTECTOR /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server - Is it the case that the package is not installed? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes audit=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*audit=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'audit=1' +The command should not return any output. + Is it the case that auditing is not enabled at boot time? - - To determine if the system is configured to audit calls to the -fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nosuid option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . nosuid . . . - Is it the case that no line is returned? + Is it the case that the "/dev/shm" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_use_openstack SELinux boolean is disabled: -$ getsebool httpd_use_openstack +Run the following command to determine if the domain_kernel_load_modules SELinux boolean is disabled: +$ getsebool domain_kernel_load_modules If properly configured, the output should show the following: -httpd_use_openstack --> off - Is it the case that httpd_use_openstack is not disabled? - - - - To check the ownership of /etc/passwd-, -run the command: -$ ls -lL /etc/passwd- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/passwd- does not have an owner of root? - - - - To determine if ignore_dot has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\bignore_dot\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that ignore_dot is not enabled in sudo? +domain_kernel_load_modules --> off + Is it the case that domain_kernel_load_modules is not disabled? - - Verify that the interactive user account passwords last change time is not in the future -The following command should return no output -$ sudo expiration=$(cat /etc/shadow|awk -F ':' '{print $3}'); -for edate in ${expiration[@]}; do if [[ $edate > $(( $(date +%s)/86400 )) ]]; -then echo "Expiry date in future"; -fi; done - Is it the case that any interactive user password that has last change time in the future? + + To check that no password hashes are stored in +/etc/passwd, run the following command: +awk '!/\S:x|\*/ {print}' /etc/passwd +If it produces any output, then a password hash is +stored in /etc/passwd. + Is it the case that any stored hashes are found in /etc/passwd? - - -Run the following command to determine if the secure_mode_policyload SELinux boolean is disabled: -$ getsebool secure_mode_policyload -If properly configured, the output should show the following: -secure_mode_policyload --> off - Is it the case that secure_mode_policyload is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEBUG_SG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the dnf-automatic package is installed: $ rpm -q dnf-automatic - Is it the case that the package is not installed? + + To verify that OpenSSL uses the system crypto policy, check out that the OpenSSL config file +/etc/pki/tls/openssl.cnf contains the [ crypto_policy ] section with the +.include /etc/crypto-policies/back-ends/opensslcnf.config directive: + +$ sudo grep '\.include\s* /etc/crypto-policies/back-ends/opensslcnf.config$' /etc/pki/tls/openssl.cnf. + Is it the case that the OpenSSL config file doesn't contain the whole section, +or the section doesn't contain the <pre>.include /etc/crypto-policies/back-ends/opensslcnf.config</pre> directive? - - To check that the cockpit service is disabled in system boot configuration, + + To check that the smb service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled cockpit -Output should indicate the cockpit service has either not been installed, +$ sudo systemctl is-enabled smb +Output should indicate the smb service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cockpit disabled +$ sudo systemctl is-enabled smb disabled -Run the following command to verify cockpit is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cockpit +Run the following command to verify smb is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active smb If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the cockpit is masked, run the following command: -$ sudo systemctl show cockpit | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the smb is masked, run the following command: +$ sudo systemctl show smb | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "cockpit" is loaded and not masked? + Is it the case that the "smb" is loaded and not masked? - - To verify if GnuTLS uses defined DoD-approved TLS Crypto Policy, run: -$ sudo grep -'+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' -/etc/crypto-policies/back-ends/gnutls.config and verify that a match exists. - Is it the case that cryptographic policy for gnutls is not configured or is configured incorrectly? + + To verify that tmux is not listed as allowed shell on the system +run the following command: +$ grep 'tmux$' /etc/shells +The output should be empty. + Is it the case that tmux is listed in /etc/shells? - - Verify Red Hat Enterprise Linux 8 defines default permissions for all authenticated users in such a way that the user can only read and modify their own files with the following command: - -# grep -i umask /etc/login.defs - -UMASK - Is it the case that the value for the "UMASK" parameter is not "<sub idref="var_accounts_user_umask" />", or the "UMASK" parameter is missing or is commented out? + + To determine if logfile has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults\s*\blogfile\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that logfile is not enabled in sudo? - - -Run the following command to determine if the abrt_upload_watch_anon_write SELinux boolean is disabled: -$ getsebool abrt_upload_watch_anon_write -If properly configured, the output should show the following: -abrt_upload_watch_anon_write --> off - Is it the case that abrt_upload_watch_anon_write is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_HIBERNATION /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - To determine if the system is configured to audit calls to the -rmdir system call, run the following command: -$ sudo grep "rmdir" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -rename system call, run the following command: -$ sudo grep "rename" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To verify the system is not configured to use a boot loader on removable media, -check that the grub configuration file has the set root command in each menu -entry with the following commands: -$ sudo grep -cw menuentry /boot/efi/EFI/redhat/grub.cfg -Note that the -c option for the grep command will print -only the count of menuentry occurrences. This number should match -the number of occurrences reported by the following command: -$ sudo grep "set root='hd0" /boot/efi/EFI/redhat/grub.cfg -The output should return something similar to: -set root='hd0,msdos1' -usb0, cd, fd0, etc. are some examples of removeable -media which should not exist in the lines: -set root='hd0,msdos1' - Is it the case that it is not? - - - - Find the list of alias maps used by the Postfix mail server: -$ sudo postconf alias_maps -Query the Postfix alias maps for an alias for the root user: -$ sudo postmap -q root hash:/etc/aliases -The output should return an alias. - Is it the case that the alias is not set? - - - - The runtime status of the net.ipv4.conf.all.log_martians kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.log_martians -1. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlink system call. - Is it the case that the correct value is not returned? +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r unlink /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep unlink /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete + Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the git_session_users SELinux boolean is disabled: -$ getsebool git_session_users +Run the following command to determine if the awstats_purge_apache_log_files SELinux boolean is disabled: +$ getsebool awstats_purge_apache_log_files If properly configured, the output should show the following: -git_session_users --> off - Is it the case that git_session_users is not disabled? +awstats_purge_apache_log_files --> off + Is it the case that awstats_purge_apache_log_files is not disabled? - + -Run the following command to determine if the virt_use_nfs SELinux boolean is disabled: -$ getsebool virt_use_nfs +Run the following command to determine if the virt_use_fusefs SELinux boolean is disabled: +$ getsebool virt_use_fusefs If properly configured, the output should show the following: -virt_use_nfs --> off - Is it the case that virt_use_nfs is not disabled? +virt_use_fusefs --> off + Is it the case that virt_use_fusefs is not disabled? - - Verify the system-wide shared library files are group-owned by "root" with the following command: + + To determine how the SSH daemon's LogLevel option is set, run the following command: -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -group root -exec ls -l {} \; - Is it the case that any system wide shared library file is returned and is not group-owned by a required system account? +$ sudo grep -i LogLevel /etc/ssh/sshd_config + +If a line indicating INFO is returned, then the required value is set. + + Is it the case that the required value is not set? + + + + # grep "^OPTIONS.*-u" /etc/sysconfig/chronyd | grep -v -e '-u\s*chrony\b' +returns no output + Is it the case that chronyd is not running under chrony user account? + + + + To check the ownership of /etc/issue.net, +run the command: +$ ls -lL /etc/issue.net +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/issue.net does not have an owner of root? + + + + Verify the system-wide shared library files are owned by "root" with the following command: + +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -user root -exec ls -l {} \; + Is it the case that any system wide shared library file is not owned by root? + + + + To check the group ownership of /etc/cron.daily, +run the command: +$ ls -lL /etc/cron.daily +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.daily does not have a group owner of root? @@ -385049,207 +385531,214 @@ $ sudo ls -al /etc/tmux.conf Is it the case that the "lock-session" is not bound to a specific key? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling autorun-never -If properly configured, the output for autorun-nevershould be true. -To ensure that users cannot enable autorun in GNOME3, run the following: -$ grep 'autorun-never' /etc/dconf/db/local.d/locks/* -If properly configured, the output for autorun-never should be /org/gnome/desktop/media-handling/autorun-never - Is it the case that GNOME autorun is not disabled? + + To check that the named service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled named +Output should indicate the named service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled named disabled + +Run the following command to verify named is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active named + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the named is masked, run the following command: +$ sudo systemctl show named | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "named" is loaded and not masked? - + -Run the following command to determine if the openvpn_can_network_connect SELinux boolean is disabled: -$ getsebool openvpn_can_network_connect +Run the following command to determine if the httpd_execmem SELinux boolean is disabled: +$ getsebool httpd_execmem If properly configured, the output should show the following: -openvpn_can_network_connect --> off - Is it the case that openvpn_can_network_connect is not disabled? - - - - To check the group ownership of /etc/cron.allow, -run the command: -$ ls -lL /etc/cron.allow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.allow does not have a group owner of root? +httpd_execmem --> off + Is it the case that httpd_execmem is not disabled? - - To determine how the SSH daemon's Banner option is set, run the following command: - -$ sudo grep -i Banner /etc/ssh/sshd_config - -If a line indicating /etc/issue.net is returned, then the required value is set. - - Is it the case that the required value is not set? + + To verify that each web content directory exists on separate partitions, +run the following command: +$ grep `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` /etc/fstab +Each of the corresponding DocumentRoot entries should have a +corresponding entry in /etc/fstab. + Is it the case that it is not? - - Run the following command to determine if the binutils package is installed: $ rpm -q binutils - Is it the case that the package is not installed? + + To ensure that wireless network notification is disabled, run the following command: +$ gsettings get org.gnome.nm-applet suppress-wireless-networks-available +If properly configured, the output should be true. +To ensure that users cannot enable wireless notification, run the following: +$ grep wireless-networks-available /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/nm-applet/suppress-wireless-networks-available + Is it the case that wireless network notification is enabled and not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-keysign" command with the following command: + + Verify that a separate file system/partition has been created for /var/log with the following command: -$ sudo auditctl -l | grep ssh-keysign +$ mountpoint /var/log --a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-keysign - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that "/var/log is not a mountpoint" is returned? - + -Run the following command to determine if the cluster_manage_all_files SELinux boolean is disabled: -$ getsebool cluster_manage_all_files +Run the following command to determine if the abrt_upload_watch_anon_write SELinux boolean is disabled: +$ getsebool abrt_upload_watch_anon_write If properly configured, the output should show the following: -cluster_manage_all_files --> off - Is it the case that cluster_manage_all_files is not disabled? +abrt_upload_watch_anon_write --> off + Is it the case that abrt_upload_watch_anon_write is not disabled? - - To check that the dovecot service is disabled in system boot configuration, + + To check that the squid service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled dovecot -Output should indicate the dovecot service has either not been installed, +$ sudo systemctl is-enabled squid +Output should indicate the squid service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled dovecot disabled +$ sudo systemctl is-enabled squid disabled -Run the following command to verify dovecot is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active dovecot +Run the following command to verify squid is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active squid If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the dovecot is masked, run the following command: -$ sudo systemctl show dovecot | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the squid is masked, run the following command: +$ sudo systemctl show squid | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "dovecot" is loaded and not masked? + Is it the case that the "squid" is loaded and not masked? - - For each private key stored on the system, use the following command: -$ sudo ssh-keygen -y -f /path/to/file -If the contents of the key are displayed, this is a finding. - Is it the case that no ssh private key is accessible without a passcode? + + To check for serial port entries which permit root login, +run the following command: +$ sudo grep ^ttyS/[0-9] /etc/securetty +If any output is returned, then root login over serial ports is permitted. + Is it the case that root login over serial ports is permitted? - - Verify the Red Hat Enterprise Linux 8 "fapolicyd" employs a deny-all, permit-by-exception policy. - -Check that "fapolicyd" is in enforcement mode with the following command: - -$ sudo grep permissive /etc/fapolicyd/fapolicyd.conf - -permissive = 0 - -Check that fapolicyd employs a deny-all policy on system mounts with the following commands: - -For RHEL 8.5 systems and older: -$ sudo tail /etc/fapolicyd/fapolicyd.rules - -For RHEL 8.6 systems and newer: -$ sudo tail /etc/fapolicyd/compiled.rules + + To determine if the system is configured to audit successful calls +to the openat system call, run the following command: +$ sudo grep "openat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -allow exe=/usr/bin/python3.7 : ftype=text/x-python -deny_audit perm=any pattern=ld_so : all -deny perm=any all : all - Is it the case that fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception policy? + Is it the case that no line is returned? - - To ensure the system is configured to mask the Ctrl-Alt-Del sequence, Check -that the ctrl-alt-del.target is masked and not active with the following -command: -sudo systemctl status ctrl-alt-del.target -The output should indicate that the target is masked and not active. It -might resemble following output: -ctrl-alt-del.target -Loaded: masked (/dev/null; bad) -Active: inactive (dead) - Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed? + + Run the following command to determine if the sudo package is installed: $ rpm -q sudo + Is it the case that the package is not installed? - - Storing logs with compression can help avoid filling the system disk. -Run the following command to verify that journald is compressing logs. - -grep "^\sCompress" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. +Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: -and it should return +$ sudo grep disk_error_action /etc/audit/auditd.conf -Compress=yes +disk_error_action = HALT - Is it the case that is commented out or not configured correctly? +If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. + Is it the case that there is no evidence of appropriate action? - - Verify the pam_faillock.so module is present in the "/etc/pam.d/system-auth" file: - -$ sudo grep pam_faillock.so /etc/pam.d/system-auth + + To determine if the system is configured to audit successful calls +to the removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -auth required pam_faillock.so preauth -auth required pam_faillock.so authfail -account required pam_faillock.so - Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/system-auth" file with the "preauth" line listed before pam_unix.so? + Is it the case that no line is returned? - - Run the following commands and verify output: - -# iptables -L INPUT -v -n | grep lo | grep ACCEPT - - -# iptables -L INPUT -v -n | grep 127.0.0.0\/8 | grep DROP - - -# iptables -L OUTPUT -v -n | grep lo | grep ACCEPT - - Is it the case that loopback traffic is not configured? + + Inspect each <Directory> instance and verify that either +FollowSymLinks does not exist, or +Options SymLinksIfOwnerMatchDisable is configured properly. + Is it the case that it is not? - - To check the group ownership of /var/log/messages, -run the command: -$ ls -lL /var/log/messages -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /var/log/messages does not have a group owner of root? + + +Run the following command to determine if the virt_use_comm SELinux boolean is disabled: +$ getsebool virt_use_comm +If properly configured, the output should show the following: +virt_use_comm --> off + Is it the case that virt_use_comm is not disabled? - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pam_timestamp_check" command with the following command: + +$ sudo auditctl -l | grep pam_timestamp_check + +-a always,exit -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pam_timestamp_check + Is it the case that the command does not return a line, or the line is commented out? + + + -Run the following command to determine if the dbadm_exec_content SELinux boolean is enabled: -$ getsebool dbadm_exec_content +Run the following command to determine if the cluster_use_execmem SELinux boolean is disabled: +$ getsebool cluster_use_execmem If properly configured, the output should show the following: -dbadm_exec_content --> on - Is it the case that dbadm_exec_content is not enabled? +cluster_use_execmem --> off + Is it the case that cluster_use_execmem is not disabled? - - Verify the audit tools are owned by "root" to prevent any unauthorized access, deletion, or modification. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "reboot" command with the following command: -Check the owner of each audit tool by running the following command: +$ sudo auditctl -l | grep reboot -$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules +-a always,exit -F path=/reboot -F perm=x -F auid>=1000 -F auid!=unset -k privileged-reboot + Is it the case that the command does not return a line, or the line is commented out? + + + + To determine whether sudo command includes configuration files from the appropriate directory, +run the following command: +$ sudo grep -rP '^[#@]include(dir)?' /etc/sudoers /etc/sudoers.d +If only the line /etc/sudoers:#includedir /etc/sudoers.d is returned, then the drop-in include configuration is set correctly. +Any other line returned is a finding. + Is it the case that the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?? + + + + To determine if the system is configured to audit calls to the +fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -root /sbin/auditctl -root /sbin/aureport -root /sbin/ausearch -root /sbin/autrace -root /sbin/auditd -root /sbin/rsyslogd -root /sbin/augenrules - Is it the case that any audit tools are not owned by root? + Is it the case that no line is returned? + + + + +Run the following command to determine if the staff_exec_content SELinux boolean is enabled: +$ getsebool staff_exec_content +If properly configured, the output should show the following: +staff_exec_content --> on + Is it the case that staff_exec_content is not enabled? @@ -385261,405 +385750,469 @@ $ sysctl kernel.yama.ptrace_scope Is it the case that the correct value is not returned? - - -Run the following command to determine if the selinuxuser_execstack SELinux boolean is disabled: -$ getsebool selinuxuser_execstack -If properly configured, the output should show the following: -selinuxuser_execstack --> off - Is it the case that selinuxuser_execstack is not disabled? + + Run the following command to determine if the python3-abrt-addon package is installed: +$ rpm -q python3-abrt-addon + Is it the case that the package is installed? - - Verify the nosuid option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . nosuid . . . - - Is it the case that the "/var/tmp" file system does not have the "nosuid" option set? + + To check the permissions of /etc/shadow, +run the command: +$ ls -l /etc/shadow +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/shadow does not have unix mode ----------? - - To verify if MaxKeepAliveRequests is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i maxkeepaliverequests /etc/httpd/conf/httpd.conf -The command should return the following: -MaxKeepAliveRequests 100 - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the syslog-ng-core package is installed: $ rpm -q syslog-ng-core - Is it the case that the package is not installed? + + To check the ownership of /etc/group-, +run the command: +$ ls -lL /etc/group- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/group- does not have an owner of root? - - To check that the netconsole service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled netconsole -Output should indicate the netconsole service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled netconsole disabled + + Run the following command to determine if the tftp-server package is installed: +$ rpm -q tftp-server + Is it the case that the package is installed? + + + + If the device or Red Hat Enterprise Linux 8 does not have a camera installed, this requirement is not applicable. -Run the following command to verify netconsole is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active netconsole +This requirement is not applicable to mobile devices (smartphones and tablets), where the use of the camera is a local AO decision. -If the service is not running the command will return the following output: -inactive +This requirement is not applicable to dedicated VTC suites located in approved VTC locations that are centrally managed. -The service will also be masked, to check that the netconsole is masked, run the following command: -$ sudo systemctl show netconsole | grep "LoadState\|UnitFileState" +For an external camera, if there is not a method for the operator to manually disconnect the camera at the end of collaborative computing sessions, this is a finding. -If the service is masked the command will return the following outputs: +For a built-in camera, the camera must be protected by a camera cover (e.g., laptop camera cover slide) when not in use. If the built-in camera is not protected with a camera cover, or is not physically disabled, this is a finding. -LoadState=masked +If the camera is not disconnected, covered, or physically disabled, determine if it is being disabled via software with the following commands: -UnitFileState=masked - Is it the case that the "netconsole" is loaded and not masked? +Verify the operating system disables the ability to load the uvcvideo kernel module. + +$ sudo grep -r uvcvideo /etc/modprobe.d/* | grep "/bin/true" + +install uvcvideo /bin/true + Is it the case that the command does not return any output, or the line is commented out, and the collaborative computing device has not been authorized for use? - - Run the following command to determine if the xinetd package is installed: -$ rpm -q xinetd - Is it the case that the package is installed? + + Run the following command to check for duplicate group names: +Check that the operating system contains no duplicate group names for interactive users by running the following command: + + cut -d : -f 1 /etc/group | uniq -d + +If output is produced, this is a finding. +Configure the operating system to contain no duplicate names for groups. +Edit the file "/etc/group" and provide each group that has a duplicate group name with a unique group name. + Is it the case that has duplicate group names? - - To find world-writable directories that lack the sticky bit, run the following command: -$ sudo find / -type d \( -perm -0002 -a ! -perm -1000 \) -print 2>/dev/null -fixtext: |- -Configure all world-writable directories to have the sticky bit set to prevent unauthorized and unintended information transferred via shared system resources. + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/43-module-load.rules +The output has to be exactly as follows: +## These rules watch for kernel module insertion. By monitoring +## the syscall, we do not need any watches on programs. +-a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b32 -S delete_module -F key=module-unload +-a always,exit -F arch=b64 -S delete_module -F key=module-unload + Is it the case that the file does not exist or the content differs? + + + + The runtime status of the net.ipv6.conf.all.max_addresses kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.max_addresses +1. -Set the sticky bit on all world-writable directories using the command, replace "[World-Writable Directory]" with any directory path missing the sticky bit: + Is it the case that the correct value is not returned? + + + + Inspect /proc/cmdline for any instances of selinux=0 +in the kernel boot arguments. Presence of selinux=0 indicates +that SELinux is disabled at boot time. -$ chmod a+t [World-Writable Directory] -srg_requirement: -A sticky bit must be set on all Red Hat Enterprise Linux 8 public directories to prevent unauthorized and unintended information transferred via shared system resources. - Is it the case that any world-writable directories are missing the sticky bit? +If it would be disabled anywhere, make sure to enable it via a +MachineConfig object. + Is it the case that SELinux is disabled at boot time? - - Run the following command to determine if the abrt package is installed: -$ rpm -q abrt - Is it the case that the package is installed? + + +Run the following command to determine if the privoxy_connect_any SELinux boolean is disabled: +$ getsebool privoxy_connect_any +If properly configured, the output should show the following: +privoxy_connect_any --> off + Is it the case that privoxy_connect_any is not disabled? - + + To determine if the system is configured to audit calls to the +delete_module system call, run the following command: +$ sudo grep "delete_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SCHED_STACK_END_CHECK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + The runtime status of the net.ipv4.conf.default.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.accept_source_route +0. + + Is it the case that the correct value is not returned? + + + -Run the following command to determine if the xguest_use_bluetooth SELinux boolean is disabled: -$ getsebool xguest_use_bluetooth +Run the following command to determine if the mysql_connect_any SELinux boolean is disabled: +$ getsebool mysql_connect_any If properly configured, the output should show the following: -xguest_use_bluetooth --> off - Is it the case that xguest_use_bluetooth is not disabled? +mysql_connect_any --> off + Is it the case that mysql_connect_any is not disabled? + + + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules +The output has to be exactly as follows: +## Unsuccessful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Is it the case that the file does not exist or the content differs? + + + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + + Is it the case that the package is not installed? + + + + To determine how the SSH daemon's Banner option is set, run the following command: + +$ sudo grep -i Banner /etc/ssh/sshd_config + +If a line indicating /etc/issue is returned, then the required value is set. + + Is it the case that the required value is not set? + + + + Run the following command to determine if the dnf-plugin-subscription-manager package is installed: $ rpm -q dnf-plugin-subscription-manager + Is it the case that the package is not installed? + + + + + +Run the following command to determine the current status of the +ntp service: +$ sudo systemctl is-active ntp +If the service is running, it should return the following: active + Is it the case that ? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/43-module-load.rules -The output has to be exactly as follows: -## These rules watch for kernel module insertion. By monitoring -## the syscall, we do not need any watches on programs. --a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b32 -S delete_module -F key=module-unload --a always,exit -F arch=b64 -S delete_module -F key=module-unload - Is it the case that the file does not exist or the content differs? + + To verify if the OpenSSH client uses defined MACs in the Crypto Policy, run: +$ grep -i macs /etc/crypto-policies/back-ends/openssh.config +and verify that the line matches: +MACs + Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - Verify the nosuid option is configured for the /srv mount point, - run the following command: - $ sudo mount | grep '\s/srv\s' - . . . /srv . . . nosuid . . . + + To determine if the system is configured to audit calls to the +lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/srv" file system does not have the "nosuid" option set? + Is it the case that no line is returned? - + -If the system is configured to prevent the loading of the usb-storage kernel module, +If the system is configured to prevent the loading of the dccp kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the usb-storage kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the dccp kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r usb-storage /etc/modprobe.conf /etc/modprobe.d +$ grep -r dccp /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - -Run the following command to determine if the fips_mode SELinux boolean is enabled: -$ getsebool fips_mode -If properly configured, the output should show the following: -fips_mode --> on - Is it the case that fips_mode is not enabled? - - - - Inspect /etc/login.defs and ensure that if eihter -SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS -are set, they must have the minimum value of 5000. - Is it the case that it does not? + + To verify that SSSD is configured for PAM services, run the following command: +$ sudo grep services /etc/sssd/sssd.conf +If configured properly, output should be similar to +services = pam + Is it the case that it does not exist or 'pam' is not added to the 'services' option under the 'sssd' section? - - -Run the following command to determine if the squid_use_tproxy SELinux boolean is disabled: -$ getsebool squid_use_tproxy -If properly configured, the output should show the following: -squid_use_tproxy --> off - Is it the case that squid_use_tproxy is not disabled? + + Run the following command to determine the current status of the logrotate timer: $ sudo systemctl is-active logrotate.timer If the timer is running, it should return the following: active + Is it the case that logrotate timer is not enabled? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Remote web authors should not be able to upload files to the Document Root +directory structure without virus checking and checking for malicious or mobile +code. + Is it the case that it is not? - - To check if pam_pwquality.so is enabled in system-auth, run the following command: -$ grep pam_pwquality /etc/pam.d/system-auth -The output should be similar to the following: -password requisite pam_pwquality.so - Is it the case that pam_pwquality.so is not enabled in system-auth? + + Run the following command to determine if the abrt-addon-ccpp package is installed: +$ rpm -q abrt-addon-ccpp + Is it the case that the package is installed? - - Storing logs remotely protects the integrity of the data from local attacks. -Run the following command to verify that journald is forwarding logs to a remote host. - -grep "^\sForwardToSyslog" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf - - -and it should return - -ForwardToSyslog=yes + + Verify the noexec option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . noexec . . . - Is it the case that is commented out or not configured correctly? + Is it the case that the "/dev/shm" file system does not have the "noexec" option set? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_IPV6 /boot/config.* + $ grep CONFIG_PANIC_ON_OOPS /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - To check if RekeyLimit is set correctly, run the following command: -$ sudo grep RekeyLimit /etc/ssh/ssh_config.d/*.conf -If configured properly, output should be -/etc/ssh/ssh_config.d/02-rekey-limit.conf: -RekeyLimit -Check also the main configuration file with the following command: -$ sudo grep RekeyLimit /etc/ssh/ssh_config -The command should not return any output. - Is it the case that it is commented out or is not set? + + Run the following command to determine if the avahi-autoipd package is installed: +$ rpm -q avahi-autoipd + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "passwd" command with the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open_by_handle_at system call. -$ sudo auditctl -l | grep passwd +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-passwd - Is it the case that the command does not return a line, or the line is commented out? - - - - To check if authentication is required for single-user mode, run the following command: -$ grep sulogin /usr/lib/systemd/system/rescue.service -The output should be similar to the following, and the line must begin with -ExecStart and /usr/lib/systemd/systemd-sulogin-shell. - ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue - Is it the case that the output is different? - - - - Only FIPS ciphers should be used. To verify that only FIPS-approved -ciphers are in use, run the following command: -$ sudo grep Ciphers /etc/ssh/sshd_config -The output should contain only those ciphers which are FIPS-approved. - Is it the case that FIPS ciphers are not configured or the enabled ciphers are not FIPS-approved? - - - - Verify Red Hat Enterprise Linux 8 is configured to lock an account until released by an administrator -after unsuccessful logon -attempts with the command: +$ sudo grep -r open_by_handle_at /etc/audit/rules.d +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ grep 'unlock_time =' /etc/security/faillock.conf -unlock_time = - Is it the case that the "unlock_time" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_unlock_time" />", -the line is missing, or commented out? - - - - To ensure that the GPG key is installed, run: -$ rpm -q --queryformat "%{SUMMARY}\n" gpg-pubkey -The command should return the string below: -gpg(Red Hat, Inc. (release key 2) <security@redhat.com> - Is it the case that the Red Hat GPG Key is not installed? +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the gpg_web_anon_write SELinux boolean is disabled: -$ getsebool gpg_web_anon_write +Run the following command to determine if the samba_load_libgfapi SELinux boolean is disabled: +$ getsebool samba_load_libgfapi If properly configured, the output should show the following: -gpg_web_anon_write --> off - Is it the case that gpg_web_anon_write is not disabled? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes spectre_v2=on, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spectre_v2=on.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*spectre_v2=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'spectre_v2=on' -The command should not return any output. - Is it the case that spectre_v2 mitigation is not enforced? +samba_load_libgfapi --> off + Is it the case that samba_load_libgfapi is not disabled? - - Verify Red Hat Enterprise Linux 8 security patches and updates are installed and up to date. -Updates are required to be applied with a frequency determined by organizational policy. - - -Obtain the list of available package security updates from Red Hat. The URL for updates is https://access.redhat.com/errata-search/. -It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. + + To check that the rhsmcertd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled rhsmcertd +Output should indicate the rhsmcertd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rhsmcertd disabled +Run the following command to verify rhsmcertd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rhsmcertd -Check that the available package security updates have been installed on the system with the following command: +If the service is not running the command will return the following output: +inactive -$ sudo yum history list | more +The service will also be masked, to check that the rhsmcertd is masked, run the following command: +$ sudo systemctl show rhsmcertd | grep "LoadState\|UnitFileState" -Loaded plugins: langpacks, product-id, subscription-manager -ID | Command line | Date and time | Action(s) | Altered -------------------------------------------------------------------------------- -70 | install aide | 2020-03-05 10:58 | Install | 1 -69 | update -y | 2020-03-04 14:34 | Update | 18 EE -68 | install vlc | 2020-02-21 17:12 | Install | 21 -67 | update -y | 2020-02-21 17:04 | Update | 7 EE +If the service is masked the command will return the following outputs: +LoadState=masked -Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. - Is it the case that Red Hat Enterprise Linux 8 is in non-compliance with the organizational patching policy? +UnitFileState=masked + Is it the case that the "rhsmcertd" is loaded and not masked? - + -Run the following command to determine if the xend_run_blktap SELinux boolean is enabled: -$ getsebool xend_run_blktap +Run the following command to determine if the virt_sandbox_use_netlink SELinux boolean is disabled: +$ getsebool virt_sandbox_use_netlink If properly configured, the output should show the following: -xend_run_blktap --> on - Is it the case that xend_run_blktap is not enabled? +virt_sandbox_use_netlink --> off + Is it the case that virt_sandbox_use_netlink is not disabled? - - The runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_rtr_pref -0. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the nscd_use_shm SELinux boolean is enabled: +$ getsebool nscd_use_shm +If properly configured, the output should show the following: +nscd_use_shm --> on + Is it the case that nscd_use_shm is not enabled? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the httpd_setrlimit SELinux boolean is disabled: +$ getsebool httpd_setrlimit +If properly configured, the output should show the following: +httpd_setrlimit --> off + Is it the case that httpd_setrlimit is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_VSYSCALL_NONE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that HBSS PA is installed, run the following command(s): +$ sudo ls /opt/McAfee/auditengine/bin/auditmanager + Is it the case that the HBSS PA module is not installed? - - To check the group ownership of /etc/cron.hourly, -run the command: -$ ls -lL /etc/cron.hourly -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.hourly does not have a group owner of root? + + Find if logging is applied to the FTP daemon. + +Procedures: + +If vsftpd is started by xinetd the following command will indicate the xinetd.d startup file: +$ grep vsftpd /etc/xinetd.d/* +$ grep server_args vsftpd xinetd.d startup file +This will indicate the vsftpd config file used when starting through xinetd. +If the server_args line is missing or does not include the vsftpd configuration file, then the default config file (/etc/vsftpd/vsftpd.conf) is used. +$ sudo grep xferlog_enable vsftpd config file + Is it the case that xferlog_enable is missing, or is not set to yes? - + + Run the following command to determine if the policycoreutils package is installed: $ rpm -q policycoreutils + Is it the case that the policycoreutils package is not installed? + + + To determine if the system is configured to audit calls to the -chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit/audit.* +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine how the SSH daemon's GSSAPIAuthentication option is set, run the following command: + + To check the ownership of /etc/ssh/*.pub, +run the command: +$ ls -lL /etc/ssh/*.pub +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/ssh/*.pub does not have an owner of root? + + + + If IPv6 is disabled, this is not applicable. -$ sudo grep -i GSSAPIAuthentication /etc/ssh/sshd_config -If a line indicating no is returned, then the required value is set. - Is it the case that the required value is not set? +Run the following command to determine the current status of the +ip6tables service: +$ sudo systemctl is-active ip6tables +If the service is running, it should return the following: active + Is it the case that ? - - To verify that DHCP is not being used, examine the following file for each interface: -# /etc/sysconfig/network-scripts/ifcfg-interface -Look for the following: -BOOTPROTO=none -and the following, substituting the appropriate values based on your site's addressing scheme: -NETMASK=255.255.255.0 -IPADDR=192.168.1.2 -GATEWAY=192.168.1.1 - Is it the case that it does not? + + To check for incorrectly labeled device files, run following commands: +$ sudo find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n" +$ sudo find /dev -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z\n" +It should produce no output in a well-configured system. + Is it the case that there is output? - - -Run the following command to determine if the puppetmaster_use_db SELinux boolean is disabled: -$ getsebool puppetmaster_use_db -If properly configured, the output should show the following: -puppetmaster_use_db --> off - Is it the case that puppetmaster_use_db is not disabled? + + To determine whether the SSH service is configured to use strong entropy seed, +run $ sudo grep SSH_USE_STRONG_RNG /etc/sysconfig/sshd +If a line indicating that SSH_USE_STRONG_RNG is set to 32 is returned, +then the option is set correctly. + Is it the case that the SSH_USE_STRONG_RNG is not set to 32 in /etc/sysconfig/sshd? - - Run the following command to determine if the squid package is installed: -$ rpm -q squid - Is it the case that the package is installed? + + The tftp package can be removed with the following command: $ sudo yum erase tftp + Is it the case that ? - - Verify that a separate file system/partition has been created for /usr with the following command: - -$ mountpoint /usr - - Is it the case that "/usr is not a mountpoint" is returned? + + Run the following command to determine if the firewalld package is installed: $ rpm -q firewalld + Is it the case that the package is not installed? + + + + To verify that Audit Daemon is configured to record the computer node +name in the audit events, run the following command: +$ sudo grep name_format /etc/audit/auditd.conf +The output should return the following: +name_format = + Is it the case that name_format isn't set to <sub idref="var_auditd_name_format" />? + + + + The ftp package can be removed with the following command: $ sudo yum erase ftp + Is it the case that ? + + + + +Run the following command to determine if the xen_use_nfs SELinux boolean is disabled: +$ getsebool xen_use_nfs +If properly configured, the output should show the following: +xen_use_nfs --> off + Is it the case that xen_use_nfs is not disabled? @@ -385671,433 +386224,440 @@ ftpd_use_nfs --> off Is it the case that ftpd_use_nfs is not disabled? - - -Run the following command to determine if the unconfined_login SELinux boolean is enabled: -$ getsebool unconfined_login -If properly configured, the output should show the following: -unconfined_login --> on - Is it the case that unconfined_login is not enabled? + + To ensure the tally directory is configured correctly, run the following command: +$ sudo grep 'dir =' /etc/security/faillock.conf +The output should show that dir is set to something other than "/var/run/faillock" + Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? - - The runtime status of the net.ipv4.conf.default.send_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.send_redirects -0. - - Is it the case that the correct value is not returned? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SYN_COOKIES /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the scap-security-guide package is installed: $ rpm -q scap-security-guide - Is it the case that the package is not installed? + + +Run the following command to determine if the nagios_run_sudo SELinux boolean is disabled: +$ getsebool nagios_run_sudo +If properly configured, the output should show the following: +nagios_run_sudo --> off + Is it the case that nagios_run_sudo is not disabled? - - Verify that yum verifies the signature of local packages prior to install with the following command: - -$ grep localpkg_gpgcheck /etc/yum.conf - -localpkg_gpgcheck=1 - -If "localpkg_gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. - Is it the case that there is no process to validate certificates for local packages that is approved by the organization? + + Check that no boot image file is specified in /etc/zipl.conf: +grep -R "^image\s*=" /etc/zipl.conf +No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL. + Is it the case that a non BLS boot entry is configured? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlink system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r unlink /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep unlink /etc/audit/audit.rules - -The output should be the following: + + Enter the following commands: --a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? - - - - To check that page poisoning is enabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't enable page poisoning. - Is it the case that page allocator poisoning is not enabled? - - - - Run the following command to determine if the dhcp-server package is installed: -$ rpm -q dhcp-server - Is it the case that the package is installed? +grep Action /etc/httpd/conf/httpd.conf +grep AddHandler /etc/httpd/conf/httpd.conf + Is it the case that either of these exist and they configure csh, or any other shell as a viewer for documents? - - To verify if the OpenSSH server uses defined MACs in the Crypto Policy, run: -$ grep -Po '(-oMACs=\S+)' /etc/crypto-policies/back-ends/opensshserver.config -and verify that the line matches: --oMACS= - Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? + + Verify the nosuid option is configured for the /opt mount point, + run the following command: + $ sudo mount | grep '\s/opt\s' + . . . /opt . . . nosuid . . . + + Is it the case that the "/opt" file system does not have the "nosuid" option set? - - To check the ownership of /etc/ssh/*.pub, + + To check the group ownership of /var/log/messages, run the command: -$ ls -lL /etc/ssh/*.pub -If properly configured, the output should indicate the following owner: +$ ls -lL /var/log/messages +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/ssh/*.pub does not have an owner of root? - - - - To ensure disable and restart on the login screen are disabled, run the following command: -$ grep disable-restart-buttons /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot enable disable and restart on the login screen, run the following: -$ grep disable-restart-buttons /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/disable-restart-buttons - Is it the case that disable-restart-buttons has not been configured or is not disabled? - - - - Inspect /etc/default/grub for any instances of selinux=0 -in the kernel boot arguments. Presence of selinux=0 indicates -that SELinux is disabled at boot time. - Is it the case that SELinux is disabled at boot time? - - - - Run the following command to determine if the rsyslog-gnutls package is installed: -$ rpm -q rsyslog-gnutls - Is it the case that the package is installed? + Is it the case that /var/log/messages does not have a group owner of root? - - To check that the psacct service is disabled in system boot configuration, + + To check that the ypbind service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled psacct -Output should indicate the psacct service has either not been installed, +$ sudo systemctl is-enabled ypbind +Output should indicate the ypbind service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled psacct disabled +$ sudo systemctl is-enabled ypbind disabled -Run the following command to verify psacct is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active psacct +Run the following command to verify ypbind is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ypbind If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the psacct is masked, run the following command: -$ sudo systemctl show psacct | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the ypbind is masked, run the following command: +$ sudo systemctl show ypbind | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "psacct" is loaded and not masked? + Is it the case that the "ypbind" is loaded and not masked? - - -Run the following command to determine if the exim_can_connect_db SELinux boolean is disabled: -$ getsebool exim_can_connect_db -If properly configured, the output should show the following: -exim_can_connect_db --> off - Is it the case that exim_can_connect_db is not disabled? + + To determine if the system is configured to audit calls to the +rmdir system call, run the following command: +$ sudo grep "rmdir" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the logging_syslogd_can_sendmail SELinux boolean is disabled: -$ getsebool logging_syslogd_can_sendmail -If properly configured, the output should show the following: -logging_syslogd_can_sendmail --> off - Is it the case that logging_syslogd_can_sendmail is not disabled? + + To ensure the login screen resets after a specified number of failures, +run the following command: +$ grep allowed-failures /etc/dconf/db/gdm.d/* +The output should be 3 or less. +To ensure that users cannot change or configure the resets after a specified +number of failures on the login screen, run the following: +$ grep allowed-failures /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/allowed-failures + Is it the case that allowed-failures is not equal to or less than the expected value? - - Run the following command to determine if the chrony package is installed: $ rpm -q chrony - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_HASH /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check if RekeyLimit is set correctly, run the -following command: - -$ sudo grep RekeyLimit /etc/ssh/sshd_config + + To determine if the system is configured to audit unsuccessful calls +to the removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -If configured properly, output should be -RekeyLimit - Is it the case that it is commented out or is not set? + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the openat system call with O_CREAT flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r openat /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep openat /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine if the system is configured to synchronize audit event data +with the log files on the disk: +$ sudo grep flush /etc/audit/auditd.conf +flush = DATA +Acceptable values are DATA, and SYNC. The setting is +case-insensitive. + Is it the case that auditd is not configured to synchronously write audit event data to disk? - + + To check the group ownership of /etc/group, +run the command: +$ ls -lL /etc/group +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/group does not have a group owner of root? + + + -Run the following command to determine if the mpd_use_nfs SELinux boolean is disabled: -$ getsebool mpd_use_nfs +Run the following command to determine if the openshift_use_nfs SELinux boolean is disabled: +$ getsebool openshift_use_nfs If properly configured, the output should show the following: -mpd_use_nfs --> off - Is it the case that mpd_use_nfs is not disabled? +openshift_use_nfs --> off + Is it the case that openshift_use_nfs is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pt_chown" command with the following command: - -$ sudo auditctl -l | grep pt_chown + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling automount +If properly configured, the output for automount should be false. +To ensure that users cannot enable automount in GNOME3, run the following: +$ grep 'automount' /etc/dconf/db/local.d/locks/* +If properly configured, the output for automount should be /org/gnome/desktop/media-handling/automount + Is it the case that GNOME automounting is not disabled? + + + + Run the following command to determine if the psacct package is installed: $ rpm -q psacct + Is it the case that the package is not installed? + + + + Verify the nodev option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . nodev . . . --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pt_chown - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the "/var/log" file system does not have the "nodev" option set? - + + Run the following command to determine if the rsyslog package is installed: $ rpm -q rsyslog + Is it the case that the package is not installed? + + + -Run the following command to determine if the cvs_read_shadow SELinux boolean is disabled: -$ getsebool cvs_read_shadow +Run the following command to determine if the httpd_dbus_sssd SELinux boolean is disabled: +$ getsebool httpd_dbus_sssd If properly configured, the output should show the following: -cvs_read_shadow --> off - Is it the case that cvs_read_shadow is not disabled? +httpd_dbus_sssd --> off + Is it the case that httpd_dbus_sssd is not disabled? - - To verify the password reuse setting is compliant, run the following command: -$ grep remember /etc/pam.d/system-auth -The output should show the following at the end of the line: -remember= - - -In newer systems, the pam_pwhistory PAM module options can also be set in -"/etc/security/pwhistory.conf" file. Use the following command to verify: -$ grep remember /etc/security/pwhistory.conf -remember = - -The pam_pwhistory remember option must be configured only in one file. - Is it the case that the value of remember is not equal to or greater than the expected value? + + To check if MaxStartups is configured, run the following command: +$ sudo grep MaxStartups /etc/ssh/sshd_config +If configured, this command should output the configuration. + Is it the case that maxstartups is not configured? - - Ensure that debug-shell service is not enabled with the following command: -sudo grep -L "^options\s+.*\bsystemd.debug-shell=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that enables the debug-shell. - Is it the case that the comand returns a line? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes mce=0, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*mce=0.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*mce=0.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'mce=0' +The command should not return any output. + Is it the case that MCE tolerance is not set to zero? - - To determine if the system is configured to audit unsuccessful calls -to the chown system call, run the following command: -$ sudo grep "chown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the puppetagent_manage_all_files SELinux boolean is disabled: +$ getsebool puppetagent_manage_all_files +If properly configured, the output should show the following: +puppetagent_manage_all_files --> off + Is it the case that puppetagent_manage_all_files is not disabled? - - To check the permissions of /etc/group, -run the command: -$ ls -l /etc/group -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/group does not have unix mode -rw-r--r--? + + +Run the following command to determine if the ftpd_connect_all_unreserved SELinux boolean is disabled: +$ getsebool ftpd_connect_all_unreserved +If properly configured, the output should show the following: +ftpd_connect_all_unreserved --> off + Is it the case that ftpd_connect_all_unreserved is not disabled? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + - Is it the case that no line is returned? +Run the following command to determine the current status of the +sshd service: +$ sudo systemctl is-active sshd +If the service is running, it should return the following: active + Is it the case that ? - + To determine if the system is configured to audit successful calls -to the fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit.* +to the chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify the operating system encrypts audit records off-loaded onto a different system -or media from the system being audited with the following commands: + + The runtime status of the net.ipv6.conf.default.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_source_route +0. -$ sudo grep -i '$DefaultNetstreamDriver' /etc/rsyslog.conf /etc/rsyslog.d/*.conf + Is it the case that the correct value is not returned? + + + + Inspect the password section of /etc/pam.d/system-auth +and ensure that the pam_unix.so module is configured to use the argument +sha512: -The output should be: +$ sudo grep "^password.*pam_unix\.so.*sha512" /etc/pam.d/system-auth -/etc/rsyslog.conf:$DefaultNetstreamDriver gtls - Is it the case that rsyslogd DefaultNetstreamDriver not set to gtls? +password sufficient pam_unix.so sha512 + Is it the case that "sha512" is missing, or is commented out? - + -Run the following command to determine if the virt_use_sanlock SELinux boolean is disabled: -$ getsebool virt_use_sanlock +Run the following command to determine if the unconfined_chrome_sandbox_transition SELinux boolean is enabled: +$ getsebool unconfined_chrome_sandbox_transition If properly configured, the output should show the following: -virt_use_sanlock --> off - Is it the case that virt_use_sanlock is not disabled? - - - - To check the permissions of /var/log, -run the command: -$ ls -l /var/log -If properly configured, the output should indicate the following permissions: -drwxr-xr-x - Is it the case that /var/log does not have unix mode drwxr-xr-x? +unconfined_chrome_sandbox_transition --> on + Is it the case that unconfined_chrome_sandbox_transition is not enabled? - - To determine if the system is configured to audit successful calls -to the fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit.* + + To determine if the system is configured to audit calls to the +lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify the noexec option is configured for the /dev/shm mount point, - run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . noexec . . . + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/dev/shm" file system does not have the "noexec" option set? - - - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules -The output has to be exactly as follows: -## Unsuccessful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Is it the case that the file does not exist or the content differs? + Is it the case that no line is returned? - - To verify that the installed operating system is supported, run -the following command: - -$ grep -i "red hat" /etc/redhat-release - -Red Hat Enterprise Linux 8 - Is it the case that the installed operating system is not supported? + + Inspect /etc/audit/audisp-remote.conf and locate the following line to +determine if the system is configured to either send to syslog, switch to single user mode, +or halt when the disk is full: +$ sudo grep -i disk_full_action /etc/audit/audisp-remote.conf +The output should return something similar to: +disk_full_action = single +Acceptable values also include syslog and halt. + Is it the case that the system is not configured to switch to single user mode for corrective action? - - Run the following command to determine if the sudo package is installed: $ rpm -q sudo - Is it the case that the package is not installed? + + To verify that null passwords cannot be used, run the following command: +$ sudo awk -F: '!$2 {print $1}' /etc/shadow +If this produces any output, it may be possible to log into accounts +with empty passwords. + Is it the case that Blank or NULL passwords can be used? - + -Run the following command to determine if the fenced_can_network_connect SELinux boolean is disabled: -$ getsebool fenced_can_network_connect +Run the following command to determine if the httpd_use_openstack SELinux boolean is disabled: +$ getsebool httpd_use_openstack If properly configured, the output should show the following: -fenced_can_network_connect --> off - Is it the case that fenced_can_network_connect is not disabled? +httpd_use_openstack --> off + Is it the case that httpd_use_openstack is not disabled? - - Run the following command to determine if the cups package is installed: -$ rpm -q cups - Is it the case that the package is installed? + + To check the ownership of /etc/issue, +run the command: +$ ls -lL /etc/issue +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/issue does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfiles" command with the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open system call with O_TRUNC_WRITE flag. -$ sudo auditctl -l | grep setfiles +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update +$ sudo grep -r open /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create Is it the case that the command does not return a line, or the line is commented out? - - If IPv6 is disabled, this is not applicable. + + Run the following command to determine if the libreport-plugin-rhtsupport package is installed: +$ rpm -q libreport-plugin-rhtsupport + Is it the case that the package is installed? + + + + The runtime status of the net.ipv4.icmp_echo_ignore_broadcasts kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.icmp_echo_ignore_broadcasts +1. -Inspect the file /etc/sysconfig/ip6tables to determine -the default policy for the INPUT chain. It should be set to DROP: -$ sudo grep ":INPUT" /etc/sysconfig/ip6tables - Is it the case that the default policy for the INPUT chain is not set to DROP? + Is it the case that the correct value is not returned? - + + To verify that root's primary group is zero run the following command: + + grep '^root:' /etc/passwd | cut -d : -f 4 + +The command should return: + +0 + + Is it the case that root has a primary gid not equal to zero? + + + -Run the following command to determine if the virt_sandbox_use_all_caps SELinux boolean is disabled: -$ getsebool virt_sandbox_use_all_caps -If properly configured, the output should show the following: -virt_sandbox_use_all_caps --> off - Is it the case that virt_sandbox_use_all_caps is not disabled? + +Run the following command to determine the current status of the +firewalld service: +$ sudo systemctl is-active firewalld +If the service is running, it should return the following: active + Is it the case that the "firewalld" service is disabled, masked, or not started.? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine that AIDE is configured for FIPS 140-2 file hashing, run the following command: +$ grep sha512 /etc/aide.conf +Verify that the sha512 option is added to the correct ruleset. + Is it the case that the sha512 option is missing or not added to the correct ruleset? + + + + The runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.drop_gratuitous_arp +1. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + -Run the following command to determine if the selinuxuser_use_ssh_chroot SELinux boolean is disabled: -$ getsebool selinuxuser_use_ssh_chroot +Run the following command to determine if the ftpd_use_passive_mode SELinux boolean is disabled: +$ getsebool ftpd_use_passive_mode If properly configured, the output should show the following: -selinuxuser_use_ssh_chroot --> off - Is it the case that selinuxuser_use_ssh_chroot is not disabled? +ftpd_use_passive_mode --> off + Is it the case that ftpd_use_passive_mode is not disabled? - - To check the screensaver mandatory use status, run the following command: -$ gsettings get org.gnome.desktop.screensaver idle-activation-enabled -If properly configured, the output should be true. -To ensure that users cannot disable the screensaver idle inactivity setting, run the following: -$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled - Is it the case that idle-activation-enabled is not enabled or configured? + + To check the permissions of /var/log, +run the command: +$ ls -l /var/log +If properly configured, the output should indicate the following permissions: +drwxr-xr-x + Is it the case that /var/log does not have unix mode drwxr-xr-x? - + Script combine_ovals.py from SCAP Security Guide ssg: [0, 1, 72], python: 3.10.12 5.11 - 2024-01-25T00:06:13 + 2024-01-26T00:06:20 diff --git a/ssg-rhel8-ds.xml b/ssg-rhel8-ds.xml index 1a7654c..d048a9a 100644 --- a/ssg-rhel8-ds.xml +++ b/ssg-rhel8-ds.xml @@ -25,7 +25,7 @@ - + Red Hat Enterprise Linux 8 @@ -77,9 +77,9 @@ - + - draft + draft Guide to the Secure Configuration of Red Hat Enterprise Linux 8 This guide presents a catalog of security-relevant configuration settings for Red Hat Enterprise Linux 8. It is a rendering of @@ -147,63 +147,99 @@ respective companies. stigid stigref - + - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + - - - - + - + - + - + + - + - + - + - + - + - + - + - - + - + - - - - + + + + + + + + + + + + + + + + + + + + + @@ -212,6 +248,12 @@ respective companies. + + + + + + @@ -219,93 +261,91 @@ respective companies. - + - + + - + - + - + - + - + - - + - + - + + - + - + - + - + - + - - - - - - + + - + - + - + - + - + - + - + - - + - + + + + + - - + - + - + - - + - + - + @@ -314,22 +354,10 @@ respective companies. - - - - - - - - - - - - - - - - + + + + @@ -342,86 +370,69 @@ respective companies. - + - - + - + - + - + - - - - - - - - - - - + - + - - + - + - + - + - + - + - - - - - - + - + - - - + - + - + - + - + - + - + - + - + + + @@ -430,50 +441,26 @@ respective companies. - - - - - - - - - - - - - - - - + - + - + - + + - + - - - + + + + + - - - - - - - - - - - - @@ -482,48 +469,47 @@ respective companies. - + - + + - + - + - + - - + - + - - + - + - + - + - + - + - + - + - + @@ -531,59 +517,73 @@ respective companies. - - - - - - + - + - - - + + + + + + + + + + + + + + + + - + - + - + - - - + - + - - + - + - + + - + - + - + + + + - - + - + + + + + + + @@ -648,6 +648,8 @@ respective companies. Eric Christensen <echriste@redhat.com> Dan Clark <danclark@redhat.com> Jayson Cofell <1051437+70k10@users.noreply.github.com> + David du Colombier <djc@datadoghq.com> + Commandcracker <lukas.fricke.dev@gmail.com> Caleb Cooper <coopercd@ornl.gov> cortesana <acortes@redhat.com> Richard Maciel Costa <richard.maciel.costa@canonical.com> @@ -671,6 +673,7 @@ respective companies. François Duthilleul <francoisduthilleul@gmail.com> Greg Elin <gregelin@gitmachines.com> eradot4027 <jrtonmac@gmail.com> + ermeratos <manuel.ermer@atos.net> Alexis Facques <alexis.facques@mythalesgroup.io> Henry Finucane <hfinucane@zscaler.com> Leah Fisher <lfisher047@gmail.com> @@ -756,6 +759,7 @@ respective companies. Takuya Mishina <tmishina@jp.ibm.com> Mixer9 <35545791+Mixer9@users.noreply.github.com> mmosel <mmosel@kde.example.com> + Thomas Montague <montague.thomas@gmail.com> Zbynek Moravec <zmoravec@redhat.com> Kazuo Moriwaka <moriwaka@users.noreply.github.com> Michael Moseley <michael@eclipse.ncsc.mil> @@ -782,6 +786,7 @@ respective companies. piggyvenus <piggyvenus@gmail.com> Vojtech Polasek <vpolasek@redhat.com> Orion Poplawski <orion@nwra.com> + Jennifer Power <barnabei.jennifer@gmail.com> Nick Poyant <npoyant@redhat.com> Martin Preisler <mpreisle@redhat.com> Wesley Ceraso Prudencio <wcerasop@redhat.com> @@ -800,12 +805,14 @@ respective companies. Pat Riehecky <riehecky@fnal.gov> rlucente-se-jboss <rlucente@redhat.com> Juan Antonio Osorio Robles <juan.osoriorobles@eu.equinix.com> + Paul Roche <paul.roche@menlosecurity.com> Jan Rodak <hony.com@seznam.cz> Matt Rogers <mrogers@redhat.com> Jesse Roland <jesse.roland@onyxpoint.com> Joshua Roys <roysjosh@gmail.com> rrenshaw <bofh69@yahoo.com> Chris Ruffalo <chris.ruffalo@gmail.com> + Benjamin Ruland <benjamin.ruland@gmail.com> rumch-se <77793453+rumch-se@users.noreply.github.com> Rutvik <32413084+rutvik23@users.noreply.github.com> rutvik23 <rutksh@gmail.com> @@ -832,6 +839,7 @@ respective companies. Jindrich Skacel <102800748+jskacel@users.noreply.github.com> Alexandre Skrzyniarz <alexandre.skrzyniarz@laposte.net> Francisco Slavin <fslavin@tresys.com> + sluetze <13255307+sluetze@users.noreply.github.com> Dave Smith <dsmith@eclipse.ncsc.mil> David Smith <dsmith@fornax.eclipse.ncsc.mil> Kevin Spargur <kspargur@redhat.com> @@ -896,246 +904,246 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - + + + - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - + - - - - - - - - - - - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + - - - + + + + + - - - - - - - + + + + - - - - + + + + + + + + + + + + + + + - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + @@ -1371,320 +1379,320 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + + - + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + - - + - - + + - - - - - - - - + + + - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + - - + - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + @@ -1922,175 +1930,175 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - + + - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - + + + + + + - - + + + + + - - - - - - + + + + + + + + + + + + + + - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + @@ -2336,53 +2344,53 @@ https://www.ssi.gouv.fr/administration/guide/recommandations-de-securite-relativ An English version of the ANSSI-BP-028 can also be found at the ANSSI website: https://cyber.gouv.fr/publications/configuration-recommendations-gnulinux-system - - - - - - - - - - - - - - - - - - - - - - + + - - - - + + + + + - - + + - - - - - + + + + + - - - + - + + + + + + + + + + + + + + + + + + + + + + @@ -2638,378 +2646,401 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + + - + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + - - - - - - - - - - - + + + + + - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - + + - - - - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - @@ -3107,7 +3138,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3139,7 +3169,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3153,22 +3182,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -3203,8 +3237,10 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - + + + @@ -3219,293 +3255,306 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - + + + + + - - - - - + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - + + - + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - + - - - - - - + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + - @@ -3651,7 +3700,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -3666,22 +3714,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -3725,289 +3778,301 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + + - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - + + - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - + - - - - - - + + + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + + - - - - - - - + + + + + + + + + + + + + + + + + - @@ -4157,7 +4222,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4173,22 +4237,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -4232,372 +4301,395 @@ Linux 8 Benchmark™, v2.0.0, released 2022-02-23. This profile includes Center for Internet Security® Red Hat Enterprise Linux 8 CIS Benchmarks™ content. https://www.cisecurity.org/benchmark/red_hat_linux/ - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + - - - + + + + + + + + - + + + + + + + + + + + + + - - - - - + + + + - - - - - - - - - - - - - - + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + - - - - - + + + + - - - - - - - - - - - + + + + + - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + - + + - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + - @@ -4697,7 +4789,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4730,7 +4821,6 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - @@ -4746,22 +4836,27 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - - - - + + + + + + - - - - + + + + + + + @@ -4796,8 +4891,10 @@ Red Hat Enterprise Linux 8 CIS Benchmarks™ content. - + + + @@ -4811,111 +4908,111 @@ Policy Resource Center: https://www.fbi.gov/services/cjis/cjis-security-policy-resource-center https://www.fbi.gov/services/cjis/cjis-security-policy-resource-center - - - - - - - - - - - - - - - - - - - - + - - - - + + + + + + + + + + + + + - - + + + + + + + + - - - + + + - - - + + + + - - - - - + + + + + - + + + + + + + + - - + + + - - + + + + - - - - - - - - - - - - - - - + - - - - - + + + + + + - - - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + - @@ -5164,216 +5261,216 @@ in NIST Special Publication 800-53. This profile configures Red Hat Enterprise Linux 8 to the NIST Special Publication 800-53 controls identified for securing Controlled Unclassified Information (CUI)." - - - - - - - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - + + + - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - + + + + - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -5608,104 +5705,104 @@ ACSC website: https://www.cyber.gov.au/acsc/view-all-content/publications/hardening-linux-workstations-and-servers https://www.cyber.gov.au/acsc/view-all-content/publications/hardening-linux-workstations-and-servers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + - - - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -5933,143 +6030,143 @@ This profile configures Red Hat Enterprise Linux 8 to the HIPAA Security Rule identified for securing of electronic protected health information. Use of this profile in no way guarantees or makes claims against legal compliance against the HIPAA Security Rule(s). https://www.hhs.gov/hipaa/for-professionals/index.html - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - + + + - + - - - - - - - - - - - - - - + - - - + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + + + + + + + + + - - - - + + + + + + + + + + - + + - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6293,171 +6390,171 @@ A copy of the ISM can be found at the ACSC website: https://www.cyber.gov.au/ism https://www.cyber.gov.au/ism - - + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + + + - - + + - - - - - - - - - - - + + + + - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - + + - - + + + - - - - - - - - - - + - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -6652,216 +6749,216 @@ U.S. National Security Systems to adhere to certain configuration parameters. Accordingly, this configuration profile is suitable for use in U.S. National Security Systems. https://www.niap-ccevs.org/Profile/Info.cfm?PPID=442&id=442 - - - - - - - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - + + + - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + - - + + + + - - - - - - - - + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - + + + + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -7096,257 +7193,259 @@ financial information. This profile ensures Red Hat Enterprise Linux 8 is configured in alignment with PCI-DSS v4.0 requirements. https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0.pdf - - - - - + + + + - - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + + - + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + - - - - + + + + + + + - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - - - - - - - - - - - + + + + - - - + + + + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - + - + + + + + + + + + + - - - - + + @@ -7553,77 +7652,77 @@ with PCI-DSS v4.0 requirements. configuration settings recommended by Red Hat, Inc for Red Hat Enterprise Linux 8 instances deployed by Red Hat Certified Cloud Providers. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - + + + + + + + + + + + + + + + + + + - - + + + - - - - - + + + + + + + - - + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - + + + + @@ -7865,85 +7964,85 @@ Cloud Providers. This profile contains rules to ensure standard security baseline of a Red Hat Enterprise Linux 8 system. Regardless of your system's workload all of these checks should pass. - - - - + + + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - + + - - + + + + - - - - - - + + + + + + + + - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + + + + + + + + + + - - - - + - - - + + + + + + - - - + + + + + + + + + + + + + + + + + @@ -8184,416 +8283,416 @@ Red Hat technologies that are based on Red Hat Enterprise Linux 8, such as: - Red Hat Storage - Red Hat Containers with a Red Hat Enterprise Linux 8 image https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + @@ -8817,413 +8916,413 @@ your Information Systems Security Officer (ISSO) lacks a documented operational requirement for a graphical user interface, please consider using the standard DISA STIG for Red Hat Enterprise Linux 8 profile. https://public.cyber.mil/stigs/downloads/?_dl_facet_stigs=operating-systems%2Cunix-linux - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - + + + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - - - + - - - - - - - - - - - + + - - - - - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + @@ -9572,19 +9671,6 @@ See https://access.redhat.com/articles/6999111. CCE-80857-6 - -# Find which files have incorrect hash (not in /etc, because of the system related config files) and then get files names -files_with_incorrect_hash="$(rpm -Va --noconfig | grep -E '^..5' | awk '{print $NF}' )" - -if [ -n "$files_with_incorrect_hash" ]; then - # From files names get package names and change newline to space, because rpm writes each package to new line - packages_to_reinstall="$(rpm -qf $files_with_incorrect_hash | tr '\n' ' ')" - - - yum reinstall -y $packages_to_reinstall - -fi - - name: 'Set fact: Package manager reinstall command' set_fact: package_manager_reinstall_cmd: yum reinstall -y @@ -9719,6 +9805,19 @@ fi - no_reboot_needed - restrict_strategy - rpm_verify_hashes + + +# Find which files have incorrect hash (not in /etc, because of the system related config files) and then get files names +files_with_incorrect_hash="$(rpm -Va --noconfig | grep -E '^..5' | awk '{print $NF}' )" + +if [ -n "$files_with_incorrect_hash" ]; then + # From files names get package names and change newline to space, because rpm writes each package to new line + packages_to_reinstall="$(rpm -qf $files_with_incorrect_hash | tr '\n' ' ')" + + + yum reinstall -y $packages_to_reinstall + +fi @@ -9850,28 +9949,6 @@ See https://access.redhat.com/articles/6999111. CCE-82196-7 - -# Declare array to hold set of RPM packages we need to correct permissions for -declare -A SETPERMS_RPM_DICT - -# Create a list of files on the system having permissions different from what -# is expected by the RPM database -readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }') - -for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" -do - RPM_PACKAGE=$(rpm -qf "$FILE_PATH") - # Use an associative array to store packages as it's keys, not having to care about duplicates. - SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 -done - -# For each of the RPM packages left in the list -- reset its permissions to the -# correct values -for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" -do - rpm --setugids "${RPM_PACKAGE}" -done - - name: Read list of files with incorrect ownership command: rpm -Va --nodeps --nosignature --nofiledigest --nosize --nomtime --nordev --nocaps --nolinkto --nomode @@ -9952,6 +10029,28 @@ done - no_reboot_needed - restrict_strategy - rpm_verify_ownership + + +# Declare array to hold set of RPM packages we need to correct permissions for +declare -A SETPERMS_RPM_DICT + +# Create a list of files on the system having permissions different from what +# is expected by the RPM database +readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }') + +for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" +do + RPM_PACKAGE=$(rpm -qf "$FILE_PATH") + # Use an associative array to store packages as it's keys, not having to care about duplicates. + SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 +done + +# For each of the RPM packages left in the list -- reset its permissions to the +# correct values +for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" +do + rpm --setugids "${RPM_PACKAGE}" +done @@ -10097,32 +10196,6 @@ See https://access.redhat.com/articles/6999111. CCE-80858-4 - -# Declare array to hold set of RPM packages we need to correct permissions for -declare -A SETPERMS_RPM_DICT - -# Create a list of files on the system having permissions different from what -# is expected by the RPM database -readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,2,1)=="M") print $NF }') - -for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" -do - # NOTE: some files maybe controlled by more then one package - readarray -t RPM_PACKAGES < <(rpm -qf "${FILE_PATH}") - for RPM_PACKAGE in "${RPM_PACKAGES[@]}" - do - # Use an associative array to store packages as it's keys, not having to care about duplicates. - SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 - done -done - -# For each of the RPM packages left in the list -- reset its permissions to the -# correct values -for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" -do - rpm --restore "${RPM_PACKAGE}" -done - - name: Read list of files with incorrect permissions command: rpm -Va --nodeps --nosignature --nofiledigest --nosize --nomtime --nordev --nocaps --nolinkto --nouser --nogroup @@ -10206,6 +10279,32 @@ done - no_reboot_needed - restrict_strategy - rpm_verify_permissions + + +# Declare array to hold set of RPM packages we need to correct permissions for +declare -A SETPERMS_RPM_DICT + +# Create a list of files on the system having permissions different from what +# is expected by the RPM database +readarray -t FILES_WITH_INCORRECT_PERMS < <(rpm -Va --nofiledigest | awk '{ if (substr($0,2,1)=="M") print $NF }') + +for FILE_PATH in "${FILES_WITH_INCORRECT_PERMS[@]}" +do + # NOTE: some files maybe controlled by more then one package + readarray -t RPM_PACKAGES < <(rpm -qf "${FILE_PATH}") + for RPM_PACKAGE in "${RPM_PACKAGES[@]}" + do + # Use an associative array to store packages as it's keys, not having to care about duplicates. + SETPERMS_RPM_DICT["$RPM_PACKAGE"]=1 + done +done + +# For each of the RPM packages left in the list -- reset its permissions to the +# correct values +for RPM_PACKAGE in "${!SETPERMS_RPM_DICT[@]}" +do + rpm --restore "${RPM_PACKAGE}" +done @@ -10308,8 +10407,29 @@ $ sudo yum install aide SV-251710r880730_rule The AIDE package must be installed if it is to be available for integrity checking. CCE-80844-4 - -package --add=aide + - name: Ensure aide is installed + package: + name: aide + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80844-4 + - CJIS-5.10.1.3 + - DISA-STIG-RHEL-08-010359 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-11.5 + - PCI-DSSv4-11.5.2 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_aide_installed + + +[[packages]] +name = "aide" +version = "*" include install_aide @@ -10318,6 +10438,9 @@ class install_aide { ensure => 'installed', } } + + +package --add=aide # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -10329,30 +10452,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "aide" -version = "*" - - - name: Ensure aide is installed - package: - name: aide - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80844-4 - - CJIS-5.10.1.3 - - DISA-STIG-RHEL-08-010359 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-11.5 - - PCI-DSSv4-11.5.2 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_aide_installed @@ -10455,20 +10554,6 @@ If this check produces any unexpected output, investigate.For AIDE to be effective, an initial database of "known-good" information about files must be captured and it should be able to be verified against the installed files. CCE-80675-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -/usr/sbin/aide --init -/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Build and Test AIDE Database - Ensure AIDE Is Installed ansible.builtin.package: name: '{{ item }}' @@ -10549,6 +10634,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +/usr/sbin/aide --init +/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -10565,6 +10664,7 @@ fi AU-9(3).1 SRG-OS-000278-GPOS-00108 RHEL-08-030650 + 5.3.3 SV-230475r880722_rule Protecting the integrity of the tools used for auditing purposes is a critical step toward ensuring the integrity of audit information. Audit @@ -10586,68 +10686,6 @@ provide the capability to identify when the audit tools have been modified, manipulated, or replaced. An example is a checksum hash of the file or files. CCE-85964-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - - - - - - - - - - -if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then -sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf -else -echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure aide is installed package: name: '{{ item }}' @@ -10726,6 +10764,68 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + + + + + + + + + + +if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then +sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf +else +echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -10834,24 +10934,6 @@ system. The operating system's Information Management Officer (IMO)/Information Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. CCE-80676-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -if ! grep -q "/usr/sbin/aide --check" /etc/crontab ; then - echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab -else - sed -i '\!^.* --check.*$!d' /etc/crontab - echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure AIDE is installed package: name: '{{ item }}' @@ -10959,6 +11041,24 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +if ! grep -q "/usr/sbin/aide --check" /etc/crontab ; then + echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab +else + sed -i '\!^.* --check.*$!d' /etc/crontab + echo "05 4 * * * root /usr/sbin/aide --check" >> /etc/crontab +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11038,36 +11138,6 @@ system. The operating system's Information Management Officer (IMO)/Information Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. CCE-82891-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi -var_aide_scan_notification_email='' - - - -CRONTAB=/etc/crontab -CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly' - -# NOTE: on some platforms, /etc/crontab may not exist -if [ -f /etc/crontab ]; then - CRONTAB_EXIST=/etc/crontab -fi - -if [ -f /var/spool/cron/root ]; then - VARSPOOL=/var/spool/cron/root -fi - -if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then - echo "0 5 * * * root /usr/sbin/aide --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_aide_scan_notification_email # promote to variable set_fact: var_aide_scan_notification_email: !!str @@ -11114,6 +11184,36 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi +var_aide_scan_notification_email='' + + + +CRONTAB=/etc/crontab +CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly' + +# NOTE: on some platforms, /etc/crontab may not exist +if [ -f /etc/crontab ]; then + CRONTAB_EXIST=/etc/crontab +fi + +if [ -f /var/spool/cron/root ]; then + VARSPOOL=/var/spool/cron/root +fi + +if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then + echo "0 5 * * * root /usr/sbin/aide --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11172,8 +11272,10 @@ submits to this process. PR.DS-6 PR.DS-8 SRG-OS-000480-GPOS-00227 + 5.3.3 File integrity tools use cryptographic hashes for verifying file contents and directories have not been altered. These hashes must be FIPS 140-2 approved cryptographic hashes. + CCE-86404-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -11260,37 +11362,6 @@ The remediation provided with this rule adds acl to all r ACLs can provide permissions beyond those permitted through the file mode and must be verified by the file integrity tools. CCE-84220-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -aide_conf="/etc/aide.conf" - -groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) - -for group in $groups -do - config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') - - if ! [[ $config = *acl* ]] - then - if [[ -z $config ]] - then - config="acl" - else - config=$config"+acl" - fi - fi - sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather list of packages package_facts: manager: auto @@ -11352,6 +11423,37 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +aide_conf="/etc/aide.conf" + +groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) + +for group in $groups +do + config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') + + if ! [[ $config = *acl* ]] + then + if [[ -z $config ]] + then + config="acl" + else + config=$config"+acl" + fi + fi + sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11402,37 +11504,6 @@ The remediation provided with this rule adds xattrs to al Extended attributes in file systems are used to contain arbitrary data and file metadata with security implications. CCE-83733-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "aide" ; then - yum install -y "aide" -fi - -aide_conf="/etc/aide.conf" - -groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) - -for group in $groups -do - config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') - - if ! [[ $config = *xattrs* ]] - then - if [[ -z $config ]] - then - config="xattrs" - else - config=$config"+xattrs" - fi - fi - sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather list of packages package_facts: manager: auto @@ -11494,6 +11565,37 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "aide" ; then + yum install -y "aide" +fi + +aide_conf="/etc/aide.conf" + +groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u) + +for group in $groups +do + config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ') + + if ! [[ $config = *xattrs* ]] + then + if [[ -z $config ]] + then + config="xattrs" + else + config=$config"+xattrs" + fi + fi + sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11521,21 +11623,6 @@ Audit tools must have the correct group owner. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86239-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /sbin/auditctl -chgrp 0 /sbin/aureport -chgrp 0 /sbin/ausearch -chgrp 0 /sbin/autrace -chgrp 0 /sbin/auditd -chgrp 0 /sbin/rsyslogd -chgrp 0 /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -11773,6 +11860,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /sbin/auditctl +chgrp 0 /sbin/aureport +chgrp 0 /sbin/ausearch +chgrp 0 /sbin/autrace +chgrp 0 /sbin/auditd +chgrp 0 /sbin/rsyslogd +chgrp 0 /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -11800,21 +11902,6 @@ Audit tools must have the correct owner. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86259-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /sbin/auditctl -chown 0 /sbin/aureport -chown 0 /sbin/ausearch -chown 0 /sbin/autrace -chown 0 /sbin/auditd -chown 0 /sbin/rsyslogd -chown 0 /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -12052,6 +12139,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /sbin/auditctl +chown 0 /sbin/aureport +chown 0 /sbin/ausearch +chown 0 /sbin/autrace +chown 0 /sbin/auditd +chown 0 /sbin/rsyslogd +chown 0 /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12077,27 +12179,6 @@ Audit tools must have a mode of 0755 or less permissive. Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information. CCE-86227-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-s,g-ws,o-wt /sbin/auditctl - -chmod u-s,g-ws,o-wt /sbin/aureport - -chmod u-s,g-ws,o-wt /sbin/ausearch - -chmod u-s,g-ws,o-wt /sbin/autrace - -chmod u-s,g-ws,o-wt /sbin/auditd - -chmod u-s,g-ws,o-wt /sbin/rsyslogd - -chmod u-s,g-ws,o-wt /sbin/augenrules - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -12335,6 +12416,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-s,g-ws,o-wt /sbin/auditctl + +chmod u-s,g-ws,o-wt /sbin/aureport + +chmod u-s,g-ws,o-wt /sbin/ausearch + +chmod u-s,g-ws,o-wt /sbin/autrace + +chmod u-s,g-ws,o-wt /sbin/auditd + +chmod u-s,g-ws,o-wt /sbin/rsyslogd + +chmod u-s,g-ws,o-wt /sbin/augenrules + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12400,19 +12502,6 @@ protect data. The operating system must implement cryptographic modules adhering standards approved by the federal government since this provides assurance they have been tested and validated. CCE-82155-3 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then - -fips-mode-setup --enable -FIPS_CONF="/etc/dracut.conf.d/40-fips.conf" -if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then - echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Check to see the current status of FIPS mode command: /usr/bin/fips-mode-setup --check register: is_fips_enabled @@ -12479,6 +12568,19 @@ fi - medium_disruption - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then + +fips-mode-setup --enable +FIPS_CONF="/etc/dracut.conf.d/40-fips.conf" +if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then + echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12532,37 +12634,6 @@ standards approved by the federal government since this provides assurance they and validated. CCE-80942-6 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_system_crypto_policy='' - - -fips-mode-setup --enable - -stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) -rc=$? - -if test "$rc" = 127; then - echo "$stderr_of_call" >&2 - echo "Make sure that the script is installed on the remediated system." >&2 - echo "See output of the 'dnf provides update-crypto-policies' command" >&2 - echo "to see what package to (re)install" >&2 - - false # end with an error code -elif test "$rc" != 0; then - echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 - false # end with an error code -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations] -fips = true - - name: XCCDF Value var_system_crypto_policy # promote to variable set_fact: var_system_crypto_policy: !!str @@ -12669,6 +12740,37 @@ fips = true - medium_disruption - reboot_required - restrict_strategy + + +[customizations] +fips = true + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_system_crypto_policy='' + + +fips-mode-setup --enable + +stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) +rc=$? + +if test "$rc" = 127; then + echo "$stderr_of_call" >&2 + echo "Make sure that the script is installed on the remediated system." >&2 + echo "See output of the 'dnf provides update-crypto-policies' command" >&2 + echo "to see what package to (re)install" >&2 + + false # end with an error code +elif test "$rc" != 0; then + echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 + false # end with an error code +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -12852,8 +12954,23 @@ $ sudo yum install crypto-policies the applications that run on that operating system. Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data. CCE-82723-8 - -package --add=crypto-policies + - name: Ensure crypto-policies is installed + package: + name: crypto-policies + state: present + tags: + - CCE-82723-8 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_crypto-policies_installed + + +[[packages]] +name = "crypto-policies" +version = "*" include install_crypto-policies @@ -12862,29 +12979,14 @@ class install_crypto-policies { ensure => 'installed', } } + + +package --add=crypto-policies if ! rpm -q --quiet "crypto-policies" ; then yum install -y "crypto-policies" fi - - -[[packages]] -name = "crypto-policies" -version = "*" - - - name: Ensure crypto-policies is installed - package: - name: crypto-policies - state: present - tags: - - CCE-82723-8 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_crypto-policies_installed @@ -12995,46 +13097,6 @@ submits to this process. the applications that run on that operating system. Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data. CCE-80935-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: configure-crypto-policy.service - enabled: true - contents: | - [Unit] - Before=kubelet.service - [Service] - Type=oneshot - ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}} - RemainAfterExit=yes - [Install] - WantedBy=multi-user.target - - -var_system_crypto_policy='' - - -stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) -rc=$? - -if test "$rc" = 127; then - echo "$stderr_of_call" >&2 - echo "Make sure that the script is installed on the remediated system." >&2 - echo "See output of the 'dnf provides update-crypto-policies' command" >&2 - echo "to see what package to (re)install" >&2 - - false # end with an error code -elif test "$rc" != 0; then - echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 - false # end with an error code -fi - - name: XCCDF Value var_system_crypto_policy # promote to variable set_fact: var_system_crypto_policy: !!str @@ -13084,6 +13146,46 @@ fi - low_disruption - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: configure-crypto-policy.service + enabled: true + contents: | + [Unit] + Before=kubelet.service + [Service] + Type=oneshot + ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}} + RemainAfterExit=yes + [Install] + WantedBy=multi-user.target + + +var_system_crypto_policy='' + + +stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null) +rc=$? + +if test "$rc" = 127; then + echo "$stderr_of_call" >&2 + echo "Make sure that the script is installed on the remediated system." >&2 + echo "See output of the 'dnf provides update-crypto-policies' command" >&2 + echo "to see what package to (re)install" >&2 + + false # end with an error code +elif test "$rc" != 0; then + echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2 + false # end with an error code +fi @@ -13113,29 +13215,6 @@ line and is not commented out: library violate expectations, and makes system configuration more fragmented. CCE-84254-2 - -CONF_FILE=/etc/crypto-policies/back-ends/gnutls.config -correct_value='+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' - -grep -q ${correct_value} ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo ${correct_value} >> ${CONF_FILE} - fi -fi - - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: set_fact' set_fact: path: /etc/crypto-policies/back-ends/gnutls.config @@ -13217,6 +13296,29 @@ fi - medium_severity - reboot_required - restrict_strategy + + +CONF_FILE=/etc/crypto-policies/back-ends/gnutls.config +correct_value='+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' + +grep -q ${correct_value} ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo ${correct_value} >> ${CONF_FILE} + fi +fi @@ -13247,10 +13349,6 @@ If the symlink exists, Kerberos is configured to use the system-wide crypto poli Overriding the system crypto policy makes the behavior of Kerberos violate expectations, and makes system configuration more fragmented. CCE-80936-8 - -rm -f /etc/krb5.conf.d/crypto-policies -ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies - - name: Configure Kerberos to use System Crypto Policy file: src: /etc/crypto-policies/back-ends/krb5.config @@ -13268,6 +13366,10 @@ ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policie - low_complexity - low_disruption - reboot_required + + +rm -f /etc/krb5.conf.d/crypto-policies +ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies @@ -13304,18 +13406,6 @@ is not commented out or superseded by later includes: service violate expectations, and makes system configuration more fragmented. CCE-80937-6 - -function remediate_libreswan_crypto_policy() { - CONFIG_FILE="/etc/ipsec.conf" - if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then - # the file might not end with a new line - echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE" - fi - return 0 -} - -remediate_libreswan_crypto_policy - - name: Configure Libreswan to use System Crypto Policy lineinfile: path: /etc/ipsec.conf @@ -13336,6 +13426,18 @@ remediate_libreswan_crypto_policy - low_disruption - no_reboot_needed - restrict_strategy + + +function remediate_libreswan_crypto_policy() { + CONFIG_FILE="/etc/ipsec.conf" + if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then + # the file might not end with a new line + echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE" + fi + return 0 +} + +remediate_libreswan_crypto_policy @@ -13371,37 +13473,6 @@ if there is a [ crypto_policy ] section that contains the Overriding the system crypto policy makes the behavior of the Java runtime violates expectations, and makes system configuration more fragmented. CCE-80938-4 - -OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]' -OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]' - -OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config' - -OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$' - - - - - - -function remediate_openssl_crypto_policy() { - CONFIG_FILE=/etc/pki/tls/openssl.cnf - if test -f "$CONFIG_FILE"; then - if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then - printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE" - return 0 - elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then - sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE" - return 0 - fi - else - echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2 - return 1 - fi -} - -remediate_openssl_crypto_policy - - name: Configure OpenSSL library to use System Crypto Policy - Search for crypto_policy Section ansible.builtin.find: @@ -13506,6 +13577,37 @@ remediate_openssl_crypto_policy - medium_severity - no_reboot_needed - unknown_strategy + + +OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]' +OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]' + +OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config' + +OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$' + + + + + + +function remediate_openssl_crypto_policy() { + CONFIG_FILE=/etc/pki/tls/openssl.cnf + if test -f "$CONFIG_FILE"; then + if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then + printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE" + return 0 + elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then + sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE" + return 0 + fi + else + echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2 + return 1 + fi +} + +remediate_openssl_crypto_policy @@ -13590,16 +13692,11 @@ in the /etc/sysconfig/sshd. 2.2.7 SRG-OS-000250-GPOS-00093 RHEL-08-010287 - 5.2.14 + 4.2.22 SV-244526r877394_rule Overriding the system crypto policy makes the behavior of the SSH service violate expectations, and makes system configuration more fragmented. CCE-80939-2 - -SSH_CONF="/etc/sysconfig/sshd" - -sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF - - name: Configure SSH to use System Crypto Policy lineinfile: dest: /etc/sysconfig/sshd @@ -13621,6 +13718,11 @@ sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF - medium_disruption - medium_severity - reboot_required + + +SSH_CONF="/etc/sysconfig/sshd" + +sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF @@ -13655,15 +13757,6 @@ variable configured with predefined value. are configured e.g. cipher suites. Currently particular requirements specified by CC are stricter compared to any existing Crypto Policy. CCE-84286-4 - -cp="Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" -file="/etc/crypto-policies/local.d/opensslcnf-ospp.config" -backend_file="/etc/crypto-policies/back-ends/opensslcnf.config" - -sed -i "/Ciphersuites\s*=\s*/d" "$backend_file" -printf "\n%s\n" "$cp" >> "$file" -update-crypto-policies - - name: Remove configuration from backend file /etc/crypto-policies/back-ends/opensslcnf.config lineinfile: path: /etc/crypto-policies/back-ends/opensslcnf.config @@ -13710,6 +13803,15 @@ update-crypto-policies - medium_severity - reboot_required - restrict_strategy + + +cp="Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" +file="/etc/crypto-policies/local.d/opensslcnf-ospp.config" +backend_file="/etc/crypto-policies/back-ends/opensslcnf.config" + +sed -i "/Ciphersuites\s*=\s*/d" "$backend_file" +printf "\n%s\n" "$cp" >> "$file" +update-crypto-policies @@ -13805,25 +13907,6 @@ specifying a cipher list with the order of ciphers being in a “strongest weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections. CCE-85902-5 - -sshd_approved_ciphers='' - - -if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then - - LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" -else - touch "/etc/crypto-policies/back-ends/openssh.config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" - -cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" -# Insert at the end of the file -printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config" -# Clean up after ourselves. -rm "/etc/crypto-policies/back-ends/openssh.config.bak" - - name: XCCDF Value sshd_approved_ciphers # promote to variable set_fact: sshd_approved_ciphers: !!str @@ -13868,6 +13951,25 @@ rm "/etc/crypto-policies/back-ends/openssh.config.bak" - low_disruption - reboot_required - restrict_strategy + + +sshd_approved_ciphers='' + + +if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then + + LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" +else + touch "/etc/crypto-policies/back-ends/openssh.config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" + +cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" +# Insert at the end of the file +printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config" +# Clean up after ourselves. +rm "/etc/crypto-policies/back-ends/openssh.config.bak" @@ -13917,38 +14019,6 @@ specifying a cipher list with the order of ciphers being in a “strongest weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections. CCE-85897-7 - -sshd_approved_ciphers='' - - -CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config -correct_value="-oCiphers=${sshd_approved_ciphers}" - -# Test if file exists -test -f ${CONF_FILE} || touch ${CONF_FILE} - -# Ensure CRYPTO_POLICY is not commented out -sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} - -grep -q "'${correct_value}'" ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} - fi -fi - - name: XCCDF Value sshd_approved_ciphers # promote to variable set_fact: sshd_approved_ciphers: !!str @@ -14036,6 +14106,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_ciphers='' + + +CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config +correct_value="-oCiphers=${sshd_approved_ciphers}" + +# Test if file exists +test -f ${CONF_FILE} || touch ${CONF_FILE} + +# Ensure CRYPTO_POLICY is not commented out +sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} + +grep -q "'${correct_value}'" ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} + fi +fi @@ -14122,25 +14224,6 @@ submits to this process. client violate expectations, and makes system configuration more fragmented. CCE-85870-4 - -sshd_approved_macs='' - - -if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then - - LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" -else - touch "/etc/crypto-policies/back-ends/openssh.config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" - -cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" -# Insert at the end of the file -printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config" -# Clean up after ourselves. -rm "/etc/crypto-policies/back-ends/openssh.config.bak" - - name: XCCDF Value sshd_approved_macs # promote to variable set_fact: sshd_approved_macs: !!str @@ -14185,6 +14268,25 @@ rm "/etc/crypto-policies/back-ends/openssh.config.bak" - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_macs='' + + +if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then + + LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config" +else + touch "/etc/crypto-policies/back-ends/openssh.config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config" + +cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak" +# Insert at the end of the file +printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config" +# Clean up after ourselves. +rm "/etc/crypto-policies/back-ends/openssh.config.bak" @@ -14232,38 +14334,6 @@ submits to this process. server violate expectations, and makes system configuration more fragmented. CCE-85899-3 - -sshd_approved_macs='' - - -CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config -correct_value="-oMACs=${sshd_approved_macs}" - -# Test if file exists -test -f ${CONF_FILE} || touch ${CONF_FILE} - -# Ensure CRYPTO_POLICY is not commented out -sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} - -grep -q "'${correct_value}'" ${CONF_FILE} - -if [[ $? -ne 0 ]]; then - # We need to get the existing value, using PCRE to maintain same regex - existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE}) - - if [[ ! -z ${existing_value} ]]; then - # replace existing_value with correct_value - sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} - else - # ***NOTE*** # - # This probably means this file is not here or it's been modified - # unintentionally. - # ********** # - # echo correct_value to end - echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} - fi -fi - - name: XCCDF Value sshd_approved_macs # promote to variable set_fact: sshd_approved_macs: !!str @@ -14351,6 +14421,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + +sshd_approved_macs='' + + +CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config +correct_value="-oMACs=${sshd_approved_macs}" + +# Test if file exists +test -f ${CONF_FILE} || touch ${CONF_FILE} + +# Ensure CRYPTO_POLICY is not commented out +sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE} + +grep -q "'${correct_value}'" ${CONF_FILE} + +if [[ $? -ne 0 ]]; then + # We need to get the existing value, using PCRE to maintain same regex + existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE}) + + if [[ ! -z ${existing_value} ]]; then + # replace existing_value with correct_value + sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE} + else + # ***NOTE*** # + # This probably means this file is not here or it's been modified + # unintentionally. + # ********** # + # echo correct_value to end + echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE} + fi +fi @@ -14405,38 +14507,6 @@ openssl() SRG-OS-000480-GPOS-00227 This rule ensures that openssl invocations always uses SP800-90A compliant random number generator as a default behavior. CCE-82721-2 - -cat > /etc/profile.d/openssl-rand.sh <<- 'EOM' -# provide a default -rand /dev/random option to openssl commands that -# support it - -# written inefficiently for maximum shell compatibility -openssl() -( - openssl_bin=/usr/bin/openssl - - case "$*" in - # if user specified -rand, honor it - *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;; - esac - - cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '` - for i in `$openssl_bin list -commands`; do - if $openssl_bin list -options "$i" | grep -q '^rand '; then - cmds=" $i $cmds" - fi - done - - case "$cmds" in - *\ "$1"\ *) - cmd="$1"; shift - exec $openssl_bin "$cmd" -rand /dev/random "$@" ;; - esac - - exec $openssl_bin "$@" -) -EOM - - name: Put a file with shell wrapper to configure OpenSSL to always use strong entropy copy: dest: /etc/profile.d/openssl-rand.sh @@ -14477,6 +14547,38 @@ EOM - no_reboot_needed - openssl_use_strong_entropy - restrict_strategy + + +cat > /etc/profile.d/openssl-rand.sh <<- 'EOM' +# provide a default -rand /dev/random option to openssl commands that +# support it + +# written inefficiently for maximum shell compatibility +openssl() +( + openssl_bin=/usr/bin/openssl + + case "$*" in + # if user specified -rand, honor it + *\ -rand\ *|*\ -help*) exec $openssl_bin "$@" ;; + esac + + cmds=`$openssl_bin list -digest-commands -cipher-commands | tr '\n' ' '` + for i in `$openssl_bin list -commands`; do + if $openssl_bin list -options "$i" | grep -q '^rand '; then + cmds=" $i $cmds" + fi + done + + case "$cmds" in + *\ "$1"\ *) + cmd="$1"; shift + exec $openssl_bin "$cmd" -rand /dev/random "$@" ;; + esac + + exec $openssl_bin "$@" +) +EOM @@ -14813,31 +14915,6 @@ The nails service can be enabled with the following comma Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. - include enable_nails - -class enable_nails { - service {'nails': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'nails.service' -"$SYSTEMCTL_EXEC" start 'nails.service' -"$SYSTEMCTL_EXEC" enable 'nails.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["nails"] - - name: Enable service nails block: @@ -14864,6 +14941,31 @@ enabled = ["nails"] - medium_severity - no_reboot_needed - service_nails_enabled + + +[customizations.services] +enabled = ["nails"] + + include enable_nails + +class enable_nails { + service {'nails': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'nails.service' +"$SYSTEMCTL_EXEC" start 'nails.service' +"$SYSTEMCTL_EXEC" enable 'nails.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -15007,7 +15109,7 @@ automated remediation is not available for this configuration check.SI-2(2) SRG-OS-000191-GPOS-00080 RHEL-08-010001 - SV-245540r754730_rule + SV-245540r942951_rule Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. CCE-86260-7 @@ -15030,7 +15132,7 @@ automated remediation is not available for this configuration check.SI-2(2) SRG-OS-000191-GPOS-00080 RHEL-08-010001 - SV-245540r754730_rule + SV-245540r942951_rule Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems. CCE-86261-5 @@ -15703,13 +15805,13 @@ option. Access to this partition should be restricted. CCE-83336-8 - -part /boot - [[customizations.filesystem]] mountpoint = "/boot" size = 1073741824 + + +part /boot @@ -15784,13 +15886,13 @@ setting of more restrictive mount options, and also helps ensure that users cannot trivially fill partitions used for log or audit data storage. CCE-81044-0 - -part /home - [[customizations.filesystem]] mountpoint = "/home" size = 1073741824 + + +part /home @@ -15810,13 +15912,13 @@ makes it easier to apply restrictions e.g. through the nosuid CCE-83340-0 - -part /opt - [[customizations.filesystem]] mountpoint = "/opt" size = 1073741824 + + +part /opt @@ -15839,13 +15941,13 @@ more restrictive mount options, and also helps ensure that users cannot trivially fill partitions used for log or audit data storage. CCE-83387-1 - -part /srv - [[customizations.filesystem]] mountpoint = "/srv" size = 1073741824 + + +part /srv @@ -15891,13 +15993,13 @@ Placing /tmp in its own partition enables the setting of restrictive mount options, which can help protect programs which use it. CCE-80851-9 - -part /tmp - [[customizations.filesystem]] mountpoint = "/tmp" size = 1073741824 + + +part /tmp @@ -15916,13 +16018,13 @@ Putting it on a separate partition allows limiting its size and applying restrictions through mount options. CCE-83343-4 - -part /usr - [[customizations.filesystem]] mountpoint = "/usr" size = 5368709120 + + +part /usr @@ -15970,13 +16072,13 @@ It is not uncommon for the /var directory to contain world-writable directories installed by other software packages. CCE-80852-7 - -part /var - [[customizations.filesystem]] mountpoint = "/var" size = 3221225472 + + +part /var @@ -16054,13 +16156,13 @@ enables better separation between log files and other files in /var/. CCE-80853-5 - -part /var/log - [[customizations.filesystem]] mountpoint = "/var/log" size = 5368709120 + + +part /var/log @@ -16153,13 +16255,13 @@ auditing cannot be halted due to the partition running out of space. CCE-80854-3 - -part /var/log/audit - [[customizations.filesystem]] mountpoint = "/var/log/audit" size = 10737418240 + + +part /var/log/audit @@ -16183,13 +16285,13 @@ Placing /var/tmp in its own partition enables the setting restrictive mount options, which can help protect programs which use it. CCE-82730-3 - -part /var/tmp - [[customizations.filesystem]] mountpoint = "/var/tmp" size = 1073741824 + + +part /var/tmp @@ -16232,36 +16334,6 @@ mode. To do so, run the following command: A graphical environment is unnecessary for certain types of systems including a virtualization hypervisor. CCE-82367-4 - -package --remove=gdm - - include remove_gdm - -class remove_gdm { - package { 'gdm': - ensure => 'purged', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# CAUTION: This remediation script will remove gdm -# from the system, and may remove any packages -# that depend on gdm. Execute this -# remediation AFTER testing on a non-production -# system! - -if rpm -q --quiet "gdm" ; then - - yum remove -y "gdm" - -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16293,6 +16365,36 @@ fi - medium_severity - no_reboot_needed - package_gdm_removed + + include remove_gdm + +class remove_gdm { + package { 'gdm': + ensure => 'purged', + } +} + + +package --remove=gdm + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# CAUTION: This remediation script will remove gdm +# from the system, and may remove any packages +# that depend on gdm. Execute this +# remediation AFTER testing on a non-production +# system! + +if rpm -q --quiet "gdm" ; then + + yum remove -y "gdm" + +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -16321,15 +16423,6 @@ configuration files have to be compliant, and the database needs to be more rece which gives confidence that it reflects them. CCE-81003-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16360,6 +16453,15 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -16470,68 +16572,6 @@ After the settings have been set, run dconf update. - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*disable-restart-buttons\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)disable-restart-buttons(\s*=)/#\1disable-restart-buttons\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-restart-buttons\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*disable-restart-buttons\\s*=\\s*.*/disable-restart-buttons=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-restart-buttons=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-restart-buttons$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/disable-restart-buttons$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/disable-restart-buttons$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/disable-restart-buttons" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -16609,41 +16649,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable the GNOME3 Login User List - In the default graphical environment, users logging directly into the -system are greeted with a login screen that displays all known users. -This functionality should be disabled by setting disable-user-list -to true. - -To disable, add or edit disable-user-list to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -disable-user-list=true -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent -user modification. For example: -/org/gnome/login-screen/disable-user-list -After the settings have been set, run dconf update. - CM-6(a) - AC-23 - SRG-OS-000480-GPOS-00227 - RHEL-08-020032 - 1.8.3 - SV-244536r743857_rule - Leaving the user list enabled is a security risk since it allows anyone -with physical access to the system to quickly enumerate known user accounts -without logging in. - - CCE-86195-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -16659,10 +16665,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-restart-buttons\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-restart-buttons(\s*=)/#\1disable-restart-buttons\2/g" "${SETTINGSFILES[@]}" fi fi @@ -16673,16 +16679,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-restart-buttons\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-restart-buttons\\s*=\\s*.*/disable-restart-buttons=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-restart-buttons=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-restart-buttons$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" @@ -16691,12 +16697,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/disable-restart-buttons$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/login-screen/disable-restart-buttons$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/disable-restart-buttons" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -16705,6 +16711,40 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable the GNOME3 Login User List + In the default graphical environment, users logging directly into the +system are greeted with a login screen that displays all known users. +This functionality should be disabled by setting disable-user-list +to true. + +To disable, add or edit disable-user-list to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +disable-user-list=true +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent +user modification. For example: +/org/gnome/login-screen/disable-user-list +After the settings have been set, run dconf update. + CM-6(a) + AC-23 + SRG-OS-000480-GPOS-00227 + RHEL-08-020032 + 1.8.3 + SV-244536r743857_rule + Leaving the user list enabled is a security risk since it allows anyone +with physical access to the system to quickly enumerate known user accounts +without logging in. + + CCE-86195-5 - name: Gather the package facts package_facts: manager: auto @@ -16781,51 +16821,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Enable the GNOME3 Login Smartcard Authentication - In the default graphical environment, smart card authentication -can be enabled on the login screen by setting enable-smartcard-authentication -to true. - -To enable, add or edit enable-smartcard-authentication to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -enable-smartcard-authentication=true -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/login-screen/enable-smartcard-authentication -After the settings have been set, run dconf update. - CCI-000765 - CCI-000766 - CCI-000767 - CCI-000768 - CCI-000771 - CCI-000772 - CCI-000884 - CCI-001948 - CCI-001954 - IA-2(3) - IA-2(4) - IA-2(8) - IA-2(9) - IA-2(11) - Req-8.3 - SRG-OS-000375-GPOS-00160 - SRG-OS-000376-GPOS-00161 - SRG-OS-000377-GPOS-00162 - Smart card login provides two-factor authentication stronger than -that provided by a username and password combination. Smart cards leverage PKI -(public key infrastructure) in order to provide and verify credentials. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -16841,10 +16837,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)enable-smartcard-authentication(\s*=)/#\1enable-smartcard-authentication\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}" fi fi @@ -16855,16 +16851,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*enable-smartcard-authentication\\s*=\\s*.*/enable-smartcard-authentication=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\enable-smartcard-authentication=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/enable-smartcard-authentication$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" @@ -16873,12 +16869,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/enable-smartcard-authentication$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/enable-smartcard-authentication$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/login-screen/enable-smartcard-authentication" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -16887,6 +16883,50 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enable the GNOME3 Login Smartcard Authentication + In the default graphical environment, smart card authentication +can be enabled on the login screen by setting enable-smartcard-authentication +to true. + +To enable, add or edit enable-smartcard-authentication to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +enable-smartcard-authentication=true +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/login-screen/enable-smartcard-authentication +After the settings have been set, run dconf update. + CCI-000765 + CCI-000766 + CCI-000767 + CCI-000768 + CCI-000771 + CCI-000772 + CCI-000884 + CCI-001948 + CCI-001954 + IA-2(3) + IA-2(4) + IA-2(8) + IA-2(9) + IA-2(11) + Req-8.3 + SRG-OS-000375-GPOS-00160 + SRG-OS-000376-GPOS-00161 + SRG-OS-000377-GPOS-00162 + Smart card login provides two-factor authentication stronger than +that provided by a username and password combination. Smart cards leverage PKI +(public key infrastructure) in order to provide and verify credentials. + - name: Gather the package facts package_facts: manager: auto @@ -16971,92 +17011,60 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Enable the GNOME3 Screen Locking On Smartcard Removal - In the default graphical environment, screen locking on smartcard removal -can be enabled by setting removal-action -to 'lock-screen'. - -To enable, add or edit removal-action to -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/settings-daemon/peripherals/smartcard] -removal-action='lock-screen' -Once the setting has been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/settings-daemon/peripherals/smartcard/removal-action -After the settings have been set, run dconf update. - CCI-000056 - CCI-000058 - SRG-OS-000028-GPOS-00009 - SRG-OS-000030-GPOS-00011 - RHEL-08-020050 - SV-230351r792899_rule - Locking the screen automatically when removing the smartcard can -prevent undesired access to system. - - CCE-83910-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*removal-action\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)removal-action(\s*=)/#\1removal-action\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)enable-smartcard-authentication(\s*=)/#\1enable-smartcard-authentication\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/settings-daemon/peripherals/smartcard]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'lock-screen'")" -if grep -q "^\\s*removal-action\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*enable-smartcard-authentication\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*removal-action\\s*=\\s*.*/removal-action=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*enable-smartcard-authentication\\s*=\\s*.*/enable-smartcard-authentication=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/settings-daemon/peripherals/smartcard\\]|a\\removal-action=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/login-screen\\]|a\\enable-smartcard-authentication=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" +LOCKFILES=$(grep -r "^/org/gnome/login-screen/enable-smartcard-authentication$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/login-screen/enable-smartcard-authentication$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/login-screen/enable-smartcard-authentication$" /etc/dconf/db/gdm.d/ then - echo "/org/gnome/settings-daemon/peripherals/smartcard/removal-action" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/login-screen/enable-smartcard-authentication" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" fi dconf update @@ -17065,6 +17073,38 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enable the GNOME3 Screen Locking On Smartcard Removal + In the default graphical environment, screen locking on smartcard removal +can be enabled by setting removal-action +to 'lock-screen'. + +To enable, add or edit removal-action to +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/settings-daemon/peripherals/smartcard] +removal-action='lock-screen' +Once the setting has been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/settings-daemon/peripherals/smartcard/removal-action +After the settings have been set, run dconf update. + CCI-000056 + CCI-000058 + SRG-OS-000028-GPOS-00009 + SRG-OS-000030-GPOS-00011 + RHEL-08-020050 + SV-230351r792899_rule + Locking the screen automatically when removing the smartcard can +prevent undesired access to system. + + CCE-83910-0 - name: Gather the package facts package_facts: manager: auto @@ -17218,90 +17258,60 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Set the GNOME3 Login Number of Failures - In the default graphical environment, the GNOME3 login -screen and be configured to restart the authentication process after -a configured number of attempts. This can be configured by setting -allowed-failures to 3 or less. - -To enable, add or edit allowed-failures to -/etc/dconf/db/gdm.d/00-security-settings. For example: -[org/gnome/login-screen] -allowed-failures=3 -Once the setting has been added, add a lock to -/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/login-screen/allowed-failures -After the settings have been set, run dconf update. - 3.1.8 - FMT_MOF_EXT.1 - Setting the password retry prompts that are permitted on a per-session basis to a low value -requires some software, such as SSH, to re-connect. This can slow down and -draw additional attention to some types of password-guessing attacks. - - CCE-80771-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*allowed-failures\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*removal-action\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)allowed-failures(\s*=)/#\1allowed-failures\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)removal-action(\s*=)/#\1removal-action\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/settings-daemon/peripherals/smartcard]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "3")" -if grep -q "^\\s*allowed-failures\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'lock-screen'")" +if grep -q "^\\s*removal-action\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*allowed-failures\\s*=\\s*.*/allowed-failures=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*removal-action\\s*=\\s*.*/removal-action=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\allowed-failures=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/settings-daemon/peripherals/smartcard\\]|a\\removal-action=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/allowed-failures$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" +LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/login-screen/allowed-failures$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/login-screen/allowed-failures$" /etc/dconf/db/gdm.d/ +if ! grep -qr "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" /etc/dconf/db/local.d/ then - echo "/org/gnome/login-screen/allowed-failures" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" + echo "/org/gnome/settings-daemon/peripherals/smartcard/removal-action" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -17310,6 +17320,36 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set the GNOME3 Login Number of Failures + In the default graphical environment, the GNOME3 login +screen and be configured to restart the authentication process after +a configured number of attempts. This can be configured by setting +allowed-failures to 3 or less. + +To enable, add or edit allowed-failures to +/etc/dconf/db/gdm.d/00-security-settings. For example: +[org/gnome/login-screen] +allowed-failures=3 +Once the setting has been added, add a lock to +/etc/dconf/db/gdm.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/login-screen/allowed-failures +After the settings have been set, run dconf update. + 3.1.8 + FMT_MOF_EXT.1 + Setting the password retry prompts that are permitted on a per-session basis to a low value +requires some software, such as SSH, to re-connect. This can slow down and +draw additional attention to some types of password-guessing attacks. + + CCE-80771-9 - name: Gather the package facts package_facts: manager: auto @@ -17377,6 +17417,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*allowed-failures\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)allowed-failures(\s*=)/#\1allowed-failures\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "3")" +if grep -q "^\\s*allowed-failures\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*allowed-failures\\s*=\\s*.*/allowed-failures=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\allowed-failures=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/allowed-failures$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/allowed-failures$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/allowed-failures$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/allowed-failures" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17425,24 +17527,6 @@ AutomaticLoginEnable=false system security. CCE-80823-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -if rpm --quiet -q gdm -then - if ! grep -q "^AutomaticLoginEnable=" /etc/gdm/custom.conf - then - sed -i "/^\[daemon\]/a \ - AutomaticLoginEnable=False" /etc/gdm/custom.conf - else - sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=False/g" /etc/gdm/custom.conf - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17486,6 +17570,24 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +if rpm --quiet -q gdm +then + if ! grep -q "^AutomaticLoginEnable=" /etc/gdm/custom.conf + then + sed -i "/^\[daemon\]/a \ + AutomaticLoginEnable=False" /etc/gdm/custom.conf + else + sed -i "s/^AutomaticLoginEnable=.*/AutomaticLoginEnable=False/g" /etc/gdm/custom.conf + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17533,24 +17635,6 @@ TimedLoginEnable=false system security. CCE-80824-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -if rpm --quiet -q gdm -then - if ! grep -q "^TimedLoginEnable=" /etc/gdm/custom.conf - then - sed -i "/^\[daemon\]/a \ - TimedLoginEnable=false" /etc/gdm/custom.conf - else - sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=false/g" /etc/gdm/custom.conf - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17594,6 +17678,24 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +if rpm --quiet -q gdm +then + if ! grep -q "^TimedLoginEnable=" /etc/gdm/custom.conf + then + sed -i "/^\[daemon\]/a \ + TimedLoginEnable=false" /etc/gdm/custom.conf + else + sed -i "s/^TimedLoginEnable=.*/TimedLoginEnable=false/g" /etc/gdm/custom.conf + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17619,28 +17721,6 @@ remote session. If a privileged user were to login using XDMCP, the privileged user password could be compromised due to typed XEvents and keystrokes will traversing over the network in clear text. CCE-86007-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Try find '[xdmcp]' and 'Enable' in '/etc/gdm/custom.conf', if it exists, set -# to 'false', if it isn't here, add it, if '[xdmcp]' doesn't exist, add it there -if grep -qzosP '[[:space:]]*\[xdmcp]([^\n\[]*\n+)+?[[:space:]]*Enable' '/etc/gdm/custom.conf'; then - - sed -i "s/Enable[^(\n)]*/Enable=false/" '/etc/gdm/custom.conf' -elif grep -qs '[[:space:]]*\[xdmcp]' '/etc/gdm/custom.conf'; then - sed -i "/[[:space:]]*\[xdmcp]/a Enable=false" '/etc/gdm/custom.conf' -else - if test -d "/etc/gdm"; then - printf '%s\n' '[xdmcp]' "Enable=false" >> '/etc/gdm/custom.conf' - else - echo "Config file directory '/etc/gdm' doesnt exist, not remediating, assuming non-applicability." >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17670,6 +17750,28 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Try find '[xdmcp]' and 'Enable' in '/etc/gdm/custom.conf', if it exists, set +# to 'false', if it isn't here, add it, if '[xdmcp]' doesn't exist, add it there +if grep -qzosP '[[:space:]]*\[xdmcp]([^\n\[]*\n+)+?[[:space:]]*Enable' '/etc/gdm/custom.conf'; then + + sed -i "s/Enable[^(\n)]*/Enable=false/" '/etc/gdm/custom.conf' +elif grep -qs '[[:space:]]*\[xdmcp]' '/etc/gdm/custom.conf'; then + sed -i "/[[:space:]]*\[xdmcp]/a Enable=false" '/etc/gdm/custom.conf' +else + if test -d "/etc/gdm"; then + printf '%s\n' '[xdmcp]' "Enable=false" >> '/etc/gdm/custom.conf' + else + echo "Config file directory '/etc/gdm' doesnt exist, not remediating, assuming non-applicability." >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17746,68 +17848,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-89904-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*automount\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)automount(\s*=)/#\1automount\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*automount\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*automount\\s*=\\s*.*/automount=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/automount$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/automount$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/automount" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -17891,6 +17931,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*automount\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)automount(\s*=)/#\1automount\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*automount\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*automount\\s*=\\s*.*/automount=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/automount$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/automount$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/automount" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -17964,68 +18066,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-83693-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*automount-open\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)automount-open(\s*=)/#\1automount-open\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*automount-open\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*automount-open\\s*=\\s*.*/automount-open=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount-open=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount-open$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/automount-open$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/automount-open$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/automount-open" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18109,6 +18149,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*automount-open\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)automount-open(\s*=)/#\1automount-open\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*automount-open\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*automount-open\\s*=\\s*.*/automount-open=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\automount-open=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/automount-open$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/automount-open$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/automount-open$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/automount-open" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -18181,68 +18283,6 @@ It will, however, also prevent desktop users from legitimate use of removable media. CCE-83742-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*autorun-never\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)autorun-never(\s*=)/#\1autorun-never\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*autorun-never\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*autorun-never\\s*=\\s*.*/autorun-never=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\autorun-never=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/autorun-never$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/media-handling/autorun-never$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/media-handling/autorun-never$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/media-handling/autorun-never" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18322,6 +18362,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/media-handling\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*autorun-never\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)autorun-never(\s*=)/#\1autorun-never\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/media-handling\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/media-handling]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*autorun-never\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*autorun-never\\s*=\\s*.*/autorun-never=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/media-handling\\]|a\\autorun-never=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/media-handling/autorun-never$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/media-handling/autorun-never$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/media-handling/autorun-never$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/media-handling/autorun-never" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -18420,68 +18522,6 @@ file to exploit this flaw. Assuming the attacker could place the malicious file malicious file would exploit the thumbnailer with the potential for malicious code execution. It is best to disable these thumbnailer applications unless they are explicitly required. - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/thumbnailers\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*disable-all\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)disable-all(\s*=)/#\1disable-all\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/thumbnailers\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/thumbnailers]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-all\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*disable-all\\s*=\\s*.*/disable-all=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/thumbnailers\\]|a\\disable-all=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/thumbnailers/disable-all$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/thumbnailers/disable-all$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/thumbnailers/disable-all$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/thumbnailers/disable-all" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -18554,42 +18594,13 @@ fi - unknown_severity - unknown_strategy - - - - - - - - - - GNOME Network Settings - GNOME network settings that apply to the graphical interface. - - Disable WIFI Network Connection Creation in GNOME3 - GNOME allows users to create ad-hoc wireless connections through the -NetworkManager applet. Wireless connections should be disabled by -adding or setting disable-wifi-create to true in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/nm-applet] -disable-wifi-create=true - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/nm-applet/disable-wifi-create -After the settings have been set, run dconf update. - 3.1.16 - Wireless network connections should not be allowed to be configured by general -users on a given system as it could open the system to backdoor attacks. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/nm-applet\\]" "/etc/dconf/db/" \ +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/thumbnailers\\]" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) DCONFFILE="/etc/dconf/db/local.d/00-security-settings" DBDIR="/etc/dconf/db/local.d" @@ -18599,30 +18610,30 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*disable-wifi-create\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-all\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)disable-wifi-create(\s*=)/#\1disable-wifi-create\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-all(\s*=)/#\1disable-all\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/nm-applet\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/thumbnailers\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/nm-applet]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/desktop/thumbnailers]" >> ${DCONFFILE} fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*disable-wifi-create\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-all\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*disable-wifi-create\\s*=\\s*.*/disable-wifi-create=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-all\\s*=\\s*.*/disable-all=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/nm-applet\\]|a\\disable-wifi-create=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/desktop/thumbnailers\\]|a\\disable-all=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/nm-applet/disable-wifi-create$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/desktop/thumbnailers/disable-all$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18631,12 +18642,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/nm-applet/disable-wifi-create$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/desktop/thumbnailers/disable-all$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/nm-applet/disable-wifi-create$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/desktop/thumbnailers/disable-all$" /etc/dconf/db/local.d/ then - echo "/org/gnome/nm-applet/disable-wifi-create" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/desktop/thumbnailers/disable-all" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18645,6 +18656,35 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + GNOME Network Settings + GNOME network settings that apply to the graphical interface. + + Disable WIFI Network Connection Creation in GNOME3 + GNOME allows users to create ad-hoc wireless connections through the +NetworkManager applet. Wireless connections should be disabled by +adding or setting disable-wifi-create to true in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/nm-applet] +disable-wifi-create=true + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/nm-applet/disable-wifi-create +After the settings have been set, run dconf update. + 3.1.16 + Wireless network connections should not be allowed to be configured by general +users on a given system as it could open the system to backdoor attacks. + - name: Gather the package facts package_facts: manager: auto @@ -18709,34 +18749,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable WIFI Network Notification in GNOME3 - By default, GNOME disables WIFI notification. This should be permanently set -so that users do not connect to a wireless network when the system finds one. -While useful for mobile devices, this setting should be disabled for all other systems. -To configure the system to disable the WIFI notication, add or set -suppress-wireless-networks-available to true in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/nm-applet] -suppress-wireless-networks-available=true - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/nm-applet/suppress-wireless-networks-available -After the settings have been set, run dconf update. - 3.1.16 - Wireless network connections should not be allowed to be configured by general -users on a given system as it could open the system to backdoor attacks. - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -18752,10 +18765,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*disable-wifi-create\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)suppress-wireless-networks-available(\s*=)/#\1suppress-wireless-networks-available\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)disable-wifi-create(\s*=)/#\1disable-wifi-create\2/g" "${SETTINGSFILES[@]}" fi fi @@ -18766,16 +18779,16 @@ then fi escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${DCONFFILE}" +if grep -q "^\\s*disable-wifi-create\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*suppress-wireless-networks-available\\s*=\\s*.*/suppress-wireless-networks-available=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*disable-wifi-create\\s*=\\s*.*/disable-wifi-create=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/nm-applet\\]|a\\suppress-wireless-networks-available=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/nm-applet\\]|a\\disable-wifi-create=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/nm-applet/suppress-wireless-networks-available$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/nm-applet/disable-wifi-create$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18784,12 +18797,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/nm-applet/suppress-wireless-networks-available$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/nm-applet/disable-wifi-create$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/nm-applet/suppress-wireless-networks-available$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/nm-applet/disable-wifi-create$" /etc/dconf/db/local.d/ then - echo "/org/gnome/nm-applet/suppress-wireless-networks-available" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/nm-applet/disable-wifi-create" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18798,6 +18811,33 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable WIFI Network Notification in GNOME3 + By default, GNOME disables WIFI notification. This should be permanently set +so that users do not connect to a wireless network when the system finds one. +While useful for mobile devices, this setting should be disabled for all other systems. +To configure the system to disable the WIFI notication, add or set +suppress-wireless-networks-available to true in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/nm-applet] +suppress-wireless-networks-available=true + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/nm-applet/suppress-wireless-networks-available +After the settings have been set, run dconf update. + 3.1.16 + Wireless network connections should not be allowed to be configured by general +users on a given system as it could open the system to backdoor attacks. + - name: Gather the package facts package_facts: manager: auto @@ -18862,49 +18902,13 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - - GNOME Remote Access Settings - GNOME remote access settings that apply to the graphical interface. - - Require Credential Prompting for Remote Access in GNOME3 - By default, GNOME does not require credentials when using Vino for -remote access. To configure the system to require remote credentials, add or set -authentication-methods to ['vnc'] in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/Vino] -authentication-methods=['vnc'] - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/Vino/authentication-methods -After the settings have been set, run dconf update. - 3.1.12 - 164.308(a)(4)(i) - 164.308(b)(1) - 164.308(b)(3) - 164.310(b) - 164.312(e)(1) - 164.312(e)(2)(ii) - Username and password prompting is required for remote access. Otherwise, non-authorized -and nefarious users can access the system freely. - - CCE-80772-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories # If files contain ibus or distro, ignore them. # The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/nm-applet\\]" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) DCONFFILE="/etc/dconf/db/local.d/00-security-settings" DBDIR="/etc/dconf/db/local.d" @@ -18914,30 +18918,30 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*authentication-methods\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)authentication-methods(\s*=)/#\1authentication-methods\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)suppress-wireless-networks-available(\s*=)/#\1suppress-wireless-networks-available\2/g" "${SETTINGSFILES[@]}" fi fi [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +if ! grep -q "\\[org/gnome/nm-applet\\]" "${DCONFFILE}" then - printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} + printf '%s\n' "[org/gnome/nm-applet]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "['vnc']")" -if grep -q "^\\s*authentication-methods\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*suppress-wireless-networks-available\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*authentication-methods\\s*=\\s*.*/authentication-methods=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*suppress-wireless-networks-available\\s*=\\s*.*/suppress-wireless-networks-available=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/Vino\\]|a\\authentication-methods=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/nm-applet\\]|a\\suppress-wireless-networks-available=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/Vino/authentication-methods$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/nm-applet/suppress-wireless-networks-available$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -18946,12 +18950,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/Vino/authentication-methods$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/nm-applet/suppress-wireless-networks-available$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/Vino/authentication-methods$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/nm-applet/suppress-wireless-networks-available$" /etc/dconf/db/local.d/ then - echo "/org/gnome/Vino/authentication-methods" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/nm-applet/suppress-wireless-networks-available" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -18960,6 +18964,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + GNOME Remote Access Settings + GNOME remote access settings that apply to the graphical interface. + + Require Credential Prompting for Remote Access in GNOME3 + By default, GNOME does not require credentials when using Vino for +remote access. To configure the system to require remote credentials, add or set +authentication-methods to ['vnc'] in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/Vino] +authentication-methods=['vnc'] + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/Vino/authentication-methods +After the settings have been set, run dconf update. + 3.1.12 + 164.308(a)(4)(i) + 164.308(b)(1) + 164.308(b)(3) + 164.310(b) + 164.312(e)(1) + 164.312(e)(2)(ii) + Username and password prompting is required for remote access. Otherwise, non-authorized +and nefarious users can access the system freely. + + CCE-80772-7 - name: Gather the package facts package_facts: manager: auto @@ -19027,6 +19067,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*authentication-methods\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)authentication-methods(\s*=)/#\1authentication-methods\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "['vnc']")" +if grep -q "^\\s*authentication-methods\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*authentication-methods\\s*=\\s*.*/authentication-methods=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/Vino\\]|a\\authentication-methods=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/Vino/authentication-methods$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/Vino/authentication-methods$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/Vino/authentication-methods$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/Vino/authentication-methods" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19101,68 +19203,6 @@ After the settings have been set, run dconf update. CCE-80773-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*require-encryption\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)require-encryption(\s*=)/#\1require-encryption\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*require-encryption\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*require-encryption\\s*=\\s*.*/require-encryption=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/Vino\\]|a\\require-encryption=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/Vino/require-encryption$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/Vino/require-encryption$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/Vino/require-encryption$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/Vino/require-encryption" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19242,6 +19282,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/Vino\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*require-encryption\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)require-encryption(\s*=)/#\1require-encryption\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/Vino\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/Vino]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*require-encryption\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*require-encryption\\s*=\\s*.*/require-encryption=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/Vino\\]|a\\require-encryption=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/Vino/require-encryption$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/Vino/require-encryption$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/Vino/require-encryption$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/Vino/require-encryption" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19352,68 +19454,6 @@ login session does not have administrator rights and the display station is loca controlled-access area. CCE-80774-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*idle-activation-enabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)idle-activation-enabled(\s*=)/#\1idle-activation-enabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*idle-activation-enabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*idle-activation-enabled\\s*=\\s*.*/idle-activation-enabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\idle-activation-enabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19501,6 +19541,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*idle-activation-enabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)idle-activation-enabled(\s*=)/#\1idle-activation-enabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*idle-activation-enabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*idle-activation-enabled\\s*=\\s*.*/idle-activation-enabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\idle-activation-enabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19557,48 +19659,21 @@ After the settings have been set, run dconf update.A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to logout because of the temporary nature of the absense. CCE-83858-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-83858-1 - - CJIS-5.5.5 - - NIST-800-171-3.1.10 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-8.1.8 - - dconf_gnome_screensaver_idle_activation_locked - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-83858-1 + - CJIS-5.5.5 + - NIST-800-171-3.1.10 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-8.1.8 + - dconf_gnome_screensaver_idle_activation_locked + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy - name: Prevent user modification of GNOME Screensaver idle-activation-enabled lineinfile: @@ -19635,6 +19710,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/idle-activation-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/idle-activation-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/idle-activation-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/idle-activation-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19704,52 +19806,6 @@ system session prior to vacating the vicinity, GNOME3 can be configured to ident a user's session has idled and take action to initiate a session lock. CCE-80775-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -inactivity_timeout_value='' - - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")" -if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -19821,6 +19877,52 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +inactivity_timeout_value='' + + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")" +if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -19887,52 +19989,6 @@ After the settings have been set, run dconf update. CCE-80776-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_screensaver_lock_delay='' - - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")" -if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20001,6 +20057,52 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_screensaver_lock_delay='' + + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")" +if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20071,68 +20173,6 @@ After the settings have been set, run dconf update. CCE-80777-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20338,6 +20378,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20398,33 +20500,6 @@ After the settings have been set, run dconf update.A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to logout because of the temporary nature of the absense. CCE-87261-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20479,6 +20554,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20547,68 +20649,6 @@ After the settings have been set, run dconf update. CCE-80778-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*picture-uri\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)picture-uri(\s*=)/#\1picture-uri\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "string ''")" -if grep -q "^\\s*picture-uri\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*picture-uri\\s*=\\s*.*/picture-uri=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\picture-uri=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/picture-uri$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/picture-uri$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/picture-uri$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/picture-uri" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20701,34 +20741,7 @@ fi - no_reboot_needed - unknown_strategy - - - - - - - - - Disable Full User Name on Splash Shield - By default when the screen is locked, the splash shield will show the user's -full name. This should be disabled to prevent casual observers from seeing -who has access to the system. This can be disabled by adding or setting -show-full-name-in-top-bar to false in -/etc/dconf/db/local.d/00-security-settings. For example: -[org/gnome/desktop/screensaver] -show-full-name-in-top-bar=false - -Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -/org/gnome/desktop/screensaver/show-full-name-in-top-bar -After the settings have been set, run dconf update. - FMT_MOF_EXT.1 - Setting the splash screen to not reveal the logged in user's name -conceals who has access to the system from passersby. - - CCE-80779-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then # Check for setting in any of the DConf db directories @@ -20744,10 +20757,10 @@ mkdir -p "${DBDIR}" # Comment out the configurations in databases different from the target one if [ "${#SETTINGSFILES[@]}" -ne 0 ] then - if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${SETTINGSFILES[@]}" + if grep -q "^\\s*picture-uri\\s*=" "${SETTINGSFILES[@]}" then - sed -Ei "s/(^\s*)show-full-name-in-top-bar(\s*=)/#\1show-full-name-in-top-bar\2/g" "${SETTINGSFILES[@]}" + sed -Ei "s/(^\s*)picture-uri(\s*=)/#\1picture-uri\2/g" "${SETTINGSFILES[@]}" fi fi @@ -20757,17 +20770,17 @@ then printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} fi -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" -if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${DCONFFILE}" +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "string ''")" +if grep -q "^\\s*picture-uri\\s*=" "${DCONFFILE}" then - sed -i "s/\\s*show-full-name-in-top-bar\\s*=\\s*.*/show-full-name-in-top-bar=${escaped_value}/g" "${DCONFFILE}" + sed -i "s/\\s*picture-uri\\s*=\\s*.*/picture-uri=${escaped_value}/g" "${DCONFFILE}" else - sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\show-full-name-in-top-bar=${escaped_value}" "${DCONFFILE}" + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\picture-uri=${escaped_value}" "${DCONFFILE}" fi dconf update # Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" "/etc/dconf/db/" \ +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/picture-uri$" "/etc/dconf/db/" \ | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) LOCKSFOLDER="/etc/dconf/db/local.d/locks" @@ -20776,12 +20789,12 @@ mkdir -p "${LOCKSFOLDER}" # Comment out the configurations in databases different from the target one if [[ ! -z "${LOCKFILES}" ]] then - sed -i -E "s|^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$|#&|" "${LOCKFILES[@]}" + sed -i -E "s|^/org/gnome/desktop/screensaver/picture-uri$|#&|" "${LOCKFILES[@]}" fi -if ! grep -qr "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" /etc/dconf/db/local.d/ +if ! grep -qr "^/org/gnome/desktop/screensaver/picture-uri$" /etc/dconf/db/local.d/ then - echo "/org/gnome/desktop/screensaver/show-full-name-in-top-bar" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" + echo "/org/gnome/desktop/screensaver/picture-uri" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" fi dconf update @@ -20790,6 +20803,33 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Full User Name on Splash Shield + By default when the screen is locked, the splash shield will show the user's +full name. This should be disabled to prevent casual observers from seeing +who has access to the system. This can be disabled by adding or setting +show-full-name-in-top-bar to false in +/etc/dconf/db/local.d/00-security-settings. For example: +[org/gnome/desktop/screensaver] +show-full-name-in-top-bar=false + +Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +/org/gnome/desktop/screensaver/show-full-name-in-top-bar +After the settings have been set, run dconf update. + FMT_MOF_EXT.1 + Setting the splash screen to not reveal the logged in user's name +conceals who has access to the system from passersby. + + CCE-80779-2 - name: Gather the package facts package_facts: manager: auto @@ -20853,6 +20893,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)show-full-name-in-top-bar(\s*=)/#\1show-full-name-in-top-bar\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "false")" +if grep -q "^\\s*show-full-name-in-top-bar\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*show-full-name-in-top-bar\\s*=\\s*.*/show-full-name-in-top-bar=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\show-full-name-in-top-bar=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/show-full-name-in-top-bar$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/show-full-name-in-top-bar" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -20916,33 +21018,6 @@ GNOME desktops can be configured to identify when a user's session has idled and session lock. As such, users should not be allowed to change session settings. CCE-80780-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -20995,6 +21070,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21060,33 +21162,6 @@ GNOME desktops can be configured to identify when a user's session has idled and session lock. As such, users should not be allowed to change session settings. CCE-80781-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21145,6 +21220,33 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21232,68 +21334,6 @@ the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-84028-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")" -if grep -q "^\\s*logout\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21377,6 +21417,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")" +if grep -q "^\\s*logout\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21409,6 +21511,101 @@ After the settings have been set, run dconf update. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Disable Geolocation in GNOME3 - location tracking + ini_file: + dest: /etc/dconf/db/local.d/00-security-settings + section: org/gnome/system/location + option: enabled + value: 'false' + create: true + no_extra_spaces: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Disable Geolocation in GNOME3 - clock location tracking + ini_file: + dest: /etc/dconf/db/local.d/00-security-settings + section: org/gnome/clocks + option: gelocation + value: 'false' + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Prevent user modification of GNOME geolocation - location tracking + lineinfile: + path: /etc/dconf/db/local.d/locks/00-security-settings-lock + regexp: ^/org/gnome/system/location/enabled$ + line: /org/gnome/system/location/enabled + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Prevent user modification of GNOME geolocation - clock location tracking + lineinfile: + path: /etc/dconf/db/local.d/locks/00-security-settings-lock + regexp: ^/org/gnome/clocks/geolocation$ + line: /org/gnome/clocks/geolocation + create: true + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + +- name: Dconf Update + command: dconf update + when: + - '"gdm" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - dconf_gnome_disable_geolocation + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then @@ -21524,101 +21721,6 @@ dconf update else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Disable Geolocation in GNOME3 - location tracking - ini_file: - dest: /etc/dconf/db/local.d/00-security-settings - section: org/gnome/system/location - option: enabled - value: 'false' - create: true - no_extra_spaces: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Disable Geolocation in GNOME3 - clock location tracking - ini_file: - dest: /etc/dconf/db/local.d/00-security-settings - section: org/gnome/clocks - option: gelocation - value: 'false' - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Prevent user modification of GNOME geolocation - location tracking - lineinfile: - path: /etc/dconf/db/local.d/locks/00-security-settings-lock - regexp: ^/org/gnome/system/location/enabled$ - line: /org/gnome/system/location/enabled - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Prevent user modification of GNOME geolocation - clock location tracking - lineinfile: - path: /etc/dconf/db/local.d/locks/00-security-settings-lock - regexp: ^/org/gnome/clocks/geolocation$ - line: /org/gnome/clocks/geolocation - create: true - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy - -- name: Dconf Update - command: dconf update - when: - - '"gdm" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - dconf_gnome_disable_geolocation - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy @@ -21677,68 +21779,6 @@ unintended configuration changes as well as a nefarious user the capability to m changes such as adding new accounts, etc. CCE-80769-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/lockdown\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/local.d/00-security-settings" -DBDIR="/etc/dconf/db/local.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*user-administration-disabled\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)user-administration-disabled(\s*=)/#\1user-administration-disabled\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/desktop/lockdown\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/desktop/lockdown]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*user-administration-disabled\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*user-administration-disabled\\s*=\\s*.*/user-administration-disabled=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/desktop/lockdown\\]|a\\user-administration-disabled=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/desktop/lockdown/user-administration-disabled$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/local.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/desktop/lockdown/user-administration-disabled$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/desktop/lockdown/user-administration-disabled$" /etc/dconf/db/local.d/ -then - echo "/org/gnome/desktop/lockdown/user-administration-disabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -21890,6 +21930,68 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/lockdown\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/local.d/00-security-settings" +DBDIR="/etc/dconf/db/local.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*user-administration-disabled\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)user-administration-disabled(\s*=)/#\1user-administration-disabled\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/desktop/lockdown\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/desktop/lockdown]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*user-administration-disabled\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*user-administration-disabled\\s*=\\s*.*/user-administration-disabled=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/desktop/lockdown\\]|a\\user-administration-disabled=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/desktop/lockdown/user-administration-disabled$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/local.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/desktop/lockdown/user-administration-disabled$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/desktop/lockdown/user-administration-disabled$" /etc/dconf/db/local.d/ +then + echo "/org/gnome/desktop/lockdown/user-administration-disabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -21978,15 +22080,33 @@ $ sudo yum install sudo FMT_MOF_EXT.1 2.2.6 SRG-OS-000324-GPOS-00125 - 5.3.1 + 4.3.1 sudo is a program designed to allow a system administrator to give limited root privileges to users and log root activity. The basic philosophy is to give as few privileges as possible but still allow system users to get their work done. CCE-82214-8 - -package --add=sudo + - name: Ensure sudo is installed + package: + name: sudo + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82214-8 + - NIST-800-53-CM-6(a) + - PCI-DSSv4-2.2.6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_sudo_installed + + +[[packages]] +name = "sudo" +version = "*" include install_sudo @@ -21995,6 +22115,9 @@ class install_sudo { ensure => 'installed', } } + + +package --add=sudo # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -22006,27 +22129,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "sudo" -version = "*" - - - name: Ensure sudo is installed - package: - name: sudo - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82214-8 - - NIST-800-53-CM-6(a) - - PCI-DSSv4-2.2.6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_sudo_installed @@ -22047,6 +22149,21 @@ in /etc/sudoers.d/. Forcing sudo to reset the environment ensures that environment variables are not passed on to the command accidentaly, preventing leak of potentially sensitive information. CCE-83820-1 + - name: Ensure env_reset is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\benv_reset\b.*$ + line: Defaults env_reset + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83820-1 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_env_reset + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22067,21 +22184,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure env_reset is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\benv_reset\b.*$ - line: Defaults env_reset - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83820-1 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_env_reset @@ -22102,6 +22204,21 @@ in /etc/sudoers.d/. Ignoring the commands in the user's current directory prevents an attacker from executing commands downloaded locally. CCE-83810-2 + - name: Ensure ignore_dot is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\bignore_dot\b.*$ + line: Defaults ignore_dot + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83810-2 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_ignore_dot + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22122,21 +22239,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure ignore_dot is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\bignore_dot\b.*$ - line: Defaults ignore_dot - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83810-2 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_ignore_dot @@ -22156,6 +22258,21 @@ in /etc/sudoers.d/. Restricting the capability of sudo allowed commands to execute sub-commands prevents users from running programs with privileges they wouldn't have otherwise. CCE-83747-6 + - name: Ensure noexec is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\bnoexec\b.*$ + line: Defaults noexec + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83747-6 + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - restrict_strategy + - sudo_add_noexec + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22176,21 +22293,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure noexec is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\bnoexec\b.*$ - line: Defaults noexec - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83747-6 - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - restrict_strategy - - sudo_add_noexec @@ -22210,38 +22312,6 @@ The passwd_timeout should be configured by making sure that the in /etc/sudoers.d/. Reducing the time sudo waits for a a password reduces the time the process is exposed. CCE-83964-7 - - -var_sudo_passwd_timeout='' - - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\bpasswd_timeout=\w+\b\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option passwd_timeout - echo "Defaults passwd_timeout=${var_sudo_passwd_timeout}" >> /etc/sudoers - else - # sudoers file defines Option passwd_timeout, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\bpasswd_timeout=${var_sudo_passwd_timeout}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_passwd_timeout//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\bpasswd_timeout=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - - name: XCCDF Value var_sudo_passwd_timeout # promote to variable set_fact: var_sudo_passwd_timeout: !!str @@ -22279,6 +22349,38 @@ fi - no_reboot_needed - restrict_strategy - sudo_add_passwd_timeout + + + +var_sudo_passwd_timeout='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\bpasswd_timeout=\w+\b\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option passwd_timeout + echo "Defaults passwd_timeout=${var_sudo_passwd_timeout}" >> /etc/sudoers + else + # sudoers file defines Option passwd_timeout, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\bpasswd_timeout=${var_sudo_passwd_timeout}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_passwd_timeout//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\bpasswd_timeout=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi @@ -22299,6 +22401,21 @@ in /etc/sudoers.d/. Restricting the use cases in which a user is allowed to execute sudo commands reduces the attack surface. CCE-83790-6 + - name: Ensure requiretty is enabled in /etc/sudoers + lineinfile: + path: /etc/sudoers + regexp: ^[\s]*Defaults.*\brequiretty\b.*$ + line: Defaults requiretty + validate: /usr/sbin/visudo -cf %s + tags: + - CCE-83790-6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_add_requiretty + if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak @@ -22319,21 +22436,6 @@ else echo "Skipping remediation, /etc/sudoers failed to validate" false fi - - - name: Ensure requiretty is enabled in /etc/sudoers - lineinfile: - path: /etc/sudoers - regexp: ^[\s]*Defaults.*\brequiretty\b.*$ - line: Defaults requiretty - validate: /usr/sbin/visudo -cf %s - tags: - - CCE-83790-6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_add_requiretty @@ -22356,38 +22458,6 @@ in /etc/sudoers.d/. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-83860-7 - - -var_sudo_umask='' - - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\bumask=\w+\b\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option umask - echo "Defaults umask=${var_sudo_umask}" >> /etc/sudoers - else - # sudoers file defines Option umask, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\bumask=${var_sudo_umask}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_umask//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\bumask=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - - name: XCCDF Value var_sudo_umask # promote to variable set_fact: var_sudo_umask: !!str @@ -22425,6 +22495,38 @@ fi - no_reboot_needed - restrict_strategy - sudo_add_umask + + + +var_sudo_umask='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\bumask=\w+\b\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option umask + echo "Defaults umask=${var_sudo_umask}" >> /etc/sudoers + else + # sudoers file defines Option umask, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\bumask=${var_sudo_umask}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_umask//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\bumask=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi @@ -22444,38 +22546,11 @@ in /etc/sudoers.d/. BP28(R58) Req-10.2.5 2.2.6 - 5.3.2 + 4.3.2 Requiring that sudo commands be run in a pseudo-terminal can prevent an attacker from retaining access to the user's terminal after the main program has finished executing. CCE-83798-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\buse_pty\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option use_pty - echo "Defaults use_pty" >> /etc/sudoers - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -22508,42 +22583,14 @@ fi - restrict_strategy - sudo_add_use_pty - - - - - - - - - Ensure Sudo Logfile Exists - sudo logfile - A custom log sudo file can be configured with the 'logfile' tag. This rule configures -a sudo custom logfile at the default location suggested by CIS, which uses -/var/log/sudo.log. - Req-10.2.5 - 2.2.6 - 5.3.3 - A sudo log file simplifies auditing of sudo commands. - - CCE-83601-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q sudo; then -var_sudo_logfile='' - - if /usr/sbin/visudo -qcf /etc/sudoers; then cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults[\s]*\blogfile\s*=\s*("(?:\\"|\\\\|[^"\\\n])*"\B|[^"](?:(?:\\,|\\"|\\ |\\\\|[^", \\\n])*)\b)\b.*$' /etc/sudoers; then - # sudoers file doesn't define Option logfile - echo "Defaults logfile=${var_sudo_logfile}" >> /etc/sudoers - else - # sudoers file defines Option logfile, remediate if appropriate value is not set - if ! grep -P "^[\s]*Defaults.*\blogfile=${var_sudo_logfile}\b.*$" /etc/sudoers; then - - escaped_variable=${var_sudo_logfile//$'/'/$'\/'} - sed -Ei "s/(^[\s]*Defaults.*\blogfile=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers - fi + if ! grep -P '^[\s]*Defaults[\s]*\buse_pty\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option use_pty + echo "Defaults use_pty" >> /etc/sudoers fi # Check validity of sudoers and cleanup bak @@ -22563,6 +22610,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure Sudo Logfile Exists - sudo logfile + A custom log sudo file can be configured with the 'logfile' tag. This rule configures +a sudo custom logfile at the default location suggested by CIS, which uses +/var/log/sudo.log. + Req-10.2.5 + 2.2.6 + 4.3.3 + A sudo log file simplifies auditing of sudo commands. + + CCE-83601-5 - name: Gather the package facts package_facts: manager: auto @@ -22620,6 +22685,43 @@ fi - no_reboot_needed - restrict_strategy - sudo_custom_logfile + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +var_sudo_logfile='' + + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults[\s]*\blogfile\s*=\s*("(?:\\"|\\\\|[^"\\\n])*"\B|[^"](?:(?:\\,|\\"|\\ |\\\\|[^", \\\n])*)\b)\b.*$' /etc/sudoers; then + # sudoers file doesn't define Option logfile + echo "Defaults logfile=${var_sudo_logfile}" >> /etc/sudoers + else + # sudoers file defines Option logfile, remediate if appropriate value is not set + if ! grep -P "^[\s]*Defaults.*\blogfile=${var_sudo_logfile}\b.*$" /etc/sudoers; then + + escaped_variable=${var_sudo_logfile//$'/'/$'\/'} + sed -Ei "s/(^[\s]*Defaults.*\blogfile=)[-]?.+(\b.*$)/\1$escaped_variable\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -22709,22 +22811,6 @@ do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate. CCE-82202-3 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "!authenticate" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -22762,6 +22848,22 @@ done - no_reboot_needed - restrict_strategy - sudo_remove_no_authenticate + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "!authenticate" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -22835,22 +22937,6 @@ When operating systems provide the capability to escalate a functional capabilit is critical that the user re-authenticate. CCE-82197-5 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "NOPASSWD" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -22888,6 +22974,22 @@ done - no_reboot_needed - restrict_strategy - sudo_remove_nopasswd + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "NOPASSWD" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -22948,44 +23050,14 @@ in /etc/sudoers.d/." PR.AC-7 2.2.6 SRG-OS-000373-GPOS-00156 - 5.3.4 + 4.3.4 + 4.3.5 Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate. CCE-82279-1 - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "NOPASSWD" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - -for f in /etc/sudoers /etc/sudoers.d/* ; do - if [ ! -e "$f" ] ; then - continue - fi - matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - # comment out "!authenticate" matches to preserve user data - sed -i "s/^${entry}$/# &/g" $f - done <<< "$matching_list" - - /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" - fi -done - - name: Find /etc/sudoers.d/ files ansible.builtin.find: paths: @@ -23061,6 +23133,37 @@ done - no_reboot_needed - restrict_strategy - sudo_require_authentication + + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "NOPASSWD" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done + +for f in /etc/sudoers /etc/sudoers.d/* ; do + if [ ! -e "$f" ] ; then + continue + fi + matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + # comment out "!authenticate" matches to preserve user data + sed -i "s/^${entry}$/# &/g" $f + done <<< "$matching_list" + + /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo" + fi +done @@ -23086,8 +23189,7 @@ and the user will not have to re-authenticate for privileged actions until the u SRG-OS-000373-GPOS-00157 SRG-OS-000373-GPOS-00158 RHEL-08-010384 - 5.3.5 - 5.3.6 + 4.3.6 SV-237643r861088_rule Without re-authentication, users may access resources or perform tasks for which they do not have authorization. @@ -23096,64 +23198,25 @@ When operating systems provide the capability to escalate a functional capabilit is critical that the user re-authenticate. CCE-87838-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -var_sudo_timestamp_timeout='' - - -if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \; -fi - -if /usr/sbin/visudo -qcf /etc/sudoers; then - cp /etc/sudoers /etc/sudoers.bak - if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then - # sudoers file doesn't define Option timestamp_timeout - echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers - else - # sudoers file defines Option timestamp_timeout, remediate wrong values if present - if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then - sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers - fi - fi - - # Check validity of sudoers and cleanup bak - if /usr/sbin/visudo -qcf /etc/sudoers; then - rm -f /etc/sudoers.bak - else - echo "Fail to validate remediated /etc/sudoers, reverting to original file." - mv /etc/sudoers.bak /etc/sudoers - false - fi -else - echo "Skipping remediation, /etc/sudoers failed to validate" - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-87838-9 - - DISA-STIG-RHEL-08-010384 - - NIST-800-53-IA-11 - - PCI-DSSv4-2.2.6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sudo_require_reauthentication -- name: XCCDF Value var_sudo_timestamp_timeout # promote to variable - set_fact: - var_sudo_timestamp_timeout: !!str - tags: - - always + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-87838-9 + - DISA-STIG-RHEL-08-010384 + - NIST-800-53-IA-11 + - PCI-DSSv4-2.2.6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sudo_require_reauthentication +- name: XCCDF Value var_sudo_timestamp_timeout # promote to variable + set_fact: + var_sudo_timestamp_timeout: !!str + tags: + - always - name: Require Re-Authentication When Using the sudo Command - Find /etc/sudoers.d/* files containing 'Defaults timestamp_timeout' @@ -23259,6 +23322,45 @@ fi - no_reboot_needed - restrict_strategy - sudo_require_reauthentication + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +var_sudo_timestamp_timeout='' + + +if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \; +fi + +if /usr/sbin/visudo -qcf /etc/sudoers; then + cp /etc/sudoers /etc/sudoers.bak + if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then + # sudoers file doesn't define Option timestamp_timeout + echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers + else + # sudoers file defines Option timestamp_timeout, remediate wrong values if present + if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then + sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers + fi + fi + + # Check validity of sudoers and cleanup bak + if /usr/sbin/visudo -qcf /etc/sudoers; then + rm -f /etc/sudoers.bak + else + echo "Fail to validate remediated /etc/sudoers, reverting to original file." + mv /etc/sudoers.bak /etc/sudoers + false + fi +else + echo "Skipping remediation, /etc/sudoers failed to validate" + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -23276,13 +23378,6 @@ To properly set the permissions of /usr/bin/sudo, run the BP28(R57) Restricting the set of users able to execute commands as privileged user reduces the attack surface. CCE-83574-4 - - - - - -chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo - - name: Test for existence /usr/bin/sudo stat: path: /usr/bin/sudo @@ -23309,6 +23404,13 @@ chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo - medium_severity - no_reboot_needed - sudo_restrict_others_executable_permission + + + + + + +chmod u-wr,g-wrs,o-xwrt /usr/bin/sudo @@ -23381,27 +23483,6 @@ Note that the '#' character doesn't denote a comment in the configuration file.< Use of these configuration options makes it easier for one compromised accound to be used to compromise other accounts. CCE-86377-9 - -sudoers_config_file="/etc/sudoers" -sudoers_config_dir="/etc/sudoers.d" -sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file") -if [ "$sudoers_includedir_count" -gt 1 ]; then - sed -i "/#includedir/d" "$sudoers_config_file" - echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" -elif [ "$sudoers_includedir_count" -eq 0 ]; then - echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" -else - if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then - sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file" - fi -fi - -sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file" - -if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then - sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/* -fi - - name: Check for duplicate values lineinfile: path: /etc/sudoers @@ -23519,6 +23600,27 @@ fi - medium_severity - no_reboot_needed - sudoers_default_includedir + + +sudoers_config_file="/etc/sudoers" +sudoers_config_dir="/etc/sudoers.d" +sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file") +if [ "$sudoers_includedir_count" -gt 1 ]; then + sed -i "/#includedir/d" "$sudoers_config_file" + echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" +elif [ "$sudoers_includedir_count" -eq 0 ]; then + echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file" +else + if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then + sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file" + fi +fi + +sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file" + +if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then + sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/* +fi @@ -23622,75 +23724,6 @@ or if cvtsudoers not supported: the invoking user for the "root" user password. CCE-83422-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sudo; then - -if grep -x '^Defaults targetpw$' /etc/sudoers; then - sed -i "/Defaults targetpw/d" /etc/sudoers \; -fi -if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \; -fi -if grep -x '^Defaults rootpw$' /etc/sudoers; then - sed -i "/Defaults rootpw/d" /etc/sudoers \; -fi -if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \; -fi -if grep -x '^Defaults runaspw$' /etc/sudoers; then - sed -i "/Defaults runaspw/d" /etc/sudoers \; -fi -if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then - find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \; -fi - -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" -if [ -e "/etc/sudoers" ] ; then - - LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers" -else - touch "/etc/sudoers" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sudoers" - -cp "/etc/sudoers" "/etc/sudoers.bak" -# Insert at the end of the file -printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers" -# Clean up after ourselves. -rm "/etc/sudoers.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -24068,6 +24101,75 @@ fi - no_reboot_needed - restrict_strategy - sudoers_validate_passwd + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sudo; then + +if grep -x '^Defaults targetpw$' /etc/sudoers; then + sed -i "/Defaults targetpw/d" /etc/sudoers \; +fi +if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \; +fi +if grep -x '^Defaults rootpw$' /etc/sudoers; then + sed -i "/Defaults rootpw/d" /etc/sudoers \; +fi +if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \; +fi +if grep -x '^Defaults runaspw$' /etc/sudoers; then + sed -i "/Defaults runaspw/d" /etc/sudoers \; +fi +if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then + find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \; +fi + +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" +if [ -e "/etc/sudoers" ] ; then + + LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers" +else + touch "/etc/sudoers" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sudoers" + +cp "/etc/sudoers" "/etc/sudoers.bak" +# Insert at the end of the file +printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers" +# Clean up after ourselves. +rm "/etc/sudoers.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -24090,8 +24192,23 @@ $ sudo yum install binutils foundational system operator activities, such as ld, nm, objcopy and readelf. CCE-82989-5 - -package --add=binutils + - name: Ensure binutils is installed + package: + name: binutils + state: present + tags: + - CCE-82989-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_binutils_installed + + +[[packages]] +name = "binutils" +version = "*" include install_binutils @@ -24100,29 +24217,14 @@ class install_binutils { ensure => 'installed', } } + + +package --add=binutils if ! rpm -q --quiet "binutils" ; then yum install -y "binutils" fi - - -[[packages]] -name = "binutils" -version = "*" - - - name: Ensure binutils is installed - package: - name: binutils - state: present - tags: - - CCE-82989-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_binutils_installed @@ -24151,8 +24253,23 @@ $ sudo yum install dnf-plugin-subscription-manager CCE-82315-3 - -package --add=dnf-plugin-subscription-manager + - name: Ensure dnf-plugin-subscription-manager is installed + package: + name: dnf-plugin-subscription-manager + state: present + tags: + - CCE-82315-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dnf-plugin-subscription-manager_installed + + +[[packages]] +name = "dnf-plugin-subscription-manager" +version = "*" include install_dnf-plugin-subscription-manager @@ -24161,29 +24278,14 @@ class install_dnf-plugin-subscription-manager { ensure => 'installed', } } + + +package --add=dnf-plugin-subscription-manager if ! rpm -q --quiet "dnf-plugin-subscription-manager" ; then yum install -y "dnf-plugin-subscription-manager" fi - - -[[packages]] -name = "dnf-plugin-subscription-manager" -version = "*" - - - name: Ensure dnf-plugin-subscription-manager is installed - package: - name: dnf-plugin-subscription-manager - state: present - tags: - - CCE-82315-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dnf-plugin-subscription-manager_installed @@ -24208,8 +24310,23 @@ other required structures. This package contains command line TLS client and server and certificate manipulation tools. CCE-82395-5 - -package --add=gnutls-utils + - name: Ensure gnutls-utils is installed + package: + name: gnutls-utils + state: present + tags: + - CCE-82395-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_gnutls-utils_installed + + +[[packages]] +name = "gnutls-utils" +version = "*" include install_gnutls-utils @@ -24218,29 +24335,14 @@ class install_gnutls-utils { ensure => 'installed', } } + + +package --add=gnutls-utils if ! rpm -q --quiet "gnutls-utils" ; then yum install -y "gnutls-utils" fi - - -[[packages]] -name = "gnutls-utils" -version = "*" - - - name: Ensure gnutls-utils is installed - package: - name: gnutls-utils - state: present - tags: - - CCE-82395-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_gnutls-utils_installed @@ -24260,8 +24362,23 @@ posix capabilities of all the programs running on a system. libcap-ng-utils also lets system operators set the file system based capabilities. CCE-82979-6 - -package --add=libcap-ng-utils + - name: Ensure libcap-ng-utils is installed + package: + name: libcap-ng-utils + state: present + tags: + - CCE-82979-6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_libcap-ng-utils_installed + + +[[packages]] +name = "libcap-ng-utils" +version = "*" include install_libcap-ng-utils @@ -24270,29 +24387,14 @@ class install_libcap-ng-utils { ensure => 'installed', } } + + +package --add=libcap-ng-utils if ! rpm -q --quiet "libcap-ng-utils" ; then yum install -y "libcap-ng-utils" fi - - -[[packages]] -name = "libcap-ng-utils" -version = "*" - - - name: Ensure libcap-ng-utils is installed - package: - name: libcap-ng-utils - state: present - tags: - - CCE-82979-6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_libcap-ng-utils_installed @@ -24314,8 +24416,23 @@ server applications. Install the nss-tools package to install command-line tools to manipulate the NSS certificate and key database. CCE-82396-3 - -package --add=nss-tools + - name: Ensure nss-tools is installed + package: + name: nss-tools + state: present + tags: + - CCE-82396-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_nss-tools_installed + + +[[packages]] +name = "nss-tools" +version = "*" include install_nss-tools @@ -24324,29 +24441,14 @@ class install_nss-tools { ensure => 'installed', } } + + +package --add=nss-tools if ! rpm -q --quiet "nss-tools" ; then yum install -y "nss-tools" fi - - -[[packages]] -name = "nss-tools" -version = "*" - - - name: Ensure nss-tools is installed - package: - name: nss-tools - state: present - tags: - - CCE-82396-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_nss-tools_installed @@ -24368,8 +24470,23 @@ $ sudo yum install openscap-scanner configuration and vulnerability scanner, capable of performing compliance checking using SCAP content. CCE-82220-5 - -package --add=openscap-scanner + - name: Ensure openscap-scanner is installed + package: + name: openscap-scanner + state: present + tags: + - CCE-82220-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openscap-scanner_installed + + +[[packages]] +name = "openscap-scanner" +version = "*" include install_openscap-scanner @@ -24378,29 +24495,14 @@ class install_openscap-scanner { ensure => 'installed', } } + + +package --add=openscap-scanner if ! rpm -q --quiet "openscap-scanner" ; then yum install -y "openscap-scanner" fi - - -[[packages]] -name = "openscap-scanner" -version = "*" - - - name: Ensure openscap-scanner is installed - package: - name: openscap-scanner - state: present - tags: - - CCE-82220-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openscap-scanner_installed @@ -24418,8 +24520,28 @@ $ sudo yum install rear image of a system and restores from backup using this image. CCE-82883-0 - -package --add=rear + - name: Ensure rear is installed + package: + name: rear + state: present + when: not ( ( ( ansible_architecture == "aarch64" and ansible_distribution == 'OracleLinux' + and ansible_distribution_version is version('9.0', '>=') ) or ( ansible_architecture + == "aarch64" and ansible_distribution == 'RedHat' and ansible_distribution_version + is version('9.0', '>=') ) or ( ansible_distribution == 'RedHat' and ansible_distribution_version + is version('8.4', '<=') and ansible_architecture == "s390x" ) ) ) + tags: + - CCE-82883-0 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rear_installed + + +[[packages]] +name = "rear" +version = "*" include install_rear @@ -24428,6 +24550,9 @@ class install_rear { ensure => 'installed', } } + + +package --add=rear # Remediation is applicable only in certain platforms if ! ( ( ( grep -q aarch64 /proc/sys/kernel/osrelease && grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; printf "%s\n%s" "$expected" "$real" | sort -VC; } ) || ( grep -q aarch64 /proc/sys/kernel/osrelease && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; printf "%s\n%s" "$expected" "$real" | sort -VC; } ) || ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.4"; printf "%s\n%s" "$real" "$expected" | sort -VC; } && grep -q s390x /proc/sys/kernel/osrelease ) ) ); then @@ -24439,29 +24564,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rear" -version = "*" - - - name: Ensure rear is installed - package: - name: rear - state: present - when: not ( ( ( ansible_architecture == "aarch64" and ansible_distribution == 'OracleLinux' - and ansible_distribution_version is version('9.0', '>=') ) or ( ansible_architecture - == "aarch64" and ansible_distribution == 'RedHat' and ansible_distribution_version - is version('9.0', '>=') ) or ( ansible_distribution == 'RedHat' and ansible_distribution_version - is version('8.4', '<=') and ansible_architecture == "s390x" ) ) ) - tags: - - CCE-82883-0 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rear_installed @@ -24483,8 +24585,25 @@ $ sudo yum install rng-tools such as those used in the formation of x509/PKI certificates. CCE-82968-9 - -package --add=rng-tools + - name: Ensure rng-tools is installed + package: + name: rng-tools + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82968-9 + - DISA-STIG-RHEL-08-010472 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_rng-tools_installed + + +[[packages]] +name = "rng-tools" +version = "*" include install_rng-tools @@ -24493,6 +24612,9 @@ class install_rng-tools { ensure => 'installed', } } + + +package --add=rng-tools # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -24504,26 +24626,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rng-tools" -version = "*" - - - name: Ensure rng-tools is installed - package: - name: rng-tools - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82968-9 - - DISA-STIG-RHEL-08-010472 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_rng-tools_installed @@ -24550,8 +24652,23 @@ package, or the SCAP Workbench GUI tool from the scap-workbench CCE-82949-9 - -package --add=scap-security-guide + - name: Ensure scap-security-guide is installed + package: + name: scap-security-guide + state: present + tags: + - CCE-82949-9 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_scap-security-guide_installed + + +[[packages]] +name = "scap-security-guide" +version = "*" include install_scap-security-guide @@ -24560,29 +24677,14 @@ class install_scap-security-guide { ensure => 'installed', } } + + +package --add=scap-security-guide if ! rpm -q --quiet "scap-security-guide" ; then yum install -y "scap-security-guide" fi - - -[[packages]] -name = "scap-security-guide" -version = "*" - - - name: Ensure scap-security-guide is installed - package: - name: scap-security-guide - state: present - tags: - - CCE-82949-9 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_scap-security-guide_installed @@ -24613,8 +24715,23 @@ It communicates with the backend subscription service (the Customer Portal or an on-premise server such as Subscription Asset Manager) and works with content management tools such as . CCE-82316-1 - -package --add=subscription-manager + - name: Ensure subscription-manager is installed + package: + name: subscription-manager + state: present + tags: + - CCE-82316-1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_subscription-manager_installed + + +[[packages]] +name = "subscription-manager" +version = "*" include install_subscription-manager @@ -24623,29 +24740,14 @@ class install_subscription-manager { ensure => 'installed', } } + + +package --add=subscription-manager if ! rpm -q --quiet "subscription-manager" ; then yum install -y "subscription-manager" fi - - -[[packages]] -name = "subscription-manager" -version = "*" - - - name: Ensure subscription-manager is installed - package: - name: subscription-manager - state: present - tags: - - CCE-82316-1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_subscription-manager_installed @@ -24664,8 +24766,23 @@ can restore individual files (or all of the files) from the archive. includes multivolume support, automatic archive compression/decompression, the the ability to perform incremental and full backups. If CCE-82965-5 - -package --add=tar + - name: Ensure tar is installed + package: + name: tar + state: present + tags: + - CCE-82965-5 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tar_installed + + +[[packages]] +name = "tar" +version = "*" include install_tar @@ -24674,29 +24791,14 @@ class install_tar { ensure => 'installed', } } + + +package --add=tar if ! rpm -q --quiet "tar" ; then yum install -y "tar" fi - - -[[packages]] -name = "tar" -version = "*" - - - name: Ensure tar is installed - package: - name: tar - state: present - tags: - - CCE-82965-5 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tar_installed @@ -24712,8 +24814,23 @@ version = "*" $ sudo yum install vim-enhanced Vim (Vi IMproved) is an almost compatible version of the UNIX editor vi. CCE-82956-4 - -package --add=vim-enhanced + - name: Ensure vim-enhanced is installed + package: + name: vim-enhanced + state: present + tags: + - CCE-82956-4 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_vim_installed + + +[[packages]] +name = "vim-enhanced" +version = "*" include install_vim-enhanced @@ -24722,29 +24839,14 @@ class install_vim-enhanced { ensure => 'installed', } } + + +package --add=vim-enhanced if ! rpm -q --quiet "vim-enhanced" ; then yum install -y "vim-enhanced" fi - - -[[packages]] -name = "vim-enhanced" -version = "*" - - - name: Ensure vim-enhanced is installed - package: - name: vim-enhanced - state: present - tags: - - CCE-82956-4 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_vim_installed @@ -24765,8 +24867,19 @@ $ sudo yum erase abrt-addon-ccpp abrt-addon-ccpp contains hooks for C/C++ crashed programs and abrt's C/C++ analyzer plugin. CCE-82919-2 - -package --remove=abrt-addon-ccpp + - name: Ensure abrt-addon-ccpp is removed + package: + name: abrt-addon-ccpp + state: absent + tags: + - CCE-82919-2 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-addon-ccpp_removed include remove_abrt-addon-ccpp @@ -24775,6 +24888,9 @@ class remove_abrt-addon-ccpp { ensure => 'purged', } } + + +package --remove=abrt-addon-ccpp # CAUTION: This remediation script will remove abrt-addon-ccpp @@ -24788,20 +24904,6 @@ if rpm -q --quiet "abrt-addon-ccpp" ; then yum remove -y "abrt-addon-ccpp" fi - - - name: Ensure abrt-addon-ccpp is removed - package: - name: abrt-addon-ccpp - state: absent - tags: - - CCE-82919-2 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-addon-ccpp_removed @@ -24822,8 +24924,19 @@ $ sudo yum erase abrt-addon-kerneloops abrt-addon-kerneloops contains plugins for collecting kernel crash information and reporter plugin which sends this information to a specified server, usually to kerneloops.org. CCE-82926-7 - -package --remove=abrt-addon-kerneloops + - name: Ensure abrt-addon-kerneloops is removed + package: + name: abrt-addon-kerneloops + state: absent + tags: + - CCE-82926-7 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-addon-kerneloops_removed include remove_abrt-addon-kerneloops @@ -24832,6 +24945,9 @@ class remove_abrt-addon-kerneloops { ensure => 'purged', } } + + +package --remove=abrt-addon-kerneloops # CAUTION: This remediation script will remove abrt-addon-kerneloops @@ -24845,20 +24961,6 @@ if rpm -q --quiet "abrt-addon-kerneloops" ; then yum remove -y "abrt-addon-kerneloops" fi - - - name: Ensure abrt-addon-kerneloops is removed - package: - name: abrt-addon-kerneloops - state: absent - tags: - - CCE-82926-7 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-addon-kerneloops_removed @@ -24879,8 +24981,19 @@ $ sudo yum erase abrt-cli abrt-cli contains a command line client for controlling abrt daemon over sockets. CCE-82907-7 - -package --remove=abrt-cli + - name: Ensure abrt-cli is removed + package: + name: abrt-cli + state: absent + tags: + - CCE-82907-7 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-cli_removed include remove_abrt-cli @@ -24889,6 +25002,9 @@ class remove_abrt-cli { ensure => 'purged', } } + + +package --remove=abrt-cli # CAUTION: This remediation script will remove abrt-cli @@ -24902,20 +25018,6 @@ if rpm -q --quiet "abrt-cli" ; then yum remove -y "abrt-cli" fi - - - name: Ensure abrt-cli is removed - package: - name: abrt-cli - state: absent - tags: - - CCE-82907-7 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-cli_removed @@ -24934,8 +25036,18 @@ $ sudo yum erase abrt-plugin-logger abrt-plugin-logger is an ABRT plugin which writes a report to a specified file. CCE-82913-5 - -package --remove=abrt-plugin-logger + - name: Ensure abrt-plugin-logger is removed + package: + name: abrt-plugin-logger + state: absent + tags: + - CCE-82913-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-logger_removed include remove_abrt-plugin-logger @@ -24944,6 +25056,9 @@ class remove_abrt-plugin-logger { ensure => 'purged', } } + + +package --remove=abrt-plugin-logger # CAUTION: This remediation script will remove abrt-plugin-logger @@ -24957,19 +25072,6 @@ if rpm -q --quiet "abrt-plugin-logger" ; then yum remove -y "abrt-plugin-logger" fi - - - name: Ensure abrt-plugin-logger is removed - package: - name: abrt-plugin-logger - state: absent - tags: - - CCE-82913-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-logger_removed @@ -24988,8 +25090,18 @@ $ sudo yum erase abrt-plugin-rhtsupport abrt-plugin-rhtsupport is a ABRT plugin to report bugs into the Red Hat Support system. CCE-82916-8 - -package --remove=abrt-plugin-rhtsupport + - name: Ensure abrt-plugin-rhtsupport is removed + package: + name: abrt-plugin-rhtsupport + state: absent + tags: + - CCE-82916-8 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-rhtsupport_removed include remove_abrt-plugin-rhtsupport @@ -24998,6 +25110,9 @@ class remove_abrt-plugin-rhtsupport { ensure => 'purged', } } + + +package --remove=abrt-plugin-rhtsupport # CAUTION: This remediation script will remove abrt-plugin-rhtsupport @@ -25011,19 +25126,6 @@ if rpm -q --quiet "abrt-plugin-rhtsupport" ; then yum remove -y "abrt-plugin-rhtsupport" fi - - - name: Ensure abrt-plugin-rhtsupport is removed - package: - name: abrt-plugin-rhtsupport - state: absent - tags: - - CCE-82916-8 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-rhtsupport_removed @@ -25043,8 +25145,19 @@ $ sudo yum erase abrt-plugin-sosreport SV-230488r627750_rule abrt-plugin-sosreport provides a plugin to include an sosreport in an ABRT report. CCE-82910-1 - -package --remove=abrt-plugin-sosreport + - name: Ensure abrt-plugin-sosreport is removed + package: + name: abrt-plugin-sosreport + state: absent + tags: + - CCE-82910-1 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_abrt-plugin-sosreport_removed include remove_abrt-plugin-sosreport @@ -25053,6 +25166,9 @@ class remove_abrt-plugin-sosreport { ensure => 'purged', } } + + +package --remove=abrt-plugin-sosreport # CAUTION: This remediation script will remove abrt-plugin-sosreport @@ -25066,20 +25182,6 @@ if rpm -q --quiet "abrt-plugin-sosreport" ; then yum remove -y "abrt-plugin-sosreport" fi - - - name: Ensure abrt-plugin-sosreport is removed - package: - name: abrt-plugin-sosreport - state: absent - tags: - - CCE-82910-1 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_abrt-plugin-sosreport_removed @@ -25095,8 +25197,18 @@ fi $ sudo yum erase geolite2-city geolite2-city is part of the GeoLite2 database packages, offering geolocation databases and tooling. CCE-82939-0 - -package --remove=geolite2-city + - name: Ensure geolite2-city is removed + package: + name: geolite2-city + state: absent + tags: + - CCE-82939-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_geolite2-city_removed include remove_geolite2-city @@ -25105,6 +25217,9 @@ class remove_geolite2-city { ensure => 'purged', } } + + +package --remove=geolite2-city # CAUTION: This remediation script will remove geolite2-city @@ -25118,19 +25233,6 @@ if rpm -q --quiet "geolite2-city" ; then yum remove -y "geolite2-city" fi - - - name: Ensure geolite2-city is removed - package: - name: geolite2-city - state: absent - tags: - - CCE-82939-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_geolite2-city_removed @@ -25146,8 +25248,18 @@ fi $ sudo yum erase geolite2-country geolite2-country is part of the GeoLite2 database packages, offering geolocation databases and tooling. CCE-82936-6 - -package --remove=geolite2-country + - name: Ensure geolite2-country is removed + package: + name: geolite2-country + state: absent + tags: + - CCE-82936-6 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_geolite2-country_removed include remove_geolite2-country @@ -25156,6 +25268,9 @@ class remove_geolite2-country { ensure => 'purged', } } + + +package --remove=geolite2-country # CAUTION: This remediation script will remove geolite2-country @@ -25169,19 +25284,6 @@ if rpm -q --quiet "geolite2-country" ; then yum remove -y "geolite2-country" fi - - - name: Ensure geolite2-country is removed - package: - name: geolite2-country - state: absent - tags: - - CCE-82936-6 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_geolite2-country_removed @@ -25206,6 +25308,20 @@ RHV uses NFS storage, which has dependency on gssproxy. gssproxy is a proxy for GSS API credential handling. CCE-82943-2 + - name: Ensure gssproxy is removed + package: + name: gssproxy + state: absent + tags: + - CCE-82943-2 + - DISA-STIG-RHEL-08-040370 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_gssproxy_removed + include remove_gssproxy class remove_gssproxy { @@ -25226,20 +25342,6 @@ if rpm -q --quiet "gssproxy" ; then yum remove -y "gssproxy" fi - - - name: Ensure gssproxy is removed - package: - name: gssproxy - state: absent - tags: - - CCE-82943-2 - - DISA-STIG-RHEL-08-040370 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_gssproxy_removed @@ -25261,8 +25363,19 @@ $ sudo yum erase iprutils iprutils provides a suite of utlilities to manage and configure SCSI devices supported by the ipr SCSI storage device driver. CCE-82946-5 - -package --remove=iprutils + - name: Ensure iprutils is removed + package: + name: iprutils + state: absent + tags: + - CCE-82946-5 + - DISA-STIG-RHEL-08-040380 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iprutils_removed include remove_iprutils @@ -25271,6 +25384,9 @@ class remove_iprutils { ensure => 'purged', } } + + +package --remove=iprutils # CAUTION: This remediation script will remove iprutils @@ -25284,20 +25400,6 @@ if rpm -q --quiet "iprutils" ; then yum remove -y "iprutils" fi - - - name: Ensure iprutils is removed - package: - name: iprutils - state: absent - tags: - - CCE-82946-5 - - DISA-STIG-RHEL-08-040380 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iprutils_removed @@ -25322,8 +25424,19 @@ RHV hosts require ipa-client package, which has dependency on krb5-workstation.< Kerberos programs (kinit, klist, kdestroy, kpasswd). CCE-82931-7 - -package --remove=krb5-workstation + - name: Ensure krb5-workstation is removed + package: + name: krb5-workstation + state: absent + tags: + - CCE-82931-7 + - DISA-STIG-RHEL-08-010162 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_krb5-workstation_removed include remove_krb5-workstation @@ -25332,6 +25445,9 @@ class remove_krb5-workstation { ensure => 'purged', } } + + +package --remove=krb5-workstation # CAUTION: This remediation script will remove krb5-workstation @@ -25345,20 +25461,6 @@ if rpm -q --quiet "krb5-workstation" ; then yum remove -y "krb5-workstation" fi - - - name: Ensure krb5-workstation is removed - package: - name: krb5-workstation - state: absent - tags: - - CCE-82931-7 - - DISA-STIG-RHEL-08-010162 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_krb5-workstation_removed @@ -25379,8 +25481,19 @@ $ sudo yum erase libreport-plugin-logger libreport-plugin-logger is a ABRT plugin to report bugs into the Red Hat Support system. CCE-89201-8 - -package --remove=libreport-plugin-logger + - name: Ensure libreport-plugin-logger is removed + package: + name: libreport-plugin-logger + state: absent + tags: + - CCE-89201-8 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_libreport-plugin-logger_removed include remove_libreport-plugin-logger @@ -25389,6 +25502,9 @@ class remove_libreport-plugin-logger { ensure => 'purged', } } + + +package --remove=libreport-plugin-logger # CAUTION: This remediation script will remove libreport-plugin-logger @@ -25402,20 +25518,6 @@ if rpm -q --quiet "libreport-plugin-logger" ; then yum remove -y "libreport-plugin-logger" fi - - - name: Ensure libreport-plugin-logger is removed - package: - name: libreport-plugin-logger - state: absent - tags: - - CCE-89201-8 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_libreport-plugin-logger_removed @@ -25436,8 +25538,19 @@ $ sudo yum erase libreport-plugin-rhtsupport libreport-plugin-rhtsupport is a ABRT plugin to report bugs into the Red Hat Support system. CCE-88955-0 - -package --remove=libreport-plugin-rhtsupport + - name: Ensure libreport-plugin-rhtsupport is removed + package: + name: libreport-plugin-rhtsupport + state: absent + tags: + - CCE-88955-0 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_libreport-plugin-rhtsupport_removed include remove_libreport-plugin-rhtsupport @@ -25446,6 +25559,9 @@ class remove_libreport-plugin-rhtsupport { ensure => 'purged', } } + + +package --remove=libreport-plugin-rhtsupport # CAUTION: This remediation script will remove libreport-plugin-rhtsupport @@ -25459,20 +25575,6 @@ if rpm -q --quiet "libreport-plugin-rhtsupport" ; then yum remove -y "libreport-plugin-rhtsupport" fi - - - name: Ensure libreport-plugin-rhtsupport is removed - package: - name: libreport-plugin-rhtsupport - state: absent - tags: - - CCE-88955-0 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_libreport-plugin-rhtsupport_removed @@ -25492,8 +25594,18 @@ have not been compiled using recommended compiler flags. The binaries are compiled without sufficient stack protection and its address space layout randomization (ASLR) is weak. CCE-82397-1 - -package --remove=pigz + - name: Ensure pigz is removed + package: + name: pigz + state: absent + tags: + - CCE-82397-1 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_pigz_removed include remove_pigz @@ -25502,6 +25614,9 @@ class remove_pigz { ensure => 'purged', } } + + +package --remove=pigz # CAUTION: This remediation script will remove pigz @@ -25515,19 +25630,6 @@ if rpm -q --quiet "pigz" ; then yum remove -y "pigz" fi - - - name: Ensure pigz is removed - package: - name: pigz - state: absent - tags: - - CCE-82397-1 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_pigz_removed @@ -25548,8 +25650,19 @@ $ sudo yum erase python3-abrt-addon python3-abrt-addon contains python hook and python analyzer plugin for handling uncaught exceptions in python programs. CCE-86084-1 - -package --remove=python3-abrt-addon + - name: Ensure python3-abrt-addon is removed + package: + name: python3-abrt-addon + state: absent + tags: + - CCE-86084-1 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_python3-abrt-addon_removed include remove_python3-abrt-addon @@ -25558,6 +25671,9 @@ class remove_python3-abrt-addon { ensure => 'purged', } } + + +package --remove=python3-abrt-addon # CAUTION: This remediation script will remove python3-abrt-addon @@ -25571,20 +25687,6 @@ if rpm -q --quiet "python3-abrt-addon" ; then yum remove -y "python3-abrt-addon" fi - - - name: Ensure python3-abrt-addon is removed - package: - name: python3-abrt-addon - state: absent - tags: - - CCE-86084-1 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_python3-abrt-addon_removed @@ -25611,8 +25713,19 @@ on that information, components will then be put into lower or higher power savi modes to adapt to the current usage. CCE-82904-4 - -package --remove=tuned + - name: Ensure tuned is removed + package: + name: tuned + state: absent + tags: + - CCE-82904-4 + - DISA-STIG-RHEL-08-040390 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tuned_removed include remove_tuned @@ -25621,6 +25734,9 @@ class remove_tuned { ensure => 'purged', } } + + +package --remove=tuned # CAUTION: This remediation script will remove tuned @@ -25634,20 +25750,6 @@ if rpm -q --quiet "tuned" ; then yum remove -y "tuned" fi - - - name: Ensure tuned is removed - package: - name: tuned - state: absent - tags: - - CCE-82904-4 - - DISA-STIG-RHEL-08-040390 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tuned_removed @@ -25679,8 +25781,23 @@ $ sudo yum install dnf-automatic dnf-automatic is an alternative command line interface (CLI) to dnf upgrade suitable for automatic, regular execution. CCE-82985-3 - -package --add=dnf-automatic + - name: Ensure dnf-automatic is installed + package: + name: dnf-automatic + state: present + tags: + - CCE-82985-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dnf-automatic_installed + + +[[packages]] +name = "dnf-automatic" +version = "*" include install_dnf-automatic @@ -25689,29 +25806,14 @@ class install_dnf-automatic { ensure => 'installed', } } + + +package --add=dnf-automatic if ! rpm -q --quiet "dnf-automatic" ; then yum install -y "dnf-automatic" fi - - -[[packages]] -name = "dnf-automatic" -version = "*" - - - name: Ensure dnf-automatic is installed - package: - name: dnf-automatic - state: present - tags: - - CCE-82985-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dnf-automatic_installed @@ -25763,20 +25865,6 @@ to 1 in /etc/yum.conf. CCE-82476-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then - sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf -else - echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf - echo "clean_requirements_on_remove=1" >> /etc/yum.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -25818,6 +25906,20 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then + sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf +else + echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf + echo "clean_requirements_on_remove=1" >> /etc/yum.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -25851,6 +25953,25 @@ lack of prompt attention to patching could result in a system compromise. The automated installation of updates ensures that recent security patches are applied in a timely manner. CCE-82494-6 + - name: Configure dnf-automatic to Install Available Updates Automatically + ini_file: + dest: /etc/dnf/automatic.conf + section: commands + option: apply_updates + value: 'yes' + create: true + tags: + - CCE-82494-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-2(5) + - NIST-800-53-SI-2(c) + - dnf-automatic_apply_updates + - low_complexity + - medium_disruption + - medium_severity + - no_reboot_needed + - unknown_strategy + found=false @@ -25878,25 +25999,6 @@ if ! $found ; then mkdir -p "$(dirname "$file")" echo -e "[commands]\napply_updates = yes" >> "$file" fi - - - name: Configure dnf-automatic to Install Available Updates Automatically - ini_file: - dest: /etc/dnf/automatic.conf - section: commands - option: apply_updates - value: 'yes' - create: true - tags: - - CCE-82494-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-2(5) - - NIST-800-53-SI-2(c) - - dnf-automatic_apply_updates - - low_complexity - - medium_disruption - - medium_severity - - no_reboot_needed - - unknown_strategy @@ -25920,6 +26022,25 @@ automatically, set upgrade_type to security CCE-82267-6 + - name: Configure dnf-automatic to Install Only Security Updates + ini_file: + dest: /etc/dnf/automatic.conf + section: commands + option: upgrade_type + value: security + create: true + tags: + - CCE-82267-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-2(5) + - NIST-800-53-SI-2(c) + - dnf-automatic_security_updates_only + - low_complexity + - low_severity + - medium_disruption + - no_reboot_needed + - unknown_strategy + found=false @@ -25947,25 +26068,6 @@ if ! $found ; then mkdir -p "$(dirname "$file")" echo -e "[commands]\nupgrade_type = security" >> "$file" fi - - - name: Configure dnf-automatic to Install Only Security Updates - ini_file: - dest: /etc/dnf/automatic.conf - section: commands - option: upgrade_type - value: security - create: true - tags: - - CCE-82267-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-2(5) - - NIST-800-53-SI-2(c) - - dnf-automatic_security_updates_only - - low_complexity - - low_severity - - medium_disruption - - no_reboot_needed - - unknown_strategy @@ -26057,35 +26159,6 @@ this requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA). CCE-80790-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" -else - if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" - fi - cce="CCE-80790-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" - printf '%s\n' "$formatted_output" >> "/etc/yum.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -26143,6 +26216,35 @@ fi - low_complexity - medium_disruption - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" +else + if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" + fi + cce="CCE-80790-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" + printf '%s\n' "$formatted_output" >> "/etc/yum.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -26200,35 +26302,6 @@ Accordingly, patches, service packs, device drivers, or operating system compone be signed with a certificate recognized and approved by the organization. CCE-80791-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q yum; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" -else - if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" - fi - cce="CCE-80791-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" - printf '%s\n' "$formatted_output" >> "/etc/yum.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -26288,6 +26361,35 @@ fi - medium_disruption - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q yum; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf" +else + if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf" + fi + cce="CCE-80791-7" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf" + printf '%s\n' "$formatted_output" >> "/etc/yum.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -26366,9 +26468,6 @@ trusted vendor. Self-signed certificates are disallowed by this requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA)." CCE-80792-5 - -sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* - - name: Grep for yum repo section names shell: | set -o pipefail @@ -26431,6 +26530,9 @@ sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* - low_complexity - medium_disruption - no_reboot_needed + + +sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/* @@ -26589,34 +26691,6 @@ not been tampered with and that it has been provided by a trusted vendor. The Red Hat GPG key is necessary to cryptographically verify packages are from Red Hat. CCE-80795-8 - # The two fingerprints below are retrieved from https://access.redhat.com/security/team/key -readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51" -readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792" - -# Location of the key we would like to import (once it's integrity verified) -readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" - -RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")") - -# Verify /etc/pki/rpm-gpg directory permissions are safe -if [ "${RPM_GPG_DIR_PERMS}" -le "755" ] -then - # If they are safe, try to obtain fingerprints from the key file - # (to ensure there won't be e.g. CRC error). - - readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10) - - GPG_RESULT=$? - # No CRC error, safe to proceed - if [ "${GPG_RESULT}" -eq "0" ] - then - echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || { - # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it - rpm --import "${REDHAT_RELEASE_KEY}" - } - fi -fi - - name: Read permission of GPG key directory stat: path: /etc/pki/rpm-gpg/ @@ -26741,6 +26815,34 @@ fi - medium_disruption - no_reboot_needed - restrict_strategy + + # The two fingerprints below are retrieved from https://access.redhat.com/security/team/key +readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51" +readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792" + +# Location of the key we would like to import (once it's integrity verified) +readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release" + +RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")") + +# Verify /etc/pki/rpm-gpg directory permissions are safe +if [ "${RPM_GPG_DIR_PERMS}" -le "755" ] +then + # If they are safe, try to obtain fingerprints from the key file + # (to ensure there won't be e.g. CRC error). + + readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10) + + GPG_RESULT=$? + # No CRC error, safe to proceed + if [ "${GPG_RESULT}" -eq "0" ] + then + echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || { + # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it + rpm --import "${REDHAT_RELEASE_KEY}" + } + fi +fi @@ -26803,10 +26905,6 @@ recent security patches and updates are not installed, unauthorized users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise. CCE-80865-9 - - -yum -y update - - name: Security patches are up to date package: name: '*' @@ -26827,6 +26925,10 @@ yum -y update - reboot_required - security_patches_up_to_date - skip_ansible_lint + + + +yum -y update @@ -26846,11 +26948,6 @@ The dnf-automatic timer can be enabled with the following The dnf-automatic is an alternative command line interface (CLI) to dnf upgrade with specific facilities to make it suitable to be executed automatically and regularly from systemd timers, cron jobs and similar. The tool is controlled by dnf-automatic.timer SystemD timer. CCE-82360-9 - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" start 'dnf-automatic.timer' -"$SYSTEMCTL_EXEC" enable 'dnf-automatic.timer' - - name: Enable timer dnf-automatic block: @@ -26876,6 +26973,11 @@ SYSTEMCTL_EXEC='/usr/bin/systemctl' - medium_severity - no_reboot_needed - timer_dnf-automatic_enabled + + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" start 'dnf-automatic.timer' +"$SYSTEMCTL_EXEC" enable 'dnf-automatic.timer' @@ -26937,20 +27039,6 @@ profiles instead of letting the administrator manually build the PAM stack. That way, it avoids potential breakage of configuration, as it ships several tested profiles that are well tested and supported to solve different use-cases. CCE-88248-0 - -var_authselect_profile='' - - -authselect select "$var_authselect_profile" - -if test "$?" -ne 0; then - if rpm --quiet --verify pam; then - authselect select --force "$var_authselect_profile" - else - echo "Files in the 'pam' package have been altered, so the authselect configuration won't be forced" >&2 - fi -fi - - name: XCCDF Value var_authselect_profile # promote to variable set_fact: var_authselect_profile: !!str @@ -27021,6 +27109,20 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + +var_authselect_profile='' + + +authselect select "$var_authselect_profile" + +if test "$?" -ne 0; then + if rpm --quiet --verify pam; then + authselect select --force "$var_authselect_profile" + else + echo "Files in the 'pam' package have been altered, so the authselect configuration won't be forced" >&2 + fi +fi @@ -27176,6 +27278,32 @@ with human users and are not required when such human interfaces do not exist. CCE-80763-6 + - @@ -27288,6 +27390,28 @@ with human users and are not required when such human interfaces do not exist. CCE-86147-6 + - @@ -27389,6 +27491,28 @@ with human users and are not required when such human interfaces do not exist. CCE-83496-0 + - @@ -27459,8 +27561,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-83708-8 - chgrp 0 /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27487,6 +27587,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/issue @@ -27508,8 +27610,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-86051-0 - chgrp 0 /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27538,6 +27638,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/issue.net @@ -27558,8 +27660,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper group ownership will ensure that only root user can modify the banner. CCE-83728-6 - chgrp 0 /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27586,6 +27686,8 @@ Proper group ownership will ensure that only root user can modify the banner. + chgrp 0 /etc/motd @@ -27606,8 +27708,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-83718-7 - chown 0 /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27634,6 +27734,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/issue @@ -27655,8 +27757,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-86054-4 - chown 0 /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27685,6 +27785,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/issue.net @@ -27705,8 +27807,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper ownership will ensure that only root user can modify the banner. CCE-83738-5 - chown 0 /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27733,6 +27833,8 @@ Proper ownership will ensure that only root user can modify the banner. + chown 0 /etc/motd @@ -27753,13 +27855,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-83348-3 - - - - - -chmod u-xs,g-xws,o-xwt /etc/issue - - name: Test for existence /etc/issue stat: path: /etc/issue @@ -27786,6 +27881,13 @@ chmod u-xs,g-xws,o-xwt /etc/issue - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/issue @@ -27807,13 +27909,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-86047-8 - - - - - -chmod u-xs,g-xws,o-xwt /etc/issue.net - - name: Test for existence /etc/issue.net stat: path: /etc/issue.net @@ -27842,6 +27937,13 @@ chmod u-xs,g-xws,o-xwt /etc/issue.net - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/issue.net @@ -27862,13 +27964,6 @@ verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. Proper permissions will ensure that only root user can modify the banner. CCE-83338-4 - - - - - -chmod u-xs,g-xws,o-xwt /etc/motd - - name: Test for existence /etc/motd stat: path: /etc/motd @@ -27895,6 +27990,13 @@ chmod u-xs,g-xws,o-xwt /etc/motd - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/motd @@ -27982,68 +28084,6 @@ Executive Orders, directives, policies, regulations, standards, and guidance. For U.S. Government systems, system use notifications are required only for access via login interfaces with human users and are not required when such human interfaces do not exist. CCE-80768-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*banner-message-enable\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)banner-message-enable(\s*=)/#\1banner-message-enable\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" -if grep -q "^\\s*banner-message-enable\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*banner-message-enable\\s*=\\s*.*/banner-message-enable=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-enable=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-enable$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/banner-message-enable$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/banner-message-enable$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/banner-message-enable" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28121,6 +28161,68 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*banner-message-enable\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)banner-message-enable(\s*=)/#\1banner-message-enable\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")" +if grep -q "^\\s*banner-message-enable\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*banner-message-enable\\s*=\\s*.*/banner-message-enable=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-enable=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-enable$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/banner-message-enable$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/banner-message-enable$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/banner-message-enable" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28197,87 +28299,6 @@ to begin and end the string with ' and use \n< An appropriate warning message reinforces policy awareness during the logon process and facilitates possible legal action against attackers. CCE-80770-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q gdm; then - -login_banner_text='' - - -# Multiple regexes transform the banner regex into a usable banner -# 0 - Remove anchors around the banner text -login_banner_text=$(echo "$login_banner_text" | sed 's/^\^\(.*\)\$$/\1/g') -# 1 - Keep only the first banners if there are multiple -# (dod_banners contains the long and short banner) -login_banner_text=$(echo "$login_banner_text" | sed 's/^(\(.*\.\)|.*)$/\1/g') -# 2 - Add spaces ' '. (Transforms regex for "space or newline" into a " ") -login_banner_text=$(echo "$login_banner_text" | sed 's/\[\\s\\n\]+/ /g') -# 3 - Adds newline "tokens". (Transforms "(?:\[\\n\]+|(?:\\n)+)" into "(n)*") -login_banner_text=$(echo "$login_banner_text" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/(n)*/g') -# 4 - Remove any leftover backslash. (From any parethesis in the banner, for example). -login_banner_text=$(echo "$login_banner_text" | sed 's/\\//g') -# 5 - Removes the newline "token." (Transforms them into newline escape sequences "\n"). -# ( Needs to be done after 4, otherwise the escapce sequence will become just "n". -login_banner_text=$(echo "$login_banner_text" | sed 's/(n)\*/\\n/g') - -# Check for setting in any of the DConf db directories -# If files contain ibus or distro, ignore them. -# The assignment assumes that individual filenames don't contain : -readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) -DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" -DBDIR="/etc/dconf/db/gdm.d" - -mkdir -p "${DBDIR}" - -# Comment out the configurations in databases different from the target one -if [ "${#SETTINGSFILES[@]}" -ne 0 ] -then - if grep -q "^\\s*banner-message-text\\s*=" "${SETTINGSFILES[@]}" - then - - sed -Ei "s/(^\s*)banner-message-text(\s*=)/#\1banner-message-text\2/g" "${SETTINGSFILES[@]}" - fi -fi - -[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" -if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" -then - printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} -fi - -escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'${login_banner_text}'")" -if grep -q "^\\s*banner-message-text\\s*=" "${DCONFFILE}" -then - sed -i "s/\\s*banner-message-text\\s*=\\s*.*/banner-message-text=${escaped_value}/g" "${DCONFFILE}" - else - sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-text=${escaped_value}" "${DCONFFILE}" -fi - -dconf update -# Check for setting in any of the DConf db directories -LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-text$" "/etc/dconf/db/" \ - | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) -LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" - -mkdir -p "${LOCKSFOLDER}" - -# Comment out the configurations in databases different from the target one -if [[ ! -z "${LOCKFILES}" ]] -then - sed -i -E "s|^/org/gnome/login-screen/banner-message-text$|#&|" "${LOCKFILES[@]}" -fi - -if ! grep -qr "^/org/gnome/login-screen/banner-message-text$" /etc/dconf/db/gdm.d/ -then - echo "/org/gnome/login-screen/banner-message-text" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" -fi - -dconf update - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28407,6 +28428,87 @@ fi - medium_severity - no_reboot_needed - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q gdm; then + +login_banner_text='' + + +# Multiple regexes transform the banner regex into a usable banner +# 0 - Remove anchors around the banner text +login_banner_text=$(echo "$login_banner_text" | sed 's/^\^\(.*\)\$$/\1/g') +# 1 - Keep only the first banners if there are multiple +# (dod_banners contains the long and short banner) +login_banner_text=$(echo "$login_banner_text" | sed 's/^(\(.*\.\)|.*)$/\1/g') +# 2 - Add spaces ' '. (Transforms regex for "space or newline" into a " ") +login_banner_text=$(echo "$login_banner_text" | sed 's/\[\\s\\n\]+/ /g') +# 3 - Adds newline "tokens". (Transforms "(?:\[\\n\]+|(?:\\n)+)" into "(n)*") +login_banner_text=$(echo "$login_banner_text" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/(n)*/g') +# 4 - Remove any leftover backslash. (From any parethesis in the banner, for example). +login_banner_text=$(echo "$login_banner_text" | sed 's/\\//g') +# 5 - Removes the newline "token." (Transforms them into newline escape sequences "\n"). +# ( Needs to be done after 4, otherwise the escapce sequence will become just "n". +login_banner_text=$(echo "$login_banner_text" | sed 's/(n)\*/\\n/g') + +# Check for setting in any of the DConf db directories +# If files contain ibus or distro, ignore them. +# The assignment assumes that individual filenames don't contain : +readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1) +DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings" +DBDIR="/etc/dconf/db/gdm.d" + +mkdir -p "${DBDIR}" + +# Comment out the configurations in databases different from the target one +if [ "${#SETTINGSFILES[@]}" -ne 0 ] +then + if grep -q "^\\s*banner-message-text\\s*=" "${SETTINGSFILES[@]}" + then + + sed -Ei "s/(^\s*)banner-message-text(\s*=)/#\1banner-message-text\2/g" "${SETTINGSFILES[@]}" + fi +fi + +[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}" +if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}" +then + printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE} +fi + +escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'${login_banner_text}'")" +if grep -q "^\\s*banner-message-text\\s*=" "${DCONFFILE}" +then + sed -i "s/\\s*banner-message-text\\s*=\\s*.*/banner-message-text=${escaped_value}/g" "${DCONFFILE}" + else + sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-text=${escaped_value}" "${DCONFFILE}" +fi + +dconf update +# Check for setting in any of the DConf db directories +LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-text$" "/etc/dconf/db/" \ + | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1) +LOCKSFOLDER="/etc/dconf/db/gdm.d/locks" + +mkdir -p "${LOCKSFOLDER}" + +# Comment out the configurations in databases different from the target one +if [[ ! -z "${LOCKFILES}" ]] +then + sed -i -E "s|^/org/gnome/login-screen/banner-message-text$|#&|" "${LOCKFILES[@]}" +fi + +if ! grep -qr "^/org/gnome/login-screen/banner-message-text$" /etc/dconf/db/gdm.d/ +then + echo "/org/gnome/login-screen/banner-message-text" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock" +fi + +dconf update + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28490,6 +28592,7 @@ The libpwquality package can be installed with the follow $ sudo yum install libpwquality CCI-000366 SRG-OS-000480-GPOS-00225 + 4.4.2.3 Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and @@ -28497,33 +28600,6 @@ brute-force attacks. "pwquality" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system. CCE-86225-0 - -package --add=libpwquality - - include install_libpwquality - -class install_libpwquality { - package { 'libpwquality': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if ! rpm -q --quiet "libpwquality" ; then - yum install -y "libpwquality" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "libpwquality" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -28549,6 +28625,33 @@ version = "*" - medium_severity - no_reboot_needed - package_pam_pwquality_installed + + +[[packages]] +name = "libpwquality" +version = "*" + + include install_libpwquality + +class install_libpwquality { + package { 'libpwquality': + ensure => 'installed', + } +} + + +package --add=libpwquality + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if ! rpm -q --quiet "libpwquality" ; then + yum install -y "libpwquality" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28575,15 +28678,6 @@ have authorization. When operating systems provide the capability to escalate a capability, it is critical the user re-authenticate. CCE-86319-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -sed -i '/pam_succeed_if/d' /etc/pam.d/sudo - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -28615,6 +28709,15 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +sed -i '/pam_succeed_if/d' /etc/pam.d/sudo + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -28691,264 +28794,6 @@ account allows the user to determine if any unauthorized activity has occurred a an opportunity to notify administrators. CCE-80788-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -f /usr/bin/authselect ]; then - if authselect list-features minimal | grep -q with-silent-lastlog; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect disable-feature with-silent-lastlog - - authselect apply-changes -b - else - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - if [ -e "$PAM_FILE_PATH" ] ; then - PAM_FILE_PATH="$PAM_FILE_PATH" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" - else - echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" - fi - fi - fi - # Check the option - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$PAM_FILE_PATH was not found" >&2 - fi - if [ -e "$PAM_FILE_PATH" ] ; then - PAM_FILE_PATH="$PAM_FILE_PATH" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$PAM_FILE_PATH was not found" >&2 - fi - fi -else - if [ -e "/etc/pam.d/postlogin" ] ; then - PAM_FILE_PATH="/etc/pam.d/postlogin" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" - else - echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" - fi - fi - fi - # Check the option - if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/postlogin was not found" >&2 - fi - if [ -e "/etc/pam.d/postlogin" ] ; then - PAM_FILE_PATH="/etc/pam.d/postlogin" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/postlogin was not found" >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -29335,6 +29180,264 @@ fi - low_disruption - low_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -f /usr/bin/authselect ]; then + if authselect list-features minimal | grep -q with-silent-lastlog; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect disable-feature with-silent-lastlog + + authselect apply-changes -b + else + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + if [ -e "$PAM_FILE_PATH" ] ; then + PAM_FILE_PATH="$PAM_FILE_PATH" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" + else + echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" + fi + fi + fi + # Check the option + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$PAM_FILE_PATH was not found" >&2 + fi + if [ -e "$PAM_FILE_PATH" ] ; then + PAM_FILE_PATH="$PAM_FILE_PATH" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$PAM_FILE_PATH") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$PAM_FILE_PATH was not found" >&2 + fi + fi +else + if [ -e "/etc/pam.d/postlogin" ] ; then + PAM_FILE_PATH="/etc/pam.d/postlogin" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*session\s+.*\s+pam_lastlog.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*session\s+).*(\bpam_lastlog.so.*)/\1'"\[default=1\]"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^\s*session\s+.*pam_succeed_if\.so.*" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a session '"\[default=1\]"' pam_lastlog.so' "$PAM_FILE_PATH" + else + echo 'session '"\[default=1\]"' pam_lastlog.so' >> "$PAM_FILE_PATH" + fi + fi + fi + # Check the option + if ! grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s*.*\sshowfailed\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so.*/ s/$/ showfailed/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/postlogin was not found" >&2 + fi + if [ -e "/etc/pam.d/postlogin" ] ; then + PAM_FILE_PATH="/etc/pam.d/postlogin" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/postlogin") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*session\s+'"\[default=1\]"'\s+pam_lastlog.so\s.*\bsilent\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*session.*'"\[default=1\]"'.*pam_lastlog.so.*)\ssilent=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/postlogin was not found" >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -29355,17 +29458,6 @@ SELinux, user name, security context or both. The polyinstatied directories can be used to dedicate separate temporary directories to each account. CCE-83744-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if ! grep -Eq '^\s*session\s+required\s+pam_namespace.so\s*$' '/etc/pam.d/login' ; then - echo "session required pam_namespace.so" >> "/etc/pam.d/login" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -29394,6 +29486,17 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if ! grep -Eq '^\s*session\s+required\s+pam_namespace.so\s*$' '/etc/pam.d/login' ; then + echo "session required pam_namespace.so" >> "/etc/pam.d/login" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -29604,99 +29707,6 @@ updates as of version 0.1.65. AC-7 (a) Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. CCE-86107-0 - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*audit" - line="audit" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" - fi - done -fi - - name: Account Lockouts Must Be Logged - Check if system relies on authselect tool ansible.builtin.stat: path: /usr/bin/authselect @@ -30252,6 +30262,99 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*audit" + line="audit" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + fi + done +fi @@ -30362,207 +30465,13 @@ updated. 8.3.7 SRG-OS-000077-GPOS-00045 RHEL-08-020220 - 5.5.3 + 4.4.3.3.1 + 4.4.3.3.3 SV-230368r902759_rule Preventing re-use of previous passwords helps ensure that a compromised password is not re-used by a user. CCE-83478-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_remember='' -var_password_pam_remember_control_flag='' - - -var_password_pam_remember_control_flag="$(echo $var_password_pam_remember_control_flag | cut -d \, -f 1)" - -if [ -f /usr/bin/authselect ]; then - if authselect list-features minimal | grep -q with-pwhistory; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect enable-feature with-pwhistory - - authselect apply-changes -b - else - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "$PAM_FILE_PATH" - else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "$PAM_FILE_PATH" - fi - fi - fi - fi -else - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/password-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/password-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/password-auth" - else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/password-auth" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/password-auth" - else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/password-auth" - fi - fi - fi -fi - -PWHISTORY_CONF="/etc/security/pwhistory.conf" -if [ -f $PWHISTORY_CONF ]; then - regex="^\s*remember\s*=" - line="remember = $var_password_pam_remember" - if ! grep -q $regex $PWHISTORY_CONF; then - echo $line >> $PWHISTORY_CONF - else - sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF - fi - if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*password\s.*\bpam_pwhistory.so\s.*\bremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*pam_pwhistory.so.*)\bremember\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "/etc/pam.d/password-auth was not found" >&2 - fi -else - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_remember"'/' "$PAM_FILE_PATH" - else - sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_remember"' \3/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -31421,105 +31330,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - - Limit Password Reuse: system-auth - Do not allow users to reuse recent passwords. This can be accomplished by using the -remember option for the pam_pwhistory PAM module. - - -On systems with newer versions of authselect, the pam_pwhistory PAM module -can be enabled via authselect feature: -authselect enable-feature with-pwhistory - -Otherwise, it should be enabled using an authselect custom profile. - -Newer systems also have the /etc/security/pwhistory.conf file for setting -pam_pwhistory module options. This file should be used whenever available. -Otherwise, the pam_pwhistory module options can be set in PAM files. - -The value for remember option must be equal or greater than - - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. - Newer versions of authselect contain an authselect feature to easily and properly -enable pam_pwhistory.so module. If this feature is not yet available in your -system, an authselect custom profile must be used to avoid integrity issues in PAM files. - 1 - 12 - 15 - 16 - 5 - 5.6.2.1.1 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - 3.5.8 - CCI-000200 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - IA-5(f) - IA-5(1)(e) - PR.AC-1 - PR.AC-6 - PR.AC-7 - Req-8.2.5 - 8.3.7 - SRG-OS-000077-GPOS-00045 - RHEL-08-020221 - 5.5.3 - SV-251717r902749_rule - Preventing re-use of previous passwords helps ensure that a compromised password is not -re-used by a user. - - CCE-83480-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then var_password_pam_remember='' @@ -31567,7 +31378,7 @@ if [ -f /usr/bin/authselect ]; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31587,17 +31398,17 @@ if [ -f /usr/bin/authselect ]; then fi fi else - if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/password-auth"; then # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/password-auth")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/system-auth" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/password-auth" else - LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/password-auth" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/system-auth" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/password-auth" else - echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/password-auth" fi fi fi @@ -31612,8 +31423,8 @@ if [ -f $PWHISTORY_CONF ]; then else sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF fi - if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -31640,7 +31451,7 @@ if [ -f $PWHISTORY_CONF ]; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31654,10 +31465,10 @@ if [ -f $PWHISTORY_CONF ]; then authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else - PAM_FILE_PATH="/etc/pam.d/system-auth" + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -31684,7 +31495,7 @@ else authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -31714,6 +31525,105 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Limit Password Reuse: system-auth + Do not allow users to reuse recent passwords. This can be accomplished by using the +remember option for the pam_pwhistory PAM module. + + +On systems with newer versions of authselect, the pam_pwhistory PAM module +can be enabled via authselect feature: +authselect enable-feature with-pwhistory + +Otherwise, it should be enabled using an authselect custom profile. + +Newer systems also have the /etc/security/pwhistory.conf file for setting +pam_pwhistory module options. This file should be used whenever available. +Otherwise, the pam_pwhistory module options can be set in PAM files. + +The value for remember option must be equal or greater than + + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. + Newer versions of authselect contain an authselect feature to easily and properly +enable pam_pwhistory.so module. If this feature is not yet available in your +system, an authselect custom profile must be used to avoid integrity issues in PAM files. + 1 + 12 + 15 + 16 + 5 + 5.6.2.1.1 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + 3.5.8 + CCI-000200 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + IA-5(f) + IA-5(1)(e) + PR.AC-1 + PR.AC-6 + PR.AC-7 + Req-8.2.5 + 8.3.7 + SRG-OS-000077-GPOS-00045 + RHEL-08-020221 + 4.4.3.3.1 + 4.4.3.3.3 + SV-251717r902749_rule + Preventing re-use of previous passwords helps ensure that a compromised password is not +re-used by a user. + + CCE-83480-4 - name: Gather the package facts package_facts: manager: auto @@ -32571,95 +32481,15 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - - Limit Password Reuse - Do not allow users to reuse recent passwords. This can be accomplished by using the -remember option for the pam_unix or pam_pwhistory PAM modules. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. - Newer versions of authselect contain an authselect feature to easily and properly -enable pam_pwhistory.so module. If this feature is not yet available in your -system, an authselect custom profile must be used to avoid integrity issues in PAM files. - BP28(R18) - 1 - 12 - 15 - 16 - 5 - 5.6.2.1.1 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - 3.5.8 - CCI-000200 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - IA-5(f) - IA-5(1)(e) - PR.AC-1 - PR.AC-6 - PR.AC-7 - Req-8.2.5 - 8.3.7 - SRG-OS-000077-GPOS-00045 - 5.4.3 - Preventing re-use of previous passwords helps ensure that a compromised password is not -re-used by a user. - - CCE-80666-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_password_pam_unix_remember='' +var_password_pam_remember='' +var_password_pam_remember_control_flag='' +var_password_pam_remember_control_flag="$(echo $var_password_pam_remember_control_flag | cut -d \, -f 1)" + if [ -f /usr/bin/authselect ]; then if authselect list-features minimal | grep -q with-pwhistory; then if ! authselect check; then @@ -32703,33 +32533,33 @@ if [ -f /usr/bin/authselect ]; then PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then # Line matching group + control + module was not found. Check group + module. if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "$PAM_FILE_PATH" else LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "$PAM_FILE_PATH" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "$PAM_FILE_PATH" else - echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "$PAM_FILE_PATH" fi fi fi fi else - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + if ! grep -qP '^\s*password\s+'"$var_password_pam_remember_control_flag"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then # Line matching group + control + module was not found. Check group + module. if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "/etc/pam.d/system-auth" + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"$var_password_pam_remember_control_flag"' \2/' "/etc/pam.d/system-auth" else LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "/etc/pam.d/system-auth" + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' "/etc/pam.d/system-auth" else - echo 'password '"requisite"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + echo 'password '"$var_password_pam_remember_control_flag"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" fi fi fi @@ -32738,11 +32568,11 @@ fi PWHISTORY_CONF="/etc/security/pwhistory.conf" if [ -f $PWHISTORY_CONF ]; then regex="^\s*remember\s*=" - line="remember = $var_password_pam_unix_remember" + line="remember = $var_password_pam_remember" if ! grep -q $regex $PWHISTORY_CONF; then echo $line >> $PWHISTORY_CONF else - sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_unix_remember"'|g' $PWHISTORY_CONF + sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_remember"'|g' $PWHISTORY_CONF fi if [ -e "/etc/pam.d/system-auth" ] ; then PAM_FILE_PATH="/etc/pam.d/system-auth" @@ -32832,9 +32662,9 @@ else fi # Check the option if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_unix_remember"'/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_remember"'/' "$PAM_FILE_PATH" else - sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_remember"' \3/' "$PAM_FILE_PATH" + sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_remember"' \3/' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -32846,6 +32676,89 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Limit Password Reuse + Do not allow users to reuse recent passwords. This can be accomplished by using the +remember option for the pam_unix or pam_pwhistory PAM modules. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. + Newer versions of authselect contain an authselect feature to easily and properly +enable pam_pwhistory.so module. If this feature is not yet available in your +system, an authselect custom profile must be used to avoid integrity issues in PAM files. + BP28(R18) + 1 + 12 + 15 + 16 + 5 + 5.6.2.1.1 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + 3.5.8 + CCI-000200 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + IA-5(f) + IA-5(1)(e) + PR.AC-1 + PR.AC-6 + PR.AC-7 + Req-8.2.5 + 8.3.7 + SRG-OS-000077-GPOS-00045 + 5.4.3 + Preventing re-use of previous passwords helps ensure that a compromised password is not +re-used by a user. + + CCE-80666-1 - name: Gather the package facts package_facts: manager: auto @@ -33665,124 +33578,217 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - Account Lockouts Must Be Logged - PAM faillock locks an account due to excessive password failures, this event must be logged. - CCI-000044 - AC-7 (a) - SRG-OS-000021-GPOS-00005 - RHEL-08-020021 - SV-230343r743981_rule - Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. - - CCE-86099-9 - # Remediation is applicable only in certain platforms -if grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.2"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; then + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_unix_remember='' + if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock + if authselect list-features minimal | grep -q with-pwhistory; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect enable-feature with-pwhistory -authselect apply-changes -b + authselect apply-changes -b + else + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "$PAM_FILE_PATH" + else + echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" + fi + fi + fi + fi else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "/etc/pam.d/system-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "/etc/pam.d/system-auth" + else + LAST_MATCH_LINE=$(grep -nP "^password.*requisite.*pam_pwquality\.so" "/etc/pam.d/system-auth" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwhistory.so' "/etc/pam.d/system-auth" + else + echo 'password '"requisite"' pam_pwhistory.so' >> "/etc/pam.d/system-auth" + fi + fi fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - fi -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*audit" - line="audit" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF +PWHISTORY_CONF="/etc/security/pwhistory.conf" +if [ -f $PWHISTORY_CONF ]; then + regex="^\s*remember\s*=" + line="remember = $var_password_pam_unix_remember" + if ! grep -q $regex $PWHISTORY_CONF; then + echo $line >> $PWHISTORY_CONF + else + sed -i --follow-symlinks 's|^\s*\(remember\s*=\s*\)\(\S\+\)|\1'"$var_password_pam_unix_remember"'|g' $PWHISTORY_CONF fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then + if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + authselect apply-changes -b + fi + + if grep -qP '^\s*password\s.*\bpam_pwhistory.so\s.*\bremember\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*pam_pwhistory.so.*)\bremember\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "/etc/pam.d/system-auth was not found" >&2 + fi +else + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi - authselect apply-changes -b - fi + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwhistory.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwhistory.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + echo 'password '"requisite"' pam_pwhistory.so' >> "$PAM_FILE_PATH" fi - done + fi + # Check the option + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwhistory.so\s*.*\sremember\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"requisite"'\s+pam_pwhistory.so.*/ s/$/ remember='"$var_password_pam_unix_remember"'/' "$PAM_FILE_PATH" + else + sed -i -E --follow-symlinks 's/(\s*password\s+'"requisite"'\s+pam_pwhistory.so\s+.*)('"remember"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_remember"' \3/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Account Lockouts Must Be Logged + PAM faillock locks an account due to excessive password failures, this event must be logged. + CCI-000044 + AC-7 (a) + SRG-OS-000021-GPOS-00005 + RHEL-08-020021 + SV-230343r743981_rule + Without auditing of these events it may be harder or impossible to identify what an attacker did after an attack. + + CCE-86099-9 - name: Account Lockouts Must Be Logged - Check if system relies on authselect tool ansible.builtin.stat: path: /usr/bin/authselect @@ -34364,6 +34370,105 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.2"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*audit" + line="audit" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\baudit\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\baudit\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*audit' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ audit/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -34454,122 +34559,13 @@ parameters should be defined in faillock.conf file.SRG-OS-000329-GPOS-00128 SRG-OS-000021-GPOS-00005 RHEL-08-020011 - 5.4.2 - 5.5.2 + 4.4.3.1.1 SV-230333r743966_rule By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking the account. CCE-80667-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_passwords_pam_faillock_deny='' - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*deny\s*=" - line="deny = $var_accounts_passwords_pam_faillock_deny" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(deny\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_deny"'|g' $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdeny\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdeny\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*deny' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" - fi - done -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -35260,93 +35256,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Configure the root Account for Failed Password Attempts - This rule configures the system to lock out the root account after a number of -incorrect login attempts using pam_faillock.so. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - BP28(R18) - 1 - 12 - 15 - 16 - DSS05.04 - DSS05.10 - DSS06.10 - CCI-002238 - CCI-000044 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - 0421 - 0422 - 0431 - 0974 - 1173 - 1401 - 1504 - 1505 - 1546 - 1557 - 1558 - 1559 - 1560 - 1561 - A.18.1.4 - A.9.2.1 - A.9.2.4 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(b) - IA-5(c) - PR.AC-7 - FMT_MOF_EXT.1 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020023 - SV-230345r743984_rule - By limiting the number of failed logon attempts, the risk of unauthorized system access via -user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking -the account. - - CCE-80668-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_deny='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -35378,10 +35293,12 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*even_deny_root" - line="even_deny_root" + regex="^\s*deny\s*=" + line="deny = $var_accounts_passwords_pam_faillock_deny" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(deny\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_deny"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -35419,8 +35336,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\beven_deny_root\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\beven_deny_root\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdeny\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdeny\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -35433,9 +35350,12 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*even_deny_root' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ even_deny_root/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ even_deny_root/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*deny' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ deny='"$var_accounts_passwords_pam_faillock_deny"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"deny"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_deny"'\3/' "$pam_file" fi done fi @@ -35444,6 +35364,91 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the root Account for Failed Password Attempts + This rule configures the system to lock out the root account after a number of +incorrect login attempts using pam_faillock.so. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + BP28(R18) + 1 + 12 + 15 + 16 + DSS05.04 + DSS05.10 + DSS06.10 + CCI-002238 + CCI-000044 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + 0421 + 0422 + 0431 + 0974 + 1173 + 1401 + 1504 + 1505 + 1546 + 1557 + 1558 + 1559 + 1560 + 1561 + A.18.1.4 + A.9.2.1 + A.9.2.4 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(b) + IA-5(c) + PR.AC-7 + FMT_MOF_EXT.1 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020023 + 4.4.3.1.3 + SV-230345r743984_rule + By limiting the number of failed logon attempts, the risk of unauthorized system access via +user password guessing, also known as brute-forcing, is reduced. Limits are imposed by locking +the account. + + CCE-80668-7 - name: Gather the package facts package_facts: manager: auto @@ -36078,56 +36083,9 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Lock Accounts Must Persist - This rule ensures that the system lock out accounts using pam_faillock.so persist -after system reboot. From "pam_faillock" man pages: -Note that the default directory that "pam_faillock" uses is usually cleared on system -boot so the access will be reenabled after system reboot. If that is undesirable, a different -tally directory must be set with the "dir" option. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - -The chosen profile expects the directory to be . - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - CCI-000044 - CCI-002238 - AC-7(b) - AC-7(a) - AC-7.1(ii) - SRG-OS-000021-GPOS-00005 - SRG-OS-000329-GPOS-00128 - RHEL-08-020016 - RHEL-08-020017 - SV-230338r627750_rule - SV-230339r743975_rule - Locking out user accounts after a number of incorrect attempts prevents direct password -guessing attacks. In combination with the silent option, user enumeration attacks -are also mitigated. - - CCE-86067-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_accounts_passwords_pam_faillock_dir='' - - if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -36159,12 +36117,10 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*dir\s*=" - line="dir = $var_accounts_passwords_pam_faillock_dir" + regex="^\s*even_deny_root" + line="even_deny_root" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(dir\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_dir"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -36202,8 +36158,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdir\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdir\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\beven_deny_root\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\beven_deny_root\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -36216,34 +36172,61 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*dir' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*even_deny_root' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ even_deny_root/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ even_deny_root/' "$pam_file" fi done fi -if ! rpm -q --quiet "python3-libselinux" ; then - yum install -y "python3-libselinux" -fi -if ! rpm -q --quiet "python3-policycoreutils" ; then - yum install -y "python3-policycoreutils" -fi -if ! rpm -q --quiet "policycoreutils-python-utils" ; then - yum install -y "policycoreutils-python-utils" -fi - -mkdir -p "$var_accounts_passwords_pam_faillock_dir" -semanage fcontext -a -t faillog_t "$var_accounts_passwords_pam_faillock_dir(/.*)?" -restorecon -R -v "$var_accounts_passwords_pam_faillock_dir" - else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Lock Accounts Must Persist + This rule ensures that the system lock out accounts using pam_faillock.so persist +after system reboot. From "pam_faillock" man pages: +Note that the default directory that "pam_faillock" uses is usually cleared on system +boot so the access will be reenabled after system reboot. If that is undesirable, a different +tally directory must be set with the "dir" option. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + +The chosen profile expects the directory to be . + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + CCI-000044 + CCI-002238 + AC-7(b) + AC-7(a) + AC-7.1(ii) + SRG-OS-000021-GPOS-00005 + SRG-OS-000329-GPOS-00128 + RHEL-08-020016 + RHEL-08-020017 + SV-230338r627750_rule + SV-230339r743975_rule + Locking out user accounts after a number of incorrect attempts prevents direct password +guessing attacks. In combination with the silent option, user enumeration attacks +are also mitigated. + + CCE-86067-6 - name: Gather the package facts package_facts: manager: auto @@ -36980,39 +36963,12 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Enforce pam_faillock for Local Accounts Only - The pam_faillock module's local_users_only parameter controls requirements for -enforcing failed lockout attempts only for local user accounts and ignoring centralized user -account management failed attempt configurations. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - Using this rule bypasses pam_faillock's functionality and should be used in cases -where centralized management such as LDAP or Active Directory is in use. - CCI-000015 - AC-2(1) - SRG-OS-000001-GPOS-00001 - The operating system must provide automated mechanisms for supporting account management -functions. Enterprise environments make application account management challenging and -complex. A manual process for account management functions adds the risk of a potential -oversight or other error. Locking out remote accounts may cause unintentional DoS. - - CCE-83401-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_dir='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -37044,10 +37000,12 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*local_users_only" - line="local_users_only" + regex="^\s*dir\s*=" + line="dir = $var_accounts_passwords_pam_faillock_dir" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(dir\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_dir"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -37085,8 +37043,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\blocal_users_only\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\blocal_users_only\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bdir\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bdir\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -37099,17 +37057,64 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*local_users_only' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ local_users_only/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ local_users_only/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*dir' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ dir='"$var_accounts_passwords_pam_faillock_dir"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"dir"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_dir"'\3/' "$pam_file" fi done fi +if ! rpm -q --quiet "python3-libselinux" ; then + yum install -y "python3-libselinux" +fi +if ! rpm -q --quiet "python3-policycoreutils" ; then + yum install -y "python3-policycoreutils" +fi +if ! rpm -q --quiet "policycoreutils-python-utils" ; then + yum install -y "policycoreutils-python-utils" +fi + +mkdir -p "$var_accounts_passwords_pam_faillock_dir" +semanage fcontext -a -t faillog_t "$var_accounts_passwords_pam_faillock_dir(/.*)?" +restorecon -R -v "$var_accounts_passwords_pam_faillock_dir" + else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Enforce pam_faillock for Local Accounts Only + The pam_faillock module's local_users_only parameter controls requirements for +enforcing failed lockout attempts only for local user accounts and ignoring centralized user +account management failed attempt configurations. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + Using this rule bypasses pam_faillock's functionality and should be used in cases +where centralized management such as LDAP or Active Directory is in use. + CCI-000015 + AC-2(1) + SRG-OS-000001-GPOS-00001 + The operating system must provide automated mechanisms for supporting account management +functions. Enterprise environments make application account management challenging and +complex. A manual process for account management functions adds the risk of a potential +oversight or other error. Locking out remote accounts may cause unintentional DoS. + + CCE-83401-0 - name: Gather the package facts package_facts: manager: auto @@ -37719,102 +37724,9 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Set Interval For Counting Failed Password Attempts - Utilizing pam_faillock.so, the fail_interval directive configures the system -to lock out an account after a number of incorrect login attempts within a specified time -period. - -Ensure that the file /etc/security/faillock.conf contains the following entry: -fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. - - -In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - BP28(R18) - 1 - 12 - 15 - 16 - DSS05.04 - DSS05.10 - DSS06.10 - CCI-000044 - CCI-002236 - CCI-002237 - CCI-002238 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - 0421 - 0422 - 0431 - 0974 - 1173 - 1401 - 1504 - 1505 - 1546 - 1557 - 1558 - 1559 - 1560 - 1561 - A.18.1.4 - A.9.2.1 - A.9.2.4 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(a) - PR.AC-7 - FIA_AFL.1 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020012 - RHEL-08-020013 - SV-230334r627750_rule - SV-230335r743969_rule - By limiting the number of failed logon attempts the risk of unauthorized system -access via user password guessing, otherwise known as brute-forcing, is reduced. -Limits are imposed by locking the account. - - CCE-80669-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_accounts_passwords_pam_faillock_fail_interval='' - - if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -37846,12 +37758,10 @@ AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*fail_interval\s*=" - line="fail_interval = $var_accounts_passwords_pam_faillock_fail_interval" + regex="^\s*local_users_only" + line="local_users_only" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(fail_interval\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_fail_interval"'|g' $FAILLOCK_CONF fi for pam_file in "${AUTH_FILES[@]}" do @@ -37889,8 +37799,8 @@ if [ -f $FAILLOCK_CONF ]; then authselect apply-changes -b fi - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bfail_interval\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bfail_interval\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\blocal_users_only\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\blocal_users_only\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -37903,12 +37813,9 @@ if [ -f $FAILLOCK_CONF ]; then else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*fail_interval' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*local_users_only' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ local_users_only/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ local_users_only/' "$pam_file" fi done fi @@ -37917,6 +37824,96 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set Interval For Counting Failed Password Attempts + Utilizing pam_faillock.so, the fail_interval directive configures the system +to lock out an account after a number of incorrect login attempts within a specified time +period. + +Ensure that the file /etc/security/faillock.conf contains the following entry: +fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. + + +In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + BP28(R18) + 1 + 12 + 15 + 16 + DSS05.04 + DSS05.10 + DSS06.10 + CCI-000044 + CCI-002236 + CCI-002237 + CCI-002238 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + 0421 + 0422 + 0431 + 0974 + 1173 + 1401 + 1504 + 1505 + 1546 + 1557 + 1558 + 1559 + 1560 + 1561 + A.18.1.4 + A.9.2.1 + A.9.2.4 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(a) + PR.AC-7 + FIA_AFL.1 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020012 + RHEL-08-020013 + SV-230334r627750_rule + SV-230335r743969_rule + By limiting the number of failed logon attempts the risk of unauthorized system +access via user password guessing, otherwise known as brute-forcing, is reduced. +Limits are imposed by locking the account. + + CCE-80669-5 - name: Gather the package facts package_facts: manager: auto @@ -38586,48 +38583,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Do Not Show System Messages When Unsuccessful Logon Attempts Occur - This rule ensures the system prevents informative messages from being presented to the user -pertaining to logon information after a number of incorrect login attempts using -pam_faillock.so. - -pam_faillock.so module requires multiple entries in pam files. These entries must be carefully -defined to work as expected. In order to avoid errors when manually editing these files, it is -recommended to use the appropriate tools, such as authselect or authconfig, -depending on the OS version. - If the system relies on authselect tool to manage PAM settings, the remediation -will also use authselect tool. However, if any manual modification was made in -PAM files, the authselect integrity check will fail and the remediation will be -aborted in order to preserve intentional changes. In this case, an informative message will -be shown in the remediation report. -If the system supports the /etc/security/faillock.conf file, the pam_faillock -parameters should be defined in faillock.conf file. - CCI-002238 - CCI-000044 - SRG-OS-000329-GPOS-00128 - SRG-OS-000021-GPOS-00005 - RHEL-08-020018 - RHEL-08-020019 - SV-230340r627750_rule - SV-230341r743978_rule - The pam_faillock module without the silent option will leak information about the existence or -non-existence of a user account in the system because the failures are not recorded for unknown -users. The message about the user account being locked is never displayed for non-existing user -accounts allowing the adversary to infer that a particular account exists or not on the system. - - CCE-87096-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then +var_accounts_passwords_pam_faillock_fail_interval='' + + if [ -f /usr/bin/authselect ]; then if ! authselect check; then echo " @@ -38655,20 +38616,73 @@ done fi - AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + FAILLOCK_CONF="/etc/security/faillock.conf" if [ -f $FAILLOCK_CONF ]; then - regex="^\s*silent" - line="silent" + regex="^\s*fail_interval\s*=" + line="fail_interval = $var_accounts_passwords_pam_faillock_fail_interval" if ! grep -q $regex $FAILLOCK_CONF; then echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(fail_interval\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_fail_interval"'|g' $FAILLOCK_CONF fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bfail_interval\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bfail_interval\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done else for pam_file in "${AUTH_FILES[@]}" do - if ! grep -qE '^\s*auth.*pam_faillock\.so\s*preauth.*silent' "$pam_file"; then - sed -i --follow-symlinks '/^\s*auth.*pam_faillock\.so.*preauth/ s/$/ silent/' "$pam_file" + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*fail_interval' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ fail_interval='"$var_accounts_passwords_pam_faillock_fail_interval"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"fail_interval"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_fail_interval"'\3/' "$pam_file" fi done fi @@ -38677,6 +38691,45 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Do Not Show System Messages When Unsuccessful Logon Attempts Occur + This rule ensures the system prevents informative messages from being presented to the user +pertaining to logon information after a number of incorrect login attempts using +pam_faillock.so. + +pam_faillock.so module requires multiple entries in pam files. These entries must be carefully +defined to work as expected. In order to avoid errors when manually editing these files, it is +recommended to use the appropriate tools, such as authselect or authconfig, +depending on the OS version. + If the system relies on authselect tool to manage PAM settings, the remediation +will also use authselect tool. However, if any manual modification was made in +PAM files, the authselect integrity check will fail and the remediation will be +aborted in order to preserve intentional changes. In this case, an informative message will +be shown in the remediation report. +If the system supports the /etc/security/faillock.conf file, the pam_faillock +parameters should be defined in faillock.conf file. + CCI-002238 + CCI-000044 + SRG-OS-000329-GPOS-00128 + SRG-OS-000021-GPOS-00005 + RHEL-08-020018 + RHEL-08-020019 + SV-230340r627750_rule + SV-230341r743978_rule + The pam_faillock module without the silent option will leak information about the existence or +non-existence of a user account in the system because the failures are not recorded for unknown +users. The message about the user account being locked is never displayed for non-existing user +accounts allowing the adversary to infer that a particular account exists or not on the system. + + CCE-87096-4 - name: Gather the package facts package_facts: manager: auto @@ -38907,6 +38960,58 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*silent" + line="silent" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + fi +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so\s*preauth.*silent' "$pam_file"; then + sed -i --follow-symlinks '/^\s*auth.*pam_faillock\.so.*preauth/ s/$/ silent/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -39006,7 +39111,7 @@ parameters should be defined in faillock.conf file.SRG-OS-000021-GPOS-00005 RHEL-08-020014 RHEL-08-020015 - 5.5.2 + 4.4.3.1.2 SV-230336r627750_rule SV-230337r743972_rule By limiting the number of failed logon attempts the risk of unauthorized system @@ -39014,114 +39119,6 @@ access via user password guessing, otherwise known as brute-forcing, is reduced. Limits are imposed by locking the account. CCE-80670-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_passwords_pam_faillock_unlock_time='' - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature with-faillock - -authselect apply-changes -b -else - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") -for pam_file in "${AUTH_FILES[@]}" -do - if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then - sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" - sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" - fi - sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" -done - -fi - -AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") - -FAILLOCK_CONF="/etc/security/faillock.conf" -if [ -f $FAILLOCK_CONF ]; then - regex="^\s*unlock_time\s*=" - line="unlock_time = $var_accounts_passwords_pam_faillock_unlock_time" - if ! grep -q $regex $FAILLOCK_CONF; then - echo $line >> $FAILLOCK_CONF - else - sed -i --follow-symlinks 's|^\s*\(unlock_time\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_unlock_time"'|g' $FAILLOCK_CONF - fi - for pam_file in "${AUTH_FILES[@]}" - do - if [ -e "$pam_file" ] ; then - PAM_FILE_PATH="$pam_file" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "$pam_file") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - - if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bunlock_time\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bunlock_time\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi - else - echo "$pam_file was not found" >&2 - fi - done -else - for pam_file in "${AUTH_FILES[@]}" - do - if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*unlock_time' "$pam_file"; then - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" - sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" - else - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" - sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" - fi - done -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -39821,6 +39818,114 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_accounts_passwords_pam_faillock_unlock_time='' + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature with-faillock + +authselect apply-changes -b +else + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") +for pam_file in "${AUTH_FILES[@]}" +do + if ! grep -qE '^\s*auth\s+required\s+pam_faillock\.so\s+(preauth silent|authfail).*$' "$pam_file" ; then + sed -i --follow-symlinks '/^auth.*sufficient.*pam_unix\.so.*/i auth required pam_faillock.so preauth silent' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_deny\.so.*/i auth required pam_faillock.so authfail' "$pam_file" + sed -i --follow-symlinks '/^account.*required.*pam_unix\.so.*/i account required pam_faillock.so' "$pam_file" + fi + sed -Ei 's/(auth.*)(\[default=die\])(.*pam_faillock\.so)/\1required \3/g' "$pam_file" +done + +fi + +AUTH_FILES=("/etc/pam.d/system-auth" "/etc/pam.d/password-auth") + +FAILLOCK_CONF="/etc/security/faillock.conf" +if [ -f $FAILLOCK_CONF ]; then + regex="^\s*unlock_time\s*=" + line="unlock_time = $var_accounts_passwords_pam_faillock_unlock_time" + if ! grep -q $regex $FAILLOCK_CONF; then + echo $line >> $FAILLOCK_CONF + else + sed -i --follow-symlinks 's|^\s*\(unlock_time\s*=\s*\)\(\S\+\)|\1'"$var_accounts_passwords_pam_faillock_unlock_time"'|g' $FAILLOCK_CONF + fi + for pam_file in "${AUTH_FILES[@]}" + do + if [ -e "$pam_file" ] ; then + PAM_FILE_PATH="$pam_file" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "$pam_file") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + + if grep -qP '^\s*auth\s.*\bpam_faillock.so\s.*\bunlock_time\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*auth.*pam_faillock.so.*)\bunlock_time\b=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi + else + echo "$pam_file was not found" >&2 + fi + done +else + for pam_file in "${AUTH_FILES[@]}" + do + if ! grep -qE '^\s*auth.*pam_faillock\.so (preauth|authfail).*unlock_time' "$pam_file"; then + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*preauth.*silent.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" + sed -i --follow-symlinks '/^auth.*required.*pam_faillock\.so.*authfail.*/ s/$/ unlock_time='"$var_accounts_passwords_pam_faillock_unlock_time"'/' "$pam_file" + else + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*preauth.*silent.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" + sed -i --follow-symlinks 's/\(^auth.*required.*pam_faillock\.so.*authfail.*\)\('"unlock_time"'=\)[0-9]\+\(.*\)/\1\2'"$var_accounts_passwords_pam_faillock_unlock_time"'\3/' "$pam_file" + fi + done +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40067,6 +40172,7 @@ length credit for each digit. Modify the dcredit setting 8.3.6 SRG-OS-000071-GPOS-00039 RHEL-08-020130 + 4.4.3.2.3 SV-230359r858775_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -40080,42 +40186,6 @@ Requiring digits makes password guessing attacks more difficult by ensuring a la search space. CCE-80653-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_dcredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dcredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dcredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^dcredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^dcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80653-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40163,6 +40233,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_dcredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dcredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dcredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^dcredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^dcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80653-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40183,6 +40289,7 @@ fi IA-5(4) SRG-OS-000480-GPOS-00225 RHEL-08-020300 + 4.4.3.2.6 SV-230377r858789_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at @@ -40195,42 +40302,6 @@ password is compromised. Passwords with dictionary words may be more vulnerable to password-guessing attacks. CCE-86233-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_dictcheck='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dictcheck") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dictcheck" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^dictcheck\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^dictcheck\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-86233-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40274,6 +40345,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_dictcheck='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^dictcheck") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_dictcheck" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^dictcheck\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^dictcheck\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-86233-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40347,6 +40454,7 @@ when changing passwords. PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020170 + 4.4.3.2.1 SV-230363r858783_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, @@ -40363,42 +40471,6 @@ newly changed passwords should not resemble previously compromised ones. Note that passwords which are changed on compromised systems will still be compromised, however. CCE-80654-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_difok='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^difok") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_difok" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^difok\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^difok\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80654-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40444,6 +40516,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_difok='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^difok") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_difok" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^difok\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^difok\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80654-7" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40471,28 +40579,6 @@ complex. A manual process for account management functions adds the risk of a po oversight or other error. CCE-83364-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/security/pwquality.conf" ] ; then - - LC_ALL=C sed -i "/^\s*local_users_only/Id" "/etc/security/pwquality.conf" -else - touch "/etc/security/pwquality.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/security/pwquality.conf" - -cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" -# Insert at the end of the file -printf '%s\n' "local_users_only" >> "/etc/security/pwquality.conf" -# Clean up after ourselves. -rm "/etc/security/pwquality.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40522,6 +40608,28 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/security/pwquality.conf" ] ; then + + LC_ALL=C sed -i "/^\s*local_users_only/Id" "/etc/security/pwquality.conf" +else + touch "/etc/security/pwquality.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/security/pwquality.conf" + +cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" +# Insert at the end of the file +printf '%s\n' "local_users_only" >> "/etc/security/pwquality.conf" +# Clean up after ourselves. +rm "/etc/security/pwquality.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40554,6 +40662,7 @@ to use complex passwords. SRG-OS-000078-GPOS-00046 SRG-OS-000480-GPOS-00225 SRG-OS-000069-GPOS-00037 + 4.4.3.2.7 Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. @@ -40563,28 +40672,6 @@ password. The more complex the password, the greater the number of possible comb that need to be tested before the password is compromised. CCE-83377-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/security/pwquality.conf" ] ; then - - LC_ALL=C sed -i "/^\s*enforce_for_root/Id" "/etc/security/pwquality.conf" -else - touch "/etc/security/pwquality.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/security/pwquality.conf" - -cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" -# Insert at the end of the file -printf '%s\n' "enforce_for_root" >> "/etc/security/pwquality.conf" -# Clean up after ourselves. -rm "/etc/security/pwquality.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40620,6 +40707,28 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/security/pwquality.conf" ] ; then + + LC_ALL=C sed -i "/^\s*enforce_for_root/Id" "/etc/security/pwquality.conf" +else + touch "/etc/security/pwquality.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/security/pwquality.conf" + +cp "/etc/security/pwquality.conf" "/etc/security/pwquality.conf.bak" +# Insert at the end of the file +printf '%s\n' "enforce_for_root" >> "/etc/security/pwquality.conf" +# Clean up after ourselves. +rm "/etc/security/pwquality.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40708,6 +40817,7 @@ length credit for each lowercase character. Modify the lcredit8.3.6 SRG-OS-000070-GPOS-00038 RHEL-08-020120 + 4.4.3.2.3 SV-230358r858773_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -40721,42 +40831,6 @@ Requiring a minimum number of lowercase characters makes password guessing attac more difficult by ensuring a larger search space. CCE-80655-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_lcredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^lcredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_lcredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^lcredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^lcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80655-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40804,6 +40878,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_lcredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^lcredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_lcredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^lcredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^lcredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80655-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -40885,42 +40995,6 @@ more complex a password, the greater the number of possible combinations that ne password is compromised. CCE-81034-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_maxclassrepeat='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxclassrepeat") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxclassrepeat" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^maxclassrepeat\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^maxclassrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-81034-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -40965,6 +41039,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_maxclassrepeat='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxclassrepeat") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxclassrepeat" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^maxclassrepeat\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^maxclassrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-81034-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41035,6 +41145,7 @@ run of (PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020150 + 4.4.3.2.4 SV-230361r858779_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at @@ -41047,42 +41158,6 @@ password is compromised. Passwords with excessive repeating characters may be more vulnerable to password-guessing attacks. CCE-82066-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_maxrepeat='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxrepeat") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxrepeat" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^maxrepeat\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^maxrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-82066-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41124,6 +41199,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_maxrepeat='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^maxrepeat") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_maxrepeat" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^maxrepeat\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^maxrepeat\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-82066-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41220,7 +41331,7 @@ differing categories of characters when changing passwords.PR.AC-7 SRG-OS-000072-GPOS-00040 RHEL-08-020160 - 5.5.1 + 4.4.3.2.3 SV-230362r858781_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts @@ -41234,42 +41345,6 @@ Requiring a minimum number of character categories makes password guessing attac by ensuring a larger search space. CCE-82046-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_minclass='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minclass") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minclass" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^minclass\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^minclass\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-82046-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41313,6 +41388,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_minclass='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minclass") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minclass" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^minclass\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^minclass\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-82046-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41401,7 +41512,7 @@ after pam_pwquality to set minimum password length requirements.8.3.6 SRG-OS-000078-GPOS-00046 RHEL-08-020230 - 5.5.1 + 4.4.3.2.2 SV-230369r858785_rule The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. @@ -41414,42 +41525,6 @@ helps to exponentially increase the time and/or resources required to compromise the password. CCE-80656-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_minlen='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minlen") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minlen" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^minlen\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^minlen\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80656-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -41499,6 +41574,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_minlen='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^minlen") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_minlen" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^minlen\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^minlen\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80656-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -41588,6 +41699,7 @@ to require use of a special character in passwords. FMT_SMF_EXT.1 SRG-OS-000266-GPOS-00101 RHEL-08-020280 + 4.4.3.2.3 SV-230375r858787_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of @@ -41601,6 +41713,50 @@ Requiring a minimum number of special characters makes password guessing attacks more difficult by ensuring a larger search space. CCE-80663-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80663-8 + - DISA-STIG-RHEL-08-020280 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-5(1)(a) + - NIST-800-53-IA-5(4) + - NIST-800-53-IA-5(c) + - accounts_password_pam_ocredit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_password_pam_ocredit # promote to variable + set_fact: + var_password_pam_ocredit: !!str + tags: + - always + +- name: Ensure PAM Enforces Password Requirements - Minimum Special Characters - Ensure + PAM variable ocredit is set accordingly + ansible.builtin.lineinfile: + create: true + dest: /etc/security/pwquality.conf + regexp: ^#?\s*ocredit + line: ocredit = {{ var_password_pam_ocredit }} + when: '"pam" in ansible_facts.packages' + tags: + - CCE-80663-8 + - DISA-STIG-RHEL-08-020280 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-5(1)(a) + - NIST-800-53-IA-5(4) + - NIST-800-53-IA-5(c) + - accounts_password_pam_ocredit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then @@ -41636,50 +41792,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80663-8 - - DISA-STIG-RHEL-08-020280 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-5(1)(a) - - NIST-800-53-IA-5(4) - - NIST-800-53-IA-5(c) - - accounts_password_pam_ocredit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_password_pam_ocredit # promote to variable - set_fact: - var_password_pam_ocredit: !!str - tags: - - always - -- name: Ensure PAM Enforces Password Requirements - Minimum Special Characters - Ensure - PAM variable ocredit is set accordingly - ansible.builtin.lineinfile: - create: true - dest: /etc/security/pwquality.conf - regexp: ^#?\s*ocredit - line: ocredit = {{ var_password_pam_ocredit }} - when: '"pam" in ansible_facts.packages' - tags: - - CCE-80663-8 - - DISA-STIG-RHEL-08-020280 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-5(1)(a) - - NIST-800-53-IA-5(4) - - NIST-800-53-IA-5(c) - - accounts_password_pam_ocredit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -41705,68 +41817,6 @@ Edit the password section in makes the system less prone to dictionary attacks. CCE-85877-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwquality.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwquality.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwquality.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" - else - LAST_MATCH_LINE=$(grep -nP "^account.*required.*pam_permit\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) - if [ ! -z $LAST_MATCH_LINE ]; then - sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwquality.so' "$PAM_FILE_PATH" - else - echo 'password '"requisite"' pam_pwquality.so' >> "$PAM_FILE_PATH" - fi - fi -fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -42026,32 +42076,11 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure PAM password complexity module is enabled in system-auth - To enable PAM password complexity in system-auth file: -Edit the password section in -/etc/pam.d/system-auth to show -password requisite pam_pwquality.so. - CCI-000366 - SRG-OS-000480-GPOS-00227 - RHEL-08-020101 - SV-251713r902740_rule - Enabling PAM password complexity permits to enforce strong passwords and consequently -makes the system less prone to dictionary attacks. - - CCE-85872-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -42078,7 +42107,7 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -42102,13 +42131,34 @@ fi authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure PAM password complexity module is enabled in system-auth + To enable PAM password complexity in system-auth file: +Edit the password section in +/etc/pam.d/system-auth to show +password requisite pam_pwquality.so. + CCI-000366 + SRG-OS-000480-GPOS-00227 + RHEL-08-020101 + SV-251713r902740_rule + Enabling PAM password complexity permits to enforce strong passwords and consequently +makes the system less prone to dictionary attacks. + + CCE-85872-0 - name: Gather the package facts package_facts: manager: auto @@ -42368,135 +42418,11 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session - To configure the number of retry prompts that are permitted per-session: - -Edit the /etc/security/pwquality.conf to include - -retry=, or a lower value if site -policy is more restrictive. The DoD requirement is a maximum of 3 prompts -per session. - 1 - 11 - 12 - 15 - 16 - 3 - 5 - 9 - 5.5.3 - BAI10.01 - BAI10.02 - BAI10.03 - BAI10.05 - DSS05.04 - DSS05.05 - DSS05.07 - DSS05.10 - DSS06.03 - DSS06.10 - CCI-000192 - CCI-000366 - 4.3.3.2.2 - 4.3.3.5.1 - 4.3.3.5.2 - 4.3.3.6.1 - 4.3.3.6.2 - 4.3.3.6.3 - 4.3.3.6.4 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.3.6.9 - 4.3.3.7.2 - 4.3.3.7.4 - 4.3.4.3.2 - 4.3.4.3.3 - SR 1.1 - SR 1.10 - SR 1.2 - SR 1.3 - SR 1.4 - SR 1.5 - SR 1.7 - SR 1.8 - SR 1.9 - SR 2.1 - SR 7.6 - A.12.1.2 - A.12.5.1 - A.12.6.2 - A.14.2.2 - A.14.2.3 - A.14.2.4 - A.18.1.4 - A.7.1.1 - A.9.2.1 - A.9.2.2 - A.9.2.3 - A.9.2.4 - A.9.2.6 - A.9.3.1 - A.9.4.2 - A.9.4.3 - CM-6(a) - AC-7(a) - IA-5(4) - PR.AC-1 - PR.AC-6 - PR.AC-7 - PR.IP-1 - FMT_MOF_EXT.1 - SRG-OS-000069-GPOS-00037 - SRG-OS-000480-GPOS-00227 - RHEL-08-020104 - 5.5.1 - SV-251716r858737_rule - Setting the password retry prompts that are permitted on a per-session basis to a low value -requires some software, such as SSH, to re-connect. This can slow down and -draw additional attention to some types of password-guessing attacks. Note that this -is different from account lockout, which is provided by the pam_faillock module. - - CCE-80664-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then -var_password_pam_retry='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^retry") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_retry" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^retry\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^retry\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80664-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - - if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -42523,59 +42449,24 @@ fi authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b fi - -if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" -fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - - if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile + if ! grep -qP '^\s*password\s+'"requisite"'\s+pam_pwquality.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_pwquality.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_pwquality.so.*)/\1'"requisite"' \2/' "$PAM_FILE_PATH" + else + LAST_MATCH_LINE=$(grep -nP "^account.*required.*pam_permit\.so" "$PAM_FILE_PATH" | tail -n 1 | cut -d: -f 1) + if [ ! -z $LAST_MATCH_LINE ]; then + sed -i --follow-symlinks $LAST_MATCH_LINE' a password '"requisite"' pam_pwquality.so' "$PAM_FILE_PATH" + else + echo 'password '"requisite"' pam_pwquality.so' >> "$PAM_FILE_PATH" fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b fi - -if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" fi if [ -f /usr/bin/authselect ]; then @@ -42589,6 +42480,105 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session + To configure the number of retry prompts that are permitted per-session: + +Edit the /etc/security/pwquality.conf to include + +retry=, or a lower value if site +policy is more restrictive. The DoD requirement is a maximum of 3 prompts +per session. + 1 + 11 + 12 + 15 + 16 + 3 + 5 + 9 + 5.5.3 + BAI10.01 + BAI10.02 + BAI10.03 + BAI10.05 + DSS05.04 + DSS05.05 + DSS05.07 + DSS05.10 + DSS06.03 + DSS06.10 + CCI-000192 + CCI-000366 + 4.3.3.2.2 + 4.3.3.5.1 + 4.3.3.5.2 + 4.3.3.6.1 + 4.3.3.6.2 + 4.3.3.6.3 + 4.3.3.6.4 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.3.6.9 + 4.3.3.7.2 + 4.3.3.7.4 + 4.3.4.3.2 + 4.3.4.3.3 + SR 1.1 + SR 1.10 + SR 1.2 + SR 1.3 + SR 1.4 + SR 1.5 + SR 1.7 + SR 1.8 + SR 1.9 + SR 2.1 + SR 7.6 + A.12.1.2 + A.12.5.1 + A.12.6.2 + A.14.2.2 + A.14.2.3 + A.14.2.4 + A.18.1.4 + A.7.1.1 + A.9.2.1 + A.9.2.2 + A.9.2.3 + A.9.2.4 + A.9.2.6 + A.9.3.1 + A.9.4.2 + A.9.4.3 + CM-6(a) + AC-7(a) + IA-5(4) + PR.AC-1 + PR.AC-6 + PR.AC-7 + PR.IP-1 + FMT_MOF_EXT.1 + SRG-OS-000069-GPOS-00037 + SRG-OS-000480-GPOS-00227 + RHEL-08-020104 + 4.4.3.3.1 + SV-251716r858737_rule + Setting the password retry prompts that are permitted on a per-session basis to a low value +requires some software, such as SSH, to re-connect. This can slow down and +draw additional attention to some types of password-guessing attacks. Note that this +is different from account lockout, which is provided by the pam_faillock module. + + CCE-80664-6 - name: Gather the package facts package_facts: manager: auto @@ -43047,6 +43037,128 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_retry='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^retry") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_retry" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^retry\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^retry\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80664-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + + if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + +if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" +fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/password-auth was not found" >&2 +fi + + if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + +if grep -qP '^\s*password\s+'".*"'\s+pam_pwquality.so\s.*\bretry\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks 's/(.*password.*'".*"'.*pam_pwquality.so.*)\sretry=?[[:alnum:]]*(.*)/\1\2/g' "$PAM_FILE_PATH" +fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43137,6 +43249,7 @@ length credit for each uppercase character. Modify the ucreditSRG-OS-000069-GPOS-00037 SRG-OS-000070-GPOS-00038 RHEL-08-020110 + 4.4.3.2.3 SV-230357r858771_rule Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts @@ -43147,42 +43260,6 @@ complex the password, the greater the number of possible combinations that need the password is compromised. CCE-80665-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_ucredit='' - - - - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ucredit") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_ucredit" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^ucredit\\>" "/etc/security/pwquality.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^ucredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" -else - if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" - fi - cce="CCE-80665-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" - printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43228,6 +43305,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_ucredit='' + + + + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ucredit") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_password_pam_ucredit" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^ucredit\\>" "/etc/security/pwquality.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^ucredit\\>.*/$escaped_formatted_output/gi" "/etc/security/pwquality.conf" +else + if [[ -s "/etc/security/pwquality.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/security/pwquality.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/security/pwquality.conf" + fi + cce="CCE-80665-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/security/pwquality.conf" >> "/etc/security/pwquality.conf" + printf '%s\n' "$formatted_output" >> "/etc/security/pwquality.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43310,6 +43423,7 @@ algorithm for password hashing: Req-8.2.1 8.3.2 SRG-OS-000073-GPOS-00041 + 4.5.1.1 Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords that @@ -43323,26 +43437,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-80891-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q libuser; then - -LIBUSER_CONF="/etc/libuser.conf" -CRYPT_STYLE_REGEX='[[:space:]]*\[defaults](.*(\n)+)+?[[:space:]]*crypt_style[[:space:]]*' - -# Try find crypt_style in [defaults] section. If it is here, then change algorithm to sha512. -# If it isn't here, then add it to [defaults] section. -if grep -qzosP $CRYPT_STYLE_REGEX $LIBUSER_CONF ; then - sed -i "s/\(crypt_style[[:space:]]*=[[:space:]]*\).*/\1sha512/g" $LIBUSER_CONF -elif grep -qs "\[defaults]" $LIBUSER_CONF ; then - sed -i "/[[:space:]]*\[defaults]/a crypt_style = sha512" $LIBUSER_CONF -else - echo -e "[defaults]\ncrypt_style = sha512" >> $LIBUSER_CONF -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43386,6 +43480,26 @@ fi - no_reboot_needed - restrict_strategy - set_password_hashing_algorithm_libuserconf + + # Remediation is applicable only in certain platforms +if rpm --quiet -q libuser; then + +LIBUSER_CONF="/etc/libuser.conf" +CRYPT_STYLE_REGEX='[[:space:]]*\[defaults](.*(\n)+)+?[[:space:]]*crypt_style[[:space:]]*' + +# Try find crypt_style in [defaults] section. If it is here, then change algorithm to sha512. +# If it isn't here, then add it to [defaults] section. +if grep -qzosP $CRYPT_STYLE_REGEX $LIBUSER_CONF ; then + sed -i "s/\(crypt_style[[:space:]]*=[[:space:]]*\).*/\1sha512/g" $LIBUSER_CONF +elif grep -qs "\[defaults]" $LIBUSER_CONF ; then + sed -i "/[[:space:]]*\[defaults]/a crypt_style = sha512" $LIBUSER_CONF +else + echo -e "[defaults]\ncrypt_style = sha512" >> $LIBUSER_CONF +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43461,7 +43575,7 @@ the system will use 8.3.2 SRG-OS-000073-GPOS-00041 RHEL-08-010110 - 5.5.4 + 4.5.1.1 SV-230231r877397_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords @@ -43470,37 +43584,6 @@ that are encrypted with a weak algorithm are no more protected than if they are Using a stronger hashing algorithm makes password cracking attacks more difficult. CCE-80892-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_password_hashing_algorithm='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ENCRYPT_METHOD") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_password_hashing_algorithm" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^ENCRYPT_METHOD\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^ENCRYPT_METHOD\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80892-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -43550,6 +43633,37 @@ fi - no_reboot_needed - restrict_strategy - set_password_hashing_algorithm_logindefs + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_password_hashing_algorithm='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^ENCRYPT_METHOD") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_password_hashing_algorithm" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^ENCRYPT_METHOD\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^ENCRYPT_METHOD\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80892-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -43638,7 +43752,7 @@ the default. SRG-OS-000073-GPOS-00041 SRG-OS-000120-GPOS-00061 RHEL-08-010160 - 5.5.4 + 4.4.3.4.3 SV-230237r809276_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can @@ -43653,67 +43767,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-85945-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -44010,6 +44063,67 @@ fi - medium_severity - no_reboot_needed - set_password_hashing_algorithm_passwordauth + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/password-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44098,7 +44212,7 @@ the default. SRG-OS-000073-GPOS-00041 SRG-OS-000120-GPOS-00061 RHEL-08-010159 - 5.5.4 + 4.4.3.4.3 SV-244524r809331_rule Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can @@ -44113,67 +44227,6 @@ of a strong hashing algorithm that makes password cracking attacks more difficult. CCE-80893-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/system-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -44468,6 +44521,67 @@ fi - medium_severity - no_reboot_needed - set_password_hashing_algorithm_systemauth + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\ssha512\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ sha512/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44500,23 +44614,6 @@ they are kept in plain text. Using more hashing rounds makes password cracking attacks more difficult. CCE-89707-4 - -if [ -e "/etc/login.defs" ] ; then - - LC_ALL=C sed -i "/^\s*SHA_CRYPT_MIN_ROUNDS\s*/Id" "/etc/login.defs" -else - printf '%s\n' "Path '/etc/login.defs' wasn't found on this system. Refusing to continue." >&2 - return 1 -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/login.defs" - -cp "/etc/login.defs" "/etc/login.defs.bak" -# Insert at the end of the file -printf '%s\n' "SHA_CRYPT_MIN_ROUNDS 5000" >> "/etc/login.defs" -# Clean up after ourselves. -rm "/etc/login.defs.bak" - - name: Set Password Hashing Rounds in /etc/login.defs - Ensure SHA_CRYPT_MIN_ROUNDS has Minimum Value of 5000 ansible.builtin.replace: @@ -44550,6 +44647,23 @@ rm "/etc/login.defs.bak" - no_reboot_needed - restrict_strategy - set_password_hashing_min_rounds_logindefs + + +if [ -e "/etc/login.defs" ] ; then + + LC_ALL=C sed -i "/^\s*SHA_CRYPT_MIN_ROUNDS\s*/Id" "/etc/login.defs" +else + printf '%s\n' "Path '/etc/login.defs' wasn't found on this system. Refusing to continue." >&2 + return 1 +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/login.defs" + +cp "/etc/login.defs" "/etc/login.defs.bak" +# Insert at the end of the file +printf '%s\n' "SHA_CRYPT_MIN_ROUNDS 5000" >> "/etc/login.defs" +# Clean up after ourselves. +rm "/etc/login.defs.bak" @@ -44617,52 +44731,6 @@ The debug-shell service can be disabled with the followin on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. CCE-80876-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - enabled: false - name: debug-shell.service - - include disable_debug-shell - -class disable_debug-shell { - service {'debug-shell': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'debug-shell.service' -"$SYSTEMCTL_EXEC" disable 'debug-shell.service' -"$SYSTEMCTL_EXEC" mask 'debug-shell.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files debug-shell.socket; then - "$SYSTEMCTL_EXEC" stop 'debug-shell.socket' - "$SYSTEMCTL_EXEC" mask 'debug-shell.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'debug-shell.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["debug-shell"] - - name: Block Disable service debug-shell block: @@ -44732,6 +44800,52 @@ disabled = ["debug-shell"] - medium_severity - no_reboot_needed - service_debug-shell_disabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - enabled: false + name: debug-shell.service + + +[customizations.services] +disabled = ["debug-shell"] + + include disable_debug-shell + +class disable_debug-shell { + service {'debug-shell': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'debug-shell.service' +"$SYSTEMCTL_EXEC" disable 'debug-shell.service' +"$SYSTEMCTL_EXEC" mask 'debug-shell.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files debug-shell.socket; then + "$SYSTEMCTL_EXEC" stop 'debug-shell.socket' + "$SYSTEMCTL_EXEC" mask 'debug-shell.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'debug-shell.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -44830,6 +44944,47 @@ the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-80784-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80784-2 + - DISA-STIG-RHEL-08-040172 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_burstaction + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + +- name: Disable Ctrl-Alt-Del Burst Action + lineinfile: + dest: /etc/systemd/system.conf + state: present + regexp: ^CtrlAltDelBurstAction + line: CtrlAltDelBurstAction=none + create: true + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"systemd" in ansible_facts.packages' + tags: + - CCE-80784-2 + - DISA-STIG-RHEL-08-040172 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_burstaction + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -44873,47 +45028,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80784-2 - - DISA-STIG-RHEL-08-040172 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_burstaction - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - -- name: Disable Ctrl-Alt-Del Burst Action - lineinfile: - dest: /etc/systemd/system.conf - state: present - regexp: ^CtrlAltDelBurstAction - line: CtrlAltDelBurstAction=none - create: true - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"systemd" in ansible_facts.packages' - tags: - - CCE-80784-2 - - DISA-STIG-RHEL-08-040172 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_burstaction - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed @@ -45010,6 +45124,26 @@ can reboot the system. If accidentally pressed, as could happen in the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. CCE-80785-9 + - name: Disable Ctrl-Alt-Del Reboot Activation + systemd: + name: ctrl-alt-del.target + force: true + masked: true + state: stopped + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80785-9 + - DISA-STIG-RHEL-08-040170 + - NIST-800-171-3.4.5 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_ctrlaltdel_reboot + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -45031,26 +45165,6 @@ systemctl mask --now ctrl-alt-del.target else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable Ctrl-Alt-Del Reboot Activation - systemd: - name: ctrl-alt-del.target - force: true - masked: true - state: stopped - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80785-9 - - DISA-STIG-RHEL-08-040170 - - NIST-800-171-3.4.5 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_ctrlaltdel_reboot - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed @@ -45164,40 +45278,6 @@ It is also required to change the runtime configuration, run: or other services, weakening system security. CCE-80826-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -# Verify that Interactive Boot is Disabled in /etc/default/grub -CONFIRM_SPAWN_YES="systemd.confirm_spawn\(=\(1\|yes\|true\|on\)\|\b\)" -CONFIRM_SPAWN_NO="systemd.confirm_spawn=no" - -if grep -q "\(GRUB_CMDLINE_LINUX\|GRUB_CMDLINE_LINUX_DEFAULT\)" /etc/default/grub -then - sed -i "s/${CONFIRM_SPAWN_YES}/${CONFIRM_SPAWN_NO}/" /etc/default/grub -fi - -# make sure GRUB_DISABLE_RECOVERY=true -if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then - # modify the GRUB command-line if an GRUB_DISABLE_RECOVERY= arg already exists - sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' /etc/default/grub -else - # no GRUB_DISABLE_RECOVERY=arg is present, append it to file - echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' -fi - - - -# Remove 'systemd.confirm_spawn' kernel argument also from runtime settings -/sbin/grubby --update-kernel=ALL --remove-args="systemd.confirm_spawn" - - -#Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn -grub2-mkconfig -o /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -45292,6 +45372,40 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +# Verify that Interactive Boot is Disabled in /etc/default/grub +CONFIRM_SPAWN_YES="systemd.confirm_spawn\(=\(1\|yes\|true\|on\)\|\b\)" +CONFIRM_SPAWN_NO="systemd.confirm_spawn=no" + +if grep -q "\(GRUB_CMDLINE_LINUX\|GRUB_CMDLINE_LINUX_DEFAULT\)" /etc/default/grub +then + sed -i "s/${CONFIRM_SPAWN_YES}/${CONFIRM_SPAWN_NO}/" /etc/default/grub +fi + +# make sure GRUB_DISABLE_RECOVERY=true +if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then + # modify the GRUB command-line if an GRUB_DISABLE_RECOVERY= arg already exists + sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' /etc/default/grub +else + # no GRUB_DISABLE_RECOVERY=arg is present, append it to file + echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' +fi + + + +# Remove 'systemd.confirm_spawn' kernel argument also from runtime settings +/sbin/grubby --update-kernel=ALL --remove-args="systemd.confirm_spawn" + + +#Regen grub.cfg handle updated GRUB_DISABLE_RECOVERY and confirm_spawn +grub2-mkconfig -o /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45405,39 +45519,13 @@ after Req-8.1.8 SRG-OS-000163-GPOS-00072 RHEL-08-020035 - SV-257258r917891_rule + SV-257258r942953_rule Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been let unattended. CCE-90784-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; [[ "$real" != "$expected" ]]; } ) || grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; }; then - -var_logind_session_timeout='' - - - -# Try find '[Login]' and 'StopIdleSessionSec' in '/etc/systemd/logind.conf', if it exists, set -# to '$var_logind_session_timeout', if it isn't here, add it, if '[Login]' doesn't exist, add it there -if grep -qzosP '[[:space:]]*\[Login]([^\n\[]*\n+)+?[[:space:]]*StopIdleSessionSec' '/etc/systemd/logind.conf'; then - - sed -i "s/StopIdleSessionSec[^(\n)]*/StopIdleSessionSec=$var_logind_session_timeout/" '/etc/systemd/logind.conf' -elif grep -qs '[[:space:]]*\[Login]' '/etc/systemd/logind.conf'; then - sed -i "/[[:space:]]*\[Login]/a StopIdleSessionSec=$var_logind_session_timeout" '/etc/systemd/logind.conf' -else - if test -d "/etc/systemd"; then - printf '%s\n' '[Login]' "StopIdleSessionSec=$var_logind_session_timeout" >> '/etc/systemd/logind.conf' - else - echo "Config file directory '/etc/systemd' doesnt exist, not remediating, assuming non-applicability." >&2 - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_logind_session_timeout # promote to variable set_fact: var_logind_session_timeout: !!str @@ -45478,6 +45566,32 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9.0"; [[ "$real" != "$expected" ]]; } ) || grep -qP "^ID=[\"']?ol[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.7"; printf "%s\n%s" "$expected" "$real" | sort -VC; }; }; then + +var_logind_session_timeout='' + + + +# Try find '[Login]' and 'StopIdleSessionSec' in '/etc/systemd/logind.conf', if it exists, set +# to '$var_logind_session_timeout', if it isn't here, add it, if '[Login]' doesn't exist, add it there +if grep -qzosP '[[:space:]]*\[Login]([^\n\[]*\n+)+?[[:space:]]*StopIdleSessionSec' '/etc/systemd/logind.conf'; then + + sed -i "s/StopIdleSessionSec[^(\n)]*/StopIdleSessionSec=$var_logind_session_timeout/" '/etc/systemd/logind.conf' +elif grep -qs '[[:space:]]*\[Login]' '/etc/systemd/logind.conf'; then + sed -i "/[[:space:]]*\[Login]/a StopIdleSessionSec=$var_logind_session_timeout" '/etc/systemd/logind.conf' +else + if test -d "/etc/systemd"; then + printf '%s\n' '[Login]' "StopIdleSessionSec=$var_logind_session_timeout" >> '/etc/systemd/logind.conf' + else + echo "Config file directory '/etc/systemd' doesnt exist, not remediating, assuming non-applicability." >&2 + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45613,25 +45727,6 @@ in /usr/lib/systemd/system/emergency.service. CCE-82186-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -service_file="/usr/lib/systemd/system/emergency.service" - - -sulogin="/usr/lib/systemd/systemd-sulogin-shell emergency" - - -if grep "^ExecStart=.*" "$service_file" ; then - sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" -else - echo "ExecStart=-$sulogin" >> "$service_file" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Require emergency mode password lineinfile: create: true @@ -45653,6 +45748,25 @@ fi - no_reboot_needed - require_emergency_target_auth - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +service_file="/usr/lib/systemd/system/emergency.service" + + +sulogin="/usr/lib/systemd/systemd-sulogin-shell emergency" + + +if grep "^ExecStart=.*" "$service_file" ; then + sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" +else + echo "ExecStart=-$sulogin" >> "$service_file" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45797,23 +45911,6 @@ in /usr/lib/systemd/system/rescue.service. CCE-80855-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -service_file="/usr/lib/systemd/system/rescue.service" - -sulogin="/usr/lib/systemd/systemd-sulogin-shell rescue" - -if grep "^ExecStart=.*" "$service_file" ; then - sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" -else - echo "ExecStart=-$sulogin" >> "$service_file" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Require single user mode password lineinfile: create: true @@ -45835,6 +45932,23 @@ fi - no_reboot_needed - require_singleuser_auth - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +service_file="/usr/lib/systemd/system/rescue.service" + +sulogin="/usr/lib/systemd/systemd-sulogin-shell rescue" + +if grep "^ExecStart=.*" "$service_file" ; then + sed -i "s%^ExecStart=.*%ExecStart=-$sulogin%" "$service_file" +else + echo "ExecStart=-$sulogin" >> "$service_file" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -45921,8 +46035,27 @@ session lock. The tmux package allows for a session lock to be implemented and configured. CCE-80644-8 - -package --add=tmux + - name: Ensure tmux is installed + package: + name: tmux + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80644-8 + - DISA-STIG-RHEL-08-020039 + - NIST-800-171-3.1.10 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_tmux_installed + + +[[packages]] +name = "tmux" +version = "*" include install_tmux @@ -45931,6 +46064,9 @@ class install_tmux { ensure => 'installed', } } + + +package --add=tmux # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -45942,28 +46078,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "tmux" -version = "*" - - - name: Ensure tmux is installed - package: - name: tmux - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80644-8 - - DISA-STIG-RHEL-08-020039 - - NIST-800-171-3.1.10 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_tmux_installed @@ -45992,24 +46106,6 @@ immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. CCE-82266-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then - cat >> /etc/profile.d/tmux.sh <<'EOF' -if [ "$PS1" ]; then - parent=$(ps -o ppid= -p $$) - name=$(ps -o comm= -p $parent) - case "$name" in sshd|login) exec tmux ;; esac -fi -EOF - chmod 0644 /etc/profile.d/tmux.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46083,6 +46179,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then + cat >> /etc/profile.d/tmux.sh <<'EOF' +if [ "$PS1" ]; then + parent=$(ps -o ppid= -p $$) + name=$(ps -o comm= -p $parent) + case "$name" in sshd|login) exec tmux ;; esac +fi +EOF + chmod 0644 /etc/profile.d/tmux.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46112,24 +46226,6 @@ immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. CCE-90782-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -if ! grep -x ' case "$name" in (sshd|login) tmux ;; esac' /etc/bashrc /etc/profile.d/*.sh; then - cat >> /etc/profile.d/tmux.sh <<'EOF' -if [ "$PS1" ]; then - parent=$(ps -o ppid= -p $$) - name=$(ps -o comm= -p $parent) - case "$name" in (sshd|login) tmux ;; esac -fi -EOF - chmod 0644 /etc/profile.d/tmux.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46208,6 +46304,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +if ! grep -x ' case "$name" in (sshd|login) tmux ;; esac' /etc/bashrc /etc/profile.d/*.sh; then + cat >> /etc/profile.d/tmux.sh <<'EOF' +if [ "$PS1" ]; then + parent=$(ps -o ppid= -p $$) + name=$(ps -o comm= -p $parent) + case "$name" in (sshd|login) tmux ;; esac +fi +EOF + chmod 0644 /etc/profile.d/tmux.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46235,22 +46349,6 @@ or equal to 900 in /etc/tmux.conf. CCE-82199-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if grep -qP '^\s*set\s+-g\s+lock-after-time' "$tmux_conf" ; then - sed -i 's/^\s*set\s\+-g\s\+lock-after-time.*$/set -g lock-after-time 900/' "$tmux_conf" -else - echo "set -g lock-after-time 900" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46307,6 +46405,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if grep -qP '^\s*set\s+-g\s+lock-after-time' "$tmux_conf" ; then + sed -i 's/^\s*set\s\+-g\s\+lock-after-time.*$/set -g lock-after-time 900/' "$tmux_conf" +else + echo "set -g lock-after-time 900" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46341,22 +46455,6 @@ However, the session lock is implemented by an external command. The default configuration does not contain an effective session lock. CCE-80940-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if grep -qP '^\s*set\s+-g\s+lock-command' "$tmux_conf" ; then - sed -i 's/^\s*set\s\+-g\s\+lock-command.*$/set -g lock-command vlock/' "$tmux_conf" -else - echo "set -g lock-command vlock" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46419,6 +46517,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if grep -qP '^\s*set\s+-g\s+lock-command' "$tmux_conf" ; then + sed -i 's/^\s*set\s\+-g\s\+lock-command.*$/set -g lock-command vlock/' "$tmux_conf" +else + echo "set -g lock-command vlock" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46445,20 +46559,6 @@ However, the session lock is implemented by an external command. The default configuration does not contain an effective session lock. CCE-86135-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then - -tmux_conf="/etc/tmux.conf" - -if ! grep -qP '^\s*bind\s+\w\s+lock-session' "$tmux_conf" ; then - echo "bind X lock-session" >> "$tmux_conf" -fi -chmod 0644 "$tmux_conf" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -46536,6 +46636,20 @@ fi - low_disruption - low_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q tmux; }; then + +tmux_conf="/etc/tmux.conf" + +if ! grep -qP '^\s*bind\s+\w\s+lock-session' "$tmux_conf" ; then + echo "bind X lock-session" >> "$tmux_conf" +fi +chmod 0644 "$tmux_conf" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -46680,8 +46794,26 @@ providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80846-9 - -package --add=opensc + - name: Ensure opensc is installed + package: + name: opensc + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80846-9 + - DISA-STIG-RHEL-08-010410 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_opensc_installed + + +[[packages]] +name = "opensc" +version = "*" include install_opensc @@ -46690,6 +46822,9 @@ class install_opensc { ensure => 'installed', } } + + +package --add=opensc # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -46701,27 +46836,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "opensc" -version = "*" - - - name: Ensure opensc is installed - package: - name: opensc - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80846-9 - - DISA-STIG-RHEL-08-010410 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_opensc_installed @@ -46744,8 +46858,25 @@ $ sudo yum install pcsc-lite The pcsc-lite package must be installed if it is to be available for multifactor authentication using smartcards. CCE-80993-9 - -package --add=pcsc-lite + - name: Ensure pcsc-lite is installed + package: + name: pcsc-lite + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80993-9 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_pcsc-lite_installed + + +[[packages]] +name = "pcsc-lite" +version = "*" include install_pcsc-lite @@ -46754,6 +46885,9 @@ class install_pcsc-lite { ensure => 'installed', } } + + +package --add=pcsc-lite # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -46765,26 +46899,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "pcsc-lite" -version = "*" - - - name: Ensure pcsc-lite is installed - package: - name: pcsc-lite - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80993-9 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_pcsc-lite_installed @@ -46825,8 +46939,29 @@ as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-84029-8 - -package --add=openssl-pkcs11 + - name: Ensure openssl-pkcs11 is installed + package: + name: openssl-pkcs11 + state: present + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture != "s390x" + tags: + - CCE-84029-8 + - DISA-STIG-RHEL-08-010390 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-8.3 + - enable_strategy + - install_smartcard_packages + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + + +[[packages]] +name = "openssl-pkcs11" +version = "*" include install_openssl-pkcs11 @@ -46835,6 +46970,9 @@ class install_openssl-pkcs11 { ensure => 'installed', } } + + +package --add=openssl-pkcs11 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ! grep -q s390x /proc/sys/kernel/osrelease; }; then @@ -46846,30 +46984,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssl-pkcs11" -version = "*" - - - name: Ensure openssl-pkcs11 is installed - package: - name: openssl-pkcs11 - state: present - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture != "s390x" - tags: - - CCE-84029-8 - - DISA-STIG-RHEL-08-010390 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-8.3 - - enable_strategy - - install_smartcard_packages - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed @@ -46908,31 +47022,6 @@ providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80881-6 - include enable_pcscd - -class enable_pcscd { - service {'pcscd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'pcscd.service' -"$SYSTEMCTL_EXEC" start 'pcscd.service' -"$SYSTEMCTL_EXEC" enable 'pcscd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["pcscd"] - - name: Enable service pcscd block: @@ -46971,6 +47060,31 @@ enabled = ["pcscd"] - medium_severity - no_reboot_needed - service_pcscd_enabled + + +[customizations.services] +enabled = ["pcscd"] + + include enable_pcscd + +class enable_pcscd { + service {'pcscd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'pcscd.service' +"$SYSTEMCTL_EXEC" start 'pcscd.service' +"$SYSTEMCTL_EXEC" enable 'pcscd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47075,22 +47189,6 @@ that provided by a username and password combination. Smart cards leverage PKI Configuring the smart card driver in use by your organization helps to prevent users from using unauthorized smart cards. CCE-80766-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_smartcard_drivers='' - - -OPENSC_TOOL="/usr/bin/opensc-tool" - -if [ -f "${OPENSC_TOOL}" ]; then - ${OPENSC_TOOL} -S app:default:card_drivers:$var_smartcard_drivers -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_smartcard_drivers # promote to variable set_fact: var_smartcard_drivers: !!str @@ -47153,6 +47251,22 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_smartcard_drivers='' + + +OPENSC_TOOL="/usr/bin/opensc-tool" + +if [ -f "${OPENSC_TOOL}" ]; then + ${OPENSC_TOOL} -S app:default:card_drivers:$var_smartcard_drivers +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47254,22 +47368,6 @@ that provided by a username and password combination. Smart cards leverage PKI Forcing the smart card driver in use by your organization helps to prevent users from using unauthorized smart cards. CCE-80821-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_smartcard_drivers='' - - -OPENSC_TOOL="/usr/bin/opensc-tool" - -if [ -f "${OPENSC_TOOL}" ]; then - ${OPENSC_TOOL} -S app:default:force_card_driver:$var_smartcard_drivers -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_smartcard_drivers # promote to variable set_fact: var_smartcard_drivers: !!str @@ -47332,6 +47430,22 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_smartcard_drivers='' + + +OPENSC_TOOL="/usr/bin/opensc-tool" + +if [ -f "${OPENSC_TOOL}" ]; then + ${OPENSC_TOOL} -S app:default:force_card_driver:$var_smartcard_drivers +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -47608,13 +47722,62 @@ elapse until the account would be automatically disabled. See the 8.2.6 SRG-OS-000118-GPOS-00060 RHEL-08-020260 - 5.6.1.4 + 4.5.1.4 SV-230373r627750_rule Inactive identifiers pose a risk to systems and applications because attackers may exploit an inactive identifier and potentially obtain undetected access to the system. Disabling inactive accounts ensures that accounts which may not have been responsibly removed are not available to attackers who may have compromised their credentials. Owners of inactive accounts will not notice if unauthorized access to their user account has been obtained. CCE-80954-1 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80954-1 + - CJIS-5.6.2.1.1 + - DISA-STIG-RHEL-08-020260 + - NIST-800-171-3.5.6 + - NIST-800-53-AC-2(3) + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-4(e) + - PCI-DSS-Req-8.1.4 + - PCI-DSSv4-8.2.6 + - account_disable_post_pw_expiration + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable + set_fact: + var_account_disable_post_pw_expiration: !!str + tags: + - always + +- name: Set Account Expiration Following Inactivity + lineinfile: + create: true + dest: /etc/default/useradd + regexp: ^INACTIVE + line: INACTIVE={{ var_account_disable_post_pw_expiration }} + when: '"shadow-utils" in ansible_facts.packages' + tags: + - CCE-80954-1 + - CJIS-5.6.2.1.1 + - DISA-STIG-RHEL-08-020260 + - NIST-800-171-3.5.6 + - NIST-800-53-AC-2(3) + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-4(e) + - PCI-DSS-Req-8.1.4 + - PCI-DSSv4-8.2.6 + - account_disable_post_pw_expiration + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if rpm --quiet -q shadow-utils; then @@ -47646,55 +47809,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80954-1 - - CJIS-5.6.2.1.1 - - DISA-STIG-RHEL-08-020260 - - NIST-800-171-3.5.6 - - NIST-800-53-AC-2(3) - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-4(e) - - PCI-DSS-Req-8.1.4 - - PCI-DSSv4-8.2.6 - - account_disable_post_pw_expiration - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable - set_fact: - var_account_disable_post_pw_expiration: !!str - tags: - - always - -- name: Set Account Expiration Following Inactivity - lineinfile: - create: true - dest: /etc/default/useradd - regexp: ^INACTIVE - line: INACTIVE={{ var_account_disable_post_pw_expiration }} - when: '"shadow-utils" in ansible_facts.packages' - tags: - - CCE-80954-1 - - CJIS-5.6.2.1.1 - - DISA-STIG-RHEL-08-020260 - - NIST-800-171-3.5.6 - - NIST-800-53-AC-2(3) - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-4(e) - - PCI-DSS-Req-8.1.4 - - PCI-DSSv4-8.2.6 - - account_disable_post_pw_expiration - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -48069,7 +48183,7 @@ The profile requirement is 8.3.9 SRG-OS-000076-GPOS-00044 RHEL-08-020200 - 5.6.1.1 + 4.5.1.2 SV-230366r646878_rule Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime @@ -48082,37 +48196,6 @@ increases the risk of users writing down the password in a convenient location subject to physical compromise. CCE-80647-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_maximum_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MAX_DAYS") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_maximum_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MAX_DAYS\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MAX_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80647-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48161,6 +48244,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_maximum_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MAX_DAYS") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_maximum_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MAX_DAYS\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MAX_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80647-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48238,7 +48352,6 @@ The profile requirement is PR.AC-7 SRG-OS-000075-GPOS-00043 RHEL-08-020190 - 5.6.1.2 SV-230365r858727_rule Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If @@ -48250,37 +48363,6 @@ Setting the minimum password age protects against users cycling back to a favorite password after satisfying the password reuse requirement. CCE-80648-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_minimum_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_DAYS") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_minimum_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_DAYS\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80648-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48325,6 +48407,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_minimum_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_DAYS") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_minimum_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_DAYS\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_DAYS\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80648-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48427,37 +48540,6 @@ must be carefully weighed against usability problems, support costs, or counterp behavior that may result. CCE-80652-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_password_minlen_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_LEN") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_minlen_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_LEN\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_LEN\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80652-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48503,6 +48585,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_password_minlen_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_MIN_LEN") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_minlen_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_MIN_LEN\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_MIN_LEN\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80652-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -48524,7 +48637,7 @@ restriction by running the following command: 8.3.9 SRG-OS-000076-GPOS-00044 RHEL-08-020210 - 5.6.1.1 + 4.5.1.2 SV-230367r627750_rule Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does @@ -48532,16 +48645,6 @@ not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised. CCE-82473-0 - -var_accounts_maximum_age_login_defs='' - - -while IFS= read -r i; do - - chage -M $var_accounts_maximum_age_login_defs $i - -done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($5 > var || $5 == "")) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_maximum_age_login_defs # promote to variable set_fact: var_accounts_maximum_age_login_defs: !!str @@ -48586,6 +48689,16 @@ done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+ - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_maximum_age_login_defs='' + + +while IFS= read -r i; do + + chage -M $var_accounts_maximum_age_login_defs $i + +done < <(awk -v var="$var_accounts_maximum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($5 > var || $5 == "")) {print $1}' /etc/shadow) @@ -48607,7 +48720,6 @@ lifetime by running the following command: CM-6(a) SRG-OS-000075-GPOS-00043 RHEL-08-020180 - 5.6.1.2 SV-230364r627750_rule Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If @@ -48615,16 +48727,6 @@ users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse. CCE-82472-2 - -var_accounts_minimum_age_login_defs='' - - -while IFS= read -r i; do - - chage -m $var_accounts_minimum_age_login_defs $i - -done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($4 < var || $4 == "")) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_minimum_age_login_defs # promote to variable set_fact: var_accounts_minimum_age_login_defs: !!str @@ -48665,6 +48767,16 @@ done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+ - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_minimum_age_login_defs='' + + +while IFS= read -r i; do + + chage -m $var_accounts_minimum_age_login_defs $i + +done < <(awk -v var="$var_accounts_minimum_age_login_defs" -F: '(/^[^:]+:[^!*]/ && ($4 < var || $4 == "")) {print $1}' /etc/shadow) @@ -48687,19 +48799,11 @@ This profile requirement is IA-5(1)(d) CM-6(a) 8.3.9 - 5.6.1.3 + 4.5.1.3 Providing an advance warning that a password will be expiring gives users time to think of a secure password. Users caught unaware may choose a simple password or write it down where it may be discovered. CCE-86914-9 - -var_accounts_password_warn_age_login_defs='' - - -while IFS= read -r i; do - chage --warndays $var_accounts_password_warn_age_login_defs $i -done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(($6 < var || $6 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) - - name: XCCDF Value var_accounts_password_warn_age_login_defs # promote to variable set_fact: var_accounts_password_warn_age_login_defs: !!str @@ -48746,6 +48850,14 @@ done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(( - low_disruption - medium_severity - no_reboot_needed + + +var_accounts_password_warn_age_login_defs='' + + +while IFS= read -r i; do + chage --warndays $var_accounts_password_warn_age_login_defs $i +done < <(awk -v var="$var_accounts_password_warn_age_login_defs" -F: '(($6 < var || $6 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) @@ -48841,42 +48953,11 @@ The profile requirement is PR.AC-7 Req-8.2.4 8.3.9 - 5.6.1.3 + 4.5.1.3 Setting the password warning age enables users to make the change at a practical time. CCE-80671-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_password_warn_age_login_defs='' - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_WARN_AGE") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_warn_age_login_defs" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^PASS_WARN_AGE\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^PASS_WARN_AGE\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-80671-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -48922,6 +49003,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_password_warn_age_login_defs='' + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^PASS_WARN_AGE") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_password_warn_age_login_defs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^PASS_WARN_AGE\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^PASS_WARN_AGE\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-80671-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -49010,18 +49122,10 @@ to be automatically disabled by running the following command: Req-8.1.4 8.2.6 SRG-OS-000118-GPOS-00060 - 5.6.1.4 + 4.5.1.4 Inactive accounts pose a threat to system security since the users are not logging in to notice failed login attempts or other anomalies. CCE-86758-0 - -var_account_disable_post_pw_expiration='' - - -while IFS= read -r i; do - chage --inactive $var_account_disable_post_pw_expiration $i -done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 > var || $7 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) - - name: XCCDF Value var_account_disable_post_pw_expiration # promote to variable set_fact: var_account_disable_post_pw_expiration: !!str @@ -49068,6 +49172,14 @@ done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 - medium_severity - no_reboot_needed - restrict_strategy + + +var_account_disable_post_pw_expiration='' + + +while IFS= read -r i; do + chage --inactive $var_account_disable_post_pw_expiration $i +done < <(awk -v var="$var_account_disable_post_pw_expiration" -F: '(($7 > var || $7 == "") && $2 ~ /^\$/) {print $1}' /etc/shadow) @@ -49214,7 +49326,7 @@ protecting passwords. If passwords are not encrypted, they can be plainly read All users should have a password change date in the past. Automatic remediation is not available, in order to avoid any system disruption. 8.3.5 - 5.6.1.5 + 4.5.1.5 If a user recorded password change date is in the future then they could bypass any set password expiration. @@ -49243,73 +49355,6 @@ but requires more CPU resources to authenticate users. Using a higher number of rounds makes password cracking attacks more difficult. CCE-83403-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_password_pam_unix_rounds='' - - - -if [ -e "/etc/pam.d/password-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/password-auth" - if [ -f /usr/bin/authselect ]; then - - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - - CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') - # If not already in use, a custom profile is created preserving the enabled features. - if [[ ! $CURRENT_PROFILE == custom/* ]]; then - ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') - authselect create-profile hardening -b $CURRENT_PROFILE - CURRENT_PROFILE="custom/hardening" - - authselect apply-changes -b --backup=before-hardening-custom-profile - authselect select $CURRENT_PROFILE - for feature in $ENABLED_FEATURES; do - authselect enable-feature $feature; - done - - authselect apply-changes -b --backup=after-hardening-custom-profile - fi - PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") - PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" - - authselect apply-changes -b - fi - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" - else - echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" - fi - fi - # Check the option - if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\srounds\b' "$PAM_FILE_PATH"; then - sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ rounds='"$var_password_pam_unix_rounds"'/' "$PAM_FILE_PATH" - else - sed -i -E --follow-symlinks 's/(\s*password\s+'"sufficient"'\s+pam_unix.so\s+.*)('"rounds"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_rounds"' \3/' "$PAM_FILE_PATH" - fi - if [ -f /usr/bin/authselect ]; then - - authselect apply-changes -b - fi -else - echo "/etc/pam.d/password-auth was not found" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -49602,39 +49647,15 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - - Set number of Password Hashing Rounds - system-auth - Configure the number or rounds for the password hashing algorithm. This can be -accomplished by using the rounds option for the pam_unix PAM module. - -In file /etc/pam.d/system-auth append rounds= -to the pam_unix.so entry, as shown below: -password sufficient pam_unix.so ...existing_options... rounds= -The system's default number of rounds is 5000. - Setting a high number of hashing rounds makes it more difficult to brute force the password, -but requires more CPU resources to authenticate users. - BP28(R68) - CCI-000196 - SRG-OS-000073-GPOS-00041 - Using a higher number of rounds makes password cracking attacks more difficult. - - CCE-83386-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q pam; then var_password_pam_unix_rounds='' -if [ -e "/etc/pam.d/system-auth" ] ; then - PAM_FILE_PATH="/etc/pam.d/system-auth" + +if [ -e "/etc/pam.d/password-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/password-auth" if [ -f /usr/bin/authselect ]; then if ! authselect check; then @@ -49661,7 +49682,7 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b --backup=after-hardening-custom-profile fi - PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_NAME=$(basename "/etc/pam.d/password-auth") PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" authselect apply-changes -b @@ -49686,13 +49707,38 @@ if [ -e "/etc/pam.d/system-auth" ] ; then authselect apply-changes -b fi else - echo "/etc/pam.d/system-auth was not found" >&2 + echo "/etc/pam.d/password-auth was not found" >&2 fi else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Set number of Password Hashing Rounds - system-auth + Configure the number or rounds for the password hashing algorithm. This can be +accomplished by using the rounds option for the pam_unix PAM module. + +In file /etc/pam.d/system-auth append rounds= +to the pam_unix.so entry, as shown below: +password sufficient pam_unix.so ...existing_options... rounds= +The system's default number of rounds is 5000. + Setting a high number of hashing rounds makes it more difficult to brute force the password, +but requires more CPU resources to authenticate users. + BP28(R68) + CCI-000196 + SRG-OS-000073-GPOS-00041 + Using a higher number of rounds makes password cracking attacks more difficult. + + CCE-83386-3 - name: Gather the package facts package_facts: manager: auto @@ -49984,6 +50030,72 @@ fi - medium_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_password_pam_unix_rounds='' + + +if [ -e "/etc/pam.d/system-auth" ] ; then + PAM_FILE_PATH="/etc/pam.d/system-auth" + if [ -f /usr/bin/authselect ]; then + + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + + CURRENT_PROFILE=$(authselect current -r | awk '{ print $1 }') + # If not already in use, a custom profile is created preserving the enabled features. + if [[ ! $CURRENT_PROFILE == custom/* ]]; then + ENABLED_FEATURES=$(authselect current | tail -n+3 | awk '{ print $2 }') + authselect create-profile hardening -b $CURRENT_PROFILE + CURRENT_PROFILE="custom/hardening" + + authselect apply-changes -b --backup=before-hardening-custom-profile + authselect select $CURRENT_PROFILE + for feature in $ENABLED_FEATURES; do + authselect enable-feature $feature; + done + + authselect apply-changes -b --backup=after-hardening-custom-profile + fi + PAM_FILE_NAME=$(basename "/etc/pam.d/system-auth") + PAM_FILE_PATH="/etc/authselect/$CURRENT_PROFILE/$PAM_FILE_NAME" + + authselect apply-changes -b + fi + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*' "$PAM_FILE_PATH"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*password\s+.*\s+pam_unix.so\s*' "$PAM_FILE_PATH")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*password\s+).*(\bpam_unix.so.*)/\1'"sufficient"' \2/' "$PAM_FILE_PATH" + else + echo 'password '"sufficient"' pam_unix.so' >> "$PAM_FILE_PATH" + fi + fi + # Check the option + if ! grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s*.*\srounds\b' "$PAM_FILE_PATH"; then + sed -i -E --follow-symlinks '/\s*password\s+'"sufficient"'\s+pam_unix.so.*/ s/$/ rounds='"$var_password_pam_unix_rounds"'/' "$PAM_FILE_PATH" + else + sed -i -E --follow-symlinks 's/(\s*password\s+'"sufficient"'\s+pam_unix.so\s+.*)('"rounds"'=)[[:alnum:]]+\s*(.*)/\1\2'"$var_password_pam_unix_rounds"' \3/' "$PAM_FILE_PATH" + fi + if [ -f /usr/bin/authselect ]; then + + authselect apply-changes -b + fi +else + echo "/etc/pam.d/system-auth was not found" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50196,7 +50308,9 @@ a container anyway. SRG-OS-000480-GPOS-00227 RHEL-08-020331 RHEL-08-020332 - 5.4.1 + 4.4.2.1 + 4.4.2.5 + 4.4.3.4.1 SV-244540r743869_rule SV-244541r743872_rule If an account has an empty password, anyone could log in and @@ -50204,64 +50318,6 @@ run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments. CCE-80841-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A - mode: 0644 - path: /etc/pam.d/password-auth - overwrite: true - - contents: - source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A - mode: 0644 - path: /etc/pam.d/system-auth - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then -echo " -authselect integrity check failed. Remediation aborted! -This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. -It is not recommended to manually edit the PAM files when authselect tool is available. -In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." -exit 1 -fi -authselect enable-feature without-nullok - -authselect apply-changes -b -else - -if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" -fi - -if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" -fi - -if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then - sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" -fi - -if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then - sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" -fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Prevent Login to Accounts With Empty Password - Check if system relies on authselect ansible.builtin.stat: @@ -50389,6 +50445,64 @@ fi - medium_disruption - no_empty_passwords - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A + mode: 0644 + path: /etc/pam.d/password-auth + overwrite: true + - contents: + source: data:,%23%20Generated%20by%20authselect%20on%20Sat%20Oct%2027%2014%3A59%3A36%202018%0A%23%20Do%20not%20modify%20this%20file%20manually.%0A%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_env.so%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_faildelay.so%20delay%3D2000000%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_fprintd.so%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet%0Aauth%20%20%20%20%20%20%20%20%5Bdefault%3D1%20ignore%3Dignore%20success%3Dok%5D%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20try_first_pass%0Aauth%20%20%20%20%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3E%3D%201000%20quiet_success%0Aauth%20%20%20%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20forward_pass%0Aauth%20%20%20%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_localuser.so%0Aaccount%20%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20uid%20%3C%201000%20quiet%0Aaccount%20%20%20%20%20%5Bdefault%3Dbad%20success%3Dok%20user_unknown%3Dignore%5D%20pam_sss.so%0Aaccount%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_permit.so%0A%0Apassword%20%20%20%20requisite%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_pwquality.so%20try_first_pass%20local_users_only%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%20sha512%20shadow%20try_first_pass%20use_authtok%0Apassword%20%20%20%20sufficient%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%20use_authtok%0Apassword%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_deny.so%0A%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_keyinit.so%20revoke%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_limits.so%0A-session%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_systemd.so%0Asession%20%20%20%20%20%5Bsuccess%3D1%20default%3Dignore%5D%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_succeed_if.so%20service%20in%20crond%20quiet%20use_uid%0Asession%20%20%20%20%20required%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_unix.so%0Asession%20%20%20%20%20optional%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20pam_sss.so%0A + mode: 0644 + path: /etc/pam.d/system-auth + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then +echo " +authselect integrity check failed. Remediation aborted! +This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. +It is not recommended to manually edit the PAM files when authselect tool is available. +In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." +exit 1 +fi +authselect enable-feature without-nullok + +authselect apply-changes -b +else + +if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" +fi + +if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/system-auth" +fi + +if grep -qP '^\s*auth\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then + sed -i -E --follow-symlinks 's/(.*auth.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" +fi + +if grep -qP '^\s*password\s+'"sufficient"'\s+pam_unix.so\s.*\bnullok\b' "/etc/pam.d/password-auth"; then + sed -i -E --follow-symlinks 's/(.*password.*'"sufficient"'.*pam_unix.so.*)\snullok=?[[:alnum:]]*(.*)/\1\2/g' "/etc/pam.d/password-auth" +fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50423,20 +50537,6 @@ run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments. CCE-85953-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -readarray -t users_with_empty_pass < <(sudo awk -F: '!$2 {print $1}' /etc/shadow) - -for user_with_empty_pass in "${users_with_empty_pass[@]}" -do - passwd -l $user_with_empty_pass -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Collect users with no password command: | awk -F: '!$2 {print $1}' /etc/shadow @@ -50474,6 +50574,20 @@ fi - no_empty_passwords_etc_shadow - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +readarray -t users_with_empty_pass < <(sudo awk -F: '!$2 {print $1}' /etc/shadow) + +for user_with_empty_pass in "${users_with_empty_pass[@]}" +do + passwd -l $user_with_empty_pass +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -50506,13 +50620,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-83389-7 - -if grep -q '^\+' /etc/group; then -# backup old file to /etc/group- - cp /etc/group /etc/group- - sed -i '/^\+.*$/d' /etc/group -fi - - name: Ensure there are no legacy + NIS entries in /etc/group - Backup the Old /etc/group File ansible.builtin.copy: @@ -50542,6 +50649,13 @@ fi - no_legacy_plus_entries_etc_group - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/group; then +# backup old file to /etc/group- + cp /etc/group /etc/group- + sed -i '/^\+.*$/d' /etc/group +fi @@ -50558,13 +50672,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-82890-5 - -if grep -q '^\+' /etc/passwd; then -# backup old file to /etc/passwd- - cp /etc/passwd /etc/passwd- - sed -i '/^\+.*$/d' /etc/passwd -fi - - name: Ensure there are no legacy + NIS entries in /etc/passwd - Backup the Old /etc/passwd File ansible.builtin.copy: @@ -50594,6 +50701,13 @@ fi - no_legacy_plus_entries_etc_passwd - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/passwd; then +# backup old file to /etc/passwd- + cp /etc/passwd /etc/passwd- + sed -i '/^\+.*$/d' /etc/passwd +fi @@ -50610,13 +50724,6 @@ entries from a network information service (NIS) should be directly inserted. CCE-84290-6 - -if grep -q '^\+' /etc/shadow; then -# backup old file to /etc/shadow- - cp /etc/shadow /etc/shadow- - sed -i '/^\+.*$/d' /etc/shadow -fi - - name: Ensure there are no legacy + NIS entries in /etc/shadow - Backup the Old /etc/shadow File ansible.builtin.copy: @@ -50646,6 +50753,13 @@ fi - no_legacy_plus_entries_etc_shadow - no_reboot_needed - restrict_strategy + + +if grep -q '^\+' /etc/shadow; then +# backup old file to /etc/shadow- + cp /etc/shadow /etc/shadow- + sed -i '/^\+.*$/d' /etc/shadow +fi @@ -50919,8 +51033,6 @@ guess a password for a privileged account. Proper configuration of sudo is recommended to afford multiple system administrators access to root privileges in an accountable manner. CCE-80649-7 - awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs --no-run-if-empty --max-lines=1 passwd -l - - name: Get all /etc/passwd file entries getent: database: passwd @@ -50963,6 +51075,8 @@ access to root privileges in an accountable manner. - low_disruption - no_reboot_needed - restrict_strategy + + awk -F: '$3 == 0 && $1 != "root" { print $1 }' /etc/passwd | xargs --no-run-if-empty --max-lines=1 passwd -l @@ -50976,7 +51090,7 @@ access to root privileges in an accountable manner. The root user should have a primary group of 0. Req-8.1.1 8.2.1 - 5.6.4 + 4.5.2.1 To help ensure that root-owned files are not inadvertently exposed to other users. CCE-86297-9 @@ -50997,29 +51111,12 @@ altered privileges through the su command.pam_wheel.so module. The pam_wheel.so module configuration is accomplished by use_pam_wheel_group_for_su rule. 2.2.6 - 5.3.7 + 4.3.7 The su program allows to run commands with a substitute user and group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-86071-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_pam_wheel_group_for_su='' - - -if ! grep -q "^${var_pam_wheel_group_for_su}:[^:]*:[^:]*:[^:]*" /etc/group; then - groupadd ${var_pam_wheel_group_for_su} -fi - -# group must be empty -gpasswd -M '' ${var_pam_wheel_group_for_su} - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51071,6 +51168,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_pam_wheel_group_for_su='' + + +if ! grep -q "^${var_pam_wheel_group_for_su}:[^:]*:[^:]*:[^:]*" /etc/group; then + groupadd ${var_pam_wheel_group_for_su} +fi + +# group must be empty +gpasswd -M '' ${var_pam_wheel_group_for_su} + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51080,6 +51194,24 @@ fi + + Ensure Authentication Required for Single User Mode + Single user mode is used for recovery when the system detects an +issue during boot or by manual selection from the bootloader. + 2.2.2 + 4.5.2.4 + Requiring authentication in single user mode prevents an unauthorized +user from rebooting the system into single user to gain root privileges +without credentials. + + CCE-86517-0 + + + + + + + Direct root Logins Not Allowed To further limit access to the root account, administrators @@ -51180,6 +51312,25 @@ to privileged (root) access via su / sudo. This is required for FISMA Low and FISMA Moderate systems. CCE-80840-2 + - name: Direct root Logins Not Allowed + copy: + dest: /etc/securetty + content: '' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80840-2 + - NIST-800-171-3.1.1 + - NIST-800-171-3.1.6 + - NIST-800-53-CM-6(a) + - NIST-800-53-IA-2 + - PCI-DSSv4-8.6.1 + - low_complexity + - low_disruption + - medium_severity + - no_direct_root_logins + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -51203,25 +51354,6 @@ echo > /etc/securetty else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Direct root Logins Not Allowed - copy: - dest: /etc/securetty - content: '' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80840-2 - - NIST-800-171-3.1.1 - - NIST-800-171-3.1.6 - - NIST-800-53-CM-6(a) - - NIST-800-53-IA-2 - - PCI-DSSv4-8.6.1 - - low_complexity - - low_disruption - - medium_severity - - no_direct_root_logins - - no_reboot_needed - - restrict_strategy @@ -51251,19 +51383,10 @@ and nfsnobody has an unlocked password, disable it with t AC-6 CM-6(a) 8.2.2 - 5.6.2 + 4.5.2.3 Disabling authentication for default system accounts makes it more difficult for attackers to make use of them to compromise a system. CCE-86112-0 - -readarray -t systemaccounts < <(awk -F: \ - '($3 < 1000 && $3 != root && $3 != halt && $3 != sync && $3 != shutdown \ - && $3 != nfsnobody) { print $1 }' /etc/passwd) - -for systemaccount in "${systemaccounts[@]}"; do - usermod -L "$systemaccount" -done - - name: Ensure that System Accounts Are Locked - Get All Local Users From /etc/passwd ansible.builtin.getent: database: passwd @@ -51315,6 +51438,15 @@ done - no_password_auth_for_systemaccounts - no_reboot_needed - restrict_strategy + + +readarray -t systemaccounts < <(awk -F: \ + '($3 < 1000 && $3 != root && $3 != halt && $3 != sync && $3 != shutdown \ + && $3 != nfsnobody) { print $1 }' /etc/passwd) + +for systemaccount in "${systemaccounts[@]}"; do + usermod -L "$systemaccount" +done @@ -51409,19 +51541,10 @@ system to become inaccessible. PR.AC-6 8.2.2 SRG-OS-000480-GPOS-00227 - 5.6.2 + 4.5.2.3 Ensuring shells are not given to system accounts upon login makes it more difficult for attackers to make use of system accounts. CCE-80843-6 - -readarray -t systemaccounts < <(awk -F: '($3 < 1000 && $3 != root \ - && $7 != "\/sbin\/shutdown" && $7 != "\/sbin\/halt" && $7 != "\/bin\/sync") \ - { print $1 }' /etc/passwd) - -for systemaccount in "${systemaccounts[@]}"; do - usermod -s /sbin/nologin "$systemaccount" -done - - name: Ensure that System Accounts Do Not Run a Shell Upon Login - Get All Local Users From /etc/passwd ansible.builtin.getent: @@ -51482,6 +51605,15 @@ done - no_reboot_needed - no_shelllogin_for_systemaccounts - restrict_strategy + + +readarray -t systemaccounts < <(awk -F: '($3 < 1000 && $3 != root \ + && $7 != "\/sbin\/shutdown" && $7 != "\/sbin\/halt" && $7 != "\/bin\/sync") \ + { print $1 }' /etc/passwd) + +for systemaccount in "${systemaccounts[@]}"; do + usermod -s /sbin/nologin "$systemaccount" +done @@ -51565,8 +51697,6 @@ ttyS1 helps ensure accountability for actions taken on the systems using the root account. CCE-80856-8 - sed -i '/ttyS/d' /etc/securetty - - name: Restrict Serial Port Root Logins lineinfile: dest: /etc/securetty @@ -51584,6 +51714,8 @@ using the root account. - no_reboot_needed - restrict_serial_port_logins - restrict_strategy + + sed -i '/ttyS/d' /etc/securetty @@ -51696,8 +51828,6 @@ vc/4 helps ensure accountability for actions taken on the system using the root account. CCE-80864-2 - sed -i '/^vc\//d' /etc/securetty - - name: Restrict Virtual Console Root Logins lineinfile: dest: /etc/securetty @@ -51716,6 +51846,8 @@ using the root account. - no_reboot_needed - restrict_strategy - securetty_root_login_console_only + + sed -i '/^vc\//d' /etc/securetty @@ -51741,16 +51873,6 @@ group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-83318-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -# uncomment the option if commented -sed '/^[[:space:]]*#[[:space:]]*auth[[:space:]]\+required[[:space:]]\+pam_wheel\.so[[:space:]]\+use_uid$/s/^[[:space:]]*#//' -i /etc/pam.d/su - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51777,6 +51899,16 @@ fi - no_reboot_needed - restrict_strategy - use_pam_wheel_for_su + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +# uncomment the option if commented +sed '/^[[:space:]]*#[[:space:]]*auth[[:space:]]\+required[[:space:]]\+pam_wheel\.so[[:space:]]\+use_uid$/s/^[[:space:]]*#//' -i /etc/pam.d/su + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51794,35 +51926,12 @@ command, make sure that the following line exists in the file /etc/pa Note that ensure_pam_wheel_group_empty rule complements this requirement by ensuring the referenced group exists and has no members. 2.2.6 - 5.3.7 + 4.3.7 The su program allows to run commands with a substitute user and group ID. It is commonly used to run commands as the root user. Limiting access to such command is considered a good security practice. CCE-86064-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_pam_wheel_group_for_su='' - - -PAM_CONF=/etc/pam.d/su - -pamstr=$(grep -P '^auth\s+required\s+pam_wheel\.so\s+(?=[^#]*\buse_uid\b)(?=[^#]*\bgroup=)' ${PAM_CONF}) -if [ -z "$pamstr" ]; then - sed -Ei '/^auth\b.*\brequired\b.*\bpam_wheel\.so/d' ${PAM_CONF} # remove any remaining uncommented pam_wheel.so line - sed -Ei "/^auth\s+sufficient\s+pam_rootok\.so.*$/a auth required pam_wheel.so use_uid group=${var_pam_wheel_group_for_su}" ${PAM_CONF} -else - group_val=$(echo -n "$pamstr" | grep -Eo '\bgroup=[_a-z][-0-9_a-z]*' | cut -d '=' -f 2) - if [ -z "${group_val}" ] || [ ${group_val} != ${var_pam_wheel_group_for_su} ]; then - sed -Ei "s/(^auth\s+required\s+pam_wheel.so\s+[^#]*group=)[_a-z][-0-9_a-z]*/\1${var_pam_wheel_group_for_su}/" ${PAM_CONF} - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -51859,6 +51968,29 @@ fi - no_reboot_needed - restrict_strategy - use_pam_wheel_group_for_su + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_pam_wheel_group_for_su='' + + +PAM_CONF=/etc/pam.d/su + +pamstr=$(grep -P '^auth\s+required\s+pam_wheel\.so\s+(?=[^#]*\buse_uid\b)(?=[^#]*\bgroup=)' ${PAM_CONF}) +if [ -z "$pamstr" ]; then + sed -Ei '/^auth\b.*\brequired\b.*\bpam_wheel\.so/d' ${PAM_CONF} # remove any remaining uncommented pam_wheel.so line + sed -Ei "/^auth\s+sufficient\s+pam_rootok\.so.*$/a auth required pam_wheel.so use_uid group=${var_pam_wheel_group_for_su}" ${PAM_CONF} +else + group_val=$(echo -n "$pamstr" | grep -Eo '\bgroup=[_a-z][-0-9_a-z]*' | cut -d '=' -f 2) + if [ -z "${group_val}" ] || [ ${group_val} != ${var_pam_wheel_group_for_su} ]; then + sed -Ei "s/(^auth\s+required\s+pam_wheel.so\s+[^#]*group=)[_a-z][-0-9_a-z]*/\1${var_pam_wheel_group_for_su}/" ${PAM_CONF} + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -51938,37 +52070,6 @@ parameter in /etc/login.defs to yes CCE-83789-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -if [ -e "/etc/login.defs" ] ; then - - LC_ALL=C sed -i "/^\s*CREATE_HOME\s\+/Id" "/etc/login.defs" -else - touch "/etc/login.defs" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/login.defs" - -cp "/etc/login.defs" "/etc/login.defs.bak" -# Insert before the line matching the regex '^\s*CREATE_HOME'. -line_number="$(LC_ALL=C grep -n "^\s*CREATE_HOME" "/etc/login.defs.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^\s*CREATE_HOME', insert at - # the end of the file. - printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" -else - head -n "$(( line_number - 1 ))" "/etc/login.defs.bak" > "/etc/login.defs" - printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" - tail -n "+$(( line_number ))" "/etc/login.defs.bak" >> "/etc/login.defs" -fi -# Clean up after ourselves. -rm "/etc/login.defs.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52020,6 +52121,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +if [ -e "/etc/login.defs" ] ; then + + LC_ALL=C sed -i "/^\s*CREATE_HOME\s\+/Id" "/etc/login.defs" +else + touch "/etc/login.defs" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/login.defs" + +cp "/etc/login.defs" "/etc/login.defs.bak" +# Insert before the line matching the regex '^\s*CREATE_HOME'. +line_number="$(LC_ALL=C grep -n "^\s*CREATE_HOME" "/etc/login.defs.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^\s*CREATE_HOME', insert at + # the end of the file. + printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" +else + head -n "$(( line_number - 1 ))" "/etc/login.defs.bak" > "/etc/login.defs" + printf '%s\n' "CREATE_HOME yes" >> "/etc/login.defs" + tail -n "+$(( line_number ))" "/etc/login.defs.bak" >> "/etc/login.defs" +fi +# Clean up after ourselves. +rm "/etc/login.defs.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52060,38 +52192,6 @@ add or correct the FAIL_DELAY setting in /etc/ enter credentials helps to slow a single-threaded brute force attack. CCE-84037-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_fail_delay='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^FAIL_DELAY") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_fail_delay" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^FAIL_DELAY\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^FAIL_DELAY\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-84037-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52130,6 +52230,38 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_fail_delay='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^FAIL_DELAY") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_fail_delay" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^FAIL_DELAY\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^FAIL_DELAY\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-84037-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52176,24 +52308,6 @@ problems caused by excessive logins. Automated login processes operating imprope maliciously may result in an exceptional number of simultaneous login sessions. CCE-80955-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -var_accounts_max_concurrent_login_sessions='' - - -if grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.d/*.conf; then - sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.d/*.conf -elif grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.conf; then - sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.conf -else - echo "* hard maxlogins $var_accounts_max_concurrent_login_sessions" >> /etc/security/limits.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -52282,6 +52396,24 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +var_accounts_max_concurrent_login_sessions='' + + +if grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.d/*.conf; then + sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.d/*.conf +elif grep -q '^[^#]*\<maxlogins\>' /etc/security/limits.conf; then + sed -i "/^[^#]*\<maxlogins\>/ s/maxlogins.*/maxlogins $var_accounts_max_concurrent_login_sessions/" /etc/security/limits.conf +else + echo "* hard maxlogins $var_accounts_max_concurrent_login_sessions" >> /etc/security/limits.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52303,19 +52435,6 @@ Then, add the following entry to /etc/security/namespace.conf CCE-83732-8 - -# shellcheck disable=SC2174 -mkdir -p --mode 000 /tmp/tmp-inst -chmod 000 /tmp/tmp-inst -chcon --reference=/tmp /tmp/tmp-inst - -if ! grep -Eq '^\s*/tmp\s+/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then - if grep -Eq '^\s*/tmp\s+' /etc/security/namespace.conf ; then - sed -i '/^\s*\/tmp/d' /etc/security/namespace.conf - fi - echo "/tmp /tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf -fi - - name: Create /tmp/tmp-inst directory file: path: /tmp/tmp-inst @@ -52348,6 +52467,19 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + +# shellcheck disable=SC2174 +mkdir -p --mode 000 /tmp/tmp-inst +chmod 000 /tmp/tmp-inst +chcon --reference=/tmp /tmp/tmp-inst + +if ! grep -Eq '^\s*/tmp\s+/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then + if grep -Eq '^\s*/tmp\s+' /etc/security/namespace.conf ; then + sed -i '/^\s*\/tmp/d' /etc/security/namespace.conf + fi + echo "/tmp /tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf +fi @@ -52368,19 +52500,6 @@ Then, add the following entry to /etc/security/namespace.conf CCE-83778-1 - -# shellcheck disable=SC2174 -mkdir -p --mode 000 /var/tmp/tmp-inst -chmod 000 /var/tmp/tmp-inst -chcon --reference=/var/tmp /var/tmp/tmp-inst - -if ! grep -Eq '^\s*/var/tmp\s+/var/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then - if grep -Eq '^\s*/var/tmp\s+' /etc/security/namespace.conf ; then - sed -i '/^\s*\/var\/tmp/d' /etc/security/namespace.conf - fi - echo "/var/tmp /var/tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf -fi - - name: Create /var/tmp/tmp-inst directory file: path: /var/tmp/tmp-inst @@ -52413,6 +52532,19 @@ fi - low_severity - no_reboot_needed - restrict_strategy + + +# shellcheck disable=SC2174 +mkdir -p --mode 000 /var/tmp/tmp-inst +chmod 000 /var/tmp/tmp-inst +chcon --reference=/var/tmp /var/tmp/tmp-inst + +if ! grep -Eq '^\s*/var/tmp\s+/var/tmp/tmp-inst/\s+level\s+root,adm$' /etc/security/namespace.conf ; then + if grep -Eq '^\s*/var/tmp\s+' /etc/security/namespace.conf ; then + sed -i '/^\s*\/var\/tmp/d' /etc/security/namespace.conf + fi + echo "/var/tmp /var/tmp/tmp-inst/ level root,adm" >> /etc/security/namespace.conf +fi @@ -52483,40 +52615,13 @@ Using the typeset keyword is preferred for wider compatib 8.6.1 SRG-OS-000163-GPOS-00072 SRG-OS-000029-GPOS-00010 - 5.6.3 + 4.5.3.2 Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. CCE-80673-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_accounts_tmout='' - - -# if 0, no occurence of tmout found, if 1, occurence found -tmout_found=0 - - -for f in /etc/profile /etc/profile.d/*.sh; do - - if grep --silent '^[^#].*TMOUT' $f; then - sed -i -E "s/^(.*)TMOUT\s*=\s*(\w|\$)*(.*)$/typeset -xr TMOUT=$var_accounts_tmout\3/g" $f - tmout_found=1 - fi -done - -if [ $tmout_found -eq 0 ]; then - echo -e "\n# Set TMOUT to $var_accounts_tmout per security requirements" >> /etc/profile.d/tmout.sh - echo "typeset -xr TMOUT=$var_accounts_tmout" >> /etc/profile.d/tmout.sh -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_accounts_tmout # promote to variable set_fact: var_accounts_tmout: !!str @@ -52567,6 +52672,33 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_accounts_tmout='' + + +# if 0, no occurence of tmout found, if 1, occurence found +tmout_found=0 + + +for f in /etc/profile /etc/profile.d/*.sh; do + + if grep --silent '^[^#].*TMOUT' $f; then + sed -i -E "s/^(.*)TMOUT\s*=\s*(\w|\$)*(.*)$/typeset -xr TMOUT=$var_accounts_tmout\3/g" $f + tmout_found=1 + fi +done + +if [ $tmout_found -eq 0 ]; then + echo -e "\n# Set TMOUT to $var_accounts_tmout per security requirements" >> /etc/profile.d/tmout.sh + echo "typeset -xr TMOUT=$var_accounts_tmout" >> /etc/profile.d/tmout.sh +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -52595,9 +52727,6 @@ of their respective initialization files. user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-86314-2 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6"/.[^\.]?*") }' /etc/passwd - - name: Ensure interactive local users are the group-owners of their respective initialization files ansible.builtin.command: @@ -52611,6 +52740,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6"/.[^\.]?*") }' /etc/passwd @@ -52674,9 +52806,6 @@ their respective initialization files. upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-86316-7 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd - - name: Ensure interactive local users are the owners of their respective initialization files ansible.builtin.command: @@ -52690,6 +52819,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6"/.[^\.]?*") }' /etc/passwd @@ -52737,14 +52869,6 @@ Therefore, this rule will report a finding for home directories like If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own. CCE-84036-3 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - # This follows the same logic of evaluation of home directories as used in OVAL. - if ! grep -q $user /etc/passwd | cut -d: -f6 | grep '^\/\w*\/\w\{1,\}'; then - sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd; - fi -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52791,6 +52915,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + # This follows the same logic of evaluation of home directories as used in OVAL. + if ! grep -q $user /etc/passwd | cut -d: -f6 | grep '^\/\w*\/\w\{1,\}'; then + sed -i "s/\($user:x:[0-9]*:[0-9]*:.*:\).*\(:.*\)$/\1\/home\/$user\2/g" /etc/passwd; + fi +done @@ -52816,11 +52948,6 @@ upon logon. This could create a Denial of Service because the user would not be able to access their logon configuration files, and it may give them visibility to system files they normally would not be able to access. CCE-83424-2 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd); do - mkhomedir_helper $user 0077; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52865,6 +52992,11 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd); do + mkhomedir_helper $user 0077; +done @@ -52892,16 +53024,6 @@ of folders or files in their respective home directories. If a local interactive users files are group-owned by a group of which the user is not a member, unintended users may be able to access them. CCE-86534-5 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd $user | cut -d: -f6) - group=$(getent passwd $user | cut -d: -f4) - # Only update the group-ownership when necessary. This will avoid changing the inode timestamp - # when the group is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find $home_dir -not -group $group -exec chgrp -f $group {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -52964,6 +53086,16 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd $user | cut -d: -f6) + group=$(getent passwd $user | cut -d: -f4) + # Only update the group-ownership when necessary. This will avoid changing the inode timestamp + # when the group is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find $home_dir -not -group $group -exec chgrp -f $group {} \; +done @@ -52991,15 +53123,6 @@ folders or files in their respective home directories. If local interactive users do not own the files in their directories, unauthorized users may be able to access them. Additionally, if files are not owned by the user, this could be an indication of system compromise. - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd $user | cut -d: -f6) - # Only update the ownership when necessary. This will avoid changing the inode timestamp - # when the owner is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find $home_dir -not -user $user -exec chown -f $user {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53054,6 +53177,15 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd $user | cut -d: -f6) + # Only update the ownership when necessary. This will avoid changing the inode timestamp + # when the owner is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find $home_dir -not -user $user -exec chown -f $user {} \; +done @@ -53075,14 +53207,6 @@ Files that begin with a "." are excluded from this requirement.If a local interactive user files have excessive permissions, unintended users may be able to access or modify them. CCE-85888-6 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53146,6 +53270,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53166,12 +53298,6 @@ to an interactive user is not group or world accessible Note: While the complete removal of .netrc files is recommended, if any are required on the system, secure permissions must be applied. CCE-87369-5 - -for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do - home_dir=$(getent passwd "$user" | cut -d: -f6) - find "${home_dir}/.netrc" -exec chmod 0600 {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53230,6 +53356,12 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for user in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $1 }' /etc/passwd); do + home_dir=$(getent passwd "$user" | cut -d: -f6) + find "${home_dir}/.netrc" -exec chmod 0600 {} \; +done @@ -53261,9 +53393,6 @@ not the same as the primary GID of the user, this would allow unauthorized access to the users files, and users that share the same group may not be able to access files that they legitimately should. CCE-83434-1 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53326,6 +53455,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chgrp -f " $4" "$6) }' /etc/passwd @@ -53354,9 +53486,6 @@ their respective home directories. users could access or modify the user's files, and the users may not be able to access their own files. CCE-86131-0 - -awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53414,6 +53543,9 @@ awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$ - medium_severity - no_reboot_needed - restrict_strategy + + +awk -F':' '{ if ($3 >= 1000 && $3 != 65534) system("chown -f " $3" "$6) }' /etc/passwd @@ -53436,28 +53568,6 @@ following command: upon logon. Malicious modification of these files could compromise accounts upon logon. CCE-84043-9 - -var_user_initialization_files_regex='' - - -readarray -t interactive_users < <(awk -F: '$3>=1000 {print $1}' /etc/passwd) -readarray -t interactive_users_home < <(awk -F: '$3>=1000 {print $6}' /etc/passwd) -readarray -t interactive_users_shell < <(awk -F: '$3>=1000 {print $7}' /etc/passwd) - -USERS_IGNORED_REGEX='nobody|nfsnobody' - -for (( i=0; i<"${#interactive_users[@]}"; i++ )); do - if ! grep -qP "$USERS_IGNORED_REGEX" <<< "${interactive_users[$i]}" && \ - [ "${interactive_users_shell[$i]}" != "/sbin/nologin" ]; then - - readarray -t init_files < <(find "${interactive_users_home[$i]}" -maxdepth 1 \ - -exec basename {} \; | grep -P "$var_user_initialization_files_regex") - for file in "${init_files[@]}"; do - chmod u-s,g-wxs,o= "${interactive_users_home[$i]}/$file" - done - fi -done - - name: XCCDF Value var_user_initialization_files_regex # promote to variable set_fact: var_user_initialization_files_regex: !!str @@ -53517,6 +53627,28 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +var_user_initialization_files_regex='' + + +readarray -t interactive_users < <(awk -F: '$3>=1000 {print $1}' /etc/passwd) +readarray -t interactive_users_home < <(awk -F: '$3>=1000 {print $6}' /etc/passwd) +readarray -t interactive_users_shell < <(awk -F: '$3>=1000 {print $7}' /etc/passwd) + +USERS_IGNORED_REGEX='nobody|nfsnobody' + +for (( i=0; i<"${#interactive_users[@]}"; i++ )); do + if ! grep -qP "$USERS_IGNORED_REGEX" <<< "${interactive_users[$i]}" && \ + [ "${interactive_users_shell[$i]}" != "/sbin/nologin" ]; then + + readarray -t init_files < <(find "${interactive_users_home[$i]}" -maxdepth 1 \ + -exec basename {} \; | grep -P "$var_user_initialization_files_regex") + for file in "${init_files[@]}"; do + chmod u-s,g-wxs,o= "${interactive_users_home[$i]}/$file" + done + fi +done @@ -53540,14 +53672,6 @@ following command: Excessive permissions on local interactive user home directories may allow unauthorized access to user files by other users. CCE-84038-9 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53611,6 +53735,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53696,14 +53828,6 @@ to other users. If a subset of users need read access to one another's home directories, this can be provided using groups or ACLs. CCE-84274-0 - -for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do - # Only update the permissions when necessary. This will avoid changing the inode timestamp when - # the permission is already defined as expected, therefore not impacting in possible integrity - # check systems that also check inodes timestamps. - find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; -done - - name: Get all local users from /etc/passwd ansible.builtin.getent: database: passwd @@ -53775,6 +53899,14 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for home_dir in $(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 }' /etc/passwd); do + # Only update the permissions when necessary. This will avoid changing the inode timestamp when + # the permission is already defined as expected, therefore not impacting in possible integrity + # check systems that also check inodes timestamps. + find "$home_dir" -maxdepth 0 -perm /7027 -exec chmod u-s,g-w-s,o=- {} \; +done @@ -53979,33 +54111,13 @@ as follows: SRG-OS-000480-GPOS-00228 SRG-OS-000480-GPOS-00227 RHEL-08-020353 - 5.6.5 + 4.5.3.3 SV-230385r792902_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81036-6 - # Remediation is applicable only in certain platforms -if rpm --quiet -q bash; then - -var_accounts_user_umask='' - - - - - - -grep -q "^\s*umask" /etc/bashrc && \ - sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/bashrc -if ! [ $? -eq 0 ]; then - echo "umask $var_accounts_user_umask" >> /etc/bashrc -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -54086,6 +54198,26 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q bash; then + +var_accounts_user_umask='' + + + + + + +grep -q "^\s*umask" /etc/bashrc && \ + sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/bashrc +if ! [ $? -eq 0 ]; then + echo "umask $var_accounts_user_umask" >> /etc/bashrc +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -54131,16 +54263,6 @@ add or correct the umask setting in /etc/csh.c A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81037-4 - -var_accounts_user_umask='' - - -grep -q "^\s*umask" /etc/csh.cshrc && \ - sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/csh.cshrc -if ! [ $? -eq 0 ]; then - echo "umask $var_accounts_user_umask" >> /etc/csh.cshrc -fi - - name: XCCDF Value var_accounts_user_umask # promote to variable set_fact: var_accounts_user_umask: !!str @@ -54202,6 +54324,16 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_user_umask='' + + +grep -q "^\s*umask" /etc/csh.cshrc && \ + sed -i -E -e "s/^(\s*umask).*/\1 $var_accounts_user_umask/g" /etc/csh.cshrc +if ! [ $? -eq 0 ]; then + echo "umask $var_accounts_user_umask" >> /etc/csh.cshrc +fi @@ -54258,45 +54390,13 @@ add or correct the UMASK setting in /etc/login PR.IP-2 SRG-OS-000480-GPOS-00228 RHEL-08-020351 - 5.6.5 + 4.5.3.3 SV-230383r627750_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read and written to by unauthorized users. CCE-82888-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q shadow-utils; then - -var_accounts_user_umask='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^UMASK") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_user_umask" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^UMASK\\>" "/etc/login.defs"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^UMASK\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" -else - if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" - fi - cce="CCE-82888-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" - printf '%s\n' "$formatted_output" >> "/etc/login.defs" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -54377,6 +54477,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q shadow-utils; then + +var_accounts_user_umask='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^UMASK") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$var_accounts_user_umask" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^UMASK\\>" "/etc/login.defs"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^UMASK\\>.*/$escaped_formatted_output/gi" "/etc/login.defs" +else + if [[ -s "/etc/login.defs" ]] && [[ -n "$(tail -c 1 -- "/etc/login.defs" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/login.defs" + fi + cce="CCE-82888-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/login.defs" >> "/etc/login.defs" + printf '%s\n' "$formatted_output" >> "/etc/login.defs" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -54422,26 +54554,12 @@ considered during the check and properly remediated, if necessary.SRG-OS-000480-GPOS-00228 SRG-OS-000480-GPOS-00227 RHEL-08-020353 - 5.6.5 + 4.5.3.3 SV-230385r792902_rule The umask value influences the permissions assigned to files when they are created. A misconfigured umask value could result in files with excessive permissions that can be read or written to by unauthorized users. CCE-81035-8 - -var_accounts_user_umask='' - - -readarray -t profile_files < <(find /etc/profile.d/ -type f -name '*.sh' -or -name 'sh.local') - -for file in "${profile_files[@]}" /etc/profile; do - grep -qE '^[^#]*umask' "$file" && sed -i -E "s/^(\s*umask\s*)[0-7]+/\1$var_accounts_user_umask/g" "$file" -done - -if ! grep -qrE '^[^#]*umask' /etc/profile*; then - echo "umask $var_accounts_user_umask" >> /etc/profile -fi - - name: XCCDF Value var_accounts_user_umask # promote to variable set_fact: var_accounts_user_umask: !!str @@ -54529,6 +54647,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + +var_accounts_user_umask='' + + +readarray -t profile_files < <(find /etc/profile.d/ -type f -name '*.sh' -or -name 'sh.local') + +for file in "${profile_files[@]}" /etc/profile; do + grep -qE '^[^#]*umask' "$file" && sed -i -E "s/^(\s*umask\s*)[0-7]+/\1$var_accounts_user_umask/g" "$file" +done + +if ! grep -qrE '^[^#]*umask' /etc/profile*; then + echo "umask $var_accounts_user_umask" >> /etc/profile +fi @@ -54546,6 +54678,7 @@ fi SRG-OS-000480-GPOS-00227 SRG-OS-000480-GPOS-00228 RHEL-08-020352 + 4.5.3.3 SV-230384r858732_rule The umask controls the default access mode assigned to newly created files. A umask of 077 limits new files to mode 700 or less permissive. Although umask can @@ -54554,15 +54687,6 @@ access modes is typically ignored or required to be 0. This requirement applies to the globally configured system defaults and the local interactive user defaults for each account on the system. CCE-84044-7 - -while IFS= read -r dir; do - while IFS= read -r -d '' file; do - if [ "$(basename $file)" != ".bash_history" ]; then - sed -i 's/^\(\s*umask\s*\)/#\1/g' "$file" - fi - done < <(find $dir -maxdepth 1 -type f -name ".*" -print0) -done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6}' /etc/passwd) - - name: Ensure interactive local users are the owners of their respective initialization files ansible.builtin.shell: @@ -54583,6 +54707,15 @@ done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6 - medium_severity - no_reboot_needed - restrict_strategy + + +while IFS= read -r dir; do + while IFS= read -r -d '' file; do + if [ "$(basename $file)" != ".bash_history" ]; then + sed -i 's/^\(\s*umask\s*\)/#\1/g' "$file" + fi + done < <(find $dir -maxdepth 1 -type f -name ".*" -print0) +done < <(awk -F':' '{ if ($3 >= 1000 && $3 != 65534) print $6}' /etc/passwd) @@ -54686,8 +54819,25 @@ $ sudo yum install audispd-plugins audit subsystem, audispd. These plugins can do things like relay events to remote machines or analyze events for suspicious behavior. CCE-82953-1 - -package --add=audispd-plugins + - name: Ensure audispd-plugins is installed + package: + name: audispd-plugins + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82953-1 + - PCI-DSSv4-10.3.3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_audispd-plugins_installed + + +[[packages]] +name = "audispd-plugins" +version = "*" include install_audispd-plugins @@ -54696,6 +54846,9 @@ class install_audispd-plugins { ensure => 'installed', } } + + +package --add=audispd-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -54707,26 +54860,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "audispd-plugins" -version = "*" - - - name: Ensure audispd-plugins is installed - package: - name: audispd-plugins - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82953-1 - - PCI-DSSv4-10.3.3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_audispd-plugins_installed @@ -54743,8 +54876,25 @@ version = "*" 10.3.3 SRG-OS-000342-GPOS-00133 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. - -package --add=audit-audispd-plugins + - name: Ensure audit-audispd-plugins is installed + package: + name: audit-audispd-plugins + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - PCI-DSS-Req-10.5.3 + - PCI-DSSv4-10.3.3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_audit-audispd-plugins_installed + + +[[packages]] +name = "audit-audispd-plugins" +version = "*" include install_audit-audispd-plugins @@ -54753,6 +54903,9 @@ class install_audit-audispd-plugins { ensure => 'installed', } } + + +package --add=audit-audispd-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -54764,26 +54917,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "audit-audispd-plugins" -version = "*" - - - name: Ensure audit-audispd-plugins is installed - package: - name: audit-audispd-plugins - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - PCI-DSS-Req-10.5.3 - - PCI-DSSv4-10.3.3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_audit-audispd-plugins_installed @@ -54858,37 +54991,10 @@ version = "*" SRG-OS-000392-GPOS-00172 SRG-OS-000475-GPOS-00220 RHEL-08-030180 - 4.1.1.1 + 5.2.1.1 SV-230411r744000_rule The auditd service is an access monitoring and accounting daemon, watching system calls to audit any access, in comparison with potential local access control policy such as SELinux policy. CCE-81043-2 - -package --add=audit - - include install_audit - -class install_audit { - package { 'audit': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "audit" ; then - yum install -y "audit" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "audit" -version = "*" - - name: Ensure audit is installed package: name: audit @@ -54912,6 +55018,33 @@ version = "*" - medium_severity - no_reboot_needed - package_audit_installed + + +[[packages]] +name = "audit" +version = "*" + + include install_audit + +class install_audit { + package { 'audit': + ensure => 'installed', + } +} + + +package --add=audit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "audit" ; then + yum install -y "audit" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55110,7 +55243,7 @@ The auditd service can be enabled with the following comm SRG-APP-000508-CTR-001300 SRG-APP-000510-CTR-001310 RHEL-08-030181 - 4.1.1.2 + 5.2.1.4 SV-244542r818838_rule Without establishing what type of events occurred, it would be difficult to establish, correlate, and investigate the events leading up to an outage or attack. @@ -55123,43 +55256,6 @@ can be held accountable for their actions. CCE-80872-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: auditd.service - enabled: true - - include enable_auditd - -class enable_auditd { - service {'auditd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q audit; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'auditd.service' -"$SYSTEMCTL_EXEC" start 'auditd.service' -"$SYSTEMCTL_EXEC" enable 'auditd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["auditd"] - - name: Gather the package facts package_facts: manager: auto @@ -55230,6 +55326,43 @@ enabled = ["auditd"] - medium_severity - no_reboot_needed - service_auditd_enabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: auditd.service + enabled: true + + +[customizations.services] +enabled = ["auditd"] + + include enable_auditd + +class enable_auditd { + service {'auditd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q audit; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'auditd.service' +"$SYSTEMCTL_EXEC" start 'auditd.service' +"$SYSTEMCTL_EXEC" enable 'auditd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55371,7 +55504,7 @@ Run the following command to update command line for already installed kernels:< SRG-OS-000473-GPOS-00218 SRG-OS-000254-GPOS-00095 RHEL-08-030601 - 4.1.1.3 + 5.2.1.2 SV-230468r792904_rule Each process on the system carries an "auditable" flag which indicates whether its activities can be audited. Although auditd takes care of enabling @@ -55379,18 +55512,6 @@ this for all processes which launch after it does, adding the kernel argument ensures it is set for every process during boot. CCE-80825-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=audit=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "audit=1" - - name: Gather the package facts package_facts: manager: auto @@ -55436,6 +55557,18 @@ append = "audit=1" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "audit=1" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=audit=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55474,7 +55607,7 @@ Run the following command to update command line for already installed kernels:< SRG-OS-000462-GPOS-00206 SRG-OS-000471-GPOS-00215 RHEL-08-030602 - 4.1.1.4 + 5.2.1.3 SV-230469r877391_rule audit_backlog_limit sets the queue length for audit events awaiting transfer to the audit daemon. Until the audit daemon is up and running, all log messages @@ -55482,18 +55615,6 @@ are stored in this queue. If the queue is overrun during boot process, the acti defined by audit failure flag is taken. CCE-80943-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=audit_backlog_limit=8192 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "audit_backlog_limit=8192" - - name: Gather the package facts package_facts: manager: auto @@ -55525,6 +55646,18 @@ append = "audit_backlog_limit=8192" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "audit_backlog_limit=8192" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=audit_backlog_limit=8192 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -55616,6 +55749,323 @@ to the same event is more efficient. See the following example: Auditing these events could serve as evidence of potential system compromise. CCE-80927-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit open tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for open for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules + set_fact: audit_file="/etc/audit/rules.d/modify.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for open for 64bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules + set_fact: audit_file="/etc/audit/rules.d/modify.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - open + syscall_grouping: [] + + - name: Check existence of open in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + -F auid>=1000 -F auid!=unset -F key=modify + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) + - audit_arch == "b64" + tags: + - CCE-80927-7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_etc_group_open + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -55943,60 +56393,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group + The audit system should collect write events to /etc/group file for all group and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80929-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56041,7 +56533,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56051,7 +56543,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56061,14 +56553,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56087,7 +56579,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56097,7 +56589,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56106,35 +56598,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56179,7 +56670,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56189,7 +56680,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56199,14 +56690,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -56225,7 +56716,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -56235,7 +56726,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -56244,65 +56735,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80927-7 + - CCE-80929-3 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open + - audit_rules_etc_group_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group - The audit system should collect write events to /etc/group file for all group and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80929-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -56630,24 +57077,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/group + The audit system should collect write events to /etc/group file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80928-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -56656,29 +57146,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56747,10 +57237,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56793,29 +57283,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56884,10 +57374,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -56931,62 +57421,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80929-3 + - CCE-80928-5 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_open_by_handle_at + - audit_rules_etc_group_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/group - The audit system should collect write events to /etc/group file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of groups through direct edition of /etc/group could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80928-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -57314,59 +57761,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80959-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57411,7 +57903,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57421,7 +57913,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57431,14 +57923,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57457,7 +57949,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57467,7 +57959,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57476,34 +57968,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57548,7 +58041,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57558,7 +58051,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57568,14 +58061,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/group -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -57594,7 +58087,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/group -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -57604,7 +58097,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/group + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -57613,65 +58106,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80928-5 + - CCE-80959-0 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_group_openat + - audit_rules_etc_gshadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80959-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -57999,60 +58449,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80960-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58097,7 +58589,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58107,7 +58599,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58117,14 +58609,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58143,7 +58635,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58153,7 +58645,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58162,35 +58654,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58235,7 +58726,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58245,7 +58736,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58255,14 +58746,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -58281,7 +58772,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -58291,7 +58782,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -58300,65 +58791,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80959-0 + - CCE-80960-8 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open + - audit_rules_etc_gshadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80960-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -58686,24 +59133,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/gshadow + The audit system should collect write events to /etc/gshadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80961-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -58712,29 +59202,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58803,10 +59293,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58849,29 +59339,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58940,10 +59430,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -58987,62 +59477,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80960-8 + - CCE-80961-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_open_by_handle_at + - audit_rules_etc_gshadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/gshadow - The audit system should collect write events to /etc/gshadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/gshadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80961-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -59370,59 +59817,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80930-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59467,7 +59959,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59477,7 +59969,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59487,14 +59979,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59513,7 +60005,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59523,7 +60015,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59532,34 +60024,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59604,7 +60097,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59614,7 +60107,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59624,14 +60117,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/gshadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -59650,7 +60143,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/gshadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -59660,7 +60153,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/gshadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -59669,65 +60162,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80961-6 + - CCE-80930-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_gshadow_openat + - audit_rules_etc_passwd_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80930-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -60055,60 +60505,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80932-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60153,7 +60645,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60163,7 +60655,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60173,14 +60665,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60199,7 +60691,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60209,7 +60701,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60218,35 +60710,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60291,7 +60782,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60301,7 +60792,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60311,14 +60802,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -60337,7 +60828,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -60347,7 +60838,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -60356,65 +60847,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80930-1 + - CCE-80932-7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open + - audit_rules_etc_passwd_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80932-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -60742,24 +61189,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/passwd + The audit system should collect write events to /etc/passwd file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80931-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -60768,29 +61258,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60859,10 +61349,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60905,29 +61395,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -60996,10 +61486,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -61043,62 +61533,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80932-7 + - CCE-80931-9 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_open_by_handle_at + - audit_rules_etc_passwd_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/passwd - The audit system should collect write events to /etc/passwd file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/passwd could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80931-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -61426,59 +61873,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + + CCE-80956-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit openat tasks +- name: Set architecture for audit open tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 32bit platform +- name: Perform remediation of Audit rules for open for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61523,7 +62015,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61533,7 +62025,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61543,14 +62035,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61569,7 +62061,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61579,7 +62071,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61588,34 +62080,35 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for openat for 64bit platform +- name: Perform remediation of Audit rules for open for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/rules.d/ + - name: Check existence of open in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61660,7 +62153,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61670,7 +62163,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61680,14 +62173,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - openat + - open syscall_grouping: [] - - name: Check existence of openat in /etc/audit/audit.rules + - name: Check existence of open in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -61706,7 +62199,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/passwd -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -61716,7 +62209,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/passwd + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -61725,65 +62218,22 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80931-9 + - CCE-80956-6 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_passwd_openat + - audit_rules_etc_shadow_open - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - - CCE-80956-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then @@ -62111,60 +62561,102 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80957-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open tasks +- name: Set architecture for audit open_by_handle_at tasks set_fact: audit_arch: b64 when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 32bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62209,7 +62701,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62219,7 +62711,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62229,14 +62721,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62255,7 +62747,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62265,7 +62757,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62274,35 +62766,34 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open for 64bit platform +- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/rules.d/ + - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62347,7 +62838,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62357,7 +62848,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62367,14 +62858,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open + - open_by_handle_at syscall_grouping: [] - - name: Check existence of open in /etc/audit/audit.rules + - name: Check existence of open_by_handle_at in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -62393,7 +62884,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a1&03 -F path=/etc/shadow -F auid>=1000 + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -62403,7 +62894,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a1&03 -F path=/etc/shadow + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=modify create: true mode: o-rwx @@ -62412,65 +62903,21 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - not ( ansible_architecture == "aarch64" ) - audit_arch == "b64" tags: - - CCE-80956-6 + - CCE-80957-4 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open + - audit_rules_etc_shadow_open_by_handle_at - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80957-4 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -62798,24 +63245,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events that Modify User/Group Information via openat syscall - /etc/shadow + The audit system should collect write events to /etc/shadow file for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. +Auditing these events could serve as evidence of potential system compromise. + CCE-80958-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Set architecture for audit open_by_handle_at tasks +- name: Set architecture for audit openat tasks set_fact: audit_arch: b64 when: @@ -62824,29 +63314,29 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 32bit platform +- name: Perform remediation of Audit rules for openat for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -62915,10 +63405,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -62961,29 +63451,29 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy -- name: Perform remediation of Audit rules for open_by_handle_at for 64bit platform +- name: Perform remediation of Audit rules for openat for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/rules.d/ + - name: Check existence of openat in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -63052,10 +63542,10 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - open_by_handle_at + - openat syscall_grouping: [] - - name: Check existence of open_by_handle_at in /etc/audit/audit.rules + - name: Check existence of openat in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S @@ -63099,62 +63589,19 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80957-4 + - CCE-80958-2 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_open_by_handle_at + - audit_rules_etc_shadow_openat - low_complexity - low_disruption - medium_severity - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify User/Group Information via openat syscall - /etc/shadow - The audit system should collect write events to /etc/shadow file for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S openat -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S open,openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Creation of users through direct edition of /etc/shadow could be an indicator of malicious activity on a system. -Auditing these events could serve as evidence of potential system compromise. - CCE-80958-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -63481,320 +63928,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Set architecture for audit openat tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for openat for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules - set_fact: audit_file="/etc/audit/rules.d/modify.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for openat for 64bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/modify.rules - set_fact: audit_file="/etc/audit/rules.d/modify.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - openat - syscall_grouping: [] - - - name: Check existence of openat in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a2&03 -F path=/etc/shadow -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a2&03 -F path=/etc/shadow - -F auid>=1000 -F auid!=unset -F key=modify - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - audit_arch == "b64" - tags: - - CCE-80958-2 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_etc_shadow_openat - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy @@ -63941,58 +64074,13 @@ With this setting, a reboot will be required to change any audit rules.SRG-APP-000119-CTR-000245 SRG-APP-000120-CTR-000250 RHEL-08-030121 - 4.1.3.20 + 5.2.3.20 SV-230402r627750_rule Making the audit configuration immutable prevents accidental as well as malicious modification of the audit rules, although it may be problematic if legitimate changes are needed during system operation. CCE-80708-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,-e%202%0A - mode: 0600 - path: /etc/audit/rules.d/90-immutable.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Traverse all of: -# -# /etc/audit/audit.rules, (for auditctl case) -# /etc/audit/rules.d/*.rules (for augenrules case) -# -# files to check if '-e .*' setting is present in that '*.rules' file already. -# If found, delete such occurrence since auditctl(8) manual page instructs the -# '-e 2' rule should be placed as the last rule in the configuration -find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-e[[:space:]]\+.*/d' {} ';' - -# Append '-e 2' requirement at the end of both: -# * /etc/audit/audit.rules file (for auditctl case) -# * /etc/audit/rules.d/immutable.rules (for augenrules case) - -for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" -do - echo '' >> $AUDIT_FILE - echo '# Set the audit.rules configuration immutable per security requirements' >> $AUDIT_FILE - echo '# Reboot is required to change audit rules once this setting is applied' >> $AUDIT_FILE - echo '-e 2' >> $AUDIT_FILE - chmod o-rwx $AUDIT_FILE -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64093,6 +64181,51 @@ fi - medium_severity - reboot_required - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,-e%202%0A + mode: 0600 + path: /etc/audit/rules.d/90-immutable.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Traverse all of: +# +# /etc/audit/audit.rules, (for auditctl case) +# /etc/audit/rules.d/*.rules (for augenrules case) +# +# files to check if '-e .*' setting is present in that '*.rules' file already. +# If found, delete such occurrence since auditctl(8) manual page instructs the +# '-e 2' rule should be placed as the last rule in the configuration +find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-e[[:space:]]\+.*/d' {} ';' + +# Append '-e 2' requirement at the end of both: +# * /etc/audit/audit.rules file (for auditctl case) +# * /etc/audit/rules.d/immutable.rules (for augenrules case) + +for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" +do + echo '' >> $AUDIT_FILE + echo '# Set the audit.rules configuration immutable per security requirements' >> $AUDIT_FILE + echo '# Reboot is required to change audit rules once this setting is applied' >> $AUDIT_FILE + echo '-e 2' >> $AUDIT_FILE + chmod o-rwx $AUDIT_FILE +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -64130,30 +64263,6 @@ immutable: If modification of login UIDs is not prevented, they can be changed by unprivileged users and make auditing complicated or impossible. CCE-90783-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# in case auditctl is used -if grep -q '^\s*ExecStartPost=-/sbin/auditctl' /usr/lib/systemd/system/auditd.service; then - if ! grep -q '^\s*--loginuid-immutable\s*$' /etc/audit/audit.rules; then - echo "--loginuid-immutable" >> /etc/audit/audit.rules - fi -else - immutable_found=0 - while IFS= read -r -d '' f; do - if grep -q '^\s*--loginuid-immutable\s*$' "$f"; then - immutable_found=1 - fi - done < <(find /etc/audit/rules.d -maxdepth 1 -name '*.rules' -print0) - if [ $immutable_found -eq 0 ]; then - echo "--loginuid-immutable" >> /etc/audit/rules.d/immutable.rules - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64238,6 +64347,30 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# in case auditctl is used +if grep -q '^\s*ExecStartPost=-/sbin/auditctl' /usr/lib/systemd/system/auditd.service; then + if ! grep -q '^\s*--loginuid-immutable\s*$' /etc/audit/audit.rules; then + echo "--loginuid-immutable" >> /etc/audit/audit.rules + fi +else + immutable_found=0 + while IFS= read -r -d '' f; do + if grep -q '^\s*--loginuid-immutable\s*$' "$f"; then + immutable_found=1 + fi + done < <(find /etc/audit/rules.d -maxdepth 1 -name '*.rules' -print0) + if [ $immutable_found -eq 0 ]; then + echo "--loginuid-immutable" >> /etc/audit/rules.d/immutable.rules + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -64375,168 +64508,11 @@ utility to read audit rules during daemon startup, add the following line to FAU_GEN.1.1.c Req-10.5.5 10.3.4 - 4.1.3.14 + 5.2.3.14 The system's mandatory access policy (SELinux) should not be arbitrarily changed by anything other than administrator action. All changes to MAC policy should be audited. CCE-80721-4 - --- - -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/selinux/%20-p%20wa%20-k%20MAC-policy%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-etcselinux-wa-MAC-policy.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/selinux/" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/MAC-policy.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/MAC-policy.rules" - # If the MAC-policy.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -64738,129 +64714,23 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Mandatory Access Controls in usr/share - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --w /usr/share/selinux/ -p wa -k MAC-policy -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /usr/share/selinux/ -p wa -k MAC-policy - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.8 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 4.1.3.14 - The system's mandatory access policy (SELinux) should not be -arbitrarily changed by anything other than administrator action. All changes to -MAC policy should be audited. - CCE-86342-3 - # Remediation is applicable only in certain platforms + --- + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/selinux/%20-p%20wa%20-k%20MAC-policy%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-etcselinux-wa-MAC-policy.rules + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -64887,7 +64757,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -64895,7 +64765,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -64911,12 +64781,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -64935,7 +64805,7 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. # If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/usr/share/selinux/" /etc/audit/rules.d/*.rules) +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/selinux/" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -64964,7 +64834,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/selinux/" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -64972,7 +64842,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -64988,12 +64858,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + echo "-w /etc/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" fi done @@ -65001,6 +64871,128 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Mandatory Access Controls in usr/share + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-w /usr/share/selinux/ -p wa -k MAC-policy +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /usr/share/selinux/ -p wa -k MAC-policy + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.8 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 5.2.3.14 + The system's mandatory access policy (SELinux) should not be +arbitrarily changed by anything other than administrator action. All changes to +MAC policy should be audited. + CCE-86342-3 - name: Gather the package facts package_facts: manager: auto @@ -65185,6 +65177,147 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/MAC-policy.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/usr/share/selinux/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/MAC-policy.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/MAC-policy.rules" + # If the MAC-policy.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/usr/share/selinux/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/usr/share/selinux/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/usr/share/selinux/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /usr/share/selinux/ -p wa -k MAC-policy" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -65338,341 +65471,13 @@ appropriate for your system: SRG-OS-000471-GPOS-00215 SRG-APP-000495-CTR-001235 RHEL-08-030302 - 4.1.3.10 + 5.2.3.10 SV-230425r627750_rule The unauthorized exportation of data to external media could result in an information leak where classified information, Privacy Act information, and intellectual property could be lost. An audit trail should be created each time a filesystem is mounted to help identify and guard against information loss. CCE-80722-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="mount" - KEY="perm_mod" - SYSCALL_GROUPING="" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -66003,158 +65808,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Network Environment - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following lines to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification --w /etc/issue -p wa -k audit_rules_networkconfig_modification --w /etc/issue.net -p wa -k audit_rules_networkconfig_modification --w /etc/hosts -p wa -k audit_rules_networkconfig_modification --w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification --w /etc/issue -p wa -k audit_rules_networkconfig_modification --w /etc/issue.net -p wa -k audit_rules_networkconfig_modification --w /etc/hosts -p wa -k audit_rules_networkconfig_modification --w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.5.5 - 10.3.4 - 4.1.3.5 - The network environment should not be modified by anything other -than administrator action. Any change to network parameters should be -audited. - CCE-80723-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -66165,10 +65819,11 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" - AUID_FILTERS="" - SYSCALL="sethostname setdomainname" - KEY="audit_rules_networkconfig_modification" - SYSCALL_GROUPING="sethostname setdomainname" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="mount" + KEY="perm_mod" + SYSCALL_GROUPING="" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -66477,541 +66132,161 @@ if [ "$skip" -ne 0 ]; then fi done -# Then perform the remediations for the watch rules -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue.net" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/hosts" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sysconfig/network" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" - # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" - fi -done - else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Network Environment + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following lines to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification +-w /etc/issue -p wa -k audit_rules_networkconfig_modification +-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification +-w /etc/hosts -p wa -k audit_rules_networkconfig_modification +-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S sethostname,setdomainname -F key=audit_rules_networkconfig_modification +-w /etc/issue -p wa -k audit_rules_networkconfig_modification +-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification +-w /etc/hosts -p wa -k audit_rules_networkconfig_modification +-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.5.5 + 10.3.4 + 5.2.3.5 + The network environment should not be modified by anything other +than administrator action. Any change to network parameters should be +audited. + CCE-80723-0 - name: Gather the package facts package_facts: manager: auto @@ -68102,180 +67377,330 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Attempts to Alter Process and Session Initiation Information - The audit system already collects process information for all -users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following lines to a file with suffix .rules in the -directory /etc/audit/rules.d in order to watch for attempted manual -edits of files involved in storing such process information: --w /var/run/utmp -p wa -k session --w /var/log/btmp -p wa -k session --w /var/log/wtmp -p wa -k session -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file in order to watch for attempted manual -edits of files involved in storing such process information: --w /var/run/utmp -p wa -k session --w /var/log/btmp -p wa -k session --w /var/log/wtmp -p wa -k session - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - 0582 - 0584 - 05885 - 0586 - 0846 - 0957 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.3 - 10.2.1.3 - SRG-APP-000505-CTR-001285 - 4.1.3.11 - Manual editing of these files may indicate nefarious activity, such -as an attacker attempting to remove evidence of an intrusion. - CCE-80742-0 - --- + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %0A-w%20/var/run/utmp%20-p%20wa%20-k%20session%0A-w%20/var/log/btmp%20-p%20wa%20-k%20session%0A-w%20/var/log/wtmp%20-p%20wa%20-k%20session%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-audit-session-events.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="" + SYSCALL="sethostname setdomainname" + KEY="audit_rules_networkconfig_modification" + SYSCALL_GROUPING="sethostname setdomainname" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done +# Then perform the remediations for the watch rules # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: @@ -68300,7 +67725,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68308,7 +67733,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68324,12 +67749,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68347,8 +67772,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/run/utmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68361,9 +67786,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68377,7 +67802,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68385,7 +67810,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68401,12 +67826,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68432,7 +67857,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68440,7 +67865,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68456,12 +67881,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68479,8 +67904,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/btmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/issue.net" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68493,9 +67918,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68509,7 +67934,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/issue.net" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68517,7 +67942,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/issue.net $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68533,12 +67958,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/issue.net$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/issue.net -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68564,7 +67989,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68572,7 +67997,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68588,12 +68013,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -68611,8 +68036,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/wtmp" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/hosts" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -68625,9 +68050,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/session.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/session.rules" - # If the session.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -68641,7 +68066,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/hosts" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -68649,7 +68074,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/hosts $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -68665,12 +68090,144 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/hosts$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + echo "-w /etc/hosts -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sysconfig/network" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_networkconfig_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_networkconfig_modification.rules" + # If the audit_rules_networkconfig_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sysconfig/network" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sysconfig/network $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sysconfig/network$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sysconfig/network -p wa -k audit_rules_networkconfig_modification" >> "$audit_rules_file" fi done @@ -68678,6 +68235,160 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Attempts to Alter Process and Session Initiation Information + The audit system already collects process information for all +users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following lines to a file with suffix .rules in the +directory /etc/audit/rules.d in order to watch for attempted manual +edits of files involved in storing such process information: +-w /var/run/utmp -p wa -k session +-w /var/log/btmp -p wa -k session +-w /var/log/wtmp -p wa -k session +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file in order to watch for attempted manual +edits of files involved in storing such process information: +-w /var/run/utmp -p wa -k session +-w /var/log/btmp -p wa -k session +-w /var/log/wtmp -p wa -k session + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + 0582 + 0584 + 05885 + 0586 + 0846 + 0957 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.3 + 10.2.1.3 + SRG-APP-000505-CTR-001285 + 5.2.3.11 + Manual editing of these files may indicate nefarious activity, such +as an attacker attempting to remove evidence of an intrusion. + CCE-80742-0 - name: Gather the package facts package_facts: manager: auto @@ -69243,59 +68954,24 @@ fi - reboot_required - restrict_strategy - - - - - - Ensure auditd Collects System Administrator Actions - /etc/sudoers - At a minimum, the audit system should collect administrator actions -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the default), -add the following line to a file with suffix .rules in the directory -/etc/audit/rules.d: --w /etc/sudoers -p wa -k actions -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /etc/sudoers -p wa -k actions - CCI-000018 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-001403 - CCI-001404 - CCI-002130 - CCI-002132 - CCI-002884 - SRG-OS-000004-GPOS-00004 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000304-GPOS-00121 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000470-GPOS-00214 - SRG-OS-000471-GPOS-00215 - SRG-OS-000239-GPOS-00089 - SRG-OS-000240-GPOS-00090 - SRG-OS-000241-GPOS-00091 - SRG-OS-000303-GPOS-00120 - SRG-OS-000466-GPOS-00210 - SRG-OS-000476-GPOS-00221 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000503-CTR-001275 - RHEL-08-030171 - SV-230409r627750_rule - The actions taken by system administrators should be audited to keep a record -of what was executed on the system, as well as, for accountability purposes. -Editing the sudoers file may be sign of an attacker trying to -establish persistent methods to a system, auditing the editing of the sudoers -files mitigates this risk. - CCE-90175-1 - # Remediation is applicable only in certain platforms + --- + + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %0A-w%20/var/run/utmp%20-p%20wa%20-k%20session%0A-w%20/var/log/btmp%20-p%20wa%20-k%20session%0A-w%20/var/log/wtmp%20-p%20wa%20-k%20session%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-audit-session-events.rules + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -69322,7 +68998,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69330,7 +69006,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69346,12 +69022,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -69369,8 +69045,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/run/utmp" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -69383,9 +69059,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -69399,7 +69075,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/var/run/utmp" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69407,7 +69083,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/run/utmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69423,75 +69099,391 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/var/run/utmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + echo "-w /var/run/utmp -p wa -k session" >> "$audit_rules_file" fi done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Check if watch rule for /etc/sudoers already exists in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: ^\s*-w\s+/etc/sudoers\s+-p\s+wa(\s|$)+ - patterns: '*.rules' - register: find_existing_watch_rules_d - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: Search /etc/audit/rules.d for other rules with specified key actions - find: - paths: /etc/audit/rules.d - contains: ^.*(?:-F key=|-k\s+)actions$ - patterns: '*.rules' - register: find_watch_key - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - find_existing_watch_rules_d.matched is defined and find_existing_watch_rules_d.matched - == 0 - tags: - - CCE-90175-1 - - DISA-STIG-RHEL-08-030171 - - audit_rules_sudoers - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') -- name: Use /etc/audit/rules.d/actions.rules as the recipient for the rule - set_fact: - all_files: +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/btmp" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/btmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/btmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/btmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/btmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/session.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/wtmp" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/session.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/session.rules" + # If the session.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/wtmp" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/wtmp $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/wtmp$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/wtmp -p wa -k session" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + Ensure auditd Collects System Administrator Actions - /etc/sudoers + At a minimum, the audit system should collect administrator actions +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the default), +add the following line to a file with suffix .rules in the directory +/etc/audit/rules.d: +-w /etc/sudoers -p wa -k actions +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /etc/sudoers -p wa -k actions + CCI-000018 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-001403 + CCI-001404 + CCI-002130 + CCI-002132 + CCI-002884 + SRG-OS-000004-GPOS-00004 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000304-GPOS-00121 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000470-GPOS-00214 + SRG-OS-000471-GPOS-00215 + SRG-OS-000239-GPOS-00089 + SRG-OS-000240-GPOS-00090 + SRG-OS-000241-GPOS-00091 + SRG-OS-000303-GPOS-00120 + SRG-OS-000466-GPOS-00210 + SRG-OS-000476-GPOS-00221 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000503-CTR-001275 + RHEL-08-030171 + SV-230409r627750_rule + The actions taken by system administrators should be audited to keep a record +of what was executed on the system, as well as, for accountability purposes. +Editing the sudoers file may be sign of an attacker trying to +establish persistent methods to a system, auditing the editing of the sudoers +files mitigates this risk. + CCE-90175-1 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Check if watch rule for /etc/sudoers already exists in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: ^\s*-w\s+/etc/sudoers\s+-p\s+wa(\s|$)+ + patterns: '*.rules' + register: find_existing_watch_rules_d + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Search /etc/audit/rules.d for other rules with specified key actions + find: + paths: /etc/audit/rules.d + contains: ^.*(?:-F key=|-k\s+)actions$ + patterns: '*.rules' + register: find_watch_key + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - find_existing_watch_rules_d.matched is defined and find_existing_watch_rules_d.matched + == 0 + tags: + - CCE-90175-1 + - DISA-STIG-RHEL-08-030171 + - audit_rules_sudoers + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Use /etc/audit/rules.d/actions.rules as the recipient for the rule + set_fact: + all_files: - /etc/audit/rules.d/actions.rules when: - '"audit" in ansible_facts.packages' @@ -69589,62 +69581,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ - At a minimum, the audit system should collect administrator actions -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the default), -add the following line to a file with suffix .rules in the directory -/etc/audit/rules.d: --w /etc/sudoers.d/ -p wa -k actions -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --w /etc/sudoers.d/ -p wa -k actions - CCI-000018 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-001403 - CCI-001404 - CCI-002130 - CCI-002132 - CCI-002884 - SRG-OS-000004-GPOS-00004 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000304-GPOS-00121 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000470-GPOS-00214 - SRG-OS-000471-GPOS-00215 - SRG-OS-000239-GPOS-00089 - SRG-OS-000240-GPOS-00090 - SRG-OS-000241-GPOS-00091 - SRG-OS-000303-GPOS-00120 - SRG-OS-000466-GPOS-00210 - SRG-OS-000476-GPOS-00221 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000503-CTR-001275 - RHEL-08-030172 - SV-230410r627750_rule - The actions taken by system administrators should be audited to keep a record -of what was executed on the system, as well as, for accountability purposes. -Editing the sudoers file may be sign of an attacker trying to -establish persistent methods to a system, auditing the editing of the sudoers -files mitigates this risk. - CCE-89497-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -69671,7 +69608,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69679,7 +69616,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69695,12 +69632,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -69719,7 +69656,7 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. # If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -69748,7 +69685,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -69756,7 +69693,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -69772,12 +69709,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" fi done @@ -69785,6 +69722,61 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ + At a minimum, the audit system should collect administrator actions +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the default), +add the following line to a file with suffix .rules in the directory +/etc/audit/rules.d: +-w /etc/sudoers.d/ -p wa -k actions +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-w /etc/sudoers.d/ -p wa -k actions + CCI-000018 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-001403 + CCI-001404 + CCI-002130 + CCI-002132 + CCI-002884 + SRG-OS-000004-GPOS-00004 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000304-GPOS-00121 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000470-GPOS-00214 + SRG-OS-000471-GPOS-00215 + SRG-OS-000239-GPOS-00089 + SRG-OS-000240-GPOS-00090 + SRG-OS-000241-GPOS-00091 + SRG-OS-000303-GPOS-00120 + SRG-OS-000466-GPOS-00210 + SRG-OS-000476-GPOS-00221 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000503-CTR-001275 + RHEL-08-030172 + SV-230410r627750_rule + The actions taken by system administrators should be audited to keep a record +of what was executed on the system, as well as, for accountability purposes. +Editing the sudoers file may be sign of an attacker trying to +establish persistent methods to a system, auditing the editing of the sudoers +files mitigates this risk. + CCE-89497-2 - name: Gather the package facts package_facts: manager: auto @@ -69937,6 +69929,147 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -69963,7 +70096,7 @@ If audit is using the "augenrules" tool to load the rules, run the following com If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. Note that these rules can be configured in a number of ways while still achieving the desired effect. - 4.1.3.2 + 5.2.3.2 Creating an audit log of users with temporary elevated privileges and the operation(s) they performed is essential to reporting. Administrators will want to correlate the events written to the audit trail with the records @@ -69977,6 +70110,128 @@ of privileged functions is one way to detect such misuse and identify the risk from insider threats and the advanced persistent threat. CCE-90209-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Service facts + ansible.builtin.service_facts: null + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Check the rules script being used + ansible.builtin.command: grep '^ExecStartPost' /usr/lib/systemd/system/auditd.service + register: check_rules_scripts_result + changed_when: false + failed_when: false + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set suid_audit_rules fact + ansible.builtin.set_fact: + suid_audit_rules: + - rule: -a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset -k user_emulation + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Update /etc/audit/rules.d/user_emulation.rules to audit privileged functions + ansible.builtin.lineinfile: + path: /etc/audit/rules.d/user_emulation.rules + line: '{{ item.rule }}' + regexp: '{{ item.regex }}' + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"auditd.service" in ansible_facts.services' + - '"augenrules" in check_rules_scripts_result.stdout' + register: augenrules_audit_rules_privilege_function_update_result + with_items: '{{ suid_audit_rules }}' + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Update Update /etc/audit/audit.rules to audit privileged functions + ansible.builtin.lineinfile: + path: /etc/audit/audit.rules + line: '{{ item.rule }}' + regexp: '{{ item.regex }}' + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - '"auditd.service" in ansible_facts.services' + - '"auditctl" in check_rules_scripts_result.stdout' + register: auditctl_audit_rules_privilege_function_update_result + with_items: '{{ suid_audit_rules }}' + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Restart Auditd + ansible.builtin.command: /usr/sbin/service auditd restart + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) + - ansible_facts.services["auditd.service"].state == "running" + tags: + - CCE-90209-8 + - audit_rules_suid_auid_privilege_function + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -70304,12 +70559,83 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Events When Privileged Executables Are Run + Verify the system generates an audit record when privileged functions are executed. + +If audit is using the "auditctl" tool to load the rules, run the following command: + +$ sudo grep execve /etc/audit/audit.rules + +If audit is using the "augenrules" tool to load the rules, run the following command: + +$ sudo grep -r execve /etc/audit/rules.d + + +-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid +-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + + +If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. +If both the "b32" and "b64" audit rules for "SGID" files are not defined, this is a finding. + Note that these rules can be configured in a +number of ways while still achieving the desired effect. + CCI-001814 + CCI-001882 + CCI-001889 + CCI-001880 + CCI-001881 + CCI-001878 + CCI-001879 + CCI-001875 + CCI-001877 + CCI-001914 + CCI-002233 + CCI-002234 + CM-5(1) + AU-7(a) + AU-7(b) + AU-8(b) + AU-12(3) + AC-6(9) + 10.2.1.2 + SRG-OS-000326-GPOS-00126 + SRG-OS-000327-GPOS-00127 + SRG-APP-000343-CTR-000780 + SRG-APP-000381-CTR-000905 + RHEL-08-030000 + SV-230386r854037_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have +compromised information system accounts, is a serious and ongoing concern +and can have significant adverse impacts on organizations. Auditing the use +of privileged functions is one way to detect such misuse and identify the +risk from insider threats and the advanced persistent threat. + + CCE-83556-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70322,25 +70648,16 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Check the rules script being used - ansible.builtin.command: grep '^ExecStartPost' /usr/lib/systemd/system/auditd.service - register: check_rules_scripts_result - changed_when: false - failed_when: false - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70350,38 +70667,57 @@ fi - name: Set suid_audit_rules fact ansible.builtin.set_fact: suid_audit_rules: - - rule: -a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset -k user_emulation - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-C[\s]+euid!=uid[\s]+-F[\s]+auid!=unset[\s]+-S[\s]+execve[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ + - rule: -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid + regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Update /etc/audit/rules.d/user_emulation.rules to audit privileged functions +- name: Update /etc/audit/rules.d/privileged.rules to audit privileged functions ansible.builtin.lineinfile: - path: /etc/audit/rules.d/user_emulation.rules + path: /etc/audit/rules.d/privileged.rules line: '{{ item.rule }}' regexp: '{{ item.regex }}' create: true when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"auditd.service" in ansible_facts.services' - - '"augenrules" in check_rules_scripts_result.stdout' + - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') register: augenrules_audit_rules_privilege_function_update_result with_items: '{{ suid_audit_rules }}' tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70397,13 +70733,20 @@ fi when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - '"auditd.service" in ansible_facts.services' - - '"auditctl" in check_rules_scripts_result.stdout' + - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') register: auditctl_audit_rules_privilege_function_update_result with_items: '{{ suid_audit_rules }}' tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity @@ -70418,77 +70761,22 @@ fi - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) - ansible_facts.services["auditd.service"].state == "running" tags: - - CCE-90209-8 - - audit_rules_suid_auid_privilege_function + - CCE-83556-1 + - DISA-STIG-RHEL-08-030000 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(3) + - NIST-800-53-AU-7(a) + - NIST-800-53-AU-7(b) + - NIST-800-53-AU-8(b) + - NIST-800-53-CM-5(1) + - PCI-DSSv4-10.2.1.2 + - audit_rules_suid_privilege_function - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Events When Privileged Executables Are Run - Verify the system generates an audit record when privileged functions are executed. - -If audit is using the "auditctl" tool to load the rules, run the following command: - -$ sudo grep execve /etc/audit/audit.rules - -If audit is using the "augenrules" tool to load the rules, run the following command: - -$ sudo grep -r execve /etc/audit/rules.d - - --a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid --a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - - -If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. -If both the "b32" and "b64" audit rules for "SGID" files are not defined, this is a finding. - Note that these rules can be configured in a -number of ways while still achieving the desired effect. - CCI-001814 - CCI-001882 - CCI-001889 - CCI-001880 - CCI-001881 - CCI-001878 - CCI-001879 - CCI-001875 - CCI-001877 - CCI-001914 - CCI-002233 - CCI-002234 - CM-5(1) - AU-7(a) - AU-7(b) - AU-8(b) - AU-12(3) - AC-6(9) - 10.2.1.2 - SRG-OS-000326-GPOS-00126 - SRG-OS-000327-GPOS-00127 - SRG-APP-000343-CTR-000780 - SRG-APP-000381-CTR-000905 - RHEL-08-030000 - SV-230386r854037_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have -compromised information system accounts, is a serious and ongoing concern -and can have significant adverse impacts on organizations. Auditing the use -of privileged functions is one way to detect such misuse and identify the -risk from insider threats and the advanced persistent threat. - - CCE-83556-1 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -71150,161 +71438,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Service facts - ansible.builtin.service_facts: null - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set suid_audit_rules fact - ansible.builtin.set_fact: - suid_audit_rules: - - rule: -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+gid!=egid[\s]+-F[\s]+egid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b32[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - - rule: -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid - regex: ^[\s]*-a[\s]+always,exit[\s]+-F[\s]+arch=b64[\s]+-S[\s]+execve[\s]+-C[\s]+uid!=euid[\s]+-F[\s]+euid=0[\s]+(?:-k[\s]+|-F[\s]+key=)[\S]+[\s]*$ - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Update /etc/audit/rules.d/privileged.rules to audit privileged functions - ansible.builtin.lineinfile: - path: /etc/audit/rules.d/privileged.rules - line: '{{ item.rule }}' - regexp: '{{ item.regex }}' - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') - register: augenrules_audit_rules_privilege_function_update_result - with_items: '{{ suid_audit_rules }}' - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Update Update /etc/audit/audit.rules to audit privileged functions - ansible.builtin.lineinfile: - path: /etc/audit/audit.rules - line: '{{ item.rule }}' - regexp: '{{ item.regex }}' - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ('"auditd.service" in ansible_facts.services' or '"augenrules.service" in ansible_facts.services') - register: auditctl_audit_rules_privilege_function_update_result - with_items: '{{ suid_audit_rules }}' - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Restart Auditd - ansible.builtin.command: /usr/sbin/service auditd restart - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - (augenrules_audit_rules_privilege_function_update_result.changed or auditctl_audit_rules_privilege_function_update_result.changed) - - ansible_facts.services["auditd.service"].state == "running" - tags: - - CCE-83556-1 - - DISA-STIG-RHEL-08-030000 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(3) - - NIST-800-53-AU-7(a) - - NIST-800-53-AU-7(b) - - NIST-800-53-AU-8(b) - - NIST-800-53-CM-5(1) - - PCI-DSSv4-10.2.1.2 - - audit_rules_suid_privilege_function - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -71514,299 +71647,10 @@ utility to read audit rules during daemon startup, add the following line to SRG-APP-000319-CTR-000745 SRG-APP-000320-CTR-000750 SRG-APP-000509-CTR-001305 - 4.1.3.1 + 5.2.3.1 The actions taken by system administrators should be audited to keep a record of what was executed on the system, as well as, for accountability purposes. CCE-80743-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/sudoers.d/%20-p%20wa%20-k%20actions%0A-w%20/etc/sudoers%20-p%20wa%20-k%20actions%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-audit-sysadmin-actions.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/actions.rules" - # If the actions.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -72234,6 +72078,295 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/sudoers.d/%20-p%20wa%20-k%20actions%0A-w%20/etc/sudoers%20-p%20wa%20-k%20actions%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-audit-sysadmin-actions.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/actions.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/sudoers.d/" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/actions.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/actions.rules" + # If the actions.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/sudoers.d/" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/sudoers.d/ $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/sudoers.d/$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/sudoers.d/ -p wa -k actions" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -72307,29 +72440,6 @@ Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. CCE-80744-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audit_failure_mode='' - - -# Traverse all of: -# -# /etc/audit/audit.rules, (for auditctl case) -# /etc/audit/rules.d/*.rules (for augenrules case) -find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-f[[:space:]]\+.*/d' {} ';' - -for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" -do - echo '' >> $AUDIT_FILE - echo '# Set the audit.rules configuration to halt system upon audit failure per security requirements' >> $AUDIT_FILE - echo "-f $var_audit_failure_mode" >> $AUDIT_FILE -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -72422,6 +72532,29 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audit_failure_mode='' + + +# Traverse all of: +# +# /etc/audit/audit.rules, (for auditctl case) +# /etc/audit/rules.d/*.rules (for augenrules case) +find /etc/audit /etc/audit/rules.d -maxdepth 1 -type f -name '*.rules' -exec sed -i '/-f[[:space:]]\+.*/d' {} ';' + +for AUDIT_FILE in "/etc/audit/audit.rules" "/etc/audit/rules.d/immutable.rules" +do + echo '' >> $AUDIT_FILE + echo '# Set the audit.rules configuration to halt system upon audit failure per security requirements' >> $AUDIT_FILE + echo "-f $var_audit_failure_mode" >> $AUDIT_FILE +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -73527,154 +73660,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030170 - 4.1.3.8 + 5.2.3.8 SV-230408r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80758-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/group" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -73900,6 +73891,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/group" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/group" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/group $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/group$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/group -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -74120,154 +74253,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030160 - 4.1.3.8 + 5.2.3.8 SV-230407r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80759-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/gshadow" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -74493,6 +74484,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/gshadow" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/gshadow" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/gshadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/gshadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/gshadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -74715,154 +74848,12 @@ account changes: SRG-APP-000498-CTR-001250 SRG-APP-000503-CTR-001275 RHEL-08-030140 - 4.1.3.8 + 5.2.3.8 SV-230405r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80760-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/security/opasswd" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -75088,6 +75079,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/security/opasswd" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/security/opasswd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/security/opasswd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/security/opasswd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/security/opasswd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -75313,154 +75446,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030150 - 4.1.3.8 + 5.2.3.8 SV-230406r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80761-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/passwd" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -75686,6 +75677,148 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/passwd" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/passwd" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/passwd $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/passwd$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/passwd -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -75906,154 +76039,12 @@ account changes: SRG-APP-000499-CTR-001255 SRG-APP-000503-CTR-001275 RHEL-08-030130 - 4.1.3.8 + 5.2.3.8 SV-230404r627750_rule In addition to auditing new user and group accounts, these watches will alert the system administrator(s) to any modifications. Any unexpected users, groups, or modifications should be investigated for legitimacy. CCE-80762-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/shadow" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" - # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -76280,58 +76271,11 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Attempts to perform maintenance activities - The Red Hat Enterprise Linux 8 operating system must generate audit records for -privileged activities, nonlocal maintenance, diagnostic sessions and -other system-level access. - -Verify the operating system audits activities performed during nonlocal -maintenance and diagnostic sessions. Run the following command: -$ sudo auditctl -l | grep sudo.log --w /var/log/sudo.log -p wa -k maintenance - BP28(R73) - CCI-000172 - CCI-002884 - Req-10.2.2 - Req-10.2.5.b - 10.2.1.4 - SRG-OS-000392-GPOS-00172 - SRG-OS-000471-GPOS-00215 - 4.1.3.3 - If events associated with nonlocal administrative access or diagnostic -sessions are not logged, a major tool for assessing and investigating -attacks would not be available. -This requirement addresses auditing-related issues associated with -maintenance tools used specifically for diagnostic and repair actions -on organizational information systems. -Nonlocal maintenance and diagnostic activities are those activities -conducted by individuals communicating through a network, either an -external network (e.g., the internet) or an internal network. Local -maintenance and diagnostic activities are those activities carried -out by individuals physically present at the information system or -information system component and not communicating across a network -connection. -This requirement applies to hardware/software diagnostic test -equipment or tools. This requirement does not cover hardware/software -components that may support information system maintenance, yet are a -part of the system, for example, the software implementing "ping," -"ls," "ipconfig," or the hardware and software implementing the -monitoring port of an Ethernet switch. - CCE-86432-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: # @@ -76355,7 +76299,7 @@ files_to_inspect+=('/etc/audit/audit.rules') for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -76363,7 +76307,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -76379,12 +76323,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" fi done # Create a list of audit *.rules files that should be inspected for presence and correctness @@ -76402,8 +76346,8 @@ files_to_inspect=() # If the audit is 'augenrules', then check if rule is already defined # If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/sudo.log" /etc/audit/rules.d/*.rules) +# If rule isn't defined, add '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/shadow" /etc/audit/rules.d/*.rules) # For each of the matched entries for match in "${matches[@]}" @@ -76416,9 +76360,9 @@ done # Case when particular audit rule isn't defined yet if [ "${#files_to_inspect[@]}" -eq "0" ] then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions + # Append '/etc/audit/rules.d/audit_rules_usergroup_modification.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_rules_usergroup_modification.rules" + # If the audit_rules_usergroup_modification.rules file doesn't exist yet, create it with correct permissions if [ ! -e "$key_rule_file" ] then touch "$key_rule_file" @@ -76432,7 +76376,7 @@ fi for audit_rules_file in "${files_to_inspect[@]}" do # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + if grep -q -P -- "^[\s]*-w[\s]+/etc/shadow" "$audit_rules_file" then # Rule is found => verify yet if existing rule definition contains # all of the required access type bits @@ -76440,7 +76384,7 @@ do # Define BRE whitespace class shortcut sp="[[:space:]]" # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/shadow $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") # Split required access bits string into characters array # (to check bit's presence for one bit at a time) for access_bit in $(echo "wa" | grep -o .) @@ -76456,12 +76400,12 @@ do done # Propagate the updated rule's access bits (original + the required # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + sed -i "s#\($sp*-w$sp\+/etc/shadow$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" else # Rule isn't present yet. Append it at the end of $audit_rules_file file # with proper key - echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + echo "-w /etc/shadow -p wa -k audit_rules_usergroup_modification" >> "$audit_rules_file" fi done @@ -76469,6 +76413,52 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Attempts to perform maintenance activities + The Red Hat Enterprise Linux 8 operating system must generate audit records for +privileged activities, nonlocal maintenance, diagnostic sessions and +other system-level access. + +Verify the operating system audits activities performed during nonlocal +maintenance and diagnostic sessions. Run the following command: +$ sudo auditctl -l | grep sudo.log +-w /var/log/sudo.log -p wa -k maintenance + BP28(R73) + CCI-000172 + CCI-002884 + Req-10.2.2 + Req-10.2.5.b + 10.2.1.4 + SRG-OS-000392-GPOS-00172 + SRG-OS-000471-GPOS-00215 + 5.2.3.3 + If events associated with nonlocal administrative access or diagnostic +sessions are not logged, a major tool for assessing and investigating +attacks would not be available. +This requirement addresses auditing-related issues associated with +maintenance tools used specifically for diagnostic and repair actions +on organizational information systems. +Nonlocal maintenance and diagnostic activities are those activities +conducted by individuals communicating through a network, either an +external network (e.g., the internet) or an internal network. Local +maintenance and diagnostic activities are those activities carried +out by individuals physically present at the information system or +information system component and not communicating across a network +connection. +This requirement applies to hardware/software diagnostic test +equipment or tools. This requirement does not cover hardware/software +components that may support information system maintenance, yet are a +part of the system, for example, the software implementing "ping," +"ls," "ipconfig," or the hardware and software implementing the +monitoring port of an Ethernet switch. + CCE-86432-2 - name: Gather the package facts package_facts: manager: auto @@ -76637,6 +76627,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/sudo.log" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/sudo.log" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/sudo.log $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/sudo.log$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/sudo.log -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -76668,6 +76801,158 @@ utility to read audit rules during daemon startup, add the rule to Auditing these events could serve as evidence of potential system compromise.' CCE-80941-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80941-8 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSSv4-10.3.1 + - directory_access_var_log_audit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /var/log/audit + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/access-audit-trail.rules + set_fact: audit_file="/etc/audit/rules.d/access-audit-trail.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r + -F auid>=1000 -F auid!=unset -F key=access-audit-trail + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r + -F auid>=1000 -F auid!=unset -F key=access-audit-trail + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80941-8 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSSv4-10.3.1 + - directory_access_var_log_audit + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -76987,158 +77272,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80941-8 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSSv4-10.3.1 - - directory_access_var_log_audit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /var/log/audit - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/access-audit-trail.rules - set_fact: audit_file="/etc/audit/rules.d/access-audit-trail.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r - -F auid>=1000 -F auid!=unset -F key=access-audit-trail - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F dir=/var/log/audit/ -F perm=r - -F auid>=1000 -F auid!=unset -F key=access-audit-trail - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80941-8 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSSv4-10.3.1 - - directory_access_var_log_audit - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -77260,27 +77393,6 @@ group account, change the group ownership of the audit directories to this speci Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. CCE-88225-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -m 1 -q ^log_group /etc/audit/auditd.conf; then - GROUP=$(awk -F "=" '/log_group/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') -else - GROUP=root -fi -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - DIR=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ' | rev | cut -d"/" -f2- | rev) -else - DIR="/var/log/audit" -fi - - -find ${DIR} -type d -exec chgrp ${GROUP} {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -77351,6 +77463,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -m 1 -q ^log_group /etc/audit/auditd.conf; then + GROUP=$(awk -F "=" '/log_group/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') +else + GROUP=root +fi +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + DIR=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ' | rev | cut -d"/" -f2- | rev) +else + DIR="/var/log/audit" +fi + + +find ${DIR} -type d -exec chgrp ${GROUP} {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77469,21 +77602,6 @@ To properly set the owner of /var/log/audit, run the comm Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. CCE-88226-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') - LOGPATH="$(dirname "$FILE")" - chown root $LOGPATH -else - chown root /var/log/audit -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -77551,6 +77669,21 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') + LOGPATH="$(dirname "$FILE")" + chown root $LOGPATH +else + chown root /var/log/audit +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77678,6 +77811,7 @@ By default, audit_log_directory is "/var SRG-OS-000058-GPOS-00028 SRG-OS-000059-GPOS-00029 RHEL-08-030120 + 5.2.4.1 SV-230401r627750_rule If users can write to audit logs, audit trails can be modified or destroyed. CCE-84048-8 @@ -77817,6 +77951,7 @@ to this specific group. SRG-OS-000059-GPOS-00029 SRG-OS-000206-GPOS-00084 RHEL-08-030090 + 5.2.4.4 SV-230398r627750_rule Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. @@ -77859,6 +77994,7 @@ fi chown :root /etc/audit/audit*.{rules,conf} /etc/audit/rules.d/* CCI-000171 SRG-OS-000063-GPOS-00032 + 5.2.4.7 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -77866,21 +78002,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find /etc/audit/ -maxdepth 1 -type f ! -group 0 -regex '^audit(\.rules|d\.conf)$' -exec chgrp 0 {} \; - -find /etc/audit/rules.d/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.rules$' -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86405-8 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77898,6 +78025,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77916,6 +78044,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77933,6 +78062,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity @@ -77951,12 +78081,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86405-8 - configure_strategy - file_groupownership_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find /etc/audit/ -maxdepth 1 -type f ! -group 0 -regex '^audit(\.rules|d\.conf)$' -exec chgrp 0 {} \; + +find /etc/audit/rules.d/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.rules$' -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -77976,6 +78118,7 @@ To properly set the owner of /etc/audit/rules.d/, run the $ sudo chown root /etc/audit/rules.d/ CCI-000171 SRG-OS-000063-GPOS-00032 + 5.2.4.6 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -77983,21 +78126,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find /etc/audit/ -maxdepth 1 -type f ! -uid 0 -regex '^audit(\.rules|d\.conf)$' -exec chown 0 {} \; - -find /etc/audit/rules.d/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.rules$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86406-6 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78015,6 +78149,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78033,6 +78168,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78050,6 +78186,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity @@ -78068,12 +78205,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86406-6 - configure_strategy - file_ownership_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find /etc/audit/ -maxdepth 1 -type f ! -uid 0 -regex '^audit(\.rules|d\.conf)$' -exec chown 0 {} \; + +find /etc/audit/rules.d/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.rules$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78339,6 +78488,7 @@ To properly set the owner of /var/log/audit/*, run the co SRG-OS-000059-GPOS-00029 SRG-OS-000206-GPOS-00084 RHEL-08-030080 + 5.2.4.3 SV-230397r627750_rule Unauthorized disclosure of audit records can reveal system and configuration data to attackers, thus compromising its confidentiality. @@ -78368,6 +78518,7 @@ fi Audit Configuration Files Permissions are 640 or More Restrictive All audit configuration files permissions must be 640 or more restrictive. chmod 0640 /etc/audit/audit*.{rules,conf} /etc/audit/rules.d/* + 5.2.4.5 Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent the auditing of critical events. @@ -78375,21 +78526,12 @@ Misconfigured audits may degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -find -H /etc/audit/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*audit\(\.rules\|d\.conf\)$' -exec chmod u-xs,g-xws,o-xwrt {} \; - -find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*\.rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - + CCE-86407-4 - name: Gather the package facts package_facts: manager: auto tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78408,6 +78550,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78426,6 +78569,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78444,6 +78588,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity @@ -78462,12 +78607,24 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-86407-4 - configure_strategy - file_permissions_audit_configuration - low_complexity - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +find -H /etc/audit/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*audit\(\.rules\|d\.conf\)$' -exec chmod u-xs,g-xws,o-xwrt {} \; + +find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '.*\.rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78597,25 +78754,10 @@ By default, audit_log_file is "/var/log/audit/audit.log".SRG-OS-000206-GPOS-00084 SRG-APP-000118-CTR-000240 RHEL-08-030070 + 5.2.4.2 SV-230396r902733_rule If users can write to audit logs, audit trails can be modified or destroyed. CCE-80819-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then - FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') -else - FILE="/var/log/audit/audit.log" -fi - - -chmod 0600 $FILE - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -78758,6 +78900,22 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if LC_ALL=C grep -iw ^log_file /etc/audit/auditd.conf; then + FILE=$(awk -F "=" '/^log_file/ {print $2}' /etc/audit/auditd.conf | tr -d ' ') +else + FILE="/var/log/audit/audit.log" +fi + + +chmod 0600 $FILE + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -78946,7 +79104,7 @@ calls with others as identifying earlier in this guide is more efficient.SRG-APP-000495-CTR-001235 SRG-APP-000499-CTR-001255 RHEL-08-030490 - 4.1.3.9 + 5.2.3.9 SV-230456r810462_rule The changing of file permissions could indicate that a user is attempting to gain access to information that would otherwise be disallowed. Auditing DAC modifications @@ -78954,334 +79112,6 @@ can facilitate the identification of patterns of abuse among both authorized and unauthorized users. CCE-80685-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="chmod" - KEY="perm_mod" - SYSCALL_GROUPING="chmod fchmod fchmodat" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -79623,185 +79453,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - chown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - CCE-80686-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -79813,9 +79465,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="chown" + SYSCALL="chmod" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="chmod fchmod fchmodat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -80129,6 +79781,184 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - chown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + + CCE-80686-9 - name: Gather the package facts package_facts: manager: auto @@ -80474,184 +80304,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchmod - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030490 - 4.1.3.9 - SV-230456r810462_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80687-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -80662,9 +80316,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchmod" + SYSCALL="chown" KEY="perm_mod" - SYSCALL_GROUPING="chmod fchmod fchmodat" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -80978,6 +80632,182 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchmod + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030490 + 5.2.3.9 + SV-230456r810462_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80687-7 - name: Gather the package facts package_facts: manager: auto @@ -81316,183 +81146,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchmodat - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured to -use the augenrules program to read audit rules during daemon startup -(the default), add the following line to a file with suffix .rules in -the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030490 - 4.1.3.9 - SV-230456r810462_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80688-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -81504,7 +81158,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchmodat" + SYSCALL="fchmod" KEY="perm_mod" SYSCALL_GROUPING="chmod fchmod fchmodat" @@ -81820,6 +81474,182 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchmodat + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured to +use the augenrules program to read audit rules during daemon startup +(the default), add the following line to a file with suffix .rules in +the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030490 + 5.2.3.9 + SV-230456r810462_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80688-5 - name: Gather the package facts package_facts: manager: auto @@ -82158,187 +81988,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80689-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -82350,9 +82000,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchown" + SYSCALL="fchmodat" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="chmod fchmod fchmodat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -82666,6 +82316,186 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80689-3 - name: Gather the package facts package_facts: manager: auto @@ -83008,184 +82838,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fchownat - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80690-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -83197,7 +82850,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fchownat" + SYSCALL="fchown" KEY="perm_mod" SYSCALL_GROUPING="chown fchown fchownat lchown" @@ -83513,6 +83166,183 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fchownat + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80690-1 - name: Gather the package facts package_facts: manager: auto @@ -83855,197 +83685,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fremovexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80691-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -84057,328 +83697,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fremovexattr" - KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - - - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid=0" - SYSCALL="fremovexattr" + SYSCALL="fchownat" KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -84692,6 +84013,196 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fremovexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fremovexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80691-9 - name: Gather the package facts package_facts: manager: auto @@ -85298,194 +84809,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - fsetxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80692-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -85497,7 +84821,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="fsetxattr" + SYSCALL="fremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -85816,7 +85140,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="fsetxattr" + SYSCALL="fremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -86132,135 +85456,322 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80692-7 - - CJIS-5.4.1.1 - - DISA-STIG-RHEL-08-030200 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.5.5 - - PCI-DSSv4-10.3.4 - - audit_rules_dac_modification_fsetxattr - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Set architecture for audit fsetxattr tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80692-7 - - CJIS-5.4.1.1 - - DISA-STIG-RHEL-08-030200 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.5.5 - - PCI-DSSv4-10.3.4 - - audit_rules_dac_modification_fsetxattr - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - -- name: Perform remediation of Audit rules for fsetxattr for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - fsetxattr - syscall_grouping: - - fremovexattr - - lremovexattr - - removexattr - - fsetxattr - - lsetxattr - - setxattr - - - name: Check existence of fsetxattr in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/perm_mod.rules - set_fact: audit_file="/etc/audit/rules.d/perm_mod.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F auid>=1000 - -F auid!=unset -F key=perm_mod - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - fsetxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S fsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S fsetxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80692-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80692-7 + - CJIS-5.4.1.1 + - DISA-STIG-RHEL-08-030200 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.5.5 + - PCI-DSSv4-10.3.4 + - audit_rules_dac_modification_fsetxattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit fsetxattr tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80692-7 + - CJIS-5.4.1.1 + - DISA-STIG-RHEL-08-030200 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.5.5 + - PCI-DSSv4-10.3.4 + - audit_rules_dac_modification_fsetxattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for fsetxattr for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - fsetxattr + syscall_grouping: + - fremovexattr + - lremovexattr + - removexattr + - fsetxattr + - lsetxattr + - setxattr + + - name: Check existence of fsetxattr in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/perm_mod.rules + set_fact: audit_file="/etc/audit/rules.d/perm_mod.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F auid>=1000 + -F auid!=unset -F key=perm_mod + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: - fsetxattr syscall_grouping: - fremovexattr @@ -86738,186 +86249,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lchown - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000466-GPOS-00210 - SRG-OS-000458-GPOS-00203 - SRG-OS-000474-GPOS-00219 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030480 - 4.1.3.9 - SV-230455r810459_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - CCE-80693-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -86928,9 +86261,328 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lchown" + SYSCALL="fsetxattr" KEY="perm_mod" - SYSCALL_GROUPING="chown fchown fchownat lchown" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + + + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid=0" + SYSCALL="fsetxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -87244,6 +86896,184 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lchown + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000466-GPOS-00210 + SRG-OS-000458-GPOS-00203 + SRG-OS-000474-GPOS-00219 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030480 + 5.2.3.9 + SV-230455r810459_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + + CCE-80693-5 - name: Gather the package facts package_facts: manager: auto @@ -87589,200 +87419,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lremovexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80694-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -87793,328 +87431,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lremovexattr" - KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - - - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid=0" - SYSCALL="lremovexattr" + SYSCALL="lchown" KEY="perm_mod" - SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + SYSCALL_GROUPING="chown fchown fchownat lchown" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a @@ -88428,6 +87747,198 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lremovexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lremovexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lremovexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80694-3 - name: Gather the package facts package_facts: manager: auto @@ -89034,194 +88545,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - lsetxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000466-GPOS-00210 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80695-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -89233,7 +88557,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="lsetxattr" + SYSCALL="lremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -89552,7 +88876,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="lsetxattr" + SYSCALL="lremovexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -89868,6 +89192,193 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - lsetxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S lsetxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S lsetxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000466-GPOS-00210 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80695-0 - name: Gather the package facts package_facts: manager: auto @@ -90474,198 +89985,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - removexattr - At a minimum, the audit system should collect file permission -changes for all users and root. - -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -following line to a file with suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod - -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000462-GPOS-00206 - SRG-OS-000463-GPOS-00207 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000474-GPOS-00219 - SRG-OS-000466-GPOS-00210 - SRG-OS-000064-GPOS-00033 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80696-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -90677,7 +89997,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="removexattr" + SYSCALL="lsetxattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -90996,7 +90316,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="removexattr" + SYSCALL="lsetxattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -91312,6 +90632,197 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - removexattr + At a minimum, the audit system should collect file permission +changes for all users and root. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +following line to a file with suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S removexattr -F auid=0 -F key=perm_mod + +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S removexattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000462-GPOS-00206 + SRG-OS-000463-GPOS-00207 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000474-GPOS-00219 + SRG-OS-000466-GPOS-00210 + SRG-OS-000064-GPOS-00033 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80696-8 - name: Gather the package facts package_facts: manager: auto @@ -91918,186 +91429,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - setxattr - At a minimum, the audit system should collect file permission -changes for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod --a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000126 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.5.5 - 10.3.4 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000466-GPOS-00210 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-APP-000091-CTR-000160 - SRG-APP-000492-CTR-001220 - SRG-APP-000493-CTR-001225 - SRG-APP-000494-CTR-001230 - SRG-APP-000500-CTR-001260 - SRG-APP-000507-CTR-001295 - SRG-APP-000495-CTR-001235 - RHEL-08-030200 - 4.1.3.9 - SV-230413r810463_rule - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-80697-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -92109,7 +91441,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="setxattr" + SYSCALL="removexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -92428,7 +91760,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid=0" - SYSCALL="setxattr" + SYSCALL="removexattr" KEY="perm_mod" SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" @@ -92744,6 +92076,185 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - setxattr + At a minimum, the audit system should collect file permission +changes for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b32 -S setxattr -F auid=0 -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=unset -F key=perm_mod +-a always,exit -F arch=b64 -S setxattr -F auid=0 -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000126 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.5.5 + 10.3.4 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000466-GPOS-00210 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-APP-000091-CTR-000160 + SRG-APP-000492-CTR-001220 + SRG-APP-000493-CTR-001225 + SRG-APP-000494-CTR-001230 + SRG-APP-000500-CTR-001260 + SRG-APP-000507-CTR-001295 + SRG-APP-000495-CTR-001235 + RHEL-08-030200 + 5.2.3.9 + SV-230413r810463_rule + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-80697-6 - name: Gather the package facts package_facts: manager: auto @@ -93350,215 +92861,502 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - umount - At a minimum, the audit system should collect file system umount -changes. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - CCI-000130 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -ACTION_ARCH_FILTERS="-a always,exit -F arch=b32" -OTHER_FILTERS="" -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="umount" -KEY="perm_mod" -SYSCALL_GROUPING="" - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -for audit_file in "${files_to_inspect[@]}" +for ARCH in "${RULE_ARCHS[@]}" do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="setxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -unset syscall_a + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + + + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid=0" + SYSCALL="setxattr" + KEY="perm_mod" + SYSCALL_GROUPING="fremovexattr lremovexattr removexattr fsetxattr lsetxattr setxattr" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -93704,11 +93502,50 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi +done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - umount + At a minimum, the audit system should collect file system umount +changes. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + CCI-000130 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + - name: Gather the package facts package_facts: manager: auto @@ -93852,67 +93689,18 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Events that Modify the System's Discretionary Access Controls - umount2 - At a minimum, the audit system should collect file system umount2 -changes. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following line to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - CCI-000130 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - The changing of file permissions could indicate that a user is attempting to -gain access to information that would otherwise be disallowed. Auditing DAC modifications -can facilitate the identification of patterns of abuse among both authorized and -unauthorized users. - CCE-90776-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="umount2" - KEY="perm_mod" - SYSCALL_GROUPING="" +ACTION_ARCH_FILTERS="-a always,exit -F arch=b32" +OTHER_FILTERS="" +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="umount" +KEY="perm_mod" +SYSCALL_GROUPING="" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94071,7 +93859,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94217,12 +94005,54 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Events that Modify the System's Discretionary Access Controls - umount2 + At a minimum, the audit system should collect file system umount2 +changes. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following line to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S umount2 -F auid>=1000 -F auid!=unset -F key=perm_mod + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + CCI-000130 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + The changing of file permissions could indicate that a user is attempting to +gain access to information that would otherwise be disallowed. Auditing DAC modifications +can facilitate the identification of patterns of abuse among both authorized and +unauthorized users. + CCE-90776-6 - name: Gather the package facts package_facts: manager: auto @@ -94517,65 +94347,24 @@ fi - reboot_required - restrict_strategy - - - - - - - - - - Record Execution Attempts to Run ACL Privileged Commands - At a minimum, the audit system should collect the execution of -ACL privileged commands for all users and root. - - Record Any Attempts to Run chacl - At a minimum, the audit system should collect any execution attempt -of the chacl command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030570 - 4.1.3.17 - SV-230464r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-89446-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/chacl -F perm=x" -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="" -KEY="privileged" -SYSCALL_GROUPING="" -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -unset syscall_a +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="umount2" + KEY="perm_mod" + SYSCALL_GROUPING="" + + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94734,7 +94523,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -unset syscall_a + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -94880,11 +94669,60 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi +done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Execution Attempts to Run ACL Privileged Commands + At a minimum, the audit system should collect the execution of +ACL privileged commands for all users and root. + + Record Any Attempts to Run chacl + At a minimum, the audit system should collect any execution attempt +of the chacl command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030570 + 5.2.3.17 + SV-230464r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-89446-9 - name: Gather the package facts package_facts: manager: auto @@ -95029,52 +94867,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setfacl - At a minimum, the audit system should collect any execution attempt -of the setfacl command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030330 - 4.1.3.16 - SV-230435r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-88437-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/setfacl -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/chacl -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -95390,6 +95187,47 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setfacl + At a minimum, the audit system should collect any execution attempt +of the setfacl command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030330 + 5.2.3.16 + SV-230435r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-88437-9 - name: Gather the package facts package_facts: manager: auto @@ -95534,140 +95372,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Record Execution Attempts to Run SELinux Privileged Commands - At a minimum, the audit system should collect the execution of -SELinux privileged commands for all users and root. - - Record Any Attempts to Run chcon - At a minimum, the audit system should collect any execution attempt -of the chcon command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030260 - 4.1.3.15 - SV-230419r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80698-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/bin/chcon -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/setfacl -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -95983,6 +95692,135 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Execution Attempts to Run SELinux Privileged Commands + At a minimum, the audit system should collect the execution of +SELinux privileged commands for all users and root. + + Record Any Attempts to Run chcon + At a minimum, the audit system should collect any execution attempt +of the chcon command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030260 + 5.2.3.15 + SV-230419r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80698-4 - name: Gather the package facts package_facts: manager: auto @@ -96137,117 +95975,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run restorecon - At a minimum, the audit system should collect any execution attempt -of the restorecon command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000392-GPOS-00172 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80699-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/restorecon -F perm=x" +OTHER_FILTERS="-F path=/usr/bin/chcon -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -96563,6 +96295,112 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run restorecon + At a minimum, the audit system should collect any execution attempt +of the restorecon command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000392-GPOS-00172 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80699-2 - name: Gather the package facts package_facts: manager: auto @@ -96715,138 +96553,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run semanage - At a minimum, the audit system should collect any execution attempt -of the semanage command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030313 - SV-230429r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80700-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/semanage -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/restorecon -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -97162,6 +96873,133 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run semanage + At a minimum, the audit system should collect any execution attempt +of the semanage command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030313 + SV-230429r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80700-8 - name: Gather the package facts package_facts: manager: auto @@ -97318,62 +97156,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setfiles - At a minimum, the audit system should collect any execution attempt -of the setfiles command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000169 - CCI-000172 - CCI-002884 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030314 - SV-230430r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-82280-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/setfiles -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/semanage -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -97689,6 +97476,57 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setfiles + At a minimum, the audit system should collect any execution attempt +of the setfiles command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000169 + CCI-000172 + CCI-002884 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030314 + SV-230430r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-82280-9 - name: Gather the package facts package_facts: manager: auto @@ -97841,131 +97679,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run setsebool - At a minimum, the audit system should collect any execution attempt -of the setsebool command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000463-GPOS-00207 - SRG-OS-000465-GPOS-00209 - SRG-APP-000495-CTR-001235 - SRG-APP-000496-CTR-001240 - SRG-APP-000497-CTR-001245 - SRG-APP-000498-CTR-001250 - RHEL-08-030316 - SV-230432r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80701-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/setsebool -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/setfiles -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -98281,6 +97999,126 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run setsebool + At a minimum, the audit system should collect any execution attempt +of the setsebool command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000463-GPOS-00207 + SRG-OS-000465-GPOS-00209 + SRG-APP-000495-CTR-001235 + SRG-APP-000496-CTR-001240 + SRG-APP-000497-CTR-001245 + SRG-APP-000498-CTR-001250 + RHEL-08-030316 + SV-230432r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80701-6 - name: Gather the package facts package_facts: manager: auto @@ -98435,47 +98273,11 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run seunshare - At a minimum, the audit system should collect any execution attempt -of the seunshare command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80933-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then ACTION_ARCH_FILTERS="-a always,exit" -OTHER_FILTERS="-F path=/usr/sbin/seunshare -F perm=x" +OTHER_FILTERS="-F path=/usr/sbin/setsebool -F perm=x" AUID_FILTERS="-F auid>=1000 -F auid!=unset" SYSCALL="" KEY="privileged" @@ -98791,6 +98593,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Any Attempts to Run seunshare + At a minimum, the audit system should collect any execution attempt +of the seunshare command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80933-5 - name: Gather the package facts package_facts: manager: auto @@ -98941,180 +98779,17 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - - Record File Deletion Events by User - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete - - Ensure auditd Collects File Deletion Events by User - At a minimum the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename -S renameat -F auid>=1000 -F auid!=unset -F key=delete - This rule checks for multiple syscalls related to file deletion; -it was written with DISA STIG in mind. Other policies should use a -separate rule for each syscall that needs to be checked. For example: -audit_rules_file_deletion_events_rmdiraudit_rules_file_deletion_events_unlinkaudit_rules_file_deletion_events_unlinkat - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000366 - CCI-000172 - CCI-002884 - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 4.1.14 - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80702-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# Perform the remediation for the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rmdir unlink unlinkat rename renameat" - KEY="delete" - SYSCALL_GROUPING="rmdir unlink unlinkat rename renameat" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a +ACTION_ARCH_FILTERS="-a always,exit" +OTHER_FILTERS="-F path=/usr/sbin/seunshare -F perm=x" +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="" +KEY="privileged" +SYSCALL_GROUPING="" +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -99273,7 +98948,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a +unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -99419,34 +99094,51 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi -done else >&2 echo 'Remediation is not applicable, nothing was done' fi - + - + - - Ensure auditd Collects File Deletion Events by User - rename - At a minimum, the audit system should collect file deletion events + + + Record File Deletion Events by User + At a minimum, the audit system should collect file deletion events for all users and root. If the auditd daemon is configured to use the augenrules program to read audit rules during daemon startup (the default), add the following line to a file with suffix .rules in the directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete If the auditd daemon is configured to use the auditctl utility to read audit rules during daemon startup, add the following line to /etc/audit/audit.rules file, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete + + Ensure auditd Collects File Deletion Events by User + At a minimum the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename,renameat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir,unlink,unlinkat,rename -S renameat -F auid>=1000 -F auid!=unset -F key=delete + This rule checks for multiple syscalls related to file deletion; +it was written with DISA STIG in mind. Other policies should use a +separate rule for each syscall that needs to be checked. For example: +audit_rules_file_deletion_events_rmdiraudit_rules_file_deletion_events_unlinkaudit_rules_file_deletion_events_unlinkat 1 11 12 @@ -99463,6 +99155,7 @@ appropriate for your system: 7 8 9 + 5.4.1.1 APO10.01 APO10.03 APO10.04 @@ -99491,27 +99184,14 @@ appropriate for your system: MEA01.05 MEA02.01 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 CCI-000366 + CCI-000172 CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) 4.2.3.10 4.3.2.6.7 4.3.3.3.9 4.3.3.5.8 - 4.3.3.6.5 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 4.3.4.4.7 4.3.4.5.6 4.3.4.5.7 @@ -99538,7 +99218,6 @@ appropriate for your system: SR 6.2 SR 7.1 SR 7.6 - A.11.2.4 A.11.2.6 A.12.4.1 A.12.4.2 @@ -99549,7 +99228,6 @@ appropriate for your system: A.13.2.1 A.14.1.3 A.14.2.7 - A.15.1.1 A.15.2.1 A.15.2.2 A.16.1.4 @@ -99567,39 +99245,21 @@ appropriate for your system: DE.CM-7 ID.SC-4 PR.AC-3 - PR.MA-2 PR.PT-1 PR.PT-4 RS.AN-1 RS.AN-4 FAU_GEN.1.1.c Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule + 4.1.14 Auditing file deletions will create an audit trail for files that are removed from the system. The audit trail could aid in system troubleshooting, as well as, detecting malicious processes that attempt to delete log files to conceal their presence. - - CCE-80703-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + CCE-80702-4 + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -# First perform the remediation of the syscall rule +# Perform the remediation for the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") @@ -99608,9 +99268,9 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rename" + SYSCALL="rmdir unlink unlinkat rename renameat" KEY="delete" - SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" + SYSCALL_GROUPING="rmdir unlink unlinkat rename renameat" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -99923,6 +99583,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - rename + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rename -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80703-2 - name: Gather the package facts package_facts: manager: auto @@ -100268,178 +100099,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - renameat - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80704-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -100450,7 +100111,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="renameat" + SYSCALL="rename" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -100765,6 +100426,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - renameat + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S renameat -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + CCE-80704-0 - name: Gather the package facts package_facts: manager: auto @@ -101107,179 +100938,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - rmdir - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.14 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - - CCE-80705-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -101290,7 +100950,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="rmdir" + SYSCALL="renameat" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -101605,6 +101265,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - rmdir + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S rmdir -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 4.1.14 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80705-7 - name: Gather the package facts package_facts: manager: auto @@ -101950,178 +101781,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - unlink - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - - CCE-80706-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -102133,7 +101793,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="unlink" + SYSCALL="rmdir" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -102448,6 +102108,177 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - unlink + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlink -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + + CCE-80706-5 - name: Gather the package facts package_facts: manager: auto @@ -102793,178 +102624,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects File Deletion Events by User - unlinkat - At a minimum, the audit system should collect file deletion events -for all users and root. If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as -appropriate for your system: --a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-000366 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.5 - 4.3.3.6.6 - 4.3.3.6.7 - 4.3.3.6.8 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.4 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.1.1 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.MA-2 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - 10.2.1.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-OS-000467-GPOS-00211 - SRG-OS-000468-GPOS-00212 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030361 - 4.1.3.13 - SV-230439r810465_rule - Auditing file deletions will create an audit trail for files that are removed -from the system. The audit trail could aid in system troubleshooting, as well as, detecting -malicious processes that attempt to delete log files to conceal their presence. - CCE-80707-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -102975,7 +102636,7 @@ do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="unlinkat" + SYSCALL="unlink" KEY="delete" SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -103290,6 +102951,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects File Deletion Events by User - unlinkat + At a minimum, the audit system should collect file deletion events +for all users and root. If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file, setting ARCH to either b32 or b64 as +appropriate for your system: +-a always,exit -F arch=ARCH -S unlinkat -F auid>=1000 -F auid!=unset -F key=delete + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-000366 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.5 + 4.3.3.6.6 + 4.3.3.6.7 + 4.3.3.6.8 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.4 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.1.1 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.MA-2 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + 10.2.1.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-OS-000467-GPOS-00211 + SRG-OS-000468-GPOS-00212 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030361 + 5.2.3.13 + SV-230439r810465_rule + Auditing file deletions will create an audit trail for files that are removed +from the system. The audit trail could aid in system troubleshooting, as well as, detecting +malicious processes that attempt to delete log files to conceal their presence. + CCE-80707-3 - name: Gather the package facts package_facts: manager: auto @@ -103631,6 +103462,333 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="unlinkat" + KEY="delete" + SYSCALL_GROUPING="unlink unlinkat rename renameat rmdir" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -105429,646 +105587,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80975-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="chmod" -KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EPERM" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -106699,43 +106217,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - chown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80984-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -106743,9 +106225,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="chown" +SYSCALL="chmod" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -107375,6 +106857,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - chown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S chown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S chown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80984-8 - name: Gather the package facts package_facts: manager: auto @@ -107989,179 +107507,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - creat - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80751-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule @@ -108169,9 +107515,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="creat" +SYSCALL="chown" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -108801,6 +108147,178 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - creat + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80751-1 - name: Gather the package facts package_facts: manager: auto @@ -109455,52 +108973,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fchmod - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80977-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchmod" +SYSCALL="creat" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -110130,6 +109613,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fchmod + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchmod -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchmod -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80977-2 - name: Gather the package facts package_facts: manager: auto @@ -110755,42 +110273,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fchmodat - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80976-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -110798,7 +110281,7 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchmodat" +SYSCALL="fchmod" KEY="access" SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" @@ -111430,6 +110913,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fchmodat + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchmodat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchmodat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80976-4 - name: Gather the package facts package_facts: manager: auto @@ -112055,42 +111573,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - fchown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80986-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -112098,9 +111581,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchown" +SYSCALL="fchmodat" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -112730,6 +112213,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - fchown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80986-3 - name: Gather the package facts package_facts: manager: auto @@ -113339,42 +112857,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - fchownat - The audit system should collect unsuccessful file ownership change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80985-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -113382,7 +112865,7 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fchownat" +SYSCALL="fchown" KEY="access" SYSCALL_GROUPING="chown fchown fchownat lchown" @@ -114014,6 +113497,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - fchownat + The audit system should collect unsuccessful file ownership change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80985-5 - name: Gather the package facts package_facts: manager: auto @@ -114623,42 +114141,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fremovexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80978-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -114666,9 +114149,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fremovexattr" +SYSCALL="fchownat" KEY="access" -SYSCALL_GROUPING="" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -115298,6 +114781,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fremovexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80978-0 - name: Gather the package facts package_facts: manager: auto @@ -115875,42 +115393,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - fsetxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80979-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -115918,9 +115401,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="fsetxattr" +SYSCALL="fremovexattr" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -116550,6 +116033,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - fsetxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S fsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80979-8 - name: Gather the package facts package_facts: manager: auto @@ -117175,181 +116693,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - ftruncate - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80752-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -117357,9 +116701,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="ftruncate" +SYSCALL="fsetxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -117989,6 +117333,180 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - ftruncate + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80752-9 - name: Gather the package facts package_facts: manager: auto @@ -118638,57 +118156,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Ownership Changes to Files - lchown - The audit system should collect unsuccessful file ownership change -attempts for all users and root. - -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80987-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lchown" +SYSCALL="ftruncate" KEY="access" -SYSCALL_GROUPING="chown fchown fchownat lchown" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -119318,6 +118796,46 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Ownership Changes to Files - lchown + The audit system should collect unsuccessful file ownership change +attempts for all users and root. + +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lchown -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lchown -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change ownership of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80987-1 - name: Gather the package facts package_facts: manager: auto @@ -119932,52 +119450,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - lremovexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80980-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lremovexattr" +SYSCALL="lchown" KEY="access" -SYSCALL_GROUPING="" +SYSCALL_GROUPING="chown fchown fchownat lchown" for ARCH in "${RULE_ARCHS[@]}" do @@ -120607,6 +120090,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - lremovexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80980-6 - name: Gather the package facts package_facts: manager: auto @@ -121184,42 +120702,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - lsetxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80981-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -121227,9 +120710,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="lsetxattr" +SYSCALL="lremovexattr" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -121859,6 +121342,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - lsetxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S lsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S lsetxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80981-4 - name: Gather the package facts package_facts: manager: auto @@ -122484,192 +122002,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - open - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80753-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="open" +SYSCALL="lsetxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -123299,6 +122642,181 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - open + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80753-7 - name: Gather the package facts package_facts: manager: auto @@ -123953,185 +123471,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - open_by_handle_at - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.10 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80755-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="open_by_handle_at" +SYSCALL="open" KEY="access" SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" @@ -124763,6 +124111,176 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - open_by_handle_at + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S open_by_handle_at,truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 4.1.10 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80755-2 - name: Gather the package facts package_facts: manager: auto @@ -125413,6 +124931,646 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="open_by_handle_at" +KEY="access" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EPERM" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -125578,57 +125736,6 @@ to the same event is more efficient. See the following example: Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80965-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -125709,6 +125816,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -125874,57 +126032,6 @@ to the same event is more efficient. See the following example: Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80966-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126005,6 +126112,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -126389,57 +126547,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80968-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126521,6 +126628,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -126683,57 +126841,6 @@ to the same event is more efficient. See the following example: these events could serve as evidence of potential system compromise. CCE-80969-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -126815,6 +126922,57 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -127204,651 +127362,11 @@ calls with others as identifying earlier in this guide is more efficient.SRG-OS-000461-GPOS-00205 SRG-APP-000495-CTR-001235 RHEL-08-030420 - 4.1.3.7 + 5.2.3.7 SV-230449r810455_rule Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing these events could serve as evidence of potential system compromise. CCE-80754-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="openat" -KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EPERM" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - -# If audit tool is 'augenrules', then check if the audit rule is defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection -# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection -default_file="/etc/audit/rules.d/$KEY.rules" -# As other_filters may include paths, lets use a different delimiter for it -# The "F" script expression tells sed to print the filenames where the expressions matched -readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) -# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet -if [ ${#files_to_inspect[@]} -eq "0" ] -then - file_to_inspect="/etc/audit/rules.d/$KEY.rules" - files_to_inspect=("$file_to_inspect") - if [ ! -e "$file_to_inspect" ] - then - touch "$file_to_inspect" - chmod 0640 "$file_to_inspect" - fi -fi - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -# -files_to_inspect=() - - -# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# file to the list of files to be inspected -default_file="/etc/audit/audit.rules" -files_to_inspect+=('/etc/audit/audit.rules' ) - -# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead -skip=1 - -for audit_file in "${files_to_inspect[@]}" -do - # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, - # i.e, collect rules that match: - # * the action, list and arch, (2-nd argument) - # * the other filters, (3-rd argument) - # * the auid filters, (4-rd argument) - readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") - - candidate_rules=() - # Filter out rules that have more fields then required. This will remove rules more specific than the required scope - for s_rule in "${similar_rules[@]}" - do - # Strip all the options and fields we know of, - # than check if there was any field left over - extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") - grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") - done - - if [[ ${#syscall_a[@]} -ge 1 ]] - then - # Check if the syscall we want is present in any of the similar existing rules - for rule in "${candidate_rules[@]}" - do - rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) - all_syscalls_found=0 - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { - # A syscall was not found in the candidate rule - all_syscalls_found=1 - } - done - if [[ $all_syscalls_found -eq 0 ]] - then - # We found a rule with all the syscall(s) we want; skip rest of macro - skip=0 - break - fi - - # Check if this rule can be grouped with our target syscall and keep track of it - for syscall_g in "${syscall_grouping[@]}" - do - if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" - then - file_to_edit=${audit_file} - rule_to_edit=${rule} - rule_syscalls_to_edit=${rule_syscalls} - fi - done - done - else - # If there is any candidate rule, it is compliant; skip rest of macro - if [ "${#candidate_rules[@]}" -gt 0 ] - then - skip=0 - fi - fi - - if [ "$skip" -eq 0 ]; then - break - fi -done - -if [ "$skip" -ne 0 ]; then - # We checked all rules that matched the expected resemblance pattern (action, arch & auid) - # At this point we know if we need to either append the $full_rule or group - # the syscall together with an exsiting rule - - # Append the full_rule if it cannot be grouped to any other rule - if [ -z ${rule_to_edit+x} ] - then - # Build full_rule while avoid adding double spaces when other_filters is empty - if [ "${#syscall_a[@]}" -gt 0 ] - then - syscall_string="" - for syscall in "${syscall_a[@]}" - do - syscall_string+=" -S $syscall" - done - fi - other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true - auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true - full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true - echo "$full_rule" >> "$default_file" - chmod o-rwx ${default_file} - else - # Check if the syscalls are declared as a comma separated list or - # as multiple -S parameters - if grep -q -- "," <<< "${rule_syscalls_to_edit}" - then - delimiter="," - else - delimiter=" -S " - fi - new_grouped_syscalls="${rule_syscalls_to_edit}" - for syscall in "${syscall_a[@]}" - do - grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { - # A syscall was not found in the candidate rule - new_grouped_syscalls+="${delimiter}${syscall}" - } - done - - # Group the syscall in the rule - sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" - fi -fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -128498,882 +128016,37 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Creation Attempts to Files - openat O_CREAT - The audit system should collect unauthorized file accesses for -all users and root. The openat syscall can be used to create new files -when O_CREAT flag is specified. + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -The following auidt rules will asure that unsuccessful attempts to create a -file via openat syscall are collected. +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -rules below to a file with suffix .rules in the directory -/etc/audit/rules.d. +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="openat" +KEY="access" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the rules below to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80962-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80962-4 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_creat - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Add unsuccessful file operations audit rules - blockinfile: - path: /etc/audit/rules.d/30-ospp-v42-remediation.rules - create: true - block: |- - ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. - ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - ## The purpose of these rules is to meet the requirements for Operating - ## System Protection Profile (OSPP)v4.2. These rules depends on having - ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - ## Unsuccessful file creation (open with O_CREAT) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - ## Unsuccessful file modifications (open for write or truncate) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - ## Unsuccessful file access (any other opens) This has to go last. - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80962-4 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_creat - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - - - - - - - - - Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE - The audit system should collect detailed unauthorized file accesses for -all users and root. The openat syscall can be used to modify files -if called for write operation of with O_TRUNC_WRITE flag. - -The following auidt rules will asure that unsuccessful attempts to modify a -file via openat syscall are collected. - -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), add the -rules below to a file with suffix .rules in the directory -/etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the rules below to -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80963-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80963-2 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_trunc_write - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Add unsuccessful file operations audit rules - blockinfile: - path: /etc/audit/rules.d/30-ospp-v42-remediation.rules - create: true - block: |- - ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. - ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - ## The purpose of these rules is to meet the requirements for Operating - ## System Protection Profile (OSPP)v4.2. These rules depends on having - ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - ## Unsuccessful file creation (open with O_CREAT) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - ## Unsuccessful file modifications (open for write or truncate) - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - ## Unsuccessful file access (any other opens) This has to go last. - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80963-2 - - NIST-800-171-3.1.7 - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.1 - - PCI-DSS-Req-10.2.4 - - audit_rules_unsuccessful_file_modification_openat_o_trunc_write - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - - - - - - - - - Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly - The audit system should collect detailed unauthorized file -accesses for all users and root. -To correctly identify unsuccessful creation, unsuccessful modification and unsuccessful access -of files via openat syscall the audit rules collecting these events need to be in certain order. -The more specific rules need to come before the less specific rules. The reason for that is that more -specific rules cover a subset of events covered in the less specific rules, thus, they need to come -before to not be overshadowed by less specific rules, which match a bigger set of events. -Make sure that rules for unsuccessful calls of openat syscall are in the order shown below. -If the auditd daemon is configured to use the augenrules -program to read audit rules during daemon startup (the default), check the order of -rules below in a file with suffix .rules in the directory -/etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, check the order of rules below in -/etc/audit/audit.rules file. - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000392-GPOS-00172 - The more specific rules cover a subset of events covered by the less specific rules. -By ordering them from more specific to less specific, it is assured that the less specific -rule will not catch events better recorded by the more specific rule. - CCE-80964-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" -cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" -## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. -## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access --a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -EOF - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - - - - - - - - - Record Unsuccessful Permission Changes to Files - removexattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80982-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# First perform the remediation of the syscall rule -# Retrieve hardware architecture of the underlying system -[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") - -AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="removexattr" -KEY="access" -SYSCALL_GROUPING="" - -for ARCH in "${RULE_ARCHS[@]}" -do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="-F exit=-EACCES" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a -unset syscall_grouping -unset syscall_string -unset syscall -unset file_to_edit -unset rule_to_edit -unset rule_syscalls_to_edit -unset other_string -unset auid_string -unset full_rule - -# Load macro arguments into arrays -read -a syscall_a <<< $SYSCALL -read -a syscall_grouping <<< $SYSCALL_GROUPING +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING # Create a list of audit *.rules files that should be inspected for presence and correctness # of a particular audit rule. The scheme is as follows: @@ -129983,85 +128656,930 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Unsuccessful Creation Attempts to Files - openat O_CREAT + The audit system should collect unauthorized file accesses for +all users and root. The openat syscall can be used to create new files +when O_CREAT flag is specified. + +The following auidt rules will asure that unsuccessful attempts to create a +file via openat syscall are collected. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +rules below to a file with suffix .rules in the directory +/etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the rules below to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80962-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80982-2 + - CCE-80962-4 + - NIST-800-171-3.1.7 - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_unsuccessful_file_modification_removexattr + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_creat - low_complexity - low_disruption - medium_severity - - reboot_required + - no_reboot_needed - restrict_strategy -- name: Set architecture for audit removexattr tasks - set_fact: - audit_arch: b64 +- name: Add unsuccessful file operations audit rules + blockinfile: + path: /etc/audit/rules.d/30-ospp-v42-remediation.rules + create: true + block: |- + ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. + ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + + ## The purpose of these rules is to meet the requirements for Operating + ## System Protection Profile (OSPP)v4.2. These rules depends on having + ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + + ## Unsuccessful file creation (open with O_CREAT) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + ## Unsuccessful file modifications (open for write or truncate) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + ## Unsuccessful file access (any other opens) This has to go last. + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access when: - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80982-2 + - CCE-80962-4 + - NIST-800-171-3.1.7 - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_unsuccessful_file_modification_removexattr + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_creat - low_complexity - low_disruption - medium_severity - - reboot_required + - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -- name: Perform remediation of Audit rules for removexattr EACCES for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - removexattr - syscall_grouping: [] - - - name: Check existence of removexattr in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F exit=-EACCES -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF - - name: No file with syscall found, set path to /etc/audit/rules.d/access.rules +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE + The audit system should collect detailed unauthorized file accesses for +all users and root. The openat syscall can be used to modify files +if called for write operation of with O_TRUNC_WRITE flag. + +The following auidt rules will asure that unsuccessful attempts to modify a +file via openat syscall are collected. + +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), add the +rules below to a file with suffix .rules in the directory +/etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the rules below to +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80963-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80963-2 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_trunc_write + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Add unsuccessful file operations audit rules + blockinfile: + path: /etc/audit/rules.d/30-ospp-v42-remediation.rules + create: true + block: |- + ## This content is a section of an Audit config snapshot recommended for Red Hat Enterprise Linux 8 systems that target OSPP compliance. + ## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + + ## The purpose of these rules is to meet the requirements for Operating + ## System Protection Profile (OSPP)v4.2. These rules depends on having + ## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + + ## Unsuccessful file creation (open with O_CREAT) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + + ## Unsuccessful file modifications (open for write or truncate) + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + + ## Unsuccessful file access (any other opens) This has to go last. + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80963-2 + - NIST-800-171-3.1.7 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.1 + - PCI-DSS-Req-10.2.4 + - audit_rules_unsuccessful_file_modification_openat_o_trunc_write + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly + The audit system should collect detailed unauthorized file +accesses for all users and root. +To correctly identify unsuccessful creation, unsuccessful modification and unsuccessful access +of files via openat syscall the audit rules collecting these events need to be in certain order. +The more specific rules need to come before the less specific rules. The reason for that is that more +specific rules cover a subset of events covered in the less specific rules, thus, they need to come +before to not be overshadowed by less specific rules, which match a bigger set of events. +Make sure that rules for unsuccessful calls of openat syscall are in the order shown below. +If the auditd daemon is configured to use the augenrules +program to read audit rules during daemon startup (the default), check the order of +rules below in a file with suffix .rules in the directory +/etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, check the order of rules below in +/etc/audit/audit.rules file. + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000392-GPOS-00172 + The more specific rules cover a subset of events covered by the less specific rules. +By ordering them from more specific to less specific, it is assured that the less specific +rule will not catch events better recorded by the more specific rule. + CCE-80964-0 + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +mkdir -p "$(dirname '/etc/audit/rules.d/30-ospp-v42-remediation.rules')" +cat <<EOF > "/etc/audit/rules.d/30-ospp-v42-remediation.rules" +## This content is a section of an Audit config snapshot recommended for linux systems that target OSPP compliance. +## The following content has been retreived on 2019-03-11 from: https://github.com/linux-audit/audit-userspace/blob/master/rules/30-ospp-v42.rules + +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## 10-base-config.rules, 11-loginuid.rules, and 43-module-load.rules installed. + +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b32 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +-a always,exit -F arch=b64 -S open,creat,truncate,ftruncate,openat,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access +EOF + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + + + Record Unsuccessful Permission Changes to Files - removexattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S removexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S removexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80982-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80982-2 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_unsuccessful_file_modification_removexattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Set architecture for audit removexattr tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80982-2 + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_unsuccessful_file_modification_removexattr + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + +- name: Perform remediation of Audit rules for removexattr EACCES for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - removexattr + syscall_grouping: [] + + - name: Check existence of removexattr in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* -F exit=-EACCES -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/access.rules set_fact: audit_file="/etc/audit/rules.d/access.rules" when: found_paths | length == 0 @@ -130560,172 +130078,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - rename - The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80973-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="rename" +SYSCALL="removexattr" KEY="access" -SYSCALL_GROUPING="rename renameat unlink unlinkat" +SYSCALL_GROUPING="" for ARCH in "${RULE_ARCHS[@]}" do @@ -131355,6 +130718,161 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - rename + The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80973-1 - name: Gather the package facts package_facts: manager: auto @@ -131987,171 +131505,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - renameat - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80974-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="renameat" +SYSCALL="rename" KEY="access" SYSCALL_GROUPING="rename renameat unlink unlinkat" @@ -132783,6 +132145,162 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - renameat + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80974-9 - name: Gather the package facts package_facts: manager: auto @@ -133410,42 +132928,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Permission Changes to Files - setxattr - The audit system should collect unsuccessful file permission change -attempts for all users and root. -If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b32 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change -If the system is 64 bit then also add the following lines: --a always,exit -F arch=b64 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change --a always,exit -F arch=b64 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the audit rule checks a -system call independently of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change - CCI-000172 - AU-2(d) - AU-12(c) - CM-6(a) - Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80983-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -133453,9 +132936,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="setxattr" +SYSCALL="renameat" KEY="access" -SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" +SYSCALL_GROUPING="rename renameat unlink unlinkat" for ARCH in "${RULE_ARCHS[@]}" do @@ -134085,6 +133568,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Permission Changes to Files - setxattr + The audit system should collect unsuccessful file permission change +attempts for all users and root. +If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b32 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +If the system is 64 bit then also add the following lines: +-a always,exit -F arch=b64 -S setxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change +-a always,exit -F arch=b64 -S setxattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the audit rule checks a +system call independently of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-perm-change + CCI-000172 + AU-2(d) + AU-12(c) + CM-6(a) + Unsuccessful attempts to change permissions of files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80983-0 - name: Gather the package facts package_facts: manager: auto @@ -134710,181 +134228,7 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Access Attempts to Files - truncate - At a minimum, the audit system should collect unauthorized file -accesses for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping these system -calls with others as identifying earlier in this guide is more efficient. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000064-GPOS-00033 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-APP-000495-CTR-001235 - RHEL-08-030420 - 4.1.3.7 - SV-230449r810455_rule - Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80756-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -134892,9 +134236,9 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="truncate" +SYSCALL="setxattr" KEY="access" -SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" +SYSCALL_GROUPING="chmod fchmod fchmodat fsetxattr lsetxattr setxattr" for ARCH in "${RULE_ARCHS[@]}" do @@ -135524,6 +134868,180 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Access Attempts to Files - truncate + At a minimum, the audit system should collect unauthorized file +accesses for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=access + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping these system +calls with others as identifying earlier in this guide is more efficient. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000064-GPOS-00033 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-APP-000495-CTR-001235 + RHEL-08-030420 + 5.2.3.7 + SV-230449r810455_rule + Unsuccessful attempts to access files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80756-0 - name: Gather the package facts package_facts: manager: auto @@ -136173,176 +135691,17 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - unlink - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - - CCE-80971-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="unlink" +SYSCALL="truncate" KEY="access" -SYSCALL_GROUPING="rename renameat unlink unlinkat" +SYSCALL_GROUPING="creat ftruncate truncate open openat open_by_handle_at" for ARCH in "${RULE_ARCHS[@]}" do @@ -136972,6 +136331,165 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - unlink + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + + CCE-80971-5 - name: Gather the package facts package_facts: manager: auto @@ -137604,173 +137122,15 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Record Unsuccessful Delete Attempts to Files - unlinkat - -The audit system should collect unsuccessful file deletion -attempts for all users and root. If the auditd daemon is configured -to use the augenrules program to read audit rules during daemon -startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file. --a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - -If the system is 64 bit then also add the following lines: - --a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Note that these rules can be configured in a -number of ways while still achieving the desired effect. Here the system calls -have been placed independent of other system calls. Grouping system calls related -to the same event is more efficient. See the following example: - --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.4 - Req-10.2.1 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000458-GPOS-00203 - SRG-OS-000461-GPOS-00205 - SRG-OS-000468-GPOS-00212 - Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing -these events could serve as evidence of potential system compromise. - CCE-80972-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") AUID_FILTERS="-F auid>=1000 -F auid!=unset" -SYSCALL="unlinkat" +SYSCALL="unlink" KEY="access" SYSCALL_GROUPING="rename renameat unlink unlinkat" @@ -138402,6 +137762,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Record Unsuccessful Delete Attempts to Files - unlinkat + +The audit system should collect unsuccessful file deletion +attempts for all users and root. If the auditd daemon is configured +to use the augenrules program to read audit rules during daemon +startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file. +-a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + +If the system is 64 bit then also add the following lines: + +-a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Note that these rules can be configured in a +number of ways while still achieving the desired effect. Here the system calls +have been placed independent of other system calls. Grouping system calls related +to the same event is more efficient. See the following example: + +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-delete + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.4 + Req-10.2.1 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000458-GPOS-00203 + SRG-OS-000461-GPOS-00205 + SRG-OS-000468-GPOS-00212 + Unsuccessful attempts to delete files could be an indicator of malicious activity on a system. Auditing +these events could serve as evidence of potential system compromise. + CCE-80972-3 - name: Gather the package facts package_facts: manager: auto @@ -139029,180 +138547,24 @@ fi - reboot_required - restrict_strategy - - - - - - - - - - Record Information on Kernel Modules Loading and Unloading - To capture kernel module loading and unloading events, use following lines, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module,delete_module -F key=modules - - -Place to add the lines depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the lines to file /etc/audit/audit.rules. - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - To capture kernel module loading and unloading events, use following lines, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module,finit_module,delete_module -F auid>=1000 -F auid!=unset -F key=modules - - -The place to add the lines depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the lines to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the lines to file /etc/audit/audit.rules. - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000172 - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.2.7 - 4.1.15 - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80709-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system -# Note: 32-bit and 64-bit kernel syscall numbers not always line up => -# it's required on a 64-bit system to check also for the presence -# of 32-bit's equivalent of the corresponding rule. -# (See `man 7 audit.rules` for details ) [ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") +AUID_FILTERS="-F auid>=1000 -F auid!=unset" +SYSCALL="unlinkat" +KEY="access" +SYSCALL_GROUPING="rename renameat unlink unlinkat" + for ARCH in "${RULE_ARCHS[@]}" do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - - SYSCALL="init_module finit_module delete_module" - KEY="modules" - SYSCALL_GROUPING="init_module finit_module delete_module" - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EACCES" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -139361,7 +138723,319 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="-F exit=-EPERM" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -139513,6 +139187,157 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Record Information on Kernel Modules Loading and Unloading + To capture kernel module loading and unloading events, use following lines, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module,delete_module -F key=modules + + +Place to add the lines depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the lines to file /etc/audit/audit.rules. + + Ensure auditd Collects Information on Kernel Module Loading and Unloading + To capture kernel module loading and unloading events, use following lines, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module,finit_module,delete_module -F auid>=1000 -F auid!=unset -F key=modules + + +The place to add the lines depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the lines to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the lines to file /etc/audit/audit.rules. + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000172 + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.2.7 + 4.1.15 + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80709-9 - name: Gather the package facts package_facts: manager: auto @@ -139855,51 +139680,8 @@ fi - reboot_required - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on Kernel Module Unloading - create_module - To capture kernel module unloading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: --a always,exit -F arch=ARCH -S create_module -F key=module-change - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - CCI-000172 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - 4.1.3.19 - The removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - - CCE-88435-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20create_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20create_module%20-k%20module-change%0A - mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-create.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -139911,15 +139693,16 @@ if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm -- for ARCH in "${RULE_ARCHS[@]}" do - ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" - OTHER_FILTERS="" - AUID_FILTERS="" - SYSCALL="create_module" - KEY="module-change" - SYSCALL_GROUPING="" - - # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - unset syscall_a + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + + SYSCALL="init_module finit_module delete_module" + KEY="modules" + SYSCALL_GROUPING="init_module finit_module delete_module" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -140078,7 +139861,7 @@ if [ "$skip" -ne 0 ]; then sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" fi fi - unset syscall_a + unset syscall_a unset syscall_grouping unset syscall_string unset syscall @@ -140230,6 +140013,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Unloading - create_module + To capture kernel module unloading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: +-a always,exit -F arch=ARCH -S create_module -F key=module-change + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + CCI-000172 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + 5.2.3.19 + The removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + + CCE-88435-3 - name: Gather the package facts package_facts: manager: auto @@ -140519,167 +140330,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Unloading - delete_module - To capture kernel module unloading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S delete_module -F auid>=1000 -F auid!=unset -F key=modules - - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030390 - 4.1.3.19 - SV-230446r627750_rule - The removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80711-5 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -140689,13 +140340,13 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20create_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20create_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-delete.rules + path: /etc/audit/rules.d/75-kernel-module-loading-create.rules overwrite: true - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -140709,12 +140360,11 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" - - AUID_FILTERS="-F auid>=1000 -F auid!=unset" - - SYSCALL="delete_module" - KEY="modules" - SYSCALL_GROUPING="delete_module" + AUID_FILTERS="" + SYSCALL="create_module" + KEY="module-change" + SYSCALL_GROUPING="" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -141027,6 +140677,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Unloading - delete_module + To capture kernel module unloading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S delete_module -F auid>=1000 -F auid!=unset -F key=modules + + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030390 + 5.2.3.19 + SV-230446r627750_rule + The removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80711-5 - name: Gather the package facts package_facts: manager: auto @@ -141349,167 +141159,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - finit_module - If the auditd daemon is configured to use the augenrules program -to read audit rules during daemon startup (the default), add the following lines to a file -with suffix .rules in the directory /etc/audit/rules.d to capture kernel module -loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: - --a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules - If the auditd daemon is configured to use the auditctl utility to read audit -rules during daemon startup, add the following lines to /etc/audit/audit.rules file -in order to capture kernel module loading and unloading events, setting ARCH to either b32 or -b64 as appropriate for your system: - --a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030360 - 4.1.3.19 - SV-230438r810464_rule - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80712-3 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -141519,12 +141169,12 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20finit_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20finit_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-finit.rules + path: /etc/audit/rules.d/75-kernel-module-loading-delete.rules overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -141542,9 +141192,9 @@ do AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="finit_module" + SYSCALL="delete_module" KEY="modules" - SYSCALL_GROUPING="init_module finit_module" + SYSCALL_GROUPING="delete_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -141857,6 +141507,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - finit_module + If the auditd daemon is configured to use the augenrules program +to read audit rules during daemon startup (the default), add the following lines to a file +with suffix .rules in the directory /etc/audit/rules.d to capture kernel module +loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: + +-a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules + If the auditd daemon is configured to use the auditctl utility to read audit +rules during daemon startup, add the following lines to /etc/audit/audit.rules file +in order to capture kernel module loading and unloading events, setting ARCH to either b32 or +b64 as appropriate for your system: + +-a always,exit -F arch=ARCH -S finit_module -F auid>=1000 -F auid!=unset -F key=modules + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030360 + 5.2.3.19 + SV-230438r810464_rule + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80712-3 - name: Gather the package facts package_facts: manager: auto @@ -142187,167 +141997,7 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading - init_module - To capture kernel module loading events, use following line, setting ARCH to -either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: - --a always,exit -F arch=ARCH -S init_module -F auid>=1000 -F auid!=unset -F key=modules - - -Place to add the line depends on a way auditd daemon is configured. If it is configured -to use the augenrules program (the default), add the line to a file with suffix -.rules in the directory /etc/audit/rules.d. - -If the auditd daemon is configured to use the auditctl utility, -add the line to file /etc/audit/audit.rules. - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - FAU_GEN.1.1.c - Req-10.2.7 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030360 - 4.1.3.19 - SV-230438r810464_rule - The addition of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - CCE-80713-1 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -142357,12 +142007,12 @@ spec: storage: files: - contents: - source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%20-k%20module-change%0A + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20finit_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20finit_module%20-k%20module-change%0A mode: 0600 - path: /etc/audit/rules.d/75-kernel-module-loading-init.rules + path: /etc/audit/rules.d/75-kernel-module-loading-finit.rules overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule @@ -142380,7 +142030,7 @@ do AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="init_module" + SYSCALL="finit_module" KEY="modules" SYSCALL_GROUPING="init_module finit_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' @@ -142695,6 +142345,166 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading - init_module + To capture kernel module loading events, use following line, setting ARCH to +either b32 for 32-bit system, or having two lines for both b32 and b64 in case your system is 64-bit: + +-a always,exit -F arch=ARCH -S init_module -F auid>=1000 -F auid!=unset -F key=modules + + +Place to add the line depends on a way auditd daemon is configured. If it is configured +to use the augenrules program (the default), add the line to a file with suffix +.rules in the directory /etc/audit/rules.d. + +If the auditd daemon is configured to use the auditctl utility, +add the line to file /etc/audit/audit.rules. + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + FAU_GEN.1.1.c + Req-10.2.7 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030360 + 5.2.3.19 + SV-230438r810464_rule + The addition of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + CCE-80713-1 - name: Gather the package facts package_facts: manager: auto @@ -143025,33 +142835,23 @@ fi - medium_severity - no_reboot_needed - - - - - - - - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module - If the auditd daemon is configured to use the augenrules program -to read audit rules during daemon startup (the default), add the following lines to a file -with suffix .rules in the directory /etc/audit/rules.d to capture kernel module -loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: --a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules -If the auditd daemon is configured to use the auditctl utility to read audit -rules during daemon startup, add the following lines to /etc/audit/audit.rules file -in order to capture kernel module loading and unloading events, setting ARCH to either b32 or -b64 as appropriate for your system: --a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules - 4.1.3.19 - The addition/removal of kernel modules can be used to alter the behavior of -the kernel and potentially introduce malicious code into kernel space. It is important -to have an audit trail of modules that have been introduced into the kernel. - - CCE-88748-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%20-k%20module-change%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%20-k%20module-change%0A + mode: 0600 + path: /etc/audit/rules.d/75-kernel-module-loading-init.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then # First perform the remediation of the syscall rule # Retrieve hardware architecture of the underlying system @@ -143065,10 +142865,12 @@ for ARCH in "${RULE_ARCHS[@]}" do ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" - SYSCALL="query_module" + + SYSCALL="init_module" KEY="modules" - SYSCALL_GROUPING="init_module query_module" + SYSCALL_GROUPING="init_module finit_module" # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' unset syscall_a unset syscall_grouping @@ -143381,6 +143183,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module + If the auditd daemon is configured to use the augenrules program +to read audit rules during daemon startup (the default), add the following lines to a file +with suffix .rules in the directory /etc/audit/rules.d to capture kernel module +loading and unloading events, setting ARCH to either b32 or b64 as appropriate for your system: +-a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules +If the auditd daemon is configured to use the auditctl utility to read audit +rules during daemon startup, add the following lines to /etc/audit/audit.rules file +in order to capture kernel module loading and unloading events, setting ARCH to either b32 or +b64 as appropriate for your system: +-a always,exit -F arch=ARCH -S query_module -F auid>=1000 -F auid!=unset -F key=modules + 5.2.3.19 + The addition/removal of kernel modules can be used to alter the behavior of +the kernel and potentially introduce malicious code into kernel space. It is important +to have an audit trail of modules that have been introduced into the kernel. + + CCE-88748-9 - name: Gather the package facts package_facts: manager: auto @@ -143685,6 +143512,337 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit && { ! ( grep -q aarch64 /proc/sys/kernel/osrelease ); }; then + +# First perform the remediation of the syscall rule +# Retrieve hardware architecture of the underlying system +# Note: 32-bit and 64-bit kernel syscall numbers not always line up => +# it's required on a 64-bit system to check also for the presence +# of 32-bit's equivalent of the corresponding rule. +# (See `man 7 audit.rules` for details ) +[ "$(getconf LONG_BIT)" = "32" ] && RULE_ARCHS=("b32") || RULE_ARCHS=("b32" "b64") + +for ARCH in "${RULE_ARCHS[@]}" +do + ACTION_ARCH_FILTERS="-a always,exit -F arch=$ARCH" + OTHER_FILTERS="" + AUID_FILTERS="-F auid>=1000 -F auid!=unset" + SYSCALL="query_module" + KEY="modules" + SYSCALL_GROUPING="init_module query_module" + # Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + +# If audit tool is 'augenrules', then check if the audit rule is defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to the list for inspection +# If rule isn't defined yet, add '/etc/audit/rules.d/$key.rules' to the list for inspection +default_file="/etc/audit/rules.d/$KEY.rules" +# As other_filters may include paths, lets use a different delimiter for it +# The "F" script expression tells sed to print the filenames where the expressions matched +readarray -t files_to_inspect < <(sed -s -n -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" -e "F" /etc/audit/rules.d/*.rules) +# Case when particular rule isn't defined in /etc/audit/rules.d/*.rules yet +if [ ${#files_to_inspect[@]} -eq "0" ] +then + file_to_inspect="/etc/audit/rules.d/$KEY.rules" + files_to_inspect=("$file_to_inspect") + if [ ! -e "$file_to_inspect" ] + then + touch "$file_to_inspect" + chmod 0640 "$file_to_inspect" + fi +fi + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi + unset syscall_a +unset syscall_grouping +unset syscall_string +unset syscall +unset file_to_edit +unset rule_to_edit +unset rule_syscalls_to_edit +unset other_string +unset auid_string +unset full_rule + +# Load macro arguments into arrays +read -a syscall_a <<< $SYSCALL +read -a syscall_grouping <<< $SYSCALL_GROUPING + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +# +files_to_inspect=() + + +# If audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# file to the list of files to be inspected +default_file="/etc/audit/audit.rules" +files_to_inspect+=('/etc/audit/audit.rules' ) + +# After converting to jinja, we cannot return; therefore we skip the rest of the macro if needed instead +skip=1 + +for audit_file in "${files_to_inspect[@]}" +do + # Filter existing $audit_file rules' definitions to select those that satisfy the rule pattern, + # i.e, collect rules that match: + # * the action, list and arch, (2-nd argument) + # * the other filters, (3-rd argument) + # * the auid filters, (4-rd argument) + readarray -t similar_rules < <(sed -e "/^$ACTION_ARCH_FILTERS/!d" -e "\#$OTHER_FILTERS#!d" -e "/$AUID_FILTERS/!d" "$audit_file") + + candidate_rules=() + # Filter out rules that have more fields then required. This will remove rules more specific than the required scope + for s_rule in "${similar_rules[@]}" + do + # Strip all the options and fields we know of, + # than check if there was any field left over + extra_fields=$(sed -E -e "s/^$ACTION_ARCH_FILTERS//" -e "s#$OTHER_FILTERS##" -e "s/$AUID_FILTERS//" -e "s/((:?-S [[:alnum:],]+)+)//g" -e "s/-F key=\w+|-k \w+//"<<< "$s_rule") + grep -q -- "-F" <<< "$extra_fields" || candidate_rules+=("$s_rule") + done + + if [[ ${#syscall_a[@]} -ge 1 ]] + then + # Check if the syscall we want is present in any of the similar existing rules + for rule in "${candidate_rules[@]}" + do + rule_syscalls=$(echo "$rule" | grep -o -P '(-S [\w,]+)+' | xargs) + all_syscalls_found=0 + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "$rule_syscalls" || { + # A syscall was not found in the candidate rule + all_syscalls_found=1 + } + done + if [[ $all_syscalls_found -eq 0 ]] + then + # We found a rule with all the syscall(s) we want; skip rest of macro + skip=0 + break + fi + + # Check if this rule can be grouped with our target syscall and keep track of it + for syscall_g in "${syscall_grouping[@]}" + do + if grep -q -- "\b${syscall_g}\b" <<< "$rule_syscalls" + then + file_to_edit=${audit_file} + rule_to_edit=${rule} + rule_syscalls_to_edit=${rule_syscalls} + fi + done + done + else + # If there is any candidate rule, it is compliant; skip rest of macro + if [ "${#candidate_rules[@]}" -gt 0 ] + then + skip=0 + fi + fi + + if [ "$skip" -eq 0 ]; then + break + fi +done + +if [ "$skip" -ne 0 ]; then + # We checked all rules that matched the expected resemblance pattern (action, arch & auid) + # At this point we know if we need to either append the $full_rule or group + # the syscall together with an exsiting rule + + # Append the full_rule if it cannot be grouped to any other rule + if [ -z ${rule_to_edit+x} ] + then + # Build full_rule while avoid adding double spaces when other_filters is empty + if [ "${#syscall_a[@]}" -gt 0 ] + then + syscall_string="" + for syscall in "${syscall_a[@]}" + do + syscall_string+=" -S $syscall" + done + fi + other_string=$([[ $OTHER_FILTERS ]] && echo " $OTHER_FILTERS") || /bin/true + auid_string=$([[ $AUID_FILTERS ]] && echo " $AUID_FILTERS") || /bin/true + full_rule="$ACTION_ARCH_FILTERS${syscall_string}${other_string}${auid_string} -F key=$KEY" || /bin/true + echo "$full_rule" >> "$default_file" + chmod o-rwx ${default_file} + else + # Check if the syscalls are declared as a comma separated list or + # as multiple -S parameters + if grep -q -- "," <<< "${rule_syscalls_to_edit}" + then + delimiter="," + else + delimiter=" -S " + fi + new_grouped_syscalls="${rule_syscalls_to_edit}" + for syscall in "${syscall_a[@]}" + do + grep -q -- "\b${syscall}\b" <<< "${rule_syscalls_to_edit}" || { + # A syscall was not found in the candidate rule + new_grouped_syscalls+="${delimiter}${syscall}" + } + done + + # Group the syscall in the rule + sed -i -e "\#${rule_to_edit}#s#${rule_syscalls_to_edit}#${new_grouped_syscalls}#" "$file_to_edit" + fi +fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -144405,156 +144563,11 @@ edits of files involved in storing logon events: SRG-APP-000503-CTR-001275 SRG-APP-000506-CTR-001290 RHEL-08-030590 - 4.1.3.12 + 5.2.3.12 SV-230466r627750_rule Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80718-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -var_accounts_passwords_pam_faillock_dir='' - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -144770,6 +144783,151 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +var_accounts_passwords_pam_faillock_dir='' + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+${var_accounts_passwords_pam_faillock_dir}" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir} $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+${var_accounts_passwords_pam_faillock_dir}$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w ${var_accounts_passwords_pam_faillock_dir} -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -144929,154 +145087,11 @@ edits of files involved in storing logon events: SRG-APP-000503-CTR-001275 SRG-APP-000506-CTR-001290 RHEL-08-030600 - 4.1.3.12 + 5.2.3.12 SV-230467r627750_rule Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80719-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/lastlog" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -145285,6 +145300,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/lastlog" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/lastlog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/lastlog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/lastlog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/lastlog -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -145434,149 +145592,6 @@ edits of files involved in storing logon events: Manual editing of these files may indicate nefarious activity, such as an attacker attempting to remove evidence of an intrusion. CCE-80720-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' - - -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/tallylog" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/logins.rules" - # If the logins.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -145777,6 +145792,149 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' + + +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/logins.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/var/log/tallylog" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/logins.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/logins.rules" + # If the logins.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/var/log/tallylog" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/var/log/tallylog $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/var/log/tallylog$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /var/log/tallylog -p wa -k logins" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -145806,6 +145964,148 @@ form to /etc/audit/audit.rules: AU-12(c) SRG-OS-000477-GPOS-00222 Misuse of the init command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_init + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/init + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_init + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -146126,31 +146426,54 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_init - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/init - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - poweroff + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-12(c) + SRG-OS-000477-GPOS-00222 + Misuse of the poweroff command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_poweroff + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/poweroff + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + - name: Check existence of in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146195,8 +146518,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -146205,8 +146528,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146221,7 +146544,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146240,7 +146563,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/init -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146250,8 +146573,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/init -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146261,36 +146584,13 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_init + - audit_privileged_commands_poweroff - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - poweroff - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/poweroff -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-12(c) - SRG-OS-000477-GPOS-00222 - Misuse of the poweroff command may cause availability issues for the system. # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -146611,19 +146911,42 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - reboot + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + AU-12(c) + SRG-OS-000477-GPOS-00222 + Misuse of the reboot command may cause availability issues for the system. + - name: Gather the package facts package_facts: manager: auto tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_poweroff + - audit_privileged_commands_reboot - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/poweroff +- name: Perform remediation of Audit rules for /usr/sbin/reboot block: - name: Declare list of syscalls @@ -146635,7 +146958,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146680,7 +147003,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146690,8 +147013,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146706,7 +147029,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -146725,7 +147048,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/poweroff -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -146735,8 +147058,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/poweroff -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -146746,36 +147069,13 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AU-12(c) - - audit_privileged_commands_poweroff + - audit_privileged_commands_reboot - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - reboot - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/reboot -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - AU-12(c) - SRG-OS-000477-GPOS-00222 - Misuse of the reboot command may cause availability issues for the system. # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -147095,148 +147395,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_reboot - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/reboot - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/reboot -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/reboot -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_reboot - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -147261,6 +147419,148 @@ form to /etc/audit/audit.rules: AU-12(c) SRG-OS-000477-GPOS-00222 Misuse of the shutdown command may cause availability issues for the system. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_shutdown + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/sbin/shutdown + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-12(c) + - audit_privileged_commands_shutdown + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -147580,148 +147880,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_shutdown - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/shutdown - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/shutdown -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/shutdown -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-12(c) - - audit_privileged_commands_shutdown - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -147901,7 +148059,7 @@ file system during check or remediation caused undesirable errors.RS.CO-2 Req-10.2.2 SRG-OS-000327-GPOS-00127 - 4.1.3.6 + 5.2.3.6 Misuse of privileged functions, either intentionally or unintentionally by authorized users, or by unauthorized external entities that have compromised system accounts, is a serious and ongoing concern that can have significant adverse impacts on organizations. @@ -147912,6 +148070,176 @@ Privileged programs are subject to escalation-of-privilege attacks, which attemp their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80724-8 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set + List of Mount Points Which Permits Execution of Privileged Commands + ansible.builtin.set_fact: + privileged_mount_points: '{{(ansible_facts.mounts | rejectattr(''options'', ''search'', + ''noexec|nosuid'') | rejectattr(''mount'', ''match'', ''/proc($|/.*$)'') | map(attribute=''mount'') + | list ) }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Search + for Privileged Commands in Eligible Mount Points + ansible.builtin.shell: + cmd: find {{ item }} -xdev -perm /6000 -type f 2>/dev/null + register: result_privileged_commands_search + changed_when: false + failed_when: false + with_items: '{{ privileged_mount_points }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set + List of Privileged Commands Found in Eligible Mount Points + ansible.builtin.set_fact: + privileged_commands: '{{ privileged_commands | default([]) + item.stdout_lines + }}' + loop: '{{ result_privileged_commands_search.results }}' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - item is not skipped + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + +- name: Ensure auditd Collects Information on the Use of Privileged Commands - Privileged + Commands are Present in the System + block: + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for All Privileged Commands in augenrules Format + ansible.builtin.lineinfile: + path: /etc/audit/rules.d/privileged.rules + line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset + -F key=privileged + regexp: ^.*path={{ item | regex_escape() }} .*$ + create: true + with_items: + - '{{ privileged_commands }}' + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for All Privileged Commands in auditctl Format + ansible.builtin.lineinfile: + path: /etc/audit/audit.rules + line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset + -F key=privileged + regexp: ^.*path={{ item | regex_escape() }} .*$ + create: true + with_items: + - '{{ privileged_commands }}' + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Search + for Duplicated Rules in Other Files + ansible.builtin.find: + paths: /etc/audit/rules.d + recurse: false + contains: ^-a always,exit -F path={{ item }} .*$ + patterns: '*.rules' + with_items: + - '{{ privileged_commands }}' + register: result_augenrules_files + + - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure + Rules for Privileged Commands are Defined Only in One File + ansible.builtin.lineinfile: + path: '{{ item.1.path }}' + regexp: ^-a always,exit -F path={{ item.0.item }} .*$ + state: absent + with_subelements: + - '{{ result_augenrules_files.results }}' + - files + when: + - item.1.path != '/etc/audit/rules.d/privileged.rules' + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - privileged_commands is defined + tags: + - CCE-80724-8 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.2.2 + - audit_rules_privileged_commands + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -148239,176 +148567,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set - List of Mount Points Which Permits Execution of Privileged Commands - ansible.builtin.set_fact: - privileged_mount_points: '{{(ansible_facts.mounts | rejectattr(''options'', ''search'', - ''noexec|nosuid'') | rejectattr(''mount'', ''match'', ''/proc($|/.*$)'') | map(attribute=''mount'') - | list ) }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Search - for Privileged Commands in Eligible Mount Points - ansible.builtin.shell: - cmd: find {{ item }} -xdev -perm /6000 -type f 2>/dev/null - register: result_privileged_commands_search - changed_when: false - failed_when: false - with_items: '{{ privileged_mount_points }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Set - List of Privileged Commands Found in Eligible Mount Points - ansible.builtin.set_fact: - privileged_commands: '{{ privileged_commands | default([]) + item.stdout_lines - }}' - loop: '{{ result_privileged_commands_search.results }}' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - item is not skipped - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - -- name: Ensure auditd Collects Information on the Use of Privileged Commands - Privileged - Commands are Present in the System - block: - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for All Privileged Commands in augenrules Format - ansible.builtin.lineinfile: - path: /etc/audit/rules.d/privileged.rules - line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset - -F key=privileged - regexp: ^.*path={{ item | regex_escape() }} .*$ - create: true - with_items: - - '{{ privileged_commands }}' - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for All Privileged Commands in auditctl Format - ansible.builtin.lineinfile: - path: /etc/audit/audit.rules - line: -a always,exit -F path={{ item }} -F perm=x -F auid>=1000 -F auid!=unset - -F key=privileged - regexp: ^.*path={{ item | regex_escape() }} .*$ - create: true - with_items: - - '{{ privileged_commands }}' - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Search - for Duplicated Rules in Other Files - ansible.builtin.find: - paths: /etc/audit/rules.d - recurse: false - contains: ^-a always,exit -F path={{ item }} .*$ - patterns: '*.rules' - with_items: - - '{{ privileged_commands }}' - register: result_augenrules_files - - - name: Ensure auditd Collects Information on the Use of Privileged Commands - Ensure - Rules for Privileged Commands are Defined Only in One File - ansible.builtin.lineinfile: - path: '{{ item.1.path }}' - regexp: ^-a always,exit -F path={{ item.0.item }} .*$ - state: absent - with_subelements: - - '{{ result_augenrules_files.results }}' - - files - when: - - item.1.path != '/etc/audit/rules.d/privileged.rules' - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - privileged_commands is defined - tags: - - CCE-80724-8 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.2.2 - - audit_rules_privileged_commands - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed @@ -148446,6 +148604,156 @@ which attempt to subvert their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80988-9 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80988-9 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_at + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/bin/at + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80988-9 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_at + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -148766,23 +149074,153 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - chage + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000468-GPOS-00212 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000501-CTR-001265 + SRG-APP-000502-CTR-001270 + RHEL-08-030250 + SV-230418r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80725-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80988-9 + - CCE-80725-5 + - DISA-STIG-RHEL-08-030250 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_at + - audit_rules_privileged_commands_chage - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/at +- name: Perform remediation of Audit rules for /usr/bin/chage block: - name: Declare list of syscalls @@ -148794,7 +149232,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -148839,8 +149277,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -148849,7 +149287,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -148865,7 +149303,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -148884,8 +149322,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -148894,7 +149332,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/at -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -148904,145 +149342,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80988-9 + - CCE-80725-5 + - DISA-STIG-RHEL-08-030250 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_at + - audit_rules_privileged_commands_chage - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - chage - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000468-GPOS-00212 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000501-CTR-001265 - SRG-APP-000502-CTR-001270 - RHEL-08-030250 - SV-230418r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80725-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -149363,26 +149677,149 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - chsh + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030410 + SV-230448r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80726-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80725-5 - - DISA-STIG-RHEL-08-030250 + - CCE-80726-3 + - DISA-STIG-RHEL-08-030410 - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chage + - audit_rules_privileged_commands_chsh - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/chage +- name: Perform remediation of Audit rules for /usr/bin/chsh block: - name: Declare list of syscalls @@ -149394,7 +149831,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -149439,7 +149876,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -149449,7 +149886,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -149465,7 +149902,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -149484,7 +149921,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -149494,7 +149931,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chage -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -149504,144 +149941,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80725-5 - - DISA-STIG-RHEL-08-030250 + - CCE-80726-3 + - DISA-STIG-RHEL-08-030410 - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chage + - audit_rules_privileged_commands_chsh - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - chsh - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030410 - SV-230448r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80726-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -149962,26 +150276,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - crontab + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030400 + SV-230447r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80727-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80726-3 - - DISA-STIG-RHEL-08-030410 + - CCE-80727-1 + - DISA-STIG-RHEL-08-030400 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chsh + - audit_rules_privileged_commands_crontab - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/chsh +- name: Perform remediation of Audit rules for /usr/bin/crontab block: - name: Declare list of syscalls @@ -149993,7 +150420,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150038,8 +150465,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -150048,7 +150475,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150064,7 +150491,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150083,7 +150510,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150093,7 +150520,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/chsh -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150103,135 +150530,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80726-3 - - DISA-STIG-RHEL-08-030410 + - CCE-80727-1 + - DISA-STIG-RHEL-08-030400 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_chsh + - audit_rules_privileged_commands_crontab - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - crontab - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030400 - SV-230447r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80727-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -150552,25 +150864,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030370 + SV-230444r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80728-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80727-1 - - DISA-STIG-RHEL-08-030400 + - CCE-80728-9 + - DISA-STIG-RHEL-08-030370 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_crontab + - audit_rules_privileged_commands_gpasswd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/crontab +- name: Perform remediation of Audit rules for /usr/bin/gpasswd block: - name: Declare list of syscalls @@ -150582,7 +151020,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150627,7 +151065,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150637,7 +151075,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150653,7 +151091,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -150672,7 +151110,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -150682,7 +151120,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/crontab -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -150692,145 +151130,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80727-1 - - DISA-STIG-RHEL-08-030400 + - CCE-80728-9 + - DISA-STIG-RHEL-08-030370 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_crontab + - audit_rules_privileged_commands_gpasswd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030370 - SV-230444r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80728-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -151151,26 +151465,79 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - kmod + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + BP28(R73) + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + AU-3 + AU-3.1 + AU-12(a) + AU-12.1(ii) + AU-12.1(iv)AU-12(c) + MA-4(1)(a) + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000471-GPOS-00216 + SRG-OS-000477-GPOS-00222 + SRG-APP-000495-CTR-001235 + SRG-APP-000504-CTR-001280 + RHEL-08-030580 + 5.2.3.19 + SV-230465r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. + +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + + CCE-89455-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80728-9 - - DISA-STIG-RHEL-08-030370 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_gpasswd + - CCE-89455-0 + - DISA-STIG-RHEL-08-030580 + - NIST-800-53-AU-12(a) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv)AU-12(c) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_kmod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/gpasswd +- name: Perform remediation of Audit rules for /usr/bin/kmod block: - name: Declare list of syscalls @@ -151182,7 +151549,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151227,8 +151594,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -151237,7 +151604,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151253,7 +151620,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151272,7 +151639,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151282,7 +151649,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/gpasswd -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151292,74 +151659,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80728-9 - - DISA-STIG-RHEL-08-030370 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_gpasswd + - CCE-89455-0 + - DISA-STIG-RHEL-08-030580 + - NIST-800-53-AU-12(a) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv)AU-12(c) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_kmod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - kmod - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - BP28(R73) - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - AU-3 - AU-3.1 - AU-12(a) - AU-12.1(ii) - AU-12.1(iv)AU-12(c) - MA-4(1)(a) - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000471-GPOS-00216 - SRG-OS-000477-GPOS-00222 - SRG-APP-000495-CTR-001235 - SRG-APP-000504-CTR-001280 - RHEL-08-030580 - 4.1.3.19 - SV-230465r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. - -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - - CCE-89455-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -151680,26 +151994,73 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - mount + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + RHEL-08-030300 + SV-230423r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80989-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-89455-0 - - DISA-STIG-RHEL-08-030580 - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv)AU-12(c) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_kmod + - CCE-80989-7 + - DISA-STIG-RHEL-08-030300 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_mount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/kmod +- name: Perform remediation of Audit rules for /usr/bin/mount block: - name: Declare list of syscalls @@ -151711,7 +152072,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151756,7 +152117,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151766,7 +152127,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151782,7 +152143,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -151801,7 +152162,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -151811,7 +152172,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/kmod -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -151821,70 +152182,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-89455-0 - - DISA-STIG-RHEL-08-030580 - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv)AU-12(c) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_kmod + - CCE-80989-7 + - DISA-STIG-RHEL-08-030300 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_mount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - mount - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - RHEL-08-030300 - SV-230423r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80989-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -152205,24 +152515,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80991-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80989-7 - - DISA-STIG-RHEL-08-030300 + - CCE-80991-3 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_mount + - audit_rules_privileged_commands_newgidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/mount +- name: Perform remediation of Audit rules for /usr/bin/newgidmap block: - name: Declare list of syscalls @@ -152234,7 +152589,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152279,8 +152634,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -152289,8 +152644,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152305,7 +152660,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152324,7 +152679,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -152334,8 +152689,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/mount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152344,64 +152699,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80989-7 - - DISA-STIG-RHEL-08-030300 + - CCE-80991-3 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_mount + - audit_rules_privileged_commands_newgidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80991-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -152722,24 +153032,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newgrp + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000169 + CCI-000135 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030350 + SV-230437r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80729-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80991-3 + - CCE-80729-7 + - DISA-STIG-RHEL-08-030350 + - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgidmap + - audit_rules_privileged_commands_newgrp - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newgidmap +- name: Perform remediation of Audit rules for /usr/bin/newgrp block: - name: Declare list of syscalls @@ -152751,7 +153188,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152796,8 +153233,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -152806,8 +153243,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152822,7 +153259,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -152841,7 +153278,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -152851,8 +153288,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -152861,144 +153298,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80991-3 + - CCE-80729-7 + - DISA-STIG-RHEL-08-030350 + - NIST-800-171-3.1.7 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgidmap + - audit_rules_privileged_commands_newgrp - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newgrp - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000169 - CCI-000135 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030350 - SV-230437r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80729-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -153319,26 +153633,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80992-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80729-7 - - DISA-STIG-RHEL-08-030350 - - NIST-800-171-3.1.7 + - CCE-80992-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgrp + - audit_rules_privileged_commands_newuidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newgrp +- name: Perform remediation of Audit rules for /usr/bin/newuidmap block: - name: Declare list of syscalls @@ -153350,7 +153707,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153395,8 +153752,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153405,8 +153762,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153421,7 +153778,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153440,7 +153797,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -153450,8 +153807,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newgrp -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153460,66 +153817,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80729-7 - - DISA-STIG-RHEL-08-030350 - - NIST-800-171-3.1.7 + - CCE-80992-1 - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newgrp + - audit_rules_privileged_commands_newuidmap - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80992-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -153840,24 +154150,142 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/pam_timestamp_check +-F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/pam_timestamp_check +-F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030340 + SV-230436r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80730-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80992-1 - - NIST-800-53-AC-2(4) + - CCE-80730-5 + - DISA-STIG-RHEL-08-030340 + - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newuidmap + - audit_rules_privileged_commands_pam_timestamp_check - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/newuidmap +- name: Perform remediation of Audit rules for /usr/sbin/pam_timestamp_check block: - name: Declare list of syscalls @@ -153869,7 +154297,8 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153914,8 +154343,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153924,8 +154353,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153940,7 +154369,8 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -153959,8 +154389,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -153969,8 +154399,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/newuidmap -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -153979,136 +154409,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80992-1 - - NIST-800-53-AC-2(4) + - CCE-80730-5 + - DISA-STIG-RHEL-08-030340 + - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_newuidmap + - audit_rules_privileged_commands_pam_timestamp_check - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/pam_timestamp_check --F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/pam_timestamp_check --F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030340 - SV-230436r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80730-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -154429,25 +154743,151 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - passwd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030290 + SV-230422r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80731-3 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80730-5 - - DISA-STIG-RHEL-08-030340 + - CCE-80731-3 + - DISA-STIG-RHEL-08-030290 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pam_timestamp_check + - audit_rules_privileged_commands_passwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/pam_timestamp_check +- name: Perform remediation of Audit rules for /usr/bin/passwd block: - name: Declare list of syscalls @@ -154459,8 +154899,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -154505,8 +154944,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -154515,8 +154954,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -154531,8 +154970,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -154551,8 +154989,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -154561,8 +154999,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/pam_timestamp_check - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -154571,145 +155009,21 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80730-5 - - DISA-STIG-RHEL-08-030340 + - CCE-80731-3 + - DISA-STIG-RHEL-08-030290 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pam_timestamp_check + - audit_rules_privileged_commands_passwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - passwd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030290 - SV-230422r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80731-3 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -155030,26 +155344,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - postdrop + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030311 + SV-230427r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80732-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80731-3 - - DISA-STIG-RHEL-08-030290 + - CCE-80732-1 + - DISA-STIG-RHEL-08-030311 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_passwd + - audit_rules_privileged_commands_postdrop - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/passwd +- name: Perform remediation of Audit rules for /usr/sbin/postdrop block: - name: Declare list of syscalls @@ -155061,7 +155488,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155106,8 +155533,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -155116,8 +155543,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -155132,7 +155559,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155151,7 +155578,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155161,8 +155588,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/passwd -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -155171,135 +155598,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80731-3 - - DISA-STIG-RHEL-08-030290 + - CCE-80732-1 + - DISA-STIG-RHEL-08-030311 - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_passwd + - audit_rules_privileged_commands_postdrop - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - postdrop - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030311 - SV-230427r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80732-1 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -155620,25 +155932,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - postqueue + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030312 + SV-230428r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80733-9 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80732-1 - - DISA-STIG-RHEL-08-030311 + - CCE-80733-9 + - DISA-STIG-RHEL-08-030312 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postdrop + - audit_rules_privileged_commands_postqueue - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/postdrop +- name: Perform remediation of Audit rules for /usr/sbin/postqueue block: - name: Declare list of syscalls @@ -155650,7 +156076,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155695,7 +156121,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155705,7 +156131,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -155721,7 +156147,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -155740,7 +156166,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/postdrop -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -155750,7 +156176,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postdrop -F + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -155760,134 +156186,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80732-1 - - DISA-STIG-RHEL-08-030311 + - CCE-80733-9 + - DISA-STIG-RHEL-08-030312 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postdrop + - audit_rules_privileged_commands_postqueue - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - postqueue - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030312 - SV-230428r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80733-9 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -156208,25 +156520,123 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000135 + CCI-000172 + CCI-002884 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000042-GPOS-00020 + SRG-OS-000392-GPOS-00172 + SRG-OS-000471-GPOS-00215 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80734-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80733-9 - - DISA-STIG-RHEL-08-030312 + - CCE-80734-7 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postqueue + - audit_rules_privileged_commands_pt_chown - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/postqueue +- name: Perform remediation of Audit rules for /usr/libexec/pt_chown block: - name: Declare list of syscalls @@ -156238,7 +156648,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156283,7 +156693,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156293,8 +156703,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156309,7 +156719,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156328,7 +156738,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/postqueue -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156338,8 +156748,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/postqueue -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156348,119 +156758,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80733-9 - - DISA-STIG-RHEL-08-030312 + - CCE-80734-7 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_postqueue + - audit_rules_privileged_commands_pt_chown - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000135 - CCI-000172 - CCI-002884 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000042-GPOS-00020 - SRG-OS-000392-GPOS-00172 - SRG-OS-000471-GPOS-00215 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80734-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -156781,24 +157091,61 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Any Attempts to Run ssh-agent + At a minimum, the audit system should collect any execution attempt +of the ssh-agent command for all users and root. If the auditd +daemon is configured to use the augenrules program to read audit rules +during daemon startup (the default), add the following lines to a file with suffix +.rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following lines to +/etc/audit/audit.rules file: +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030280 + SV-230421r627750_rule + Without generating audit records that are specific to the security and +mission needs of the organization, it would be difficult to establish, +correlate, and investigate the events relating to an incident or identify +those responsible for one. + +Audit records can be generated from various components within the +information system (e.g., module or policy filter). + CCE-85944-7 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80734-7 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pt_chown + - CCE-85944-7 + - DISA-STIG-RHEL-08-030280 + - audit_rules_privileged_commands_ssh_agent - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/libexec/pt_chown +- name: Perform remediation of Audit rules for /usr/bin/ssh-agent block: - name: Declare list of syscalls @@ -156810,7 +157157,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156855,7 +157202,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156865,8 +157212,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156881,7 +157228,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -156900,7 +157247,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -156910,8 +157257,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/pt_chown - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -156920,60 +157267,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80734-7 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_pt_chown + - CCE-85944-7 + - DISA-STIG-RHEL-08-030280 + - audit_rules_privileged_commands_ssh_agent - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Any Attempts to Run ssh-agent - At a minimum, the audit system should collect any execution attempt -of the ssh-agent command for all users and root. If the auditd -daemon is configured to use the augenrules program to read audit rules -during daemon startup (the default), add the following lines to a file with suffix -.rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following lines to -/etc/audit/audit.rules file: --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030280 - SV-230421r627750_rule - Without generating audit records that are specific to the security and -mission needs of the organization, it would be difficult to establish, -correlate, and investigate the events relating to an incident or identify -those responsible for one. - -Audit records can be generated from various components within the -information system (e.g., module or policy filter). - CCE-85944-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -157293,150 +157595,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-85944-7 - - DISA-STIG-RHEL-08-030280 - - audit_rules_privileged_commands_ssh_agent - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/bin/ssh-agent - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/ssh-agent -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85944-7 - - DISA-STIG-RHEL-08-030280 - - audit_rules_privileged_commands_ssh_agent - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -157554,6 +157712,162 @@ which attempt to subvert their normal role of providing some necessary but limited capability. As such, motivation exists to monitor these programs for unusual activity. CCE-80735-4 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80735-4 + - DISA-STIG-RHEL-08-030320 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_ssh_keysign + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for /usr/libexec/openssh/ssh-keysign + block: + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules + set_fact: audit_file="/etc/audit/rules.d/privileged.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: [] + syscall_grouping: [] + + - name: Check existence of in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F + path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset + (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( + -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80735-4 + - DISA-STIG-RHEL-08-030320 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_ssh_keysign + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -157874,25 +158188,144 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - su + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000064-GPOS-0003 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030190 + SV-230412r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80736-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80735-4 - - DISA-STIG-RHEL-08-030320 + - CCE-80736-2 + - DISA-STIG-RHEL-08-030190 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_ssh_keysign + - audit_rules_privileged_commands_su - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/libexec/openssh/ssh-keysign +- name: Perform remediation of Audit rules for /usr/bin/su block: - name: Declare list of syscalls @@ -157904,8 +158337,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -157950,8 +158382,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 + -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -157960,8 +158392,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -157976,8 +158408,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset - (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -157996,8 +158427,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (?:-k + |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158006,8 +158437,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/libexec/openssh/ssh-keysign - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -158016,139 +158447,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80735-4 - - DISA-STIG-RHEL-08-030320 + - CCE-80736-2 + - DISA-STIG-RHEL-08-030190 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_ssh_keysign + - audit_rules_privileged_commands_su - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - su - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000064-GPOS-0003 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030190 - SV-230412r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80736-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -158469,25 +158781,144 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - sudo + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + BP28(R19) + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030550 + SV-230462r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80737-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80736-2 - - DISA-STIG-RHEL-08-030190 + - CCE-80737-0 + - DISA-STIG-RHEL-08-030550 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_su + - audit_rules_privileged_commands_sudo - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/su +- name: Perform remediation of Audit rules for /usr/bin/sudo block: - name: Declare list of syscalls @@ -158499,7 +158930,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -158544,8 +158975,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 - -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158554,7 +158985,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -158570,7 +159001,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -158589,8 +159020,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset (?:-k - |-F key=)\w+) + -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset + (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -158599,7 +159030,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/su -F perm=x + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -158609,139 +159040,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80736-2 - - DISA-STIG-RHEL-08-030190 + - CCE-80737-0 + - DISA-STIG-RHEL-08-030550 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_su + - audit_rules_privileged_commands_sudo - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - sudo - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - BP28(R19) - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030550 - SV-230462r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80737-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -159062,25 +159374,137 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80738-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80737-0 - - DISA-STIG-RHEL-08-030550 + - CCE-80738-8 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudo + - audit_rules_privileged_commands_sudoedit - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/sudo +- name: Perform remediation of Audit rules for /usr/bin/sudoedit block: - name: Declare list of syscalls @@ -159092,7 +159516,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159137,8 +159561,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -159147,8 +159571,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159163,7 +159587,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159182,7 +159606,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -159192,8 +159616,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudo -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159202,133 +159626,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80737-0 - - DISA-STIG-RHEL-08-030550 + - CCE-80738-8 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudo + - audit_rules_privileged_commands_sudoedit - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80738-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -159649,24 +159959,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - umount + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000169 + CCI-000135 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + RHEL-08-030301 + SV-230424r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80739-6 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80738-8 + - CCE-80739-6 + - DISA-STIG-RHEL-08-030301 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudoedit + - audit_rules_privileged_commands_umount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/sudoedit +- name: Perform remediation of Audit rules for /usr/bin/umount block: - name: Declare list of syscalls @@ -159678,7 +160103,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159723,8 +160148,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F + auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -159733,8 +160158,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159749,7 +160174,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -159768,7 +160193,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -159778,8 +160203,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/sudoedit -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x + -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -159788,133 +160213,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80738-8 + - CCE-80739-6 + - DISA-STIG-RHEL-08-030301 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) - NIST-800-53-AU-12(c) - NIST-800-53-AU-2(d) - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_sudoedit + - audit_rules_privileged_commands_umount - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - umount - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000169 - CCI-000135 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - RHEL-08-030301 - SV-230424r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80739-6 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -160235,25 +160547,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + CIP-007-3 R6.5 + AC-2(4) + AU-2(d) + AU-3 + AU-3.1 + AU-12(a) + AU-12(c) + AU-12.1(ii) + AU-12.1(iv) + AC-6(9) + CM-6(a) + MA-4(1)(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000029-CTR-000085 + SRG-APP-000495-CTR-001235 + RHEL-08-030317 + SV-230433r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80740-4 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80739-6 - - DISA-STIG-RHEL-08-030301 + - CCE-80740-4 + - DISA-STIG-RHEL-08-030317 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(a) - NIST-800-53-AU-12(c) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv) - NIST-800-53-AU-2(d) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_umount + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_unix_chkpwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/bin/umount +- name: Perform remediation of Audit rules for /usr/sbin/unix_chkpwd block: - name: Declare list of syscalls @@ -160265,7 +160716,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160310,8 +160761,8 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F - auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x + -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -160320,8 +160771,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -160336,7 +160787,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160355,7 +160806,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160365,8 +160816,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/bin/umount -F perm=x - -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -160375,152 +160826,27 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80739-6 - - DISA-STIG-RHEL-08-030301 + - CCE-80740-4 + - DISA-STIG-RHEL-08-030317 - NIST-800-171-3.1.7 + - NIST-800-53-AC-2(4) - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(a) - NIST-800-53-AU-12(c) + - NIST-800-53-AU-12.1(ii) + - NIST-800-53-AU-12.1(iv) - NIST-800-53-AU-2(d) + - NIST-800-53-AU-3 + - NIST-800-53-AU-3.1 - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_umount + - NIST-800-53-MA-4(1)(a) + - audit_rules_privileged_commands_unix_chkpwd - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - CIP-007-3 R6.5 - AC-2(4) - AU-2(d) - AU-3 - AU-3.1 - AU-12(a) - AU-12(c) - AU-12.1(ii) - AU-12.1(iv) - AC-6(9) - CM-6(a) - MA-4(1)(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000029-CTR-000085 - SRG-APP-000495-CTR-001235 - RHEL-08-030317 - SV-230433r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80740-4 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -160841,32 +161167,65 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_update + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000064-GPOS-00033 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030310 + SV-230426r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-89480-8 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80740-4 - - DISA-STIG-RHEL-08-030317 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv) - - NIST-800-53-AU-2(d) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-CM-6(a) - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_unix_chkpwd + - CCE-89480-8 + - DISA-STIG-RHEL-08-030310 + - audit_rules_privileged_commands_unix_update - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/unix_chkpwd +- name: Perform remediation of Audit rules for /usr/sbin/unix_update block: - name: Declare list of syscalls @@ -160878,7 +161237,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160923,7 +161282,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160933,7 +161292,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -160949,7 +161308,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -160968,7 +161327,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -160978,7 +161337,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_chkpwd + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -160988,72 +161347,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80740-4 - - DISA-STIG-RHEL-08-030317 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(a) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-12.1(ii) - - NIST-800-53-AU-12.1(iv) - - NIST-800-53-AU-2(d) - - NIST-800-53-AU-3 - - NIST-800-53-AU-3.1 - - NIST-800-53-CM-6(a) - - NIST-800-53-MA-4(1)(a) - - audit_rules_privileged_commands_unix_chkpwd + - CCE-89480-8 + - DISA-STIG-RHEL-08-030310 + - audit_rules_privileged_commands_unix_update - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_update - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000064-GPOS-00033 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030310 - SV-230426r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-89480-8 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -161374,20 +161676,139 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - userhelper + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + 1 + 12 + 13 + 14 + 15 + 16 + 2 + 3 + 5 + 6 + 7 + 8 + 9 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + BAI03.05 + DSS01.03 + DSS03.05 + DSS05.02 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.4.4.7 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.8 + SR 2.9 + SR 6.1 + SR 6.2 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.14.2.7 + A.15.2.1 + A.15.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.PT-1 + FAU_GEN.1.1.c + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-APP-000495-CTR-001235 + RHEL-08-030315 + SV-230431r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80741-2 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-89480-8 - - DISA-STIG-RHEL-08-030310 - - audit_rules_privileged_commands_unix_update + - CCE-80741-2 + - DISA-STIG-RHEL-08-030315 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_userhelper - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/unix_update +- name: Perform remediation of Audit rules for /usr/sbin/userhelper block: - name: Declare list of syscalls @@ -161399,7 +161820,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -161444,7 +161865,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -161454,7 +161875,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -161470,7 +161891,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -161489,7 +161910,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/unix_update -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -161499,7 +161920,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/unix_update + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx @@ -161509,129 +161930,20 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-89480-8 - - DISA-STIG-RHEL-08-030310 - - audit_rules_privileged_commands_unix_update + - CCE-80741-2 + - DISA-STIG-RHEL-08-030315 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_userhelper - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - userhelper - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - 1 - 12 - 13 - 14 - 15 - 16 - 2 - 3 - 5 - 6 - 7 - 8 - 9 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - BAI03.05 - DSS01.03 - DSS03.05 - DSS05.02 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.4.4.7 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.8 - SR 2.9 - SR 6.1 - SR 6.2 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.14.2.7 - A.15.2.1 - A.15.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.PT-1 - FAU_GEN.1.1.c - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-APP-000495-CTR-001235 - RHEL-08-030315 - SV-230431r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80741-2 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -161952,25 +162264,67 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - usermod + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000130 + CCI-000135 + CCI-000169 + CCI-000172 + CCI-002884 + SRG-OS-000037-GPOS-00015 + SRG-OS-000042-GPOS-00020 + SRG-OS-000062-GPOS-00031 + SRG-OS-000392-GPOS-00172 + SRG-OS-000462-GPOS-00206 + SRG-OS-000471-GPOS-00215 + SRG-OS-000466-GPOS-00210 + SRG-APP-000495-CTR-001235 + SRG-APP-000499-CTR-001255 + RHEL-08-030560 + 5.2.3.18 + SV-230463r627750_rule + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-86027-0 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80741-2 - - DISA-STIG-RHEL-08-030315 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_userhelper + - CCE-86027-0 + - DISA-STIG-RHEL-08-030560 + - audit_rules_privileged_commands_usermod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/userhelper +- name: Perform remediation of Audit rules for /usr/sbin/usermod block: - name: Declare list of syscalls @@ -161982,7 +162336,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162027,7 +162381,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162037,8 +162391,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162053,7 +162407,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162072,7 +162426,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162082,8 +162436,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/userhelper - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F + perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162092,67 +162446,15 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80741-2 - - DISA-STIG-RHEL-08-030315 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_userhelper + - CCE-86027-0 + - DISA-STIG-RHEL-08-030560 + - audit_rules_privileged_commands_usermod - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - usermod - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000130 - CCI-000135 - CCI-000169 - CCI-000172 - CCI-002884 - SRG-OS-000037-GPOS-00015 - SRG-OS-000042-GPOS-00020 - SRG-OS-000062-GPOS-00031 - SRG-OS-000392-GPOS-00172 - SRG-OS-000462-GPOS-00206 - SRG-OS-000471-GPOS-00215 - SRG-OS-000466-GPOS-00210 - SRG-APP-000495-CTR-001235 - SRG-APP-000499-CTR-001255 - RHEL-08-030560 - 4.1.3.18 - SV-230463r627750_rule - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-86027-0 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -162473,20 +162775,69 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl + At a minimum, the audit system should collect the execution of +privileged commands for all users and root. If the auditd daemon is +configured to use the augenrules program to read audit rules during +daemon startup (the default), add a line of the following form to a file with +suffix .rules in the directory /etc/audit/rules.d: +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add a line of the following +form to /etc/audit/audit.rules: +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + CCI-000172 + CIP-004-6 R2.2.2 + CIP-004-6 R2.2.3 + CIP-007-3 R.1.3 + CIP-007-3 R5 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.3 + CIP-007-3 R5.2.1 + CIP-007-3 R5.2.3 + AC-2(4) + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + FAU_GEN.1.1.c + Misuse of privileged functions, either intentionally or unintentionally by +authorized users, or by unauthorized external entities that have compromised system accounts, +is a serious and ongoing concern and can have significant adverse impacts on organizations. +Auditing the use of privileged functions is one way to detect such misuse and identify +the risk from insider and advanced persistent threats. + +Privileged programs are subject to escalation-of-privilege attacks, +which attempt to subvert their normal role of providing some necessary but +limited capability. As such, motivation exists to monitor these programs for +unusual activity. + CCE-80990-5 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-86027-0 - - DISA-STIG-RHEL-08-030560 - - audit_rules_privileged_commands_usermod + - CCE-80990-5 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_usernetctl - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for /usr/sbin/usermod +- name: Perform remediation of Audit rules for /usr/sbin/usernetctl block: - name: Declare list of syscalls @@ -162498,7 +162849,7 @@ fi find: paths: /etc/audit/rules.d contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162543,7 +162894,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162553,8 +162904,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162569,7 +162920,7 @@ fi find: paths: /etc/audit contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ + path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -162588,7 +162939,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/usermod -F perm=x -F auid>=1000 -F auid!=unset + -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true @@ -162598,8 +162949,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usermod -F - perm=x -F auid>=1000 -F auid!=unset -F key=privileged + line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl + -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged create: true mode: o-rwx state: present @@ -162608,60 +162959,19 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-86027-0 - - DISA-STIG-RHEL-08-030560 - - audit_rules_privileged_commands_usermod + - CCE-80990-5 + - NIST-800-53-AC-2(4) + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - audit_rules_privileged_commands_usernetctl - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl - At a minimum, the audit system should collect the execution of -privileged commands for all users and root. If the auditd daemon is -configured to use the augenrules program to read audit rules during -daemon startup (the default), add a line of the following form to a file with -suffix .rules in the directory /etc/audit/rules.d: --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add a line of the following -form to /etc/audit/audit.rules: --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - CCI-000172 - CIP-004-6 R2.2.2 - CIP-004-6 R2.2.3 - CIP-007-3 R.1.3 - CIP-007-3 R5 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.3 - CIP-007-3 R5.2.1 - CIP-007-3 R5.2.3 - AC-2(4) - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - FAU_GEN.1.1.c - Misuse of privileged functions, either intentionally or unintentionally by -authorized users, or by unauthorized external entities that have compromised system accounts, -is a serious and ongoing concern and can have significant adverse impacts on organizations. -Auditing the use of privileged functions is one way to detect such misuse and identify -the risk from insider and advanced persistent threats. - -Privileged programs are subject to escalation-of-privilege attacks, -which attempt to subvert their normal role of providing some necessary but -limited capability. As such, motivation exists to monitor these programs for -unusual activity. - CCE-80990-5 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then @@ -162981,158 +163291,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80990-5 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_usernetctl - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for /usr/sbin/usernetctl - block: - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/privileged.rules - set_fact: audit_file="/etc/audit/rules.d/privileged.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x - -F auid>=1000 -F auid!=unset (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: [] - syscall_grouping: [] - - - name: Check existence of in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit(( -S |,)\w+)*(( -S |,){{ item }})+(( -S |,)\w+)* -F - path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | join("|") }}))\b)((?:( - -S |,)\w+)+)( -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset - (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit{{ syscalls | join(',') }} -F path=/usr/sbin/usernetctl - -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80990-5 - - NIST-800-53-AC-2(4) - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - audit_rules_privileged_commands_usernetctl - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -163288,12 +163446,341 @@ not required. See an example of multiple combined syscalls: RS.AN-4 Req-10.4.2.b 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80745-3 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set architecture for audit tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for adjtimex for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for adjtimex for 64bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + + - name: Check existence of adjtimex in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - adjtimex + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of adjtimex in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - audit_arch == "b64" + tags: + - CCE-80745-3 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_adjtimex + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -163648,11 +164135,164 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts + + + + + + + + + Record Attempts to Alter Time Through clock_settime + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change +The -k option allows for the specification of a key in string form that can +be used for better reporting capability through ausearch and aureport. +Multiple system calls can be defined on the same line to save space if +desired, but is not required. See an example of multiple combined syscalls: +-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules + BP28(R73) + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-001487 + CCI-000169 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.4.2.b + 10.6.3 + 5.2.3.4 + Arbitrary changes to the system time can be used to obfuscate +nefarious activities in log files, as well as to confuse network services that +are highly dependent upon an accurate system time (such as sshd). All changes +to the system time should be audited. + CCE-80746-1 + - name: Gather the package facts package_facts: manager: auto tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163661,7 +164301,7 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity @@ -163677,7 +164317,7 @@ fi - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163686,30 +164326,27 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for adjtimex for 32bit platform +- name: Perform remediation of Audit rules for clock_settime for 32bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/rules.d/ + - name: Check existence of clock_settime in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163739,8 +164376,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules + set_fact: audit_file="/etc/audit/rules.d/time-change.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -163754,7 +164391,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163763,7 +164400,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163772,17 +164410,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/audit.rules + - name: Check existence of clock_settime in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163801,7 +164436,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163810,7 +164445,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163819,7 +164455,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163828,29 +164464,27 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for adjtimex for 64bit platform +- name: Perform remediation of Audit rules for clock_settime for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/rules.d/ + - name: Check existence of clock_settime in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163880,8 +164514,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules + set_fact: audit_file="/etc/audit/rules.d/time-change.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -163895,7 +164529,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163904,7 +164538,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163913,17 +164548,14 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - adjtimex - syscall_grouping: - - adjtimex - - settimeofday - - stime + - clock_settime + syscall_grouping: [] - - name: Check existence of adjtimex in /etc/audit/audit.rules + - name: Check existence of clock_settime in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -163942,7 +164574,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -163951,7 +164583,8 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F + key=time-change create: true mode: o-rwx state: present @@ -163961,7 +164594,7 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80745-3 + - CCE-80746-1 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -163970,166 +164603,13 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_adjtimex + - audit_rules_time_clock_settime - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record Attempts to Alter Time Through clock_settime - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S clock_settime -F a0=0x0 -F key=time-change -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S clock_settime -F a0=0x0 -F key=time-change -The -k option allows for the specification of a key in string form that can -be used for better reporting capability through ausearch and aureport. -Multiple system calls can be defined on the same line to save space if -desired, but is not required. See an example of multiple combined syscalls: --a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules - BP28(R73) - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-001487 - CCI-000169 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.4.2.b - 10.6.3 - 4.1.3.4 - Arbitrary changes to the system time can be used to obfuscate -nefarious activities in log files, as well as to confuse network services that -are highly dependent upon an accurate system time (such as sshd). All changes -to the system time should be audited. - CCE-80746-1 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -164472,155 +164952,312 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80746-1 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set architecture for audit tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80746-1 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for clock_settime for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - clock_settime - syscall_grouping: [] - - - name: Check existence of clock_settime in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules - set_fact: audit_file="/etc/audit/rules.d/time-change.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - clock_settime - syscall_grouping: [] - - - name: Check existence of clock_settime in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: + + + + + + + + + Record attempts to alter time through settimeofday + If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), add the following line to a file with suffix .rules in the +directory /etc/audit/rules.d: +-a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, add the following line to +/etc/audit/audit.rules file: +-a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules +If the system is 64 bit then also add the following line: +-a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules +The -k option allows for the specification of a key in string form that can be +used for better reporting capability through ausearch and aureport. Multiple +system calls can be defined on the same line to save space if desired, but is +not required. See an example of multiple combined syscalls: +-a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules + 1 + 11 + 12 + 13 + 14 + 15 + 16 + 19 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 5.4.1.1 + APO10.01 + APO10.03 + APO10.04 + APO10.05 + APO11.04 + APO12.06 + APO13.01 + BAI03.05 + BAI08.02 + DSS01.03 + DSS01.04 + DSS02.02 + DSS02.04 + DSS02.07 + DSS03.01 + DSS03.05 + DSS05.02 + DSS05.03 + DSS05.04 + DSS05.05 + DSS05.07 + MEA01.01 + MEA01.02 + MEA01.03 + MEA01.04 + MEA01.05 + MEA02.01 + 3.1.7 + CCI-001487 + CCI-000169 + 164.308(a)(1)(ii)(D) + 164.308(a)(3)(ii)(A) + 164.308(a)(5)(ii)(C) + 164.312(a)(2)(i) + 164.312(b) + 164.312(d) + 164.312(e) + 4.2.3.10 + 4.3.2.6.7 + 4.3.3.3.9 + 4.3.3.5.8 + 4.3.3.6.6 + 4.3.4.4.7 + 4.3.4.5.6 + 4.3.4.5.7 + 4.3.4.5.8 + 4.4.2.1 + 4.4.2.2 + 4.4.2.4 + SR 1.13 + SR 2.10 + SR 2.11 + SR 2.12 + SR 2.6 + SR 2.8 + SR 2.9 + SR 3.1 + SR 3.5 + SR 3.8 + SR 4.1 + SR 4.3 + SR 5.1 + SR 5.2 + SR 5.3 + SR 6.1 + SR 6.2 + SR 7.1 + SR 7.6 + A.11.2.6 + A.12.4.1 + A.12.4.2 + A.12.4.3 + A.12.4.4 + A.12.7.1 + A.13.1.1 + A.13.2.1 + A.14.1.3 + A.14.2.7 + A.15.2.1 + A.15.2.2 + A.16.1.4 + A.16.1.5 + A.16.1.7 + A.6.2.1 + A.6.2.2 + AU-2(d) + AU-12(c) + AC-6(9) + CM-6(a) + DE.AE-3 + DE.AE-5 + DE.CM-1 + DE.CM-3 + DE.CM-7 + ID.SC-4 + PR.AC-3 + PR.PT-1 + PR.PT-4 + RS.AN-1 + RS.AN-4 + Req-10.4.2.b + 10.6.3 + 5.2.3.4 + Arbitrary changes to the system time can be used to obfuscate +nefarious activities in log files, as well as to confuse network services that +are highly dependent upon an accurate system time (such as sshd). All changes +to the system time should be audited. + CCE-80747-9 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80747-9 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_settimeofday + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Set architecture for audit tasks + set_fact: + audit_arch: b64 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture + == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" + tags: + - CCE-80747-9 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_settimeofday + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for settimeofday for 32bit platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of settimeofday in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of settimeofday in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164629,8 +165266,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164639,7 +165275,7 @@ fi - '"audit" in ansible_facts.packages' - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80746-1 + - CCE-80747-9 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -164648,27 +165284,30 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime + - audit_rules_time_settimeofday - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy -- name: Perform remediation of Audit rules for clock_settime for 64bit platform +- name: Perform remediation of Audit rules for settimeofday for 64bit platform block: - name: Declare list of syscalls set_fact: syscalls: - - clock_settime - syscall_grouping: [] + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime - - name: Check existence of clock_settime in /etc/audit/rules.d/ + - name: Check existence of settimeofday in /etc/audit/rules.d/ find: paths: /etc/audit/rules.d contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ patterns: '*.rules' register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -164698,8 +165337,8 @@ fi | last).key }}" when: found_paths | length >= 1 - - name: No file with syscall found, set path to /etc/audit/rules.d/time-change.rules - set_fact: audit_file="/etc/audit/rules.d/time-change.rules" + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" when: found_paths | length == 0 - name: Declare found syscalls @@ -164713,7 +165352,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164722,8 +165361,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164732,14 +165370,17 @@ fi - name: Declare list of syscalls set_fact: syscalls: - - clock_settime - syscall_grouping: [] + - settimeofday + syscall_grouping: + - adjtimex + - settimeofday + - stime - - name: Check existence of clock_settime in /etc/audit/audit.rules + - name: Check existence of settimeofday in /etc/audit/audit.rules find: paths: /etc/audit contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* -F a0=0x0 (-k\s+|-F\s+key=)\S+\s*$ + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ patterns: audit.rules register: find_command loop: '{{ (syscall_grouping + syscalls) | unique }}' @@ -164758,7 +165399,7 @@ fi lineinfile: path: '{{ audit_file }}' regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( -F a0=0x0 (?:-k |-F key=)\w+) + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) line: \1\2\3{{ missing_syscalls | join("\3") }}\4 backrefs: true state: present @@ -164767,8 +165408,7 @@ fi - name: Add the audit rule to {{ audit_file }} lineinfile: path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F a0=0x0 -F - key=time-change + line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules create: true mode: o-rwx state: present @@ -164778,7 +165418,7 @@ fi - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - audit_arch == "b64" tags: - - CCE-80746-1 + - CCE-80747-9 - CJIS-5.4.1.1 - NIST-800-171-3.1.7 - NIST-800-53-AC-6(9) @@ -164787,165 +165427,13 @@ fi - NIST-800-53-CM-6(a) - PCI-DSS-Req-10.4.2.b - PCI-DSSv4-10.6.3 - - audit_rules_time_clock_settime + - audit_rules_time_settimeofday - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Record attempts to alter time through settimeofday - If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), add the following line to a file with suffix .rules in the -directory /etc/audit/rules.d: --a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, add the following line to -/etc/audit/audit.rules file: --a always,exit -F arch=b32 -S settimeofday -F key=audit_time_rules -If the system is 64 bit then also add the following line: --a always,exit -F arch=b64 -S settimeofday -F key=audit_time_rules -The -k option allows for the specification of a key in string form that can be -used for better reporting capability through ausearch and aureport. Multiple -system calls can be defined on the same line to save space if desired, but is -not required. See an example of multiple combined syscalls: --a always,exit -F arch=b64 -S adjtimex,settimeofday -F key=audit_time_rules - 1 - 11 - 12 - 13 - 14 - 15 - 16 - 19 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 5.4.1.1 - APO10.01 - APO10.03 - APO10.04 - APO10.05 - APO11.04 - APO12.06 - APO13.01 - BAI03.05 - BAI08.02 - DSS01.03 - DSS01.04 - DSS02.02 - DSS02.04 - DSS02.07 - DSS03.01 - DSS03.05 - DSS05.02 - DSS05.03 - DSS05.04 - DSS05.05 - DSS05.07 - MEA01.01 - MEA01.02 - MEA01.03 - MEA01.04 - MEA01.05 - MEA02.01 - 3.1.7 - CCI-001487 - CCI-000169 - 164.308(a)(1)(ii)(D) - 164.308(a)(3)(ii)(A) - 164.308(a)(5)(ii)(C) - 164.312(a)(2)(i) - 164.312(b) - 164.312(d) - 164.312(e) - 4.2.3.10 - 4.3.2.6.7 - 4.3.3.3.9 - 4.3.3.5.8 - 4.3.3.6.6 - 4.3.4.4.7 - 4.3.4.5.6 - 4.3.4.5.7 - 4.3.4.5.8 - 4.4.2.1 - 4.4.2.2 - 4.4.2.4 - SR 1.13 - SR 2.10 - SR 2.11 - SR 2.12 - SR 2.6 - SR 2.8 - SR 2.9 - SR 3.1 - SR 3.5 - SR 3.8 - SR 4.1 - SR 4.3 - SR 5.1 - SR 5.2 - SR 5.3 - SR 6.1 - SR 6.2 - SR 7.1 - SR 7.6 - A.11.2.6 - A.12.4.1 - A.12.4.2 - A.12.4.3 - A.12.4.4 - A.12.7.1 - A.13.1.1 - A.13.2.1 - A.14.1.3 - A.14.2.7 - A.15.2.1 - A.15.2.2 - A.16.1.4 - A.16.1.5 - A.16.1.7 - A.6.2.1 - A.6.2.2 - AU-2(d) - AU-12(c) - AC-6(9) - CM-6(a) - DE.AE-3 - DE.AE-5 - DE.CM-1 - DE.CM-3 - DE.CM-7 - ID.SC-4 - PR.AC-3 - PR.PT-1 - PR.PT-4 - RS.AN-1 - RS.AN-4 - Req-10.4.2.b - 10.6.3 - 4.1.3.4 - Arbitrary changes to the system time can be used to obfuscate -nefarious activities in log files, as well as to confuse network services that -are highly dependent upon an accurate system time (such as sshd). All changes -to the system time should be audited. - CCE-80747-9 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -165299,336 +165787,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Set architecture for audit tasks - set_fact: - audit_arch: b64 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ansible_architecture == "aarch64" or ansible_architecture == "ppc64" or ansible_architecture - == "ppc64le" or ansible_architecture == "s390x" or ansible_architecture == "x86_64" - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for settimeofday for 32bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for settimeofday for 64bit platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - settimeofday - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of settimeofday in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b64(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b64)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b64 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - audit_arch == "b64" - tags: - - CCE-80747-9 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_settimeofday - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -165781,13 +165939,177 @@ required. See an example of multiple combined system calls: RS.AN-4 Req-10.4.2.b 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80748-7 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80748-7 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_stime + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + +- name: Perform remediation of Audit rules for stime syscall for x86 platform + block: + + - name: Declare list of syscalls + set_fact: + syscalls: + - stime + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of stime in /etc/audit/rules.d/ + find: + paths: /etc/audit/rules.d + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: '*.rules' + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Reset syscalls found per file + set_fact: + syscalls_per_file: {} + found_paths_dict: {} + + - name: Declare syscalls found per file + set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path + :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" + loop: '{{ find_command.results | selectattr(''matched'') | list }}' + + - name: Declare files where syscalls were found + set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten + | map(attribute='path') | list }}" + + - name: Count occurrences of syscalls in paths + set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, + 0) }) }}" + loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') + | list }}' + + - name: Get path with most syscalls + set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') + | last).key }}" + when: found_paths | length >= 1 + + - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules + set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" + when: found_paths | length == 0 + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] + | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + + - name: Declare list of syscalls + set_fact: + syscalls: + - stime + syscall_grouping: + - adjtimex + - settimeofday + - stime + + - name: Check existence of stime in /etc/audit/audit.rules + find: + paths: /etc/audit + contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S + |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ + patterns: audit.rules + register: find_command + loop: '{{ (syscall_grouping + syscalls) | unique }}' + + - name: Set path to /etc/audit/audit.rules + set_fact: audit_file="/etc/audit/audit.rules" + + - name: Declare found syscalls + set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') + | list }}" + + - name: Declare missing syscalls + set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" + + - name: Replace the audit rule in {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | + join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) + line: \1\2\3{{ missing_syscalls | join("\3") }}\4 + backrefs: true + state: present + when: syscalls_found | length > 0 and missing_syscalls | length > 0 + + - name: Add the audit rule to {{ audit_file }} + lineinfile: + path: '{{ audit_file }}' + line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules + create: true + mode: o-rwx + state: present + when: syscalls_found | length == 0 + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - ( not ( ansible_architecture == "aarch64" ) and not ( ansible_architecture == + "s390x" ) ) + tags: + - CCE-80748-7 + - CJIS-5.4.1.1 + - NIST-800-171-3.1.7 + - NIST-800-53-AC-6(9) + - NIST-800-53-AU-12(c) + - NIST-800-53-AU-2(d) + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4.2.b + - PCI-DSSv4-10.6.3 + - audit_rules_time_stime + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -166141,170 +166463,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80748-7 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_stime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - -- name: Perform remediation of Audit rules for stime syscall for x86 platform - block: - - - name: Declare list of syscalls - set_fact: - syscalls: - - stime - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of stime in /etc/audit/rules.d/ - find: - paths: /etc/audit/rules.d - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: '*.rules' - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Reset syscalls found per file - set_fact: - syscalls_per_file: {} - found_paths_dict: {} - - - name: Declare syscalls found per file - set_fact: syscalls_per_file="{{ syscalls_per_file | combine( {item.files[0].path - :[item.item] + syscalls_per_file.get(item.files[0].path, []) } ) }}" - loop: '{{ find_command.results | selectattr(''matched'') | list }}' - - - name: Declare files where syscalls were found - set_fact: found_paths="{{ find_command.results | map(attribute='files') | flatten - | map(attribute='path') | list }}" - - - name: Count occurrences of syscalls in paths - set_fact: found_paths_dict="{{ found_paths_dict | combine({ item:1+found_paths_dict.get(item, - 0) }) }}" - loop: '{{ find_command.results | map(attribute=''files'') | flatten | map(attribute=''path'') - | list }}' - - - name: Get path with most syscalls - set_fact: audit_file="{{ (found_paths_dict | dict2items() | sort(attribute='value') - | last).key }}" - when: found_paths | length >= 1 - - - name: No file with syscall found, set path to /etc/audit/rules.d/audit_time_rules.rules - set_fact: audit_file="/etc/audit/rules.d/audit_time_rules.rules" - when: found_paths | length == 0 - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_per_file[audit_file] - | join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - - - name: Declare list of syscalls - set_fact: - syscalls: - - stime - syscall_grouping: - - adjtimex - - settimeofday - - stime - - - name: Check existence of stime in /etc/audit/audit.rules - find: - paths: /etc/audit - contains: -a always,exit -F arch=b32(( -S |,)\w+)*(( -S |,){{ item }})+(( -S - |,)\w+)* (-k\s+|-F\s+key=)\S+\s*$ - patterns: audit.rules - register: find_command - loop: '{{ (syscall_grouping + syscalls) | unique }}' - - - name: Set path to /etc/audit/audit.rules - set_fact: audit_file="/etc/audit/audit.rules" - - - name: Declare found syscalls - set_fact: syscalls_found="{{ find_command.results | selectattr('matched') | map(attribute='item') - | list }}" - - - name: Declare missing syscalls - set_fact: missing_syscalls="{{ syscalls | difference(syscalls_found) }}" - - - name: Replace the audit rule in {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - regexp: (-a always,exit -F arch=b32)(?=.*(?:(?:-S |,)(?:{{ syscalls_found | - join("|") }}))\b)((?:( -S |,)\w+)+)( (?:-k |-F key=)\w+) - line: \1\2\3{{ missing_syscalls | join("\3") }}\4 - backrefs: true - state: present - when: syscalls_found | length > 0 and missing_syscalls | length > 0 - - - name: Add the audit rule to {{ audit_file }} - lineinfile: - path: '{{ audit_file }}' - line: -a always,exit -F arch=b32 -S {{ syscalls | join(',') }} -F key=audit_time_rules - create: true - mode: o-rwx - state: present - when: syscalls_found | length == 0 - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - ( not ( ansible_architecture == "aarch64" ) and not ( ansible_architecture == - "s390x" ) ) - tags: - - CCE-80748-7 - - CJIS-5.4.1.1 - - NIST-800-171-3.1.7 - - NIST-800-53-AC-6(9) - - NIST-800-53-AU-12(c) - - NIST-800-53-AU-2(d) - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4.2.b - - PCI-DSSv4-10.6.3 - - audit_rules_time_stime - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -166448,168 +166606,12 @@ should always be used. Req-10.4.2.b 10.6.3 10.6.3 - 4.1.3.4 + 5.2.3.4 Arbitrary changes to the system time can be used to obfuscate nefarious activities in log files, as well as to confuse network services that are highly dependent upon an accurate system time (such as sshd). All changes to the system time should be audited. CCE-80749-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ -w%20/etc/localtime%20-p%20wa%20-k%20audit_time_rules%0A }} - mode: 0600 - path: /etc/audit/rules.d/75-etclocaltime-wa-audit_time_rules.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - - -# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' -# into the list of files to be inspected -files_to_inspect+=('/etc/audit/audit.rules') - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" - fi -done -# Create a list of audit *.rules files that should be inspected for presence and correctness -# of a particular audit rule. The scheme is as follows: -# -# ----------------------------------------------------------------------------------------- -# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | -# ----------------------------------------------------------------------------------------- -# auditctl | Doesn't matter | /etc/audit/audit.rules | -# ----------------------------------------------------------------------------------------- -# augenrules | Yes | /etc/audit/rules.d/*.rules | -# augenrules | No | /etc/audit/rules.d/$key.rules | -# ----------------------------------------------------------------------------------------- -files_to_inspect=() - -# If the audit is 'augenrules', then check if rule is already defined -# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. -# If rule isn't defined, add '/etc/audit/rules.d/audit_time_rules.rules' to list of files for inspection. -readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/localtime" /etc/audit/rules.d/*.rules) - -# For each of the matched entries -for match in "${matches[@]}" -do - # Extract filepath from the match - rulesd_audit_file=$(echo $match | cut -f1 -d ':') - # Append that path into list of files for inspection - files_to_inspect+=("$rulesd_audit_file") -done -# Case when particular audit rule isn't defined yet -if [ "${#files_to_inspect[@]}" -eq "0" ] -then - # Append '/etc/audit/rules.d/audit_time_rules.rules' into list of files for inspection - key_rule_file="/etc/audit/rules.d/audit_time_rules.rules" - # If the audit_time_rules.rules file doesn't exist yet, create it with correct permissions - if [ ! -e "$key_rule_file" ] - then - touch "$key_rule_file" - chmod 0640 "$key_rule_file" - fi - files_to_inspect+=("$key_rule_file") -fi - -# Finally perform the inspection and possible subsequent audit rule -# correction for each of the files previously identified for inspection -for audit_rules_file in "${files_to_inspect[@]}" -do - # Check if audit watch file system object rule for given path already present - if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" - then - # Rule is found => verify yet if existing rule definition contains - # all of the required access type bits - - # Define BRE whitespace class shortcut - sp="[[:space:]]" - # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule - current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") - # Split required access bits string into characters array - # (to check bit's presence for one bit at a time) - for access_bit in $(echo "wa" | grep -o .) - do - # For each from the required access bits (e.g. 'w', 'a') check - # if they are already present in current access bits for rule. - # If not, append that bit at the end - if ! grep -q "$access_bit" <<< "$current_access_bits" - then - # Concatenate the existing mask with the missing bit - current_access_bits="$current_access_bits$access_bit" - fi - done - # Propagate the updated rule's access bits (original + the required - # ones) back into the /etc/audit/audit.rules file for that rule - sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" - else - # Rule isn't present yet. Append it at the end of $audit_rules_file file - # with proper key - - echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -166826,6 +166828,162 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ -w%20/etc/localtime%20-p%20wa%20-k%20audit_time_rules%0A }} + mode: 0600 + path: /etc/audit/rules.d/75-etclocaltime-wa-audit_time_rules.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +# Perform the remediation for both possible tools: 'auditctl' and 'augenrules' +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + + +# If the audit tool is 'auditctl', then add '/etc/audit/audit.rules' +# into the list of files to be inspected +files_to_inspect+=('/etc/audit/audit.rules') + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" + fi +done +# Create a list of audit *.rules files that should be inspected for presence and correctness +# of a particular audit rule. The scheme is as follows: +# +# ----------------------------------------------------------------------------------------- +# Tool used to load audit rules | Rule already defined | Audit rules file to inspect | +# ----------------------------------------------------------------------------------------- +# auditctl | Doesn't matter | /etc/audit/audit.rules | +# ----------------------------------------------------------------------------------------- +# augenrules | Yes | /etc/audit/rules.d/*.rules | +# augenrules | No | /etc/audit/rules.d/$key.rules | +# ----------------------------------------------------------------------------------------- +files_to_inspect=() + +# If the audit is 'augenrules', then check if rule is already defined +# If rule is defined, add '/etc/audit/rules.d/*.rules' to list of files for inspection. +# If rule isn't defined, add '/etc/audit/rules.d/audit_time_rules.rules' to list of files for inspection. +readarray -t matches < <(grep -HP "[\s]*-w[\s]+/etc/localtime" /etc/audit/rules.d/*.rules) + +# For each of the matched entries +for match in "${matches[@]}" +do + # Extract filepath from the match + rulesd_audit_file=$(echo $match | cut -f1 -d ':') + # Append that path into list of files for inspection + files_to_inspect+=("$rulesd_audit_file") +done +# Case when particular audit rule isn't defined yet +if [ "${#files_to_inspect[@]}" -eq "0" ] +then + # Append '/etc/audit/rules.d/audit_time_rules.rules' into list of files for inspection + key_rule_file="/etc/audit/rules.d/audit_time_rules.rules" + # If the audit_time_rules.rules file doesn't exist yet, create it with correct permissions + if [ ! -e "$key_rule_file" ] + then + touch "$key_rule_file" + chmod 0640 "$key_rule_file" + fi + files_to_inspect+=("$key_rule_file") +fi + +# Finally perform the inspection and possible subsequent audit rule +# correction for each of the files previously identified for inspection +for audit_rules_file in "${files_to_inspect[@]}" +do + # Check if audit watch file system object rule for given path already present + if grep -q -P -- "^[\s]*-w[\s]+/etc/localtime" "$audit_rules_file" + then + # Rule is found => verify yet if existing rule definition contains + # all of the required access type bits + + # Define BRE whitespace class shortcut + sp="[[:space:]]" + # Extract current permission access types (e.g. -p [r|w|x|a] values) from audit rule + current_access_bits=$(sed -ne "s#$sp*-w$sp\+/etc/localtime $sp\+-p$sp\+\([rxwa]\{1,4\}\).*#\1#p" "$audit_rules_file") + # Split required access bits string into characters array + # (to check bit's presence for one bit at a time) + for access_bit in $(echo "wa" | grep -o .) + do + # For each from the required access bits (e.g. 'w', 'a') check + # if they are already present in current access bits for rule. + # If not, append that bit at the end + if ! grep -q "$access_bit" <<< "$current_access_bits" + then + # Concatenate the existing mask with the missing bit + current_access_bits="$current_access_bits$access_bit" + fi + done + # Propagate the updated rule's access bits (original + the required + # ones) back into the /etc/audit/audit.rules file for that rule + sed -i "s#\($sp*-w$sp\+/etc/localtime$sp\+-p$sp\+\)\([rxwa]\{1,4\}\)\(.*\)#\1$current_access_bits\3#" "$audit_rules_file" + else + # Rule isn't present yet. Append it at the end of $audit_rules_file file + # with proper key + + echo "-w /etc/localtime -p wa -k audit_time_rules" >> "$audit_rules_file" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167082,42 +167240,6 @@ send audit records to. For example deletion or alteration.Off-loading is a common process in information systems with limited audit storage capacity. CCE-80925-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_remote_server='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^remote_server") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_remote_server" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^remote_server\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^remote_server\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80925-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167153,6 +167275,42 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_remote_server='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^remote_server") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_remote_server" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^remote_server\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^remote_server\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80925-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167220,38 +167378,6 @@ determined. SRG-OS-000479-GPOS-00224 Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_disk_full_action='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^disk_full_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_disk_full_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^disk_full_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^disk_full_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167295,6 +167421,38 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_disk_full_action='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^disk_full_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_disk_full_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^disk_full_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^disk_full_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167385,38 +167543,6 @@ This profile configures the action to be SRG-OS-000479-GPOS-00224 Taking appropriate action when there is an error sending audit records to a remote system will minimize the possibility of losing audit records. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_audispd_network_failure_action='' - - -AUDITCONFIG=/etc/audit/audisp-remote.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^network_failure_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_network_failure_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^network_failure_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^network_failure_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167460,6 +167586,38 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_audispd_network_failure_action='' + + +AUDITCONFIG=/etc/audit/audisp-remote.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^network_failure_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_audispd_network_failure_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^network_failure_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^network_failure_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167554,39 +167712,6 @@ records to a centralized server for management directly. It does, however, include a plug-in for audit event multiplexor (audispd) to pass audit records to the local syslog server. CCE-80677-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_syslog_active="yes" - -AUDISP_SYSLOGCONFIG=/etc/audit/plugins.d/syslog.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^active") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_syslog_active" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^active\\>" "$AUDISP_SYSLOGCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^active\\>.*/$escaped_formatted_output/gi" "$AUDISP_SYSLOGCONFIG" -else - if [[ -s "$AUDISP_SYSLOGCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDISP_SYSLOGCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDISP_SYSLOGCONFIG" - fi - cce="CCE-80677-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDISP_SYSLOGCONFIG" >> "$AUDISP_SYSLOGCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDISP_SYSLOGCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -167628,6 +167753,39 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_syslog_active="yes" + +AUDISP_SYSLOGCONFIG=/etc/audit/plugins.d/syslog.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^active") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_syslog_active" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^active\\>" "$AUDISP_SYSLOGCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^active\\>.*/$escaped_formatted_output/gi" "$AUDISP_SYSLOGCONFIG" +else + if [[ -s "$AUDISP_SYSLOGCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDISP_SYSLOGCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDISP_SYSLOGCONFIG" + fi + cce="CCE-80677-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDISP_SYSLOGCONFIG" >> "$AUDISP_SYSLOGCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDISP_SYSLOGCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -167726,10 +167884,59 @@ determined. Details regarding all possible values for ACTION ar SRG-APP-000290-CTR-000670 SRG-APP-000357-CTR-000800 RHEL-08-030040 + 5.2.2.3 SV-230390r627750_rule Taking appropriate action in case of disk errors will minimize the possibility of losing audit records. CCE-84046-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-84046-2 + - DISA-STIG-RHEL-08-030040 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_error_action # promote to variable + set_fact: + var_auditd_disk_error_action: !!str + tags: + - always + +- name: Configure auditd Disk Error Action on Disk Error + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_error_action = {{ var_auditd_disk_error_action.split('|')[0] }} + regexp: ^\s*disk_error_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84046-2 + - DISA-STIG-RHEL-08-030040 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -167783,54 +167990,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-84046-2 - - DISA-STIG-RHEL-08-030040 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_error_action # promote to variable - set_fact: - var_auditd_disk_error_action: !!str - tags: - - always - -- name: Configure auditd Disk Error Action on Disk Error - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_error_action = {{ var_auditd_disk_error_action.split('|')[0] }} - regexp: ^\s*disk_error_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84046-2 - - DISA-STIG-RHEL-08-030040 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -167924,6 +168083,50 @@ determined. Details regarding all possible values for ACTION ar SRG-OS-000047-GPOS-00023 Taking appropriate action in case of disk errors will minimize the possibility of losing audit records. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_error_action # promote to variable + set_fact: + var_auditd_disk_error_action: !!str + tags: + - always + +- name: Configure auditd Disk Error Action on Disk Error + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_error_action = {{ var_auditd_disk_error_action }} + regexp: ^\s*disk_error_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_error_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -167968,50 +168171,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_error_action # promote to variable - set_fact: - var_auditd_disk_error_action: !!str - tags: - - always - -- name: Configure auditd Disk Error Action on Disk Error - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_error_action = {{ var_auditd_disk_error_action }} - regexp: ^\s*disk_error_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_error_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168106,10 +168265,59 @@ determined. Details regarding all possible values for ACTION ar RS.AN-4 SRG-OS-000047-GPOS-00023 RHEL-08-030060 + 5.2.2.3 SV-230392r627750_rule Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. CCE-84045-4 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-84045-4 + - DISA-STIG-RHEL-08-030060 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_full_action # promote to variable + set_fact: + var_auditd_disk_full_action: !!str + tags: + - always + +- name: Configure auditd Disk Full Action when Disk Space Is Full + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_full_action = {{ var_auditd_disk_full_action.split('|')[0] }} + regexp: ^\s*disk_full_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84045-4 + - DISA-STIG-RHEL-08-030060 + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -168158,54 +168366,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-84045-4 - - DISA-STIG-RHEL-08-030060 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_full_action # promote to variable - set_fact: - var_auditd_disk_full_action: !!str - tags: - - always - -- name: Configure auditd Disk Full Action when Disk Space Is Full - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_full_action = {{ var_auditd_disk_full_action.split('|')[0] }} - regexp: ^\s*disk_full_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84045-4 - - DISA-STIG-RHEL-08-030060 - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168299,6 +168459,50 @@ determined. Details regarding all possible values for ACTION ar SRG-OS-000047-GPOS-00023 Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records. + - name: Gather the package facts + package_facts: + manager: auto + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_disk_full_action # promote to variable + set_fact: + var_auditd_disk_full_action: !!str + tags: + - always + +- name: Configure auditd Disk Full Action when Disk Space Is Full + lineinfile: + dest: /etc/audit/auditd.conf + line: disk_full_action = {{ var_auditd_disk_full_action }} + regexp: ^\s*disk_full_action\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-AU-5(1) + - NIST-800-53-AU-5(2) + - NIST-800-53-AU-5(4) + - NIST-800-53-AU-5(b) + - NIST-800-53-CM-6(a) + - auditd_data_disk_full_action_stig + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -168343,50 +168547,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_disk_full_action # promote to variable - set_fact: - var_auditd_disk_full_action: !!str - tags: - - always - -- name: Configure auditd Disk Full Action when Disk Space Is Full - lineinfile: - dest: /etc/audit/auditd.conf - line: disk_full_action = {{ var_auditd_disk_full_action }} - regexp: ^\s*disk_full_action\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-AU-5(1) - - NIST-800-53-AU-5(2) - - NIST-800-53-AU-5(4) - - NIST-800-53-AU-5(b) - - NIST-800-53-CM-6(a) - - auditd_data_disk_full_action_stig - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -168492,45 +168652,11 @@ via email for those situations: SRG-OS-000046-GPOS-00022 SRG-OS-000343-GPOS-00134 RHEL-08-030020 - 4.1.2.3 + 5.2.2.4 SV-230388r627750_rule Email sent to the root account is typically aliased to the administrators of the system, who can take appropriate action. CCE-80678-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_action_mail_acct='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^action_mail_acct") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_action_mail_acct" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^action_mail_acct\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^action_mail_acct\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80678-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168581,6 +168707,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_action_mail_acct='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^action_mail_acct") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_action_mail_acct" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^action_mail_acct\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^action_mail_acct\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80678-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -168679,60 +168839,11 @@ determined. Details regarding all possible values for ACTION ar Req-10.7 10.5.1 SRG-OS-000343-GPOS-00134 - 4.1.2.3 + 5.2.2.4 Administrators should be made aware of an inability to record audit records. If a separate partition or logical volume of adequate size is used, running low on space for audit records should never occur. CCE-80679-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_admin_space_left_action='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^admin_space_left_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_admin_space_left_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^admin_space_left_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^admin_space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80679-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168786,6 +168897,55 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_admin_space_left_action='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^admin_space_left_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_admin_space_left_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^admin_space_left_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^admin_space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80679-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -168876,20 +169036,6 @@ to cause the system to perform an action. SRG-OS-000343-GPOS-00134 Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_admin_space_left_percentage='' - - -grep -q "^admin_space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^admin_space_left[[:space:]]*=.*$/admin_space_left = $var_auditd_admin_space_left_percentage%/g" /etc/audit/auditd.conf || \ - echo "admin_space_left = $var_auditd_admin_space_left_percentage%" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -168935,6 +169081,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_admin_space_left_percentage='' + + +grep -q "^admin_space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^admin_space_left[[:space:]]*=.*$/admin_space_left = $var_auditd_admin_space_left_percentage%/g" /etc/audit/auditd.conf || \ + echo "admin_space_left = $var_auditd_admin_space_left_percentage%" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169032,6 +169192,48 @@ fully synchronized with the log files on the disk: log integrity. These parameters assure that all audit event data is fully synchronized with the log files on the disk. CCE-80680-2 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80680-2 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - auditd_data_retention_flush + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_flush # promote to variable + set_fact: + var_auditd_flush: !!str + tags: + - always + +- name: Configure auditd Flush Priority + lineinfile: + dest: /etc/audit/auditd.conf + regexp: ^\s*flush\s*=\s*.*$ + line: flush = {{ var_auditd_flush }} + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80680-2 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - auditd_data_retention_flush + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169083,48 +169285,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80680-2 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - auditd_data_retention_flush - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_flush # promote to variable - set_fact: - var_auditd_flush: !!str - tags: - - always - -- name: Configure auditd Flush Priority - lineinfile: - dest: /etc/audit/auditd.conf - regexp: ^\s*flush\s*=\s*.*$ - line: flush = {{ var_auditd_flush }} - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80680-2 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - auditd_data_retention_flush - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169209,11 +169369,55 @@ support retention of even more audit data. RS.AN-1 RS.AN-4 Req-10.7 - 4.1.2.1 + 5.2.2.1 The total storage for audit log files must be large enough to retain log information over the period required. This is a function of the maximum log file size and the number of logs retained. CCE-80681-0 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80681-0 + - CJIS-5.4.1.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_max_log_file + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_max_log_file # promote to variable + set_fact: + var_auditd_max_log_file: !!str + tags: + - always + +- name: Configure auditd Max Log File Size + lineinfile: + dest: /etc/audit/auditd.conf + regexp: ^\s*max_log_file\s*=\s*.*$ + line: max_log_file = {{ var_auditd_max_log_file }} + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80681-0 + - CJIS-5.4.1.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_max_log_file + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169262,50 +169466,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80681-0 - - CJIS-5.4.1.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_max_log_file - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_max_log_file # promote to variable - set_fact: - var_auditd_max_log_file: !!str - tags: - - always - -- name: Configure auditd Max Log File Size - lineinfile: - dest: /etc/audit/auditd.conf - regexp: ^\s*max_log_file\s*=\s*.*$ - line: max_log_file = {{ var_auditd_max_log_file }} - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80681-0 - - CJIS-5.4.1.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_max_log_file - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169398,62 +169558,13 @@ occurs. This is the default. The setting is case-insensitive.RS.AN-4 Req-10.7 SRG-OS-000047-GPOS-00023 - 4.1.2.2 + 5.2.2.2 Automatically rotating logs (by setting this to rotate) minimizes the chances of the system unexpectedly running out of disk space by being overwhelmed with log data. However, for systems that must never discard log data, or which use external processes to transfer it and reclaim space, keep_logs can be employed. CCE-80682-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_max_log_file_action='' - - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80682-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -169503,6 +169614,55 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_max_log_file_action='' + + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80682-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169606,51 +169766,6 @@ minimizes the chances of the system unexpectedly running out of disk space by being overwhelmed with log data. However, for systems that must never discard log data, or which use external processes to transfer it and reclaim space, keep_logs can be employed. - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_max_log_file_action='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "/etc/audit/auditd.conf"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "/etc/audit/auditd.conf" -else - if [[ -s "/etc/audit/auditd.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/audit/auditd.conf" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/audit/auditd.conf" - fi - printf '%s\n' "$formatted_output" >> "/etc/audit/auditd.conf" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -169696,6 +169811,51 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_max_log_file_action='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^max_log_file_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_max_log_file_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^max_log_file_action\\>" "/etc/audit/auditd.conf"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^max_log_file_action\\>.*/$escaped_formatted_output/gi" "/etc/audit/auditd.conf" +else + if [[ -s "/etc/audit/auditd.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/audit/auditd.conf" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/audit/auditd.conf" + fi + printf '%s\n' "$formatted_output" >> "/etc/audit/auditd.conf" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -169783,6 +169943,52 @@ Note that values less than 2 result in no log rotation. log information over the period required. This is a function of the maximum log file size and the number of logs retained. CCE-80683-6 + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-80683-6 + - CJIS-5.4.1.1 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_num_logs + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy +- name: XCCDF Value var_auditd_num_logs # promote to variable + set_fact: + var_auditd_num_logs: !!str + tags: + - always + +- name: Configure auditd Number of Logs Retained + lineinfile: + dest: /etc/audit/auditd.conf + line: num_logs = {{ var_auditd_num_logs }} + regexp: ^\s*num_logs\s*=\s*.*$ + state: present + create: true + when: + - '"audit" in ansible_facts.packages' + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80683-6 + - CJIS-5.4.1.1 + - NIST-800-171-3.3.1 + - NIST-800-53-AU-11 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - auditd_data_retention_num_logs + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -169831,52 +170037,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-80683-6 - - CJIS-5.4.1.1 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_num_logs - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy -- name: XCCDF Value var_auditd_num_logs # promote to variable - set_fact: - var_auditd_num_logs: !!str - tags: - - always - -- name: Configure auditd Number of Logs Retained - lineinfile: - dest: /etc/audit/auditd.conf - line: num_logs = {{ var_auditd_num_logs }} - regexp: ^\s*num_logs\s*=\s*.*$ - state: present - create: true - when: - - '"audit" in ansible_facts.packages' - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80683-6 - - CJIS-5.4.1.1 - - NIST-800-171-3.3.1 - - NIST-800-53-AU-11 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - auditd_data_retention_num_logs - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy @@ -169969,35 +170129,6 @@ notify the user of an issue. Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-83619-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left='' - - -grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left/g" /etc/audit/auditd.conf || \ - echo "space_left = $var_auditd_space_left" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170047,6 +170178,35 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left='' + + +grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left/g" /etc/audit/auditd.conf || \ + echo "space_left = $var_auditd_space_left" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170144,67 +170304,11 @@ also include suspend, single, and 10.5.1 SRG-OS-000343-GPOS-00134 RHEL-08-030731 - 4.1.2.3 + 5.2.2.4 SV-244543r877389_rule Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-80684-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left_action='' - - -var_auditd_space_left_action="$(echo $var_auditd_space_left_action | cut -d \| -f 1)" -# -# If space_left_action present in /etc/audit/auditd.conf, change value -# to var_auditd_space_left_action, else -# add "space_left_action = $var_auditd_space_left_action" to /etc/audit/auditd.conf -# - -AUDITCONFIG=/etc/audit/auditd.conf - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^space_left_action") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_space_left_action" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^space_left_action\\>" "$AUDITCONFIG"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" -else - if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" - fi - cce="CCE-80684-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" - printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170260,6 +170364,62 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left_action='' + + +var_auditd_space_left_action="$(echo $var_auditd_space_left_action | cut -d \| -f 1)" +# +# If space_left_action present in /etc/audit/auditd.conf, change value +# to var_auditd_space_left_action, else +# add "space_left_action = $var_auditd_space_left_action" to /etc/audit/auditd.conf +# + +AUDITCONFIG=/etc/audit/auditd.conf + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^space_left_action") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$var_auditd_space_left_action" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^space_left_action\\>" "$AUDITCONFIG"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^space_left_action\\>.*/$escaped_formatted_output/gi" "$AUDITCONFIG" +else + if [[ -s "$AUDITCONFIG" ]] && [[ -n "$(tail -c 1 -- "$AUDITCONFIG" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "$AUDITCONFIG" + fi + cce="CCE-80684-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "$AUDITCONFIG" >> "$AUDITCONFIG" + printf '%s\n' "$formatted_output" >> "$AUDITCONFIG" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170353,20 +170513,6 @@ notify the user of an issue. Notifying administrators of an impending disk space problem may allow them to take corrective action prior to any disruption. CCE-86055-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -var_auditd_space_left_percentage='' - - -grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ - sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left_percentage%/g" /etc/audit/auditd.conf || \ - echo "space_left = $var_auditd_space_left_percentage%" >> /etc/audit/auditd.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170416,6 +170562,20 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_space_left_percentage='' + + +grep -q "^space_left[[:space:]]*=.*$" /etc/audit/auditd.conf && \ + sed -i "s/^space_left[[:space:]]*=.*$/space_left = $var_auditd_space_left_percentage%/g" /etc/audit/auditd.conf || \ + echo "space_left = $var_auditd_space_left_percentage%" >> /etc/audit/auditd.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170437,43 +170597,6 @@ in /etc/audit/auditd.conf. may happen after higher number of records, increasing the danger of audit loss. CCE-82258-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if [ -e "/etc/audit/auditd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*freq\s*=\s*/Id" "/etc/audit/auditd.conf" -else - touch "/etc/audit/auditd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/audit/auditd.conf" - -cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" -# Insert at the end of the file -printf '%s\n' "freq = 50" >> "/etc/audit/auditd.conf" -# Clean up after ourselves. -rm "/etc/audit/auditd.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -170528,29 +170651,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Include Local Events in Audit Logs - To configure Audit daemon to include local events in Audit logs, set -local_events to yes in /etc/audit/auditd.conf. -This is the default setting. - CCI-000366 - CM-6 - FAU_GEN.1 - SRG-OS-000062-GPOS-00031 - SRG-OS-000480-GPOS-00227 - RHEL-08-030061 - SV-230393r627750_rule - If option local_events isn't set to yes only events from -network will be aggregated. - CCE-82233-8 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170565,12 +170666,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*local_events\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*freq\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170579,7 +170680,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "local_events = yes" >> "/etc/audit/auditd.conf" +printf '%s\n' "freq = 50" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170587,6 +170688,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Include Local Events in Audit Logs + To configure Audit daemon to include local events in Audit logs, set +local_events to yes in /etc/audit/auditd.conf. +This is the default setting. + CCI-000366 + CM-6 + FAU_GEN.1 + SRG-OS-000062-GPOS-00031 + SRG-OS-000480-GPOS-00227 + RHEL-08-030061 + SV-230393r627750_rule + If option local_events isn't set to yes only events from +network will be aggregated. + CCE-82233-8 - name: Gather the package facts package_facts: manager: auto @@ -170643,40 +170766,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Resolve information before writing to audit logs - To configure Audit daemon to resolve all uid, gid, syscall, -architecture, and socket address information before writing the -events to disk, set log_format to ENRICHED -in /etc/audit/auditd.conf. - CCI-000366 - CM-6 - AU-3 - FAU_GEN.1.2 - SRG-OS-000255-GPOS-00096 - SRG-OS-000480-GPOS-00227 - SRG-APP-000096-CTR-000175 - SRG-APP-000097-CTR-000180 - SRG-APP-000098-CTR-000185 - SRG-APP-000099-CTR-000190 - SRG-APP-000100-CTR-000195 - SRG-APP-000100-CTR-000200 - SRG-APP-000109-CTR-000215 - SRG-APP-000290-CTR-000670 - SRG-APP-000357-CTR-000800 - RHEL-08-030063 - SV-230395r627750_rule - If option log_format isn't set to ENRICHED, the -audit records will be stored in a format exactly as the kernel sends them. - CCE-82201-5 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170691,12 +170781,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*log_format\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*local_events\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170705,7 +170795,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "log_format = ENRICHED" >> "/etc/audit/auditd.conf" +printf '%s\n' "local_events = yes" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170713,6 +170803,39 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Resolve information before writing to audit logs + To configure Audit daemon to resolve all uid, gid, syscall, +architecture, and socket address information before writing the +events to disk, set log_format to ENRICHED +in /etc/audit/auditd.conf. + CCI-000366 + CM-6 + AU-3 + FAU_GEN.1.2 + SRG-OS-000255-GPOS-00096 + SRG-OS-000480-GPOS-00227 + SRG-APP-000096-CTR-000175 + SRG-APP-000097-CTR-000180 + SRG-APP-000098-CTR-000185 + SRG-APP-000099-CTR-000190 + SRG-APP-000100-CTR-000195 + SRG-APP-000100-CTR-000200 + SRG-APP-000109-CTR-000215 + SRG-APP-000290-CTR-000670 + SRG-APP-000357-CTR-000800 + RHEL-08-030063 + SV-230395r627750_rule + If option log_format isn't set to ENRICHED, the +audit records will be stored in a format exactly as the kernel sends them. + CCE-82201-5 - name: Gather the package facts package_facts: manager: auto @@ -170771,35 +170894,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Set type of computer node name logging in audit logs - To configure Audit daemon to use a unique identifier -as computer node name in the audit events, -set name_format to -in /etc/audit/auditd.conf. - Whenever the variable var_auditd_name_format uses a multiple value option, for example -A|B|C, the first value will be used when remediating this rule. - CCI-001851 - CM-6 - AU-3 - FAU_GEN.1.2 - SRG-OS-000039-GPOS-00017 - SRG-OS-000342-GPOS-00133 - SRG-OS-000479-GPOS-00224 - RHEL-08-030062 - SV-230394r877390_rule - If option name_format is left at its default value of -none, audit events from different computers may be hard -to distinguish. - CCE-82897-0 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -170814,17 +170909,12 @@ spec: path: /etc/audit/auditd.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then -var_auditd_name_format='' - - -var_auditd_name_format="$(echo $var_auditd_name_format | cut -d \| -f 1)" - if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*name_format\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*log_format\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -170833,7 +170923,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "name_format = $var_auditd_name_format" >> "/etc/audit/auditd.conf" +printf '%s\n' "log_format = ENRICHED" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -170841,6 +170931,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Set type of computer node name logging in audit logs + To configure Audit daemon to use a unique identifier +as computer node name in the audit events, +set name_format to +in /etc/audit/auditd.conf. + Whenever the variable var_auditd_name_format uses a multiple value option, for example +A|B|C, the first value will be used when remediating this rule. + CCI-001851 + CM-6 + AU-3 + FAU_GEN.1.2 + SRG-OS-000039-GPOS-00017 + SRG-OS-000342-GPOS-00133 + SRG-OS-000479-GPOS-00224 + RHEL-08-030062 + SV-230394r877390_rule + If option name_format is left at its default value of +none, audit events from different computers may be hard +to distinguish. + CCE-82897-0 - name: Gather the package facts package_facts: manager: auto @@ -170922,6 +171040,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +var_auditd_name_format='' + + +var_auditd_name_format="$(echo $var_auditd_name_format | cut -d \| -f 1)" + +if [ -e "/etc/audit/auditd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*name_format\s*=\s*/Id" "/etc/audit/auditd.conf" +else + touch "/etc/audit/auditd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/audit/auditd.conf" + +cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" +# Insert at the end of the file +printf '%s\n' "name_format = $var_auditd_name_format" >> "/etc/audit/auditd.conf" +# Clean up after ourselves. +rm "/etc/audit/auditd.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -170945,28 +171105,6 @@ to one of the following values: syslog, single The audit system should have an action setup in the event the internal event queue becomes full so that no data is lost. CCE-85889-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then - -if [ -e "/etc/audit/auditd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*overflow_action\s*=\s*/Id" "/etc/audit/auditd.conf" -else - touch "/etc/audit/auditd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/audit/auditd.conf" - -cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" -# Insert at the end of the file -printf '%s\n' "overflow_action = syslog" >> "/etc/audit/auditd.conf" -# Clean up after ourselves. -rm "/etc/audit/auditd.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -171023,45 +171161,12 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Write Audit Logs to the Disk - To configure Audit daemon to write Audit logs to the disk, set -write_logs to yes in /etc/audit/auditd.conf. -This is the default setting. - CM-6 - FAU_STG.1 - SRG-OS-000480-GPOS-00227 - If write_logs isn't set to yes, the Audit logs will -not be written to the disk. - CCE-82366-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} - mode: 0640 - path: /etc/audit/auditd.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then if [ -e "/etc/audit/auditd.conf" ] ; then - LC_ALL=C sed -i "/^\s*write_logs\s*=\s*/Id" "/etc/audit/auditd.conf" + LC_ALL=C sed -i "/^\s*overflow_action\s*=\s*/Id" "/etc/audit/auditd.conf" else touch "/etc/audit/auditd.conf" fi @@ -171070,7 +171175,7 @@ sed -i -e '$a\' "/etc/audit/auditd.conf" cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" # Insert at the end of the file -printf '%s\n' "write_logs = yes" >> "/etc/audit/auditd.conf" +printf '%s\n' "overflow_action = syslog" >> "/etc/audit/auditd.conf" # Clean up after ourselves. rm "/etc/audit/auditd.conf.bak" @@ -171078,6 +171183,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Write Audit Logs to the Disk + To configure Audit daemon to write Audit logs to the disk, set +write_logs to yes in /etc/audit/auditd.conf. +This is the default setting. + CM-6 + FAU_STG.1 + SRG-OS-000480-GPOS-00227 + If write_logs isn't set to yes, the Audit logs will +not be written to the disk. + CCE-82366-6 - name: Gather the package facts package_facts: manager: auto @@ -171131,6 +171254,43 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20audit%20daemon%0A%23%0A%0Alocal_events%20%3D%20yes%0Awrite_logs%20%3D%20yes%0Alog_file%20%3D%20/var/log/audit/audit.log%0Alog_group%20%3D%20root%0Alog_format%20%3D%20ENRICHED%0Aflush%20%3D%20%7B%7B.var_auditd_flush%7D%7D%0Afreq%20%3D%2050%0Amax_log_file%20%3D%20%7B%7B.var_auditd_max_log_file%7D%7D%0Anum_logs%20%3D%20%7B%7B.var_auditd_num_logs%7D%7D%0Apriority_boost%20%3D%204%0Aname_format%20%3D%20hostname%0A%23%23name%20%3D%20mydomain%0Amax_log_file_action%20%3D%20%7B%7B.var_auditd_max_log_file_action%7D%7D%0Aspace_left%20%3D%20%7B%7B.var_auditd_space_left%7D%7D%0Aspace_left_action%20%3D%20%7B%7B.var_auditd_space_left_action%7D%7D%0Averify_email%20%3D%20yes%0Aaction_mail_acct%20%3D%20%7B%7B.var_auditd_action_mail_acct%7D%7D%0Aadmin_space_left%20%3D%2050%0Aadmin_space_left_action%20%3D%20syslog%0Adisk_full_action%20%3D%20%7B%7B.var_auditd_disk_full_action%7D%7D%0Adisk_error_action%20%3D%20%7B%7B.var_auditd_disk_error_action%7D%7D%0Ause_libwrap%20%3D%20yes%0A%23%23tcp_listen_port%20%3D%2060%0Atcp_listen_queue%20%3D%205%0Atcp_max_per_addr%20%3D%201%0A%23%23tcp_client_ports%20%3D%201024-65535%0Atcp_client_max_idle%20%3D%200%0Atransport%20%3D%20TCP%0Akrb5_principal%20%3D%20auditd%0A%23%23krb5_key_file%20%3D%20/etc/audit/audit.key%0Adistribute_network%20%3D%20no%0Aq_depth%20%3D%20400%0Aoverflow_action%20%3D%20syslog%0Amax_restarts%20%3D%2010%0Aplugin_dir%20%3D%20/etc/audit/plugins.d }} + mode: 0640 + path: /etc/audit/auditd.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q audit; then + +if [ -e "/etc/audit/auditd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*write_logs\s*=\s*/Id" "/etc/audit/auditd.conf" +else + touch "/etc/audit/auditd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/audit/auditd.conf" + +cp "/etc/audit/auditd.conf" "/etc/audit/auditd.conf.bak" +# Insert at the end of the file +printf '%s\n' "write_logs = yes" >> "/etc/audit/auditd.conf" +# Clean up after ourselves. +rm "/etc/audit/auditd.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171184,25 +171344,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful attempts to access a file might be signs of malicious activity happening within the system. Auditing of such activities helps in their monitoring and investigation. CCE-82833-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules according to policy copy: @@ -171239,6 +171380,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171277,39 +171437,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to access a file helps in investigation of activities performed on the system. CCE-82834-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Successful%20file%20access%20%28any%20other%20opens%29%20This%20has%20to%20go%20last.%0A%23%23%20These%20next%20two%20are%20likely%20to%20result%20in%20a%20whole%20lot%20of%20events%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-3-access-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-success.rules -## Successful file access (any other opens) This has to go last. -## These next two are likely to result in a whole lot of events --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-3-access-success.rules according to policy copy: @@ -171345,6 +171472,39 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Successful%20file%20access%20%28any%20other%20opens%29%20This%20has%20to%20go%20last.%0A%23%23%20These%20next%20two%20are%20likely%20to%20result%20in%20a%20whole%20lot%20of%20events%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%2Copenat%2Copen_by_handle_at%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-access + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-3-access-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-3-access-success.rules +## Successful file access (any other opens) This has to go last. +## These next two are likely to result in a whole lot of events +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-3-access-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171381,48 +171541,6 @@ Load new Audit rules into kernel by running: SRG-OS-000475-GPOS-00220 Without basic configurations, audit may not perform as expected. It may not be able to correctly handle events under stressful conditions, or log events in case of failure. CCE-82827-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20First%20rule%20-%20delete%20all%0A-D%0A%0A%23%23%20Increase%20the%20buffers%20to%20survive%20stress%20events.%0A%23%23%20Make%20this%20bigger%20for%20busy%20systems%0A-b%208192%0A%0A%23%23%20This%20determine%20how%20long%20to%20wait%20in%20burst%20of%20events%0A--backlog_wait_time%2060000%0A%0A%23%23%20Set%20failure%20mode%20to%20syslog%0A-f%201%0A - mode: 0600 - path: /etc/audit/rules.d/10-base-config.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/10-base-config.rules -## First rule - delete all --D - -## Increase the buffers to survive stress events. -## Make this bigger for busy systems --b 8192 - -## This determine how long to wait in burst of events ---backlog_wait_time 60000 - -## Set failure mode to syslog --f 1 - -EOF - -chmod o-rwx /etc/audit/rules.d/10-base-config.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/10-base-config.rules according to policy copy: dest: /etc/audit/rules.d/10-base-config.rules @@ -171466,6 +171584,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20First%20rule%20-%20delete%20all%0A-D%0A%0A%23%23%20Increase%20the%20buffers%20to%20survive%20stress%20events.%0A%23%23%20Make%20this%20bigger%20for%20busy%20systems%0A-b%208192%0A%0A%23%23%20This%20determine%20how%20long%20to%20wait%20in%20burst%20of%20events%0A--backlog_wait_time%2060000%0A%0A%23%23%20Set%20failure%20mode%20to%20syslog%0A-f%201%0A + mode: 0600 + path: /etc/audit/rules.d/10-base-config.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/10-base-config.rules +## First rule - delete all +-D + +## Increase the buffers to survive stress events. +## Make this bigger for busy systems +-b 8192 + +## This determine how long to wait in burst of events +--backlog_wait_time 60000 + +## Set failure mode to syslog +-f 1 + +EOF + +chmod o-rwx /etc/audit/rules.d/10-base-config.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171513,33 +171673,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful file creations might be a sign of a malicious action being performed on the system. Keeping log of such events helps in monitoring and investigation of such actions. CCE-82374-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules -## Unsuccessful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules according to policy copy: @@ -171584,6 +171717,33 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules +## Unsuccessful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-create +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171619,27 +171779,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to create a file helps in investigation of actions which happened on the system. CCE-82829-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-success.rules -## Successful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-1-create-success.rules according to policy copy: @@ -171678,6 +171817,27 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-1-create-success.rules +## Successful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-1-create-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171712,40 +171872,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000468-GPOS-00212 Unsuccessful attempts to delete a file might be signs of malicious activities. Auditing of such events help in monitoring and investigating of such activities. CCE-82835-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Unsuccessful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules -## Unsuccessful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules according to policy copy: @@ -171782,6 +171908,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Unsuccessful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EACCES%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20exit%3D-EPERM%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-delete + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules +## Unsuccessful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171814,39 +171974,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000468-GPOS-00212 Auditing of successful attempts to delete a file may help in monitoring and investigation of activities performed on the system. CCE-82836-8 - --- - -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%23%20Successful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete }} - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules -## Successful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules according to policy copy: @@ -171881,6 +172008,39 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- + +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%23%20Successful%20file%20delete%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20unlink%2Cunlinkat%2Crename%2Crenameat%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-delete }} + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules +## Successful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -171916,38 +172076,6 @@ Load new Audit rules into kernel by running: If modification of login UIDs is not prevented, they can be changed by unprivileged users and make auditing complicated or impossible. CCE-82828-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Make%20the%20loginuid%20immutable.%20This%20prevents%20tampering%20with%20the%20auid.%0A--loginuid-immutable%0A%0A - mode: 0600 - path: /etc/audit/rules.d/11-loginuid.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/11-loginuid.rules -## Make the loginuid immutable. This prevents tampering with the auid. ---loginuid-immutable - -EOF - -chmod o-rwx /etc/audit/rules.d/11-loginuid.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/11-loginuid.rules according to policy copy: dest: /etc/audit/rules.d/11-loginuid.rules @@ -171981,6 +172109,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Make%20the%20loginuid%20immutable.%20This%20prevents%20tampering%20with%20the%20auid.%0A--loginuid-immutable%0A%0A + mode: 0600 + path: /etc/audit/rules.d/11-loginuid.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/11-loginuid.rules +## Make the loginuid immutable. This prevents tampering with the auid. +--loginuid-immutable + +EOF + +chmod o-rwx /etc/audit/rules.d/11-loginuid.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172028,48 +172188,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-APP-000507-CTR-001295 Unsuccessful file modifications might be a sign of a malicious action being performed on the system. Auditing of such events helps in detection and investigation of such actions. CCE-82830-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Unsuccessful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules according to policy copy: @@ -172114,6 +172232,48 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Unsuccessful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EACCES%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2601003%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20exit%3D-EPERM%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dunsuccessful-modification%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172149,42 +172309,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000461-GPOS-00205 Auditing of successful attempts to modify a file helps in investigation of actions which happened on the system. CCE-82832-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20Successful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules -## Successful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules according to policy copy: @@ -172223,6 +172347,42 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20Successful%20file%20modifications%20%28open%20for%20write%20or%20truncate%29%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%26amp%3B01003%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20truncate%2Cftruncate%20-F%20success%3D1%20-F%20auid%26gt%3B%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsuccessful-modification%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules +## Successful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172252,41 +172412,6 @@ Load new Audit rules into kernel by running: SRG-OS-000475-GPOS-00220 Loading of a malicious kernel module introduces a risk to the system, as the module has access to sensitive data and perform actions at the operating system kernel level. Having such events audited helps in monitoring and investigating of malicious activities. CCE-82838-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20These%20rules%20watch%20for%20kernel%20module%20insertion.%20By%20monitoring%0A%23%23%20the%20syscall%2C%20we%20do%20not%20need%20any%20watches%20on%20programs.%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A - mode: 0600 - path: /etc/audit/rules.d/43-module-load.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/43-module-load.rules -## These rules watch for kernel module insertion. By monitoring -## the syscall, we do not need any watches on programs. --a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b32 -S delete_module -F key=module-unload --a always,exit -F arch=b64 -S delete_module -F key=module-unload -EOF - -chmod o-rwx /etc/audit/rules.d/43-module-load.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/43-module-load.rules according to policy copy: dest: /etc/audit/rules.d/43-module-load.rules @@ -172323,6 +172448,41 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20These%20rules%20watch%20for%20kernel%20module%20insertion.%20By%20monitoring%0A%23%23%20the%20syscall%2C%20we%20do%20not%20need%20any%20watches%20on%20programs.%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20init_module%2Cfinit_module%20-F%20key%3Dmodule-load%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20delete_module%20-F%20key%3Dmodule-unload%0A + mode: 0600 + path: /etc/audit/rules.d/43-module-load.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/43-module-load.rules +## These rules watch for kernel module insertion. By monitoring +## the syscall, we do not need any watches on programs. +-a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b32 -S delete_module -F key=module-unload +-a always,exit -F arch=b64 -S delete_module -F key=module-unload +EOF + +chmod o-rwx /etc/audit/rules.d/43-module-load.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172440,119 +172600,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000304-GPOS-00121 Auditing of events listed in the description provides data for monitoring and investigation of potentially malicious events e.g. tampering with Audit logs, malicious access to files storing information about system users and groups etc. CCE-82373-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%23%20The%20purpose%20of%20these%20rules%20is%20to%20meet%20the%20requirements%20for%20Operating%0A%23%23%20System%20Protection%20Profile%20%28OSPP%29v4.2.%20These%20rules%20depends%20on%20having%0A%23%23%20the%20following%20rule%20files%20copied%20to%20%2Fetc%2Faudit%2Frules.d%3A%0A%23%23%0A%23%23%2010-base-config.rules%2C%2011-loginuid.rules%2C%0A%23%23%2030-ospp-v42-1-create-failed.rules%2C%2030-ospp-v42-1-create-success.rules%2C%0A%23%23%2030-ospp-v42-2-modify-failed.rules%2C%2030-ospp-v42-2-modify-success.rules%2C%0A%23%23%2030-ospp-v42-3-access-failed.rules%2C%2030-ospp-v42-3-access-success.rules%2C%0A%23%23%2030-ospp-v42-4-delete-failed.rules%2C%2030-ospp-v42-4-delete-success.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-failed.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-success.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-failed.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-success.rules%0A%23%23%0A%23%23%20original%20copies%20may%20be%20found%20in%20%2Fusr%2Fshare%2Faudit%2Fsample-rules%2F%0A%0A%0A%23%23%20User%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20passwd%20and%0A%23%23%20shadow%20for%20writes%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A%0A%23%23%20User%20enable%20and%20disable.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Group%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20group%20and%0A%23%23%20gshadow%20for%20writes%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgroup%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A%0A%0A%23%23%20Use%20of%20special%20rights%20for%20config%20changes.%20This%20would%20be%20use%20of%20setuid%0A%23%23%20programs%20that%20relate%20to%20user%20accts.%20This%20is%20not%20all%20setuid%20apps%20because%0A%23%23%20requirements%20are%20only%20for%20ones%20that%20affect%20system%20configuration.%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Funix_chkpwd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fusernetctl%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fuserhelper%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fseunshare%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fmount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgrp%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewuidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fgpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fumount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fcrontab%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fat%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Privilege%20escalation%20via%20su%20or%20sudo.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Watch%20for%20configuration%20changes%20to%20privilege%20escalation.%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fsudoers%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fsudoers.d%2F%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Audit%20log%20access%0A-a%20always%2Cexit%20-F%20dir%3D%2Fvar%2Flog%2Faudit%2F%20-F%20perm%3Dr%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Daccess-audit-trail%0A%23%23%20Attempts%20to%20Alter%20Process%20and%20Session%20Initiation%20Information%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Frun%2Futmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fbtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fwtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A%0A%23%23%20Attempts%20to%20modify%20MAC%20controls%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fselinux%2F%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3DMAC-policy%0A%0A%23%23%20Software%20updates.%20This%20is%20entirely%20handled%20by%20rpm.%0A%0A%23%23%20System%20start%20and%20shutdown.%20This%20is%20entirely%20handled%20by%20systemd%0A%0A%23%23%20Kernel%20Module%20loading.%20This%20is%20handled%20in%2043-module-load.rules%0A%0A%23%23%20Application%20invocation.%20The%20requirements%20list%20an%20optional%20requirement%0A%23%23%20FPT_SRP_EXT.1%20Software%20Restriction%20Policies.%20This%20event%20is%20intended%20to%0A%23%23%20state%20results%20from%20that%20policy.%20This%20would%20be%20handled%20entirely%20by%0A%23%23%20that%20daemon.%0A%0A - mode: 0600 - path: /etc/audit/rules.d/30-ospp-v42.rules - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42.rules -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## the following rule files copied to /etc/audit/rules.d: -## -## 10-base-config.rules, 11-loginuid.rules, -## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, -## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, -## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, -## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, -## 30-ospp-v42-5-perm-change-failed.rules, -## 30-ospp-v42-5-perm-change-success.rules, -## 30-ospp-v42-6-owner-change-failed.rules, -## 30-ospp-v42-6-owner-change-success.rules -## -## original copies may be found in /usr/share/audit/sample-rules/ - - -## User add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch passwd and -## shadow for writes --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - -## User enable and disable. This is entirely handled by pam. - -## Group add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch group and -## gshadow for writes --a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify --a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify - - -## Use of special rights for config changes. This would be use of setuid -## programs that relate to user accts. This is not all setuid apps because -## requirements are only for ones that affect system configuration. --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes - -## Privilege escalation via su or sudo. This is entirely handled by pam. - -## Watch for configuration changes to privilege escalation. --a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes --a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes - -## Audit log access --a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail -## Attempts to Alter Process and Session Initiation Information --a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session - -## Attempts to modify MAC controls --a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy - -## Software updates. This is entirely handled by rpm. - -## System start and shutdown. This is entirely handled by systemd - -## Kernel Module loading. This is handled in 43-module-load.rules - -## Application invocation. The requirements list an optional requirement -## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to -## state results from that policy. This would be handled entirely by -## that daemon. - -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42.rules according to policy copy: dest: /etc/audit/rules.d/30-ospp-v42.rules @@ -172667,6 +172714,119 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%23%20The%20purpose%20of%20these%20rules%20is%20to%20meet%20the%20requirements%20for%20Operating%0A%23%23%20System%20Protection%20Profile%20%28OSPP%29v4.2.%20These%20rules%20depends%20on%20having%0A%23%23%20the%20following%20rule%20files%20copied%20to%20%2Fetc%2Faudit%2Frules.d%3A%0A%23%23%0A%23%23%2010-base-config.rules%2C%2011-loginuid.rules%2C%0A%23%23%2030-ospp-v42-1-create-failed.rules%2C%2030-ospp-v42-1-create-success.rules%2C%0A%23%23%2030-ospp-v42-2-modify-failed.rules%2C%2030-ospp-v42-2-modify-success.rules%2C%0A%23%23%2030-ospp-v42-3-access-failed.rules%2C%2030-ospp-v42-3-access-success.rules%2C%0A%23%23%2030-ospp-v42-4-delete-failed.rules%2C%2030-ospp-v42-4-delete-success.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-failed.rules%2C%0A%23%23%2030-ospp-v42-5-perm-change-success.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-failed.rules%2C%0A%23%23%2030-ospp-v42-6-owner-change-success.rules%0A%23%23%0A%23%23%20original%20copies%20may%20be%20found%20in%20%2Fusr%2Fshare%2Faudit%2Fsample-rules%2F%0A%0A%0A%23%23%20User%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20passwd%20and%0A%23%23%20shadow%20for%20writes%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20openat%2Copen_by_handle_at%20-F%20a2%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db32%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20arch%3Db64%20-S%20open%20-F%20a1%2603%20-F%20path%3D%2Fetc%2Fshadow%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A%0A%23%23%20User%20enable%20and%20disable.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Group%20add%20delete%20modify.%20This%20is%20covered%20by%20pam.%20However%2C%20someone%20could%0A%23%23%20open%20a%20file%20and%20directly%20create%20or%20modify%20a%20user%2C%20so%20we%27ll%20watch%20group%20and%0A%23%23%20gshadow%20for%20writes%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fpasswd%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Duser-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgroup%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fgshadow%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dgroup-modify%0A%0A%0A%23%23%20Use%20of%20special%20rights%20for%20config%20changes.%20This%20would%20be%20use%20of%20setuid%0A%23%23%20programs%20that%20relate%20to%20user%20accts.%20This%20is%20not%20all%20setuid%20apps%20because%0A%23%23%20requirements%20are%20only%20for%20ones%20that%20affect%20system%20configuration.%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Funix_chkpwd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fusernetctl%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fuserhelper%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fsbin%2Fseunshare%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fmount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgrp%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewuidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fgpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fnewgidmap%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fumount%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fpasswd%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fcrontab%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20path%3D%2Fusr%2Fbin%2Fat%20-F%20perm%3Dx%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Privilege%20escalation%20via%20su%20or%20sudo.%20This%20is%20entirely%20handled%20by%20pam.%0A%0A%23%23%20Watch%20for%20configuration%20changes%20to%20privilege%20escalation.%0A-a%20always%2Cexit%20-F%20path%3D%2Fetc%2Fsudoers%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fsudoers.d%2F%20-F%20perm%3Dwa%20-F%20key%3Dspecial-config-changes%0A%0A%23%23%20Audit%20log%20access%0A-a%20always%2Cexit%20-F%20dir%3D%2Fvar%2Flog%2Faudit%2F%20-F%20perm%3Dr%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Daccess-audit-trail%0A%23%23%20Attempts%20to%20Alter%20Process%20and%20Session%20Initiation%20Information%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Frun%2Futmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fbtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A-a%20always%2Cexit%20-F%20path%3D%2Fvar%2Flog%2Fwtmp%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3Dsession%0A%0A%23%23%20Attempts%20to%20modify%20MAC%20controls%0A-a%20always%2Cexit%20-F%20dir%3D%2Fetc%2Fselinux%2F%20-F%20perm%3Dwa%20-F%20auid%3E%3D1000%20-F%20auid%21%3Dunset%20-F%20key%3DMAC-policy%0A%0A%23%23%20Software%20updates.%20This%20is%20entirely%20handled%20by%20rpm.%0A%0A%23%23%20System%20start%20and%20shutdown.%20This%20is%20entirely%20handled%20by%20systemd%0A%0A%23%23%20Kernel%20Module%20loading.%20This%20is%20handled%20in%2043-module-load.rules%0A%0A%23%23%20Application%20invocation.%20The%20requirements%20list%20an%20optional%20requirement%0A%23%23%20FPT_SRP_EXT.1%20Software%20Restriction%20Policies.%20This%20event%20is%20intended%20to%0A%23%23%20state%20results%20from%20that%20policy.%20This%20would%20be%20handled%20entirely%20by%0A%23%23%20that%20daemon.%0A%0A + mode: 0600 + path: /etc/audit/rules.d/30-ospp-v42.rules + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42.rules +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## the following rule files copied to /etc/audit/rules.d: +## +## 10-base-config.rules, 11-loginuid.rules, +## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, +## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, +## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, +## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, +## 30-ospp-v42-5-perm-change-failed.rules, +## 30-ospp-v42-5-perm-change-success.rules, +## 30-ospp-v42-6-owner-change-failed.rules, +## 30-ospp-v42-6-owner-change-success.rules +## +## original copies may be found in /usr/share/audit/sample-rules/ + + +## User add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch passwd and +## shadow for writes +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify + +## User enable and disable. This is entirely handled by pam. + +## Group add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch group and +## gshadow for writes +-a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify +-a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify + + +## Use of special rights for config changes. This would be use of setuid +## programs that relate to user accts. This is not all setuid apps because +## requirements are only for ones that affect system configuration. +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes + +## Privilege escalation via su or sudo. This is entirely handled by pam. + +## Watch for configuration changes to privilege escalation. +-a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes +-a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes + +## Audit log access +-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail +## Attempts to Alter Process and Session Initiation Information +-a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session + +## Attempts to modify MAC controls +-a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy + +## Software updates. This is entirely handled by rpm. + +## System start and shutdown. This is entirely handled by systemd + +## Kernel Module loading. This is handled in 43-module-load.rules + +## Application invocation. The requirements list an optional requirement +## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to +## state results from that policy. This would be handled entirely by +## that daemon. + +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172701,25 +172861,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Unsuccessful attempts to change an ownership of files or directories might be signs of a malicious activity. Having such events audited helps in monitoring and investigation of such activities. CCE-82384-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules -## Unsuccessful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules according to policy copy: @@ -172756,6 +172897,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +## Unsuccessful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172788,23 +172948,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Auditing of successful ownership changes of files or directories helps in monitoring or investingating of activities performed on the system. CCE-82385-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules -## Successful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules according to policy copy: @@ -172839,6 +172982,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules +## Successful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172873,25 +173033,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Unsuccessful attempts to change permissions of files or directories might be signs of malicious activity. Having such events audited helps in monitoring and investigation of such activities. CCE-82837-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules -## Unsuccessful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules according to policy copy: @@ -172928,6 +173069,25 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules +## Unsuccessful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -172960,23 +173120,6 @@ Note: This rule uses a special set of Audit rules to comply with OSPP 4.2.1. You SRG-OS-000064-GPOS-00033 Auditing successful file or directory permission changes helps in monitoring and investigating of activities performed on the system. CCE-82383-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules -## Successful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change -EOF - -chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules - -augenrules --load - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Put contents into /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules according to policy copy: @@ -173011,6 +173154,23 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat << 'EOF' > /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules +## Successful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +EOF + +chmod o-rwx /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules + +augenrules --load + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173169,21 +173329,6 @@ also required to change the runtime configuration, run: or other services, weakening system security. CCE-86006-4 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common; then - -if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then - sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' "/etc/default/grub" -else - echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' -fi - -grubby --update-kernel=ALL --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173223,6 +173368,21 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common; then + +if grep -q '^GRUB_DISABLE_RECOVERY=.*' '/etc/default/grub' ; then + sed -i 's/GRUB_DISABLE_RECOVERY=.*/GRUB_DISABLE_RECOVERY=true/' "/etc/default/grub" +else + echo "GRUB_DISABLE_RECOVERY=true" >> '/etc/default/grub' +fi + +grubby --update-kernel=ALL --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173247,18 +173407,6 @@ Run the following command to update command line for already installed kernels:< hardware devices. CCE-83920-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=iommu=force --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "iommu=force" - - name: Gather the package facts package_facts: manager: auto @@ -173284,6 +173432,18 @@ append = "iommu=force" - reboot_required - restrict_strategy - unknown_severity + + [customizations.kernel] +append = "iommu=force" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=iommu=force --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173316,18 +173476,6 @@ be useful during boot time when other means of getting random data can be slow because there is not yet enough entropy in the system. CCE-83314-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=random.trust_cpu=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "random.trust_cpu=on" - - name: Gather the package facts package_facts: manager: auto @@ -173353,6 +173501,18 @@ append = "random.trust_cpu=on" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "random.trust_cpu=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=random.trust_cpu=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173387,22 +173547,6 @@ by the system or hypervisor. The L1TF vulnerability allows read access to any ph location that is cached in the L1 Data Cache. CCE-88123-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_l1tf_options='' - - - -grubby --update-kernel=ALL --args=l1tf=$var_l1tf_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "l1tf=" - - name: Gather the package facts package_facts: manager: auto @@ -173433,6 +173577,22 @@ append = "l1tf=[customizations.kernel] +append = "l1tf=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_l1tf_options='' + + + +grubby --update-kernel=ALL --args=l1tf=$var_l1tf_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173463,18 +173623,6 @@ Run the following command to update command line for already installed kernels:< trying to exploit a vulnerability such as Rowhammer. CCE-87098-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=mce=0 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "mce=0" - - name: Gather the package facts package_facts: manager: auto @@ -173500,6 +173648,18 @@ append = "mce=0" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "mce=0" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=mce=0 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173526,15 +173686,6 @@ Run the following command to update command line for already installed kernels: manipulation of data in the user space. CCE-87345-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=nosmap --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173560,6 +173711,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=nosmap --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173586,15 +173746,6 @@ Run the following command to update command line for already installed kernels: the kernel to unintentionally execute code in less privileged memory space. CCE-85989-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=nosmep --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -173620,6 +173771,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=nosmep --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173652,18 +173812,6 @@ against attempts to bypass kernel address space layout randomization (KASLR). CCE-82194-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=pti=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "pti=on" - - name: Gather the package facts package_facts: manager: auto @@ -173693,6 +173841,18 @@ append = "pti=on" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "pti=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=pti=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173730,22 +173890,6 @@ Run the following command to update command line for already installed kernels:< from the hardware number generators available in the system helps fill up the entropy pool. CCE-89567-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_rng_core_default_quality='' - - - -grubby --update-kernel=ALL --args=rng_core.default_quality=$var_rng_core_default_quality --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "rng_core.default_quality=" - - name: Gather the package facts package_facts: manager: auto @@ -173777,6 +173921,22 @@ append = "rng_core.default_quality=[customizations.kernel] +append = "rng_core.default_quality=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_rng_core_default_quality='' + + + +grubby --update-kernel=ALL --args=rng_core.default_quality=$var_rng_core_default_quality --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173810,18 +173970,6 @@ with unmerged caches the heap overflow would only affect the objects in the same Overall, this reduces the kernel attack surface area by isolating slabs from each other. CCE-86777-0 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=slab_nomerge=yes --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "slab_nomerge=yes" - - name: Gather the package facts package_facts: manager: auto @@ -173847,6 +173995,18 @@ append = "slab_nomerge=yes" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "slab_nomerge=yes" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=slab_nomerge=yes --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173884,22 +174044,6 @@ attack. An example of this is reading memory to which the attacker does not dire for example inside the sandboxed code. CCE-89234-9 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_spec_store_bypass_disable_options='' - - - -grubby --update-kernel=ALL --args=spec_store_bypass_disable=$var_spec_store_bypass_disable_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "spec_store_bypass_disable=" - - name: Gather the package facts package_facts: manager: auto @@ -173931,6 +174075,22 @@ append = "spec_store_bypass_disable=[customizations.kernel] +append = "spec_store_bypass_disable=" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_spec_store_bypass_disable_options='' + + + +grubby --update-kernel=ALL --args=spec_store_bypass_disable=$var_spec_store_bypass_disable_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -173964,18 +174124,6 @@ Run the following command to update command line for already installed kernels:< access to. CCE-89345-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=spectre_v2=on --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "spectre_v2=on" - - name: Gather the package facts package_facts: manager: auto @@ -174001,6 +174149,18 @@ append = "spectre_v2=on" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "spectre_v2=on" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=spectre_v2=on --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174032,15 +174192,6 @@ Run the following command to update command line for already installed kernels: on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --remove-args=systemd.debug-shell --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174064,6 +174215,15 @@ fi - medium_severity - reboot_required - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --remove-args=systemd.debug-shell --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174094,18 +174254,6 @@ Run the following command to update command line for already installed kernels:< of the return instruction pointer. CCE-80946-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -grubby --update-kernel=ALL --args=vsyscall=none --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "vsyscall=none" - - name: Gather the package facts package_facts: manager: auto @@ -174135,6 +174283,18 @@ append = "vsyscall=none" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "vsyscall=none" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +grubby --update-kernel=ALL --args=vsyscall=none --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174219,15 +174379,6 @@ To properly set the group owner of /boot/grub2/grub.cfg, file should not have any access privileges anyway. CCE-80800-6 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174292,6 +174443,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174372,15 +174532,6 @@ file should not have any access privileges anyway. Non-root users who read the b may be able to identify weaknesses in security upon boot and be able to exploit them. CCE-86009-8 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174445,6 +174596,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174524,15 +174684,6 @@ To properly set the owner of /boot/grub2/grub.cfg, run th Only root should be able to modify important boot parameters. CCE-80805-5 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174597,6 +174748,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174676,15 +174836,6 @@ the boot parameters may be able to identify weaknesses in security upon boot and exploit them. CCE-86015-5 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174749,6 +174900,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174824,15 +174984,6 @@ To properly set the permissions of /boot/grub2/grub.cfg, parameters. CCE-80814-7 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-xs,g-xwrs,o-xwrt /boot/grub2/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -174891,6 +175042,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-xs,g-xwrs,o-xwrt /boot/grub2/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -174966,15 +175126,6 @@ To properly set the permissions of /boot/grub2/user.cfg, parameters. CCE-86024-7 - # Remediation is applicable only in certain platforms -if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-xs,g-xwrs,o-xwrt /boot/grub2/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175033,6 +175184,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-xs,g-xwrs,o-xwrt /boot/grub2/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175389,15 +175549,6 @@ To properly set the group owner of /boot/efi/EFI/redhat/grub.cfg CCE-85915-7 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175459,6 +175610,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175526,15 +175686,6 @@ file should not have any access privileges anyway. Non-root users who read the b may be able to identify weaknesses in security upon boot and be able to exploit them. CCE-86012-2 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chgrp 0 /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175596,6 +175747,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chgrp 0 /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175662,15 +175822,6 @@ To properly set the owner of /boot/efi/EFI/redhat/grub.cfgOnly root should be able to modify important boot parameters. CCE-85913-2 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175732,6 +175883,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175799,15 +175959,6 @@ the boot parameters may be able to identify weaknesses in security upon boot and exploit them. CCE-86021-3 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chown 0 /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175869,6 +176020,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chown 0 /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -175932,15 +176092,6 @@ To properly set the permissions of /boot/efi/EFI/redhat/grub.cfg CCE-85912-4 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/grub.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -175996,6 +176147,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/grub.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176059,15 +176219,6 @@ To properly set the permissions of /boot/efi/EFI/redhat/user.cfg CCE-86028-8 - # Remediation is applicable only in certain platforms -if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/user.cfg - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -176123,6 +176274,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ -d /sys/firmware/efi ] && rpm --quiet -q grub2-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +chmod u-s,g-xwrs,o-xwrt /boot/efi/EFI/redhat/user.cfg + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176411,24 +176571,6 @@ this for all processes which launch after it does, adding the kernel argument ensures it is set for every process during boot. CCE-83321-0 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="audit=1" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "audit=1" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?audit=1(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 audit=1/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain audit=1 block: @@ -176488,6 +176630,24 @@ fi - medium_severity - reboot_required - zipl_audit_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="audit=1" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "audit=1" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?audit=1(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 audit=1/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176511,24 +176671,6 @@ are stored in this queue. If the queue is overrun during boot process, the acti defined by audit failure flag is taken. CCE-83341-8 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="audit_backlog_limit=8192" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "audit_backlog_limit=8192" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?audit_backlog_limit=8192(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 audit_backlog_limit=8192/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain audit_backlog_limit=8192 block: @@ -176588,6 +176730,24 @@ fi - medium_severity - reboot_required - zipl_audit_backlog_limit_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="audit_backlog_limit=8192" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "audit_backlog_limit=8192" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?audit_backlog_limit=8192(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 audit_backlog_limit=8192/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176623,15 +176783,6 @@ Run zipl command to generate an updated /boot/ boot correct kernel and options. CCE-83486-1 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -/usr/sbin/zipl - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure zIPL bootmap is up to date block: @@ -176661,6 +176812,15 @@ fi - medium_severity - no_reboot_needed - zipl_bootmap_is_up_to_date + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +/usr/sbin/zipl + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176696,24 +176856,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-83351-7 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="page_poison=1" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "page_poison=1" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?page_poison=1(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 page_poison=1/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain page_poison=1 block: @@ -176773,6 +176915,24 @@ fi - medium_severity - reboot_required - zipl_page_poison_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="page_poison=1" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "page_poison=1" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?page_poison=1(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 page_poison=1/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176795,24 +176955,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-83371-5 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="slub_debug=P" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "slub_debug=P" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?slub_debug=P(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 slub_debug=P/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain slub_debug=P block: @@ -176872,6 +177014,24 @@ fi - medium_severity - reboot_required - zipl_slub_debug_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="slub_debug=P" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "slub_debug=P" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?slub_debug=P(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 slub_debug=P/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176903,21 +177063,6 @@ that systemd.debug-shell=1 is not present in / on the machine through valid troubleshooting configurations and gaining root access when the system is rebooted. - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --remove-args="systemd.debug-shell" - -# Ensure new kernels and boot entries retain the boot option -if grep -q '\bsystemd.debug-shell\b' /etc/kernel/cmdline; then - sed -Ei 's/^(.*)\s*systemd.debug-shell\b\S*(.*)/\1\2/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain systemd.debug-shell block: @@ -176962,6 +177107,21 @@ fi - medium_severity - reboot_required - zipl_systemd_debug-shell_argument_absent + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --remove-args="systemd.debug-shell" + +# Ensure new kernels and boot entries retain the boot option +if grep -q '\bsystemd.debug-shell\b' /etc/kernel/cmdline; then + sed -Ei 's/^(.*)\s*systemd.debug-shell\b\S*(.*)/\1\2/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -176982,24 +177142,6 @@ add vsyscall=none to /etc/kernel/cmdline CCE-83381-4 - # Remediation is applicable only in certain platforms -if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# Correct BLS option using grubby, which is a thin wrapper around BLS operations -grubby --update-kernel=ALL --args="vsyscall=none" - -# Ensure new kernels and boot entries retain the boot option -if [ ! -f /etc/kernel/cmdline ]; then - echo "vsyscall=none" > /etc/kernel/cmdline -elif ! grep -q '^(.*\s)?vsyscall=none(\s.*)?$' /etc/kernel/cmdline; then - - sed -Ei 's/^(.*)$/\1 vsyscall=none/' /etc/kernel/cmdline -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure BLS boot entries options contain vsyscall=none block: @@ -177059,6 +177201,24 @@ fi - medium_severity - reboot_required - zipl_vsyscall_argument + + # Remediation is applicable only in certain platforms +if grep -q s390x /proc/sys/kernel/osrelease && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# Correct BLS option using grubby, which is a thin wrapper around BLS operations +grubby --update-kernel=ALL --args="vsyscall=none" + +# Ensure new kernels and boot entries retain the boot option +if [ ! -f /etc/kernel/cmdline ]; then + echo "vsyscall=none" > /etc/kernel/cmdline +elif ! grep -q '^(.*\s)?vsyscall=none(\s.*)?$' /etc/kernel/cmdline; then + + sed -Ei 's/^(.*)$/\1 vsyscall=none/' /etc/kernel/cmdline +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -178703,8 +178863,25 @@ $ sudo yum install rsyslog-gnutls The rsyslog-gnutls package provides Transport Layer Security (TLS) support for the rsyslog daemon, which enables secure remote logging. CCE-82859-0 - -package --add=rsyslog-gnutls + - name: Ensure rsyslog-gnutls is installed + package: + name: rsyslog-gnutls + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82859-0 + - DISA-STIG-RHEL-08-030680 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsyslog-gnutls_installed + + +[[packages]] +name = "rsyslog-gnutls" +version = "*" include install_rsyslog-gnutls @@ -178713,6 +178890,9 @@ class install_rsyslog-gnutls { ensure => 'installed', } } + + +package --add=rsyslog-gnutls # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -178724,26 +178904,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rsyslog-gnutls" -version = "*" - - - name: Ensure rsyslog-gnutls is installed - package: - name: rsyslog-gnutls - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82859-0 - - DISA-STIG-RHEL-08-030680 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsyslog-gnutls_installed @@ -178794,13 +178954,31 @@ version = "*" SRG-OS-000051-GPOS-00024 SRG-OS-000480-GPOS-00227 RHEL-08-030670 - 4.2.1.1 + 5.1.1.1 SV-230477r627750_rule The rsyslog package provides the rsyslog daemon, which provides system logging services. CCE-80847-7 - -package --add=rsyslog + - name: Ensure rsyslog is installed + package: + name: rsyslog + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80847-7 + - DISA-STIG-RHEL-08-030670 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsyslog_installed + + +[[packages]] +name = "rsyslog" +version = "*" include install_rsyslog @@ -178809,6 +178987,9 @@ class install_rsyslog { ensure => 'installed', } } + + +package --add=rsyslog # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -178820,27 +179001,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "rsyslog" -version = "*" - - - name: Ensure rsyslog is installed - package: - name: rsyslog - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80847-7 - - DISA-STIG-RHEL-08-030670 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsyslog_installed @@ -178930,36 +179090,11 @@ The rsyslog service can be enabled with the following com PR.PT-1 SRG-OS-000480-GPOS-00227 RHEL-08-010561 - 4.2.1.2 + 5.1.1.2 SV-230298r627750_rule The rsyslog service must be running in order to provide logging services, which are essential to system administration. CCE-80886-5 - include enable_rsyslog - -class enable_rsyslog { - service {'rsyslog': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'rsyslog.service' -"$SYSTEMCTL_EXEC" start 'rsyslog.service' -"$SYSTEMCTL_EXEC" enable 'rsyslog.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["rsyslog"] - - name: Enable service rsyslog block: @@ -178987,6 +179122,31 @@ enabled = ["rsyslog"] - medium_severity - no_reboot_needed - service_rsyslog_enabled + + +[customizations.services] +enabled = ["rsyslog"] + + include enable_rsyslog + +class enable_rsyslog { + service {'rsyslog': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'rsyslog.service' +"$SYSTEMCTL_EXEC" start 'rsyslog.service' +"$SYSTEMCTL_EXEC" enable 'rsyslog.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179011,42 +179171,10 @@ easier and less time-intensive for administrators. rsyslog will create logfiles that do not already exist on the system. This settings controls what permissions will be applied to these newly created files. - 4.2.1.4 + 5.1.1.4 It is important to ensure that log files have the correct permissions to ensure that sensitive data is archived and protected. CCE-88321-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -readarray -t targets < <(grep -H '^\s*$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*) - -# if $FileCreateMode set in multiple places -if [ ${#targets[@]} -gt 1 ]; then - # delete all and create new entry with expected value - sed -i '/^\s*$FileCreateMode/d' /etc/rsyslog.conf /etc/rsyslog.d/* - echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf -# if $FileCreateMode set in only one place -elif [ "${#targets[@]}" -eq 1 ]; then - filename=$(echo "${targets[0]}" | cut -d':' -f1) - value=$(echo "${targets[0]}" | cut -d' ' -f2) - #convert to decimal and bitwise or operation - result=$((8#$value | 416)) - # if more permissive than expected, then set it to 0640 - if [ $result -ne 416 ]; then - # if value is wrong remove it - sed -i '/^\s*$FileCreateMode/d' $filename - echo '$FileCreateMode 0640' > $filename - fi -else - echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf -fi - -systemctl restart rsyslog.service - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure rsyslog Default File Permissions Configured - Search for $FileCreateMode Parameter in rsyslog Main Config File ansible.builtin.find: @@ -179155,6 +179283,38 @@ fi - medium_severity - no_reboot_needed - rsyslog_filecreatemode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +readarray -t targets < <(grep -H '^\s*$FileCreateMode' /etc/rsyslog.conf /etc/rsyslog.d/*) + +# if $FileCreateMode set in multiple places +if [ ${#targets[@]} -gt 1 ]; then + # delete all and create new entry with expected value + sed -i '/^\s*$FileCreateMode/d' /etc/rsyslog.conf /etc/rsyslog.d/* + echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf +# if $FileCreateMode set in only one place +elif [ "${#targets[@]}" -eq 1 ]; then + filename=$(echo "${targets[0]}" | cut -d':' -f1) + value=$(echo "${targets[0]}" | cut -d' ' -f2) + #convert to decimal and bitwise or operation + result=$((8#$value | 416)) + # if more permissive than expected, then set it to 0640 + if [ $result -ne 416 ]; then + # if value is wrong remove it + sed -i '/^\s*$FileCreateMode/d' $filename + echo '$FileCreateMode 0640' > $filename + fi +else + echo '$FileCreateMode 0640' > /etc/rsyslog.d/99-rsyslog_filecreatemode.conf +fi + +systemctl restart rsyslog.service + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179323,30 +179483,6 @@ When using rsyslogd to off-load logs the remote system mu configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-86339-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -sed -i '/^.*\$ActionSendStreamDriverAuthMode.*/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2> /dev/null - -if [ -e "/etc/rsyslog.d/stream_driver_auth.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverAuthMode /Id" "/etc/rsyslog.d/stream_driver_auth.conf" -else - touch "/etc/rsyslog.d/stream_driver_auth.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/stream_driver_auth.conf" - -cp "/etc/rsyslog.d/stream_driver_auth.conf" "/etc/rsyslog.d/stream_driver_auth.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$ActionSendStreamDriverAuthMode x509/name" >> "/etc/rsyslog.d/stream_driver_auth.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/stream_driver_auth.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Authenticates Off-Loaded Audit Records block: @@ -179398,6 +179534,30 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_actionsendstreamdriverauthmode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sed -i '/^.*\$ActionSendStreamDriverAuthMode.*/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf 2> /dev/null + +if [ -e "/etc/rsyslog.d/stream_driver_auth.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverAuthMode /Id" "/etc/rsyslog.d/stream_driver_auth.conf" +else + touch "/etc/rsyslog.d/stream_driver_auth.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/stream_driver_auth.conf" + +cp "/etc/rsyslog.d/stream_driver_auth.conf" "/etc/rsyslog.d/stream_driver_auth.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$ActionSendStreamDriverAuthMode x509/name" >> "/etc/rsyslog.d/stream_driver_auth.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/stream_driver_auth.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179425,28 +179585,6 @@ When using rsyslogd to off-load logs off a encrpytion sys configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-86098-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverMode /Id" "/etc/rsyslog.d/encrypt.conf" -else - touch "/etc/rsyslog.d/encrypt.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" - -cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$ActionSendStreamDriverMode 1" >> "/etc/rsyslog.d/encrypt.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/encrypt.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Encrypts Off-Loaded Audit Records block: @@ -179498,6 +179636,28 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_actionsendstreamdrivermode + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$ActionSendStreamDriverMode /Id" "/etc/rsyslog.d/encrypt.conf" +else + touch "/etc/rsyslog.d/encrypt.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" + +cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$ActionSendStreamDriverMode 1" >> "/etc/rsyslog.d/encrypt.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/encrypt.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179525,28 +179685,6 @@ When using rsyslogd to off-load logs off an encryption sy configuration, user authentication, and other such information. Audit records should be protected from unauthorized access. CCE-85992-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then - - LC_ALL=C sed -i "/^\s*\$DefaultNetstreamDriver /Id" "/etc/rsyslog.d/encrypt.conf" -else - touch "/etc/rsyslog.d/encrypt.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" - -cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" -# Insert at the end of the file -printf '%s\n' "\$DefaultNetstreamDriver gtls" >> "/etc/rsyslog.d/encrypt.conf" -# Clean up after ourselves. -rm "/etc/rsyslog.d/encrypt.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Rsyslog Encrypts Off-Loaded Audit Records block: @@ -179598,6 +179736,28 @@ fi - medium_severity - no_reboot_needed - rsyslog_encrypt_offload_defaultnetstreamdriver + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/rsyslog.d/encrypt.conf" ] ; then + + LC_ALL=C sed -i "/^\s*\$DefaultNetstreamDriver /Id" "/etc/rsyslog.d/encrypt.conf" +else + touch "/etc/rsyslog.d/encrypt.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/rsyslog.d/encrypt.conf" + +cp "/etc/rsyslog.d/encrypt.conf" "/etc/rsyslog.d/encrypt.conf.bak" +# Insert at the end of the file +printf '%s\n' "\$DefaultNetstreamDriver gtls" >> "/etc/rsyslog.d/encrypt.conf" +# Clean up after ourselves. +rm "/etc/rsyslog.d/encrypt.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -179678,113 +179838,11 @@ correct this: Req-10.5.1 Req-10.5.2 10.3.2 + 5.1.4 The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access. CCE-80860-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# List of log file paths to be inspected for correct permissions -# * Primarily inspect log file paths listed in /etc/rsyslog.conf -RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" -# * And also the log file paths listed after rsyslog's $IncludeConfig directive -# (store the result into array for the case there's shell glob used as value of IncludeConfig) -readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) -readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) -readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') -readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) - -# Declare an array to hold the final list of different log file paths -declare -a LOG_FILE_PATHS - -# Array to hold all rsyslog config entries -RSYSLOG_CONFIGS=() -RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") - -# Get full list of files to be checked -# RSYSLOG_CONFIGS may contain globs such as -# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule -# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. -RSYSLOG_CONFIG_FILES=() -for ENTRY in "${RSYSLOG_CONFIGS[@]}" -do - # If directory, rsyslog will search for config files in recursively. - # However, files in hidden sub-directories or hidden files will be ignored. - if [ -d "${ENTRY}" ] - then - readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) - RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") - elif [ -f "${ENTRY}" ] - then - RSYSLOG_CONFIG_FILES+=("${ENTRY}") - else - echo "Invalid include object: ${ENTRY}" - fi -done - -# Browse each file selected above as containing paths of log files -# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - # From each of these files extract just particular log file path(s), thus: - # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, - # * Ignore empty lines, - # * Strip quotes and closing brackets from paths. - # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files - # * From the remaining valid rows select only fields constituting a log file path - # Text file column is understood to represent a log file path if and only if all of the - # following are met: - # * it contains at least one slash '/' character, - # * it is preceded by space - # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters - # Search log file for path(s) only in case it exists! - if [[ -f "${LOG_FILE}" ]] - then - NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") - LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") - FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") - CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") - MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") - # Since above sed command might return more than one item (delimited by newline), split - # the particular matches entries into new array specific for this log file - readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" - # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with - # items from newly created array for this log file - LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") - # Delete the temporary array - unset ARRAY_FOR_LOG_FILE - fi -done - -# Check for RainerScript action log format which might be also multiline so grep regex is a bit -# curly: -# extract possibly multiline action omfile expressions -# extract File="logfile" expression -# match only "logfile" expression -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") - OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") - LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") -done - -# Ensure the correct attribute if file exists -FILE_CMD="chgrp" -for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" -do - # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing - if [ -z "$LOG_FILE_PATH" ] - then - continue - fi - $FILE_CMD "root" "$LOG_FILE_PATH" -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Log Files Are Owned By Appropriate Group - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -179988,6 +180046,109 @@ fi - medium_severity - no_reboot_needed - rsyslog_files_groupownership + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# List of log file paths to be inspected for correct permissions +# * Primarily inspect log file paths listed in /etc/rsyslog.conf +RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" +# * And also the log file paths listed after rsyslog's $IncludeConfig directive +# (store the result into array for the case there's shell glob used as value of IncludeConfig) +readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) +readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) +readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') +readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) + +# Declare an array to hold the final list of different log file paths +declare -a LOG_FILE_PATHS + +# Array to hold all rsyslog config entries +RSYSLOG_CONFIGS=() +RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") + +# Get full list of files to be checked +# RSYSLOG_CONFIGS may contain globs such as +# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule +# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. +RSYSLOG_CONFIG_FILES=() +for ENTRY in "${RSYSLOG_CONFIGS[@]}" +do + # If directory, rsyslog will search for config files in recursively. + # However, files in hidden sub-directories or hidden files will be ignored. + if [ -d "${ENTRY}" ] + then + readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) + RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") + elif [ -f "${ENTRY}" ] + then + RSYSLOG_CONFIG_FILES+=("${ENTRY}") + else + echo "Invalid include object: ${ENTRY}" + fi +done + +# Browse each file selected above as containing paths of log files +# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + # From each of these files extract just particular log file path(s), thus: + # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, + # * Ignore empty lines, + # * Strip quotes and closing brackets from paths. + # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files + # * From the remaining valid rows select only fields constituting a log file path + # Text file column is understood to represent a log file path if and only if all of the + # following are met: + # * it contains at least one slash '/' character, + # * it is preceded by space + # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters + # Search log file for path(s) only in case it exists! + if [[ -f "${LOG_FILE}" ]] + then + NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") + LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") + FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") + CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") + MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") + # Since above sed command might return more than one item (delimited by newline), split + # the particular matches entries into new array specific for this log file + readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" + # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with + # items from newly created array for this log file + LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") + # Delete the temporary array + unset ARRAY_FOR_LOG_FILE + fi +done + +# Check for RainerScript action log format which might be also multiline so grep regex is a bit +# curly: +# extract possibly multiline action omfile expressions +# extract File="logfile" expression +# match only "logfile" expression +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") + OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") + LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") +done + +# Ensure the correct attribute if file exists +FILE_CMD="chgrp" +for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" +do + # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing + if [ -z "$LOG_FILE_PATH" ] + then + continue + fi + $FILE_CMD "root" "$LOG_FILE_PATH" +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180075,113 +180236,11 @@ correct this: Req-10.5.1 Req-10.5.2 10.3.2 + 5.1.4 The log files generated by rsyslog contain valuable information regarding system configuration, user authentication, and other such information. Log files should be protected from unauthorized access. CCE-80861-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# List of log file paths to be inspected for correct permissions -# * Primarily inspect log file paths listed in /etc/rsyslog.conf -RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" -# * And also the log file paths listed after rsyslog's $IncludeConfig directive -# (store the result into array for the case there's shell glob used as value of IncludeConfig) -readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) -readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) -readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') -readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) - -# Declare an array to hold the final list of different log file paths -declare -a LOG_FILE_PATHS - -# Array to hold all rsyslog config entries -RSYSLOG_CONFIGS=() -RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") - -# Get full list of files to be checked -# RSYSLOG_CONFIGS may contain globs such as -# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule -# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. -RSYSLOG_CONFIG_FILES=() -for ENTRY in "${RSYSLOG_CONFIGS[@]}" -do - # If directory, rsyslog will search for config files in recursively. - # However, files in hidden sub-directories or hidden files will be ignored. - if [ -d "${ENTRY}" ] - then - readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) - RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") - elif [ -f "${ENTRY}" ] - then - RSYSLOG_CONFIG_FILES+=("${ENTRY}") - else - echo "Invalid include object: ${ENTRY}" - fi -done - -# Browse each file selected above as containing paths of log files -# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - # From each of these files extract just particular log file path(s), thus: - # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, - # * Ignore empty lines, - # * Strip quotes and closing brackets from paths. - # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files - # * From the remaining valid rows select only fields constituting a log file path - # Text file column is understood to represent a log file path if and only if all of the - # following are met: - # * it contains at least one slash '/' character, - # * it is preceded by space - # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters - # Search log file for path(s) only in case it exists! - if [[ -f "${LOG_FILE}" ]] - then - NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") - LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") - FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") - CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") - MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") - # Since above sed command might return more than one item (delimited by newline), split - # the particular matches entries into new array specific for this log file - readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" - # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with - # items from newly created array for this log file - LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") - # Delete the temporary array - unset ARRAY_FOR_LOG_FILE - fi -done - -# Check for RainerScript action log format which might be also multiline so grep regex is a bit -# curly: -# extract possibly multiline action omfile expressions -# extract File="logfile" expression -# match only "logfile" expression -for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" -do - ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") - OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") - LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") -done - -# Ensure the correct attribute if file exists -FILE_CMD="chown" -for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" -do - # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing - if [ -z "$LOG_FILE_PATH" ] - then - continue - fi - $FILE_CMD "root" "$LOG_FILE_PATH" -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure Log Files Are Owned By Appropriate User - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -180386,49 +180445,7 @@ fi - no_reboot_needed - rsyslog_files_ownership - - - - - - - - - Ensure System Log Files Have Correct Permissions - The file permissions for all log files written by rsyslog should -be set to 640, or more restrictive. These log files are determined by the -second part of each Rule line in /etc/rsyslog.conf and typically -all appear in /var/log. For each log file LOGFILE -referenced in /etc/rsyslog.conf, run the following command to -inspect the file's permissions: -$ ls -l LOGFILE -If the permissions are not 640 or more restrictive, run the following -command to correct this: -$ sudo chmod 640 LOGFILE" - BP28(R36) - CCI-001314 - 0988 - 1405 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-6(a) - AC-6(1) - Req-10.5.1 - Req-10.5.2 - 10.3.1 - 4.2.3 - Log files can contain valuable information regarding system -configuration. If the system log files are not protected unauthorized -users could change the logged data, eliminating their forensic value. - CCE-80862-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then # List of log file paths to be inspected for correct permissions @@ -180516,7 +180533,7 @@ do done # Ensure the correct attribute if file exists -FILE_CMD="chmod" +FILE_CMD="chown" for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" do # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing @@ -180524,13 +180541,55 @@ do then continue fi - $FILE_CMD "0640" "$LOG_FILE_PATH" + $FILE_CMD "root" "$LOG_FILE_PATH" done else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure System Log Files Have Correct Permissions + The file permissions for all log files written by rsyslog should +be set to 640, or more restrictive. These log files are determined by the +second part of each Rule line in /etc/rsyslog.conf and typically +all appear in /var/log. For each log file LOGFILE +referenced in /etc/rsyslog.conf, run the following command to +inspect the file's permissions: +$ ls -l LOGFILE +If the permissions are not 640 or more restrictive, run the following +command to correct this: +$ sudo chmod 640 LOGFILE" + BP28(R36) + CCI-001314 + 0988 + 1405 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-6(a) + AC-6(1) + Req-10.5.1 + Req-10.5.2 + 10.3.1 + 5.1.4 + Log files can contain valuable information regarding system +configuration. If the system log files are not protected unauthorized +users could change the logged data, eliminating their forensic value. + CCE-80862-6 - name: Ensure System Log Files Have Correct Permissions - Set rsyslog logfile configuration facts ansible.builtin.set_fact: @@ -180734,6 +180793,109 @@ fi - medium_severity - no_reboot_needed - rsyslog_files_permissions + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# List of log file paths to be inspected for correct permissions +# * Primarily inspect log file paths listed in /etc/rsyslog.conf +RSYSLOG_ETC_CONFIG="/etc/rsyslog.conf" +# * And also the log file paths listed after rsyslog's $IncludeConfig directive +# (store the result into array for the case there's shell glob used as value of IncludeConfig) +readarray -t OLD_INC < <(grep -e "\$IncludeConfig[[:space:]]\+[^[:space:];]\+" /etc/rsyslog.conf | cut -d ' ' -f 2) +readarray -t RSYSLOG_INCLUDE_CONFIG < <(for INCPATH in "${OLD_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) +readarray -t NEW_INC < <(sed -n '/^\s*include(/,/)/Ip' /etc/rsyslog.conf | sed -n 's@.*file\s*=\s*"\([/[:alnum:][:punct:]]*\)".*@\1@Ip') +readarray -t RSYSLOG_INCLUDE < <(for INCPATH in "${NEW_INC[@]}"; do eval printf '%s\\n' "${INCPATH}"; done) + +# Declare an array to hold the final list of different log file paths +declare -a LOG_FILE_PATHS + +# Array to hold all rsyslog config entries +RSYSLOG_CONFIGS=() +RSYSLOG_CONFIGS=("${RSYSLOG_ETC_CONFIG}" "${RSYSLOG_INCLUDE_CONFIG[@]}" "${RSYSLOG_INCLUDE[@]}") + +# Get full list of files to be checked +# RSYSLOG_CONFIGS may contain globs such as +# /etc/rsyslog.d/*.conf /etc/rsyslog.d/*.frule +# So, loop over the entries in RSYSLOG_CONFIGS and use find to get the list of included files. +RSYSLOG_CONFIG_FILES=() +for ENTRY in "${RSYSLOG_CONFIGS[@]}" +do + # If directory, rsyslog will search for config files in recursively. + # However, files in hidden sub-directories or hidden files will be ignored. + if [ -d "${ENTRY}" ] + then + readarray -t FINDOUT < <(find "${ENTRY}" -not -path '*/.*' -type f) + RSYSLOG_CONFIG_FILES+=("${FINDOUT[@]}") + elif [ -f "${ENTRY}" ] + then + RSYSLOG_CONFIG_FILES+=("${ENTRY}") + else + echo "Invalid include object: ${ENTRY}" + fi +done + +# Browse each file selected above as containing paths of log files +# ('/etc/rsyslog.conf' and '/etc/rsyslog.d/*.conf' in the default configuration) +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + # From each of these files extract just particular log file path(s), thus: + # * Ignore lines starting with space (' '), comment ('#"), or variable syntax ('$') characters, + # * Ignore empty lines, + # * Strip quotes and closing brackets from paths. + # * Ignore paths that match /dev|/etc.*\.conf, as those are paths, but likely not log files + # * From the remaining valid rows select only fields constituting a log file path + # Text file column is understood to represent a log file path if and only if all of the + # following are met: + # * it contains at least one slash '/' character, + # * it is preceded by space + # * it doesn't contain space (' '), colon (':'), and semicolon (';') characters + # Search log file for path(s) only in case it exists! + if [[ -f "${LOG_FILE}" ]] + then + NORMALIZED_CONFIG_FILE_LINES=$(sed -e "/^[#|$]/d" "${LOG_FILE}") + LINES_WITH_PATHS=$(grep '[^/]*\s\+\S*/\S\+$' <<< "${NORMALIZED_CONFIG_FILE_LINES}") + FILTERED_PATHS=$(awk '{if(NF>=2&&($NF~/^\//||$NF~/^-\//)){sub(/^-\//,"/",$NF);print $NF}}' <<< "${LINES_WITH_PATHS}") + CLEANED_PATHS=$(sed -e "s/[\"')]//g; /\\/etc.*\.conf/d; /\\/dev\\//d" <<< "${FILTERED_PATHS}") + MATCHED_ITEMS=$(sed -e "/^$/d" <<< "${CLEANED_PATHS}") + # Since above sed command might return more than one item (delimited by newline), split + # the particular matches entries into new array specific for this log file + readarray -t ARRAY_FOR_LOG_FILE <<< "$MATCHED_ITEMS" + # Concatenate the two arrays - previous content of $LOG_FILE_PATHS array with + # items from newly created array for this log file + LOG_FILE_PATHS+=("${ARRAY_FOR_LOG_FILE[@]}") + # Delete the temporary array + unset ARRAY_FOR_LOG_FILE + fi +done + +# Check for RainerScript action log format which might be also multiline so grep regex is a bit +# curly: +# extract possibly multiline action omfile expressions +# extract File="logfile" expression +# match only "logfile" expression +for LOG_FILE in "${RSYSLOG_CONFIG_FILES[@]}" +do + ACTION_OMFILE_LINES=$(grep -iozP "action\s*\(\s*type\s*=\s*\"omfile\"[^\)]*\)" "${LOG_FILE}") + OMFILE_LINES=$(echo "${ACTION_OMFILE_LINES}"| grep -iaoP "File\s*=\s*\"([/[:alnum:][:punct:]]*)\"\s*\)") + LOG_FILE_PATHS+=("$(echo "${OMFILE_LINES}"| grep -oE "\"([/[:alnum:][:punct:]]*)\""|tr -d "\"")") +done + +# Ensure the correct attribute if file exists +FILE_CMD="chmod" +for LOG_FILE_PATH in "${LOG_FILE_PATHS[@]}" +do + # Sanity check - if particular $LOG_FILE_PATH is empty string, skip it from further processing + if [ -z "$LOG_FILE_PATH" ] + then + continue + fi + $FILE_CMD "0640" "$LOG_FILE_PATH" +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180783,37 +180945,6 @@ associated with remote user access management. It can also be used to spot cyber attacks and ensure ongoing compliance with organizational policies surrounding the use of remote access methods. CCE-83426-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -declare -A REMOTE_METHODS=( ['auth.*']='^[^#]*auth\.\*.*$' ['authpriv.*']='^[^#]*authpriv\.\*.*$' ['daemon.*']='^[^#]*daemon\.\*.*$' ) - -if [[ ! -f /etc/rsyslog.conf ]]; then - # Something is not right, create the file - touch /etc/rsyslog.conf -fi - -APPEND_LINE=$(sed -rn '/^\S+\s+\/var\/log\/secure$/p' /etc/rsyslog.conf) - -# Loop through the remote methods associative array -for K in "${!REMOTE_METHODS[@]}" -do - # Check to see if selector/value exists - if ! grep -rq "${REMOTE_METHODS[$K]}" /etc/rsyslog.*; then - # Make sure we have a line to insert after, otherwise append to end - if [[ ! -z ${APPEND_LINE} ]]; then - # Add selector to file - sed -r -i "0,/^(\S+\s+\/var\/log\/secure$)/s//\1\n${K} \/var\/log\/secure/" /etc/rsyslog.conf - else - echo "${K} /var/log/secure" >> /etc/rsyslog.conf - fi - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Ensure remote access methods are monitored in Rsyslog: Set facts' set_fact: conf_files: @@ -180933,6 +181064,37 @@ fi - medium_severity - no_reboot_needed - rsyslog_remote_access_monitoring + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +declare -A REMOTE_METHODS=( ['auth.*']='^[^#]*auth\.\*.*$' ['authpriv.*']='^[^#]*authpriv\.\*.*$' ['daemon.*']='^[^#]*daemon\.\*.*$' ) + +if [[ ! -f /etc/rsyslog.conf ]]; then + # Something is not right, create the file + touch /etc/rsyslog.conf +fi + +APPEND_LINE=$(sed -rn '/^\S+\s+\/var\/log\/secure$/p' /etc/rsyslog.conf) + +# Loop through the remote methods associative array +for K in "${!REMOTE_METHODS[@]}" +do + # Check to see if selector/value exists + if ! grep -rq "${REMOTE_METHODS[$K]}" /etc/rsyslog.*; then + # Make sure we have a line to insert after, otherwise append to end + if [[ ! -z ${APPEND_LINE} ]]; then + # Add selector to file + sed -r -i "0,/^(\S+\s+\/var\/log\/secure$)/s//\1\n${K} \/var\/log\/secure/" /etc/rsyslog.conf + else + echo "${K} /var/log/secure" >> /etc/rsyslog.conf + fi + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -180956,13 +181118,29 @@ For more information on systemd-journald and additional Journald (via systemd-journal-remote ) supports the ability to send log events it gathers to a remote log host or to receive messages from remote hosts, thus enabling centralised log management. - 4.2.2.1.1 + 5.1.2.1.1 Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. CCE-86467-8 - -package --add=systemd-journal-remote + - name: Ensure systemd-journal-remote is installed + package: + name: systemd-journal-remote + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86467-8 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_systemd-journal-remote_installed + + +[[packages]] +name = "systemd-journal-remote" +version = "*" include install_systemd-journal-remote @@ -180971,6 +181149,9 @@ class install_systemd-journal-remote { ensure => 'installed', } } + + +package --add=systemd-journal-remote # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -180982,25 +181163,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "systemd-journal-remote" -version = "*" - - - name: Ensure systemd-journal-remote is installed - package: - name: systemd-journal-remote - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86467-8 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_systemd-journal-remote_installed @@ -181019,35 +181181,10 @@ The systemd-journald service can be enabled with the foll CCI-001665 SC-24 SRG-OS-000269-GPOS-00103 - 4.2.2.2 + 5.1.2.2 In the event of a system failure, Red Hat Enterprise Linux 8 must preserve any information necessary to determine cause of failure and any information necessary to return to operations with least disruption to system processes. CCE-85921-5 - include enable_systemd-journald - -class enable_systemd-journald { - service {'systemd-journald': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'systemd-journald.service' -"$SYSTEMCTL_EXEC" start 'systemd-journald.service' -"$SYSTEMCTL_EXEC" enable 'systemd-journald.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["systemd-journald"] - - name: Enable service systemd-journald block: @@ -181073,6 +181210,31 @@ enabled = ["systemd-journald"] - medium_severity - no_reboot_needed - service_systemd-journald_enabled + + +[customizations.services] +enabled = ["systemd-journald"] + + include enable_systemd-journald + +class enable_systemd-journald { + service {'systemd-journald': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'systemd-journald.service' +"$SYSTEMCTL_EXEC" start 'systemd-journald.service' +"$SYSTEMCTL_EXEC" enable 'systemd-journald.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181084,57 +181246,9 @@ enabled = ["systemd-journald"] Ensure journald is configured to compress large log files The journald system can compress large log files to avoid fill the system disk. - 4.2.2.3 + 5.1.2.3 Log files that are not properly compressed run the risk of growing so large that they fill up the log partition. Valuable logging information could be lost if the log partition becomes full. CCE-85930-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function remove_journald_Compress_configuration { - local COMPONENT_PARAM_CONFIG - mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) - COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") - - for f in "${COMPONENT_PARAM_CONFIG[@]}" - do - sed -i "/^\s*Compress\s*=\s*/d" "$f" - # make sure file has newline at the end - sed -i -e '$a\' "$f" - done - sed -i -e '$a\' "/etc/systemd/journald.conf" -} - -function journald_Compress_add_configuration { - local COMPONENT_PARAM_REMEDY_CFG - mkdir -p "/etc/systemd/journald.conf.d" - COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" - - if [ ! -f "${COMPONENT_PARAM_REMEDY_CFG}" ] ; then - touch "${COMPONENT_PARAM_REMEDY_CFG}" - fi - cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" - # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*Compress" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" - if [ -z "$line_number" ]; then - # There was no match of '^#\s*Compress', insert at - # the end of the file. - printf '%s\n' "Compress=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" - else - head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf" - tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" - fi - # Clean up after ourselves. - rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" -} - -remove_journald_Compress_configuration -journald_Compress_add_configuration - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Check for duplicate Compress values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181224,38 +181338,24 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure journald is configured to send logs to rsyslog - Data from journald may be stored in volatile memory or persisted locally. -Utilities exist to accept remote export of journald logs. - 4.2.1.3 - Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. - CCE-85995-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -function remove_journald_ForwardToSyslog_configuration { +function remove_journald_Compress_configuration { local COMPONENT_PARAM_CONFIG mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") for f in "${COMPONENT_PARAM_CONFIG[@]}" do - sed -i "/^\s*ForwardToSyslog\s*=\s*/d" "$f" + sed -i "/^\s*Compress\s*=\s*/d" "$f" # make sure file has newline at the end sed -i -e '$a\' "$f" done sed -i -e '$a\' "/etc/systemd/journald.conf" } -function journald_ForwardToSyslog_add_configuration { +function journald_Compress_add_configuration { local COMPONENT_PARAM_REMEDY_CFG mkdir -p "/etc/systemd/journald.conf.d" COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" @@ -181265,27 +181365,41 @@ function journald_ForwardToSyslog_add_configuration { fi cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*ForwardToSyslog" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + line_number="$(LC_ALL=C grep -n "^#\s*Compress" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" if [ -z "$line_number" ]; then - # There was no match of '^#\s*ForwardToSyslog', insert at + # There was no match of '^#\s*Compress', insert at # the end of the file. - printf '%s\n' "ForwardToSyslog=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "Compress=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" else head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf" + printf '%s\n' "Compress=yes" >> "/etc/systemd/journald.conf" tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" fi # Clean up after ourselves. rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" } -remove_journald_ForwardToSyslog_configuration -journald_ForwardToSyslog_add_configuration +remove_journald_Compress_configuration +journald_Compress_add_configuration else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure journald is configured to send logs to rsyslog + Data from journald may be stored in volatile memory or persisted locally. +Utilities exist to accept remote export of journald logs. + 5.1.1.3 + Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system. + CCE-85995-9 - name: Check for duplicate ForwardToSyslog values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181375,38 +181489,24 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Ensure journald is configured to write log files to persistent disk - The journald system may store log files in volatile memory or locally on disk. -If the logs are only stored in volatile memory they will we lost upon reboot. - 4.2.2.4 - Log files contain valuable data and need to be persistent to aid in possible investigations. - CCE-86045-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -function remove_journald_Storage_configuration { +function remove_journald_ForwardToSyslog_configuration { local COMPONENT_PARAM_CONFIG mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") for f in "${COMPONENT_PARAM_CONFIG[@]}" do - sed -i "/^\s*Storage\s*=\s*/d" "$f" + sed -i "/^\s*ForwardToSyslog\s*=\s*/d" "$f" # make sure file has newline at the end sed -i -e '$a\' "$f" done sed -i -e '$a\' "/etc/systemd/journald.conf" } -function journald_Storage_add_configuration { +function journald_ForwardToSyslog_add_configuration { local COMPONENT_PARAM_REMEDY_CFG mkdir -p "/etc/systemd/journald.conf.d" COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" @@ -181416,27 +181516,41 @@ function journald_Storage_add_configuration { fi cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" # Insert before the line matching the regex '^#\s*Compress'. - line_number="$(LC_ALL=C grep -n "^#\s*Storage" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + line_number="$(LC_ALL=C grep -n "^#\s*ForwardToSyslog" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" if [ -z "$line_number" ]; then - # There was no match of '^#\s*Storage', insert at + # There was no match of '^#\s*ForwardToSyslog', insert at # the end of the file. - printf '%s\n' "Storage=persistent" >> "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "ForwardToSyslog=yes" >> "${COMPONENT_PARAM_REMEDY_CFG}" else head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" - printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf" + printf '%s\n' "ForwardToSyslog=yes" >> "/etc/systemd/journald.conf" tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" fi # Clean up after ourselves. rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" } -remove_journald_Storage_configuration -journald_Storage_add_configuration +remove_journald_ForwardToSyslog_configuration +journald_ForwardToSyslog_add_configuration else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Ensure journald is configured to write log files to persistent disk + The journald system may store log files in volatile memory or locally on disk. +If the logs are only stored in volatile memory they will we lost upon reboot. + 5.1.2.4 + Log files contain valuable data and need to be persistent to aid in possible investigations. + CCE-86045-2 - name: Check for duplicate Storage values in master journald configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf @@ -181525,6 +181639,54 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function remove_journald_Storage_configuration { + local COMPONENT_PARAM_CONFIG + mapfile -t COMPONENT_PARAM_CONFIG < <(ls /etc/systemd/journald.conf.d/*.conf) + COMPONENT_PARAM_CONFIG+=("/etc/systemd/journald.conf") + + for f in "${COMPONENT_PARAM_CONFIG[@]}" + do + sed -i "/^\s*Storage\s*=\s*/d" "$f" + # make sure file has newline at the end + sed -i -e '$a\' "$f" + done + sed -i -e '$a\' "/etc/systemd/journald.conf" +} + +function journald_Storage_add_configuration { + local COMPONENT_PARAM_REMEDY_CFG + mkdir -p "/etc/systemd/journald.conf.d" + COMPONENT_PARAM_REMEDY_CFG="/etc/systemd/journald.conf.d/oscap-remedy.conf" + + if [ ! -f "${COMPONENT_PARAM_REMEDY_CFG}" ] ; then + touch "${COMPONENT_PARAM_REMEDY_CFG}" + fi + cp "${COMPONENT_PARAM_REMEDY_CFG}" "${COMPONENT_PARAM_REMEDY_CFG}.bak" + # Insert before the line matching the regex '^#\s*Compress'. + line_number="$(LC_ALL=C grep -n "^#\s*Storage" "${COMPONENT_PARAM_REMEDY_CFG}.bak" | LC_ALL=C sed 's/:.*//g')" + if [ -z "$line_number" ]; then + # There was no match of '^#\s*Storage', insert at + # the end of the file. + printf '%s\n' "Storage=persistent" >> "${COMPONENT_PARAM_REMEDY_CFG}" + else + head -n "$(( line_number - 1 ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" > "${COMPONENT_PARAM_REMEDY_CFG}" + printf '%s\n' "Storage=persistent" >> "/etc/systemd/journald.conf" + tail -n "+$(( line_number ))" "${COMPONENT_PARAM_REMEDY_CFG}.bak" >> "${COMPONENT_PARAM_REMEDY_CFG}" + fi + # Clean up after ourselves. + rm "${COMPONENT_PARAM_REMEDY_CFG}.bak" +} + +remove_journald_Storage_configuration +journald_Storage_add_configuration + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181543,25 +181705,10 @@ NOTE: logs to remote hosts and receiving incoming logs. With regards to receiving logs, there are two Systemd unit files; systemd-journal-remote.socket and systemd-journal-remote.service. - 4.2.2.1.4 + 5.1.2.1.4 If a client is configured to also receive data, thus turning it into a server, the client system is acting outside it's operational boundary. CCE-87605-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SOCKET_NAME="systemd-journal-remote.socket" -SYSTEMCTL_EXEC='/usr/bin/systemctl' - -if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then - "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" - "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable systemd-journal-remote Socket - Collect systemd Socket Units Present in the System ansible.builtin.command: @@ -181596,6 +181743,21 @@ fi - medium_severity - no_reboot_needed - socket_systemd-journal-remote_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SOCKET_NAME="systemd-journal-remote.socket" +SYSTEMCTL_EXEC='/usr/bin/systemctl' + +if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then + "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" + "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181667,11 +181829,30 @@ used. PR.PT-1 Req-10.7 10.5.1 - 4.3 + 5.1.3 The logrotate package provides the logrotate services. CCE-86154-2 - -package --add=logrotate + - name: Ensure logrotate is installed + package: + name: logrotate + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86154-2 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.7 + - PCI-DSSv4-10.5.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_logrotate_installed + + +[[packages]] +name = "logrotate" +version = "*" include install_logrotate @@ -181680,6 +181861,9 @@ class install_logrotate { ensure => 'installed', } } + + +package --add=logrotate # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -181691,28 +181875,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "logrotate" -version = "*" - - - name: Ensure logrotate is installed - package: - name: logrotate - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86154-2 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.7 - - PCI-DSSv4-10.5.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_logrotate_installed @@ -181763,52 +181925,12 @@ daily CM-6(a) PR.PT-1 Req-10.7 - 4.3 + 5.1.3 Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full. CCE-80794-1 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20see%20%22man%20logrotate%22%20for%20details%0A%23%20rotate%20log%20files%20daily%0Adaily%0A%0A%23%20keep%204%20weeks%20worth%20of%20backlogs%0Arotate%2030%0A%0A%23%20create%20new%20%28empty%29%20log%20files%20after%20rotating%20old%20ones%0Acreate%0A%0A%23%20use%20date%20as%20a%20suffix%20of%20the%20rotated%20file%0Adateext%0A%0A%23%20uncomment%20this%20if%20you%20want%20your%20log%20files%20compressed%0A%23compress%0A%0A%23%20RPM%20packages%20drop%20log%20rotation%20information%20into%20this%20directory%0Ainclude%20/etc/logrotate.d%0A%0A%23%20system-specific%20logs%20may%20be%20also%20be%20configured%20here. }} - mode: 0644 - path: /etc/logrotate.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q logrotate; }; then - -LOGROTATE_CONF_FILE="/etc/logrotate.conf" - -CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate" - - -# daily rotation is configured -grep -q "^daily$" $LOGROTATE_CONF_FILE|| echo "daily" >> $LOGROTATE_CONF_FILE - -# remove any line configuring weekly, monthly or yearly rotation -sed -i '/^\s*\(weekly\|monthly\|yearly\).*$/d' $LOGROTATE_CONF_FILE - - -# configure cron.daily if not already -if ! grep -q "^[[:space:]]*/usr/sbin/logrotate[[:alnum:][:blank:][:punct:]]*$LOGROTATE_CONF_FILE$" $CRON_DAILY_LOGROTATE_FILE; then - echo '#!/bin/sh' > $CRON_DAILY_LOGROTATE_FILE - echo "/usr/sbin/logrotate $LOGROTATE_CONF_FILE" >> $CRON_DAILY_LOGROTATE_FILE -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -181891,6 +182013,46 @@ fi - low_disruption - medium_severity - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20see%20%22man%20logrotate%22%20for%20details%0A%23%20rotate%20log%20files%20daily%0Adaily%0A%0A%23%20keep%204%20weeks%20worth%20of%20backlogs%0Arotate%2030%0A%0A%23%20create%20new%20%28empty%29%20log%20files%20after%20rotating%20old%20ones%0Acreate%0A%0A%23%20use%20date%20as%20a%20suffix%20of%20the%20rotated%20file%0Adateext%0A%0A%23%20uncomment%20this%20if%20you%20want%20your%20log%20files%20compressed%0A%23compress%0A%0A%23%20RPM%20packages%20drop%20log%20rotation%20information%20into%20this%20directory%0Ainclude%20/etc/logrotate.d%0A%0A%23%20system-specific%20logs%20may%20be%20also%20be%20configured%20here. }} + mode: 0644 + path: /etc/logrotate.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q logrotate; }; then + +LOGROTATE_CONF_FILE="/etc/logrotate.conf" + +CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate" + + +# daily rotation is configured +grep -q "^daily$" $LOGROTATE_CONF_FILE|| echo "daily" >> $LOGROTATE_CONF_FILE + +# remove any line configuring weekly, monthly or yearly rotation +sed -i '/^\s*\(weekly\|monthly\|yearly\).*$/d' $LOGROTATE_CONF_FILE + + +# configure cron.daily if not already +if ! grep -q "^[[:space:]]*/usr/sbin/logrotate[[:alnum:][:blank:][:punct:]]*$LOGROTATE_CONF_FILE$" $CRON_DAILY_LOGROTATE_FILE; then + echo '#!/bin/sh' > $CRON_DAILY_LOGROTATE_FILE + echo "/usr/sbin/logrotate $LOGROTATE_CONF_FILE" >> $CRON_DAILY_LOGROTATE_FILE +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -181940,23 +182102,12 @@ The logrotate timer can be enabled with the following com PR.PT-1 Req-10.7 10.5.1 - 4.3 + 5.1.3 Log files that are not properly rotated run the risk of growing so large that they fill up the /var/log partition. Valuable logging information could be lost if the /var/log partition becomes full. CCE-86157-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && rpm --quiet -q logrotate ); }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" start 'logrotate.timer' -"$SYSTEMCTL_EXEC" enable 'logrotate.timer' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -182001,6 +182152,17 @@ fi - medium_severity - no_reboot_needed - timer_logrotate_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="9"; printf "%s\n%s" "$expected" "$real" | sort -VC; } && rpm --quiet -q logrotate ); }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" start 'logrotate.timer' +"$SYSTEMCTL_EXEC" enable 'logrotate.timer' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182061,8 +182223,24 @@ $ sudo yum install syslog-ng-core PR.PT-1 The syslog-ng-core package provides the syslog-ng daemon, which provides system logging services. - -package --add=syslog-ng + - name: Ensure syslog-ng is installed + package: + name: syslog-ng + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_syslogng_installed + + +[[packages]] +name = "syslog-ng" +version = "*" include install_syslog-ng @@ -182071,6 +182249,9 @@ class install_syslog-ng { ensure => 'installed', } } + + +package --add=syslog-ng # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -182082,25 +182263,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "syslog-ng" -version = "*" - - - name: Ensure syslog-ng is installed - package: - name: syslog-ng - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_syslogng_installed @@ -182190,31 +182352,6 @@ The syslog-ng service can be enabled with the following c PR.PT-1 The syslog-ng service must be running in order to provide logging services, which are essential to system administration. - include enable_syslog-ng - -class enable_syslog-ng { - service {'syslog-ng': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'syslog-ng.service' -"$SYSTEMCTL_EXEC" start 'syslog-ng.service' -"$SYSTEMCTL_EXEC" enable 'syslog-ng.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["syslog-ng"] - - name: Enable service syslog-ng block: @@ -182240,6 +182377,31 @@ enabled = ["syslog-ng"] - medium_severity - no_reboot_needed - service_syslogng_enabled + + +[customizations.services] +enabled = ["syslog-ng"] + + include enable_syslog-ng + +class enable_syslog-ng { + service {'syslog-ng': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'syslog-ng.service' +"$SYSTEMCTL_EXEC" start 'syslog-ng.service' +"$SYSTEMCTL_EXEC" enable 'syslog-ng.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182478,43 +182640,11 @@ input(type="imudp" port="514") PR.PT-1 PR.PT-4 SRG-OS-000480-GPOS-00227 - 4.2.1.7 + 5.1.1.7 Any process which receives messages from the network incurs some risk of receiving malicious messages. This risk can be eliminated for rsyslog by configuring it not to listen on the network. CCE-84275-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -legacy_regex='^\s*\$(((Input(TCP|RELP)|UDP)ServerRun)|ModLoad\s+(imtcp|imudp|imrelp))' -rainer_regex='^\s*(module|input)\((load|type)="(imtcp|imudp)".*$' - -readarray -t legacy_targets < <(grep -l -E -r "${legacy_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) -readarray -t rainer_targets < <(grep -l -E -r "${rainer_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) - -config_changed=false -if [ ${#legacy_targets[@]} -gt 0 ]; then - for target in "${legacy_targets[@]}"; do - sed -E -i "/$legacy_regex/ s/^/# /" "$target" - done - config_changed=true -fi - -if [ ${#rainer_targets[@]} -gt 0 ]; then - for target in "${rainer_targets[@]}"; do - sed -E -i "/$rainer_regex/ s/^/# /" "$target" - done - config_changed=true -fi - -if $config_changed; then - systemctl restart rsyslog.service -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server - Define Rsyslog Config Lines Regex in Legacy Syntax ansible.builtin.set_fact: @@ -182732,6 +182862,38 @@ fi - medium_severity - no_reboot_needed - rsyslog_nolisten + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +legacy_regex='^\s*\$(((Input(TCP|RELP)|UDP)ServerRun)|ModLoad\s+(imtcp|imudp|imrelp))' +rainer_regex='^\s*(module|input)\((load|type)="(imtcp|imudp)".*$' + +readarray -t legacy_targets < <(grep -l -E -r "${legacy_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) +readarray -t rainer_targets < <(grep -l -E -r "${rainer_regex[@]}" /etc/rsyslog.conf /etc/rsyslog.d/) + +config_changed=false +if [ ${#legacy_targets[@]} -gt 0 ]; then + for target in "${legacy_targets[@]}"; do + sed -E -i "/$legacy_regex/ s/^/# /" "$target" + done + config_changed=true +fi + +if [ ${#rainer_targets[@]} -gt 0 ]; then + for target in "${rainer_targets[@]}"; do + sed -E -i "/$rainer_regex/ s/^/# /" "$target" + done + config_changed=true +fi + +if $config_changed; then + systemctl restart rsyslog.service +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -182871,7 +183033,7 @@ $ActionResumeRetryCount -1 SRG-OS-000480-GPOS-00227 SRG-OS-000342-GPOS-00133 RHEL-08-030690 - 4.2.1.6 + 5.1.1.6 SV-230479r917883_rule A log server (loghost) receives syslog messages from one or more systems. This data can be used as an additional log source in the event a @@ -182879,6 +183041,32 @@ system is compromised and its local logs are suspect. Forwarding log messages to a remote loghost also provides system administrators with a centralized place to view the status of multiple hosts within the enterprise. CCE-80863-4 + - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable + set_fact: + rsyslog_remote_loghost_address: !!str + tags: + - always + +- name: Set rsyslog remote loghost + lineinfile: + dest: /etc/rsyslog.conf + regexp: ^\*\.\* + line: '*.* @@{{ rsyslog_remote_loghost_address }}' + create: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80863-4 + - DISA-STIG-RHEL-08-030690 + - NIST-800-53-AU-4(1) + - NIST-800-53-AU-9(2) + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - rsyslog_remote_loghost + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -182910,32 +183098,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable - set_fact: - rsyslog_remote_loghost_address: !!str - tags: - - always - -- name: Set rsyslog remote loghost - lineinfile: - dest: /etc/rsyslog.conf - regexp: ^\*\.\* - line: '*.* @@{{ rsyslog_remote_loghost_address }}' - create: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80863-4 - - DISA-STIG-RHEL-08-030690 - - NIST-800-53-AU-4(1) - - NIST-800-53-AU-9(2) - - NIST-800-53-CM-6(a) - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - rsyslog_remote_loghost @@ -182968,36 +183130,6 @@ Replace the <remote system> in the above command wi For protection of data being logged, the connection to the remote logging server needs to be authenticated and encrypted. CCE-82457-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -rsyslog_remote_loghost_address='' - -params_to_add_if_missing=("protocol" "target" "port" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") -values_to_add_if_missing=("tcp" "$rsyslog_remote_loghost_address" "6514" "gtls" "1" "x509/name" "on") -params_to_replace_if_wrong_value=("protocol" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") -values_to_replace_if_wrong_value=("tcp" "gtls" "1" "x509/name" "on") - -files_containing_omfwd=("$(grep -ilE '^[^#]*\s*action\s*\(\s*type\s*=\s*"omfwd".*' /etc/rsyslog.conf /etc/rsyslog.d/*.conf)") -if [ -n "${files_containing_omfwd[*]}" ]; then - for file in "${files_containing_omfwd[@]}"; do - for ((i=0; i<${#params_to_replace_if_wrong_value[@]}; i++)); do - sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?)${params_to_replace_if_wrong_value[$i]}\s*=\s*[\"]\S*[\"](.*\))|\1${params_to_replace_if_wrong_value[$i]}=\"${values_to_replace_if_wrong_value[$i]}\"\2|gI" "$file" - done - for ((i=0; i<${#params_to_add_if_missing[@]}; i++)); do - if ! grep -qPzi "(?s)\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?${params_to_add_if_missing[$i]}.*?\).*" "$file"; then - sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"])|\1\n${params_to_add_if_missing[$i]}=\"${values_to_add_if_missing[$i]}\"|gI" "$file" - fi - done - done -else - echo "action(type=\"omfwd\" protocol=\"tcp\" Target=\"$rsyslog_remote_loghost_address\" port=\"6514\" StreamDriver=\"gtls\" StreamDriverMode=\"1\" StreamDriverAuthMode=\"x509/name\" streamdriver.CheckExtendedKeyPurpose=\"on\")" >> /etc/rsyslog.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value rsyslog_remote_loghost_address # promote to variable set_fact: rsyslog_remote_loghost_address: !!str @@ -183204,6 +183336,36 @@ fi - medium_severity - no_reboot_needed - rsyslog_remote_tls + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +rsyslog_remote_loghost_address='' + +params_to_add_if_missing=("protocol" "target" "port" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") +values_to_add_if_missing=("tcp" "$rsyslog_remote_loghost_address" "6514" "gtls" "1" "x509/name" "on") +params_to_replace_if_wrong_value=("protocol" "StreamDriver" "StreamDriverMode" "StreamDriverAuthMode" "streamdriver.CheckExtendedKeyPurpose") +values_to_replace_if_wrong_value=("tcp" "gtls" "1" "x509/name" "on") + +files_containing_omfwd=("$(grep -ilE '^[^#]*\s*action\s*\(\s*type\s*=\s*"omfwd".*' /etc/rsyslog.conf /etc/rsyslog.d/*.conf)") +if [ -n "${files_containing_omfwd[*]}" ]; then + for file in "${files_containing_omfwd[@]}"; do + for ((i=0; i<${#params_to_replace_if_wrong_value[@]}; i++)); do + sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?)${params_to_replace_if_wrong_value[$i]}\s*=\s*[\"]\S*[\"](.*\))|\1${params_to_replace_if_wrong_value[$i]}=\"${values_to_replace_if_wrong_value[$i]}\"\2|gI" "$file" + done + for ((i=0; i<${#params_to_add_if_missing[@]}; i++)); do + if ! grep -qPzi "(?s)\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"].*?${params_to_add_if_missing[$i]}.*?\).*" "$file"; then + sed -i -E -e 'H;$!d;x;s/^\n//' -e "s|(\s*action\s*\(\s*type\s*=\s*[\"]omfwd[\"])|\1\n${params_to_add_if_missing[$i]}=\"${values_to_add_if_missing[$i]}\"|gI" "$file" + fi + done + done +else + echo "action(type=\"omfwd\" protocol=\"tcp\" Target=\"$rsyslog_remote_loghost_address\" port=\"6514\" StreamDriver=\"gtls\" StreamDriverMode=\"1\" StreamDriverAuthMode=\"x509/name\" streamdriver.CheckExtendedKeyPurpose=\"on\")" >> /etc/rsyslog.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183471,15 +183633,6 @@ untrusted access, prevent system availability, and/or can lead to a compromise o attack. CCE-82179-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q polkit; then - -printf "[Disable General User Access to NetworkManager]\nIdentity=default\nAction=org.freedesktop.NetworkManager.*\nResultAny=no\nResultInactive=no\nResultActive=auth_admin\n" > /etc/polkit-1/localauthority/20-org.d/10-nm-harden-access.pkla - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -183528,6 +183681,15 @@ fi - network_nmcli_permissions - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q polkit; then + +printf "[Disable General User Access to NetworkManager]\nIdentity=default\nAction=org.freedesktop.NetworkManager.*\nResultAny=no\nResultInactive=no\nResultActive=auth_admin\n" > /etc/polkit-1/localauthority/20-org.d/10-nm-harden-access.pkla + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183651,17 +183813,6 @@ tools must be documented with the Information Systems Security Manager (ISSM) an to only authorized personnel. CCE-82283-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -for interface in $(ip link show | grep -E '^[0-9]' | cut -d ":" -f 2); do - ip link set dev $interface multicast off promisc off -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure System is Not Acting as a Network Sniffer - Gather network interfaces ansible.builtin.command: cmd: ip link show @@ -183705,6 +183856,17 @@ fi - network_sniffer_disabled - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +for interface in $(ip link show | grep -E '^[0-9]' | cut -d ":" -f 2); do + ip link set dev $interface multicast off promisc off +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183745,37 +183907,6 @@ the firewall has to be reloaded. Utilizing the limit statement in "nftables" can help to mitigate DoS attacks. CCE-86506-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then - -if [ -e "/etc/firewalld/firewalld.conf" ] ; then - - LC_ALL=C sed -i "/^\s*FirewallBackend\s*=\s*/d" "/etc/firewalld/firewalld.conf" -else - touch "/etc/firewalld/firewalld.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/firewalld/firewalld.conf" - -cp "/etc/firewalld/firewalld.conf" "/etc/firewalld/firewalld.conf.bak" -# Insert before the line matching the regex '^#\s*FirewallBackend'. -line_number="$(LC_ALL=C grep -n "^#\s*FirewallBackend" "/etc/firewalld/firewalld.conf.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^#\s*FirewallBackend', insert at - # the end of the file. - printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" -else - head -n "$(( line_number - 1 ))" "/etc/firewalld/firewalld.conf.bak" > "/etc/firewalld/firewalld.conf" - printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" - tail -n "+$(( line_number ))" "/etc/firewalld/firewalld.conf.bak" >> "/etc/firewalld/firewalld.conf" -fi -# Clean up after ourselves. -rm "/etc/firewalld/firewalld.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -183834,6 +183965,37 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then + +if [ -e "/etc/firewalld/firewalld.conf" ] ; then + + LC_ALL=C sed -i "/^\s*FirewallBackend\s*=\s*/d" "/etc/firewalld/firewalld.conf" +else + touch "/etc/firewalld/firewalld.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/firewalld/firewalld.conf" + +cp "/etc/firewalld/firewalld.conf" "/etc/firewalld/firewalld.conf.bak" +# Insert before the line matching the regex '^#\s*FirewallBackend'. +line_number="$(LC_ALL=C grep -n "^#\s*FirewallBackend" "/etc/firewalld/firewalld.conf.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^#\s*FirewallBackend', insert at + # the end of the file. + printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" +else + head -n "$(( line_number - 1 ))" "/etc/firewalld/firewalld.conf.bak" > "/etc/firewalld/firewalld.conf" + printf '%s\n' "FirewallBackend=nftables" >> "/etc/firewalld/firewalld.conf" + tail -n "+$(( line_number ))" "/etc/firewalld/firewalld.conf.bak" >> "/etc/firewalld/firewalld.conf" +fi +# Clean up after ourselves. +rm "/etc/firewalld/firewalld.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -183945,8 +184107,26 @@ Remote access is access to DoD nonpublic information systems by an authorized us Red Hat Enterprise Linux 8 functionality (e.g., SSH) must be capable of taking enforcement action if the audit reveals unauthorized activity. Automated control of remote access sessions allows organizations to ensure ongoing compliance with remote access policies by enforcing connection rules of remote access applications on a variety of information system components (e.g., servers, workstations, notebook computers, smartphones, and tablets)." CCE-82998-6 - -package --add=firewalld + - name: Ensure firewalld is installed + package: + name: firewalld + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82998-6 + - DISA-STIG-RHEL-08-040100 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_firewalld_installed + + +[[packages]] +name = "firewalld" +version = "*" include install_firewalld @@ -183955,6 +184135,9 @@ class install_firewalld { ensure => 'installed', } } + + +package --add=firewalld # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -183966,27 +184149,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "firewalld" -version = "*" - - - name: Ensure firewalld is installed - package: - name: firewalld - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82998-6 - - DISA-STIG-RHEL-08-040100 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_firewalld_installed @@ -184045,31 +184207,6 @@ by restricting services and known good IP addresses and address ranges. This prevents connections from unknown hosts and protocols. CCE-80877-4 - include enable_firewalld - -class enable_firewalld { - service {'firewalld': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'firewalld.service' -"$SYSTEMCTL_EXEC" start 'firewalld.service' -"$SYSTEMCTL_EXEC" enable 'firewalld.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["firewalld"] - - name: Gather the package facts package_facts: manager: auto @@ -184126,6 +184263,31 @@ enabled = ["firewalld"] - medium_severity - no_reboot_needed - service_firewalld_enabled + + +[customizations.services] +enabled = ["firewalld"] + + include enable_firewalld + +class enable_firewalld { + service {'firewalld': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q firewalld; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'firewalld.service' +"$SYSTEMCTL_EXEC" start 'firewalld.service' +"$SYSTEMCTL_EXEC" enable 'firewalld.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -184291,7 +184453,7 @@ The default "drop" zone will drop all incoming network packets unless it is expl AC-17 (1) SRG-OS-000297-GPOS-00115 RHEL-08-040090 - SV-230504r854047_rule + SV-230504r942942_rule Failure to restrict network connectivity only to authorized systems permits inbound connections from malicious systems. It also permits outbound connections that may facilitate exfiltration of data. CCE-86266-4 @@ -184391,7 +184553,7 @@ above. SRG-OS-000480-GPOS-00227 RHEL-08-040090 3.4.1.5 - SV-230504r854047_rule + SV-230504r942942_rule In firewalld the default zone is applied only after all the applicable rules in the table are examined for a match. Setting the default zone to drop implements proper design for a firewall, i.e. @@ -184479,27 +184641,6 @@ $ sudo yum install libreswan to initiate a secure VPN connection protects information when it is transmitted over a wide area network. CCE-80845-1 - -package --add=libreswan - - include install_libreswan - -class install_libreswan { - package { 'libreswan': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "libreswan" ; then - yum install -y "libreswan" -fi - - -[[packages]] -name = "libreswan" -version = "*" - - name: Ensure libreswan is installed package: name: libreswan @@ -184514,6 +184655,27 @@ version = "*" - medium_severity - no_reboot_needed - package_libreswan_installed + + +[[packages]] +name = "libreswan" +version = "*" + + include install_libreswan + +class install_libreswan { + package { 'libreswan': + ensure => 'installed', + } +} + + +package --add=libreswan + + +if ! rpm -q --quiet "libreswan" ; then + yum install -y "libreswan" +fi @@ -184650,33 +184812,6 @@ These services load the iptables rules during the system startup and also allow the iptables rules during runtime. CCE-85982-7 - -package --add=iptables-services - - include install_iptables-services - -class install_iptables-services { - package { 'iptables-services': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q iptables; then - -if ! rpm -q --quiet "iptables-services" ; then - yum install -y "iptables-services" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "iptables-services" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -184704,6 +184839,33 @@ version = "*" - medium_severity - no_reboot_needed - package_iptables-services_installed + + +[[packages]] +name = "iptables-services" +version = "*" + + include install_iptables-services + +class install_iptables-services { + package { 'iptables-services': + ensure => 'installed', + } +} + + +package --add=iptables-services + + # Remediation is applicable only in certain platforms +if rpm --quiet -q iptables; then + +if ! rpm -q --quiet "iptables-services" ; then + yum install -y "iptables-services" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -184726,8 +184888,27 @@ code. iptables allows system operators to set up firewall masquerading, etc. CCE-82982-0 - -package --add=iptables + - name: Ensure iptables is installed + package: + name: iptables + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] ) + tags: + - CCE-82982-0 + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-1.4.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables_installed + + +[[packages]] +name = "iptables" +version = "*" include install_iptables @@ -184736,6 +184917,9 @@ class install_iptables { ensure => 'installed', } } + + +package --add=iptables # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] ); then @@ -184747,28 +184931,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "iptables" -version = "*" - - - name: Ensure iptables is installed - package: - name: iptables - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] ) - tags: - - CCE-82982-0 - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-1.4.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables_installed @@ -184791,8 +184953,31 @@ during runtime. Those iptables services conflicts with firewalld so they should firewalld is used. CCE-86679-8 - -package --remove=iptables-services + - name: Gather the package facts + package_facts: + manager: auto + tags: + - CCE-86679-8 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables-services_removed + +- name: Ensure iptables-services is removed + package: + name: iptables-services + state: absent + when: '"iptables" in ansible_facts.packages' + tags: + - CCE-86679-8 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_iptables-services_removed include remove_iptables-services @@ -184801,6 +184986,9 @@ class remove_iptables-services { ensure => 'purged', } } + + +package --remove=iptables-services # Remediation is applicable only in certain platforms if rpm --quiet -q iptables; then @@ -184820,32 +185008,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Gather the package facts - package_facts: - manager: auto - tags: - - CCE-86679-8 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables-services_removed - -- name: Ensure iptables-services is removed - package: - name: iptables-services - state: absent - when: '"iptables" in ansible_facts.packages' - tags: - - CCE-86679-8 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_iptables-services_removed @@ -185021,31 +185183,6 @@ The ip6tables service can be enabled with the following c capability for IPv6 and ICMPv6. CCE-85955-3 - include enable_ip6tables - -class enable_ip6tables { - service {'ip6tables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ip6tables.service' -"$SYSTEMCTL_EXEC" start 'ip6tables.service' -"$SYSTEMCTL_EXEC" enable 'ip6tables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ip6tables"] - - name: Enable service ip6tables block: @@ -185075,6 +185212,31 @@ enabled = ["ip6tables"] - medium_severity - no_reboot_needed - service_ip6tables_enabled + + +[customizations.services] +enabled = ["ip6tables"] + + include enable_ip6tables + +class enable_ip6tables { + service {'ip6tables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ip6tables.service' +"$SYSTEMCTL_EXEC" start 'ip6tables.service' +"$SYSTEMCTL_EXEC" enable 'ip6tables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185223,31 +185385,6 @@ The iptables service can be enabled with the following co capability for IPv4 and ICMP. CCE-85961-1 - include enable_iptables - -class enable_iptables { - service {'iptables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q iptables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'iptables.service' -"$SYSTEMCTL_EXEC" start 'iptables.service' -"$SYSTEMCTL_EXEC" enable 'iptables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["iptables"] - - name: Gather the package facts package_facts: manager: auto @@ -185295,6 +185432,31 @@ enabled = ["iptables"] - medium_severity - no_reboot_needed - service_iptables_enabled + + +[customizations.services] +enabled = ["iptables"] + + include enable_iptables + +class enable_iptables { + service {'iptables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q iptables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'iptables.service' +"$SYSTEMCTL_EXEC" start 'iptables.service' +"$SYSTEMCTL_EXEC" enable 'iptables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185799,18 +185961,6 @@ Run the following command to update command line for already installed kernels:< the vulnerability to exploitation. CCE-82887-1 - # Remediation is applicable only in certain platforms -if rpm --quiet -q grub2-common; then - -grubby --update-kernel=ALL --args=ipv6.disable=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "ipv6.disable=1" - - name: Gather the package facts package_facts: manager: auto @@ -185838,6 +185988,18 @@ append = "ipv6.disable=1" - medium_complexity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "ipv6.disable=1" + + # Remediation is applicable only in certain platforms +if rpm --quiet -q grub2-common; then + +grubby --update-kernel=ALL --args=ipv6.disable=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -185927,39 +186089,6 @@ depend on it), while disabling support for the IPv6 protocol. CCE-82872-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Prevent the IPv6 kernel module (ipv6) from loading the IPv6 networking stack -echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf - -# Since according to: https://access.redhat.com/solutions/72733 -# "ipv6 disable=1" options doesn't always disable the IPv6 networking stack from -# loading, instruct also sysctl configuration to disable IPv6 according to: -# https://access.redhat.com/solutions/8709#rhel6disable - -declare -a IPV6_SETTINGS=("net.ipv6.conf.all.disable_ipv6" "net.ipv6.conf.default.disable_ipv6") - -for setting in "${IPV6_SETTINGS[@]}" -do - # Set runtime =1 for setting - /sbin/sysctl -q -n -w "$setting=1" - - # If setting is present in /etc/sysctl.conf, change value to "1" - # else, add "$setting = 1" to /etc/sysctl.conf - if grep -q ^"$setting" /etc/sysctl.conf ; then - sed -i "s/^$setting.*/$setting = 1/g" /etc/sysctl.conf - else - echo "" >> /etc/sysctl.conf - echo "# Set $setting = 1 per security requirements" >> /etc/sysctl.conf - echo "$setting = 1" >> /etc/sysctl.conf - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable IPv6 Networking kernel module lineinfile: create: true @@ -186000,6 +186129,39 @@ fi - medium_disruption - medium_severity - reboot_required + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Prevent the IPv6 kernel module (ipv6) from loading the IPv6 networking stack +echo "options ipv6 disable=1" > /etc/modprobe.d/ipv6.conf + +# Since according to: https://access.redhat.com/solutions/72733 +# "ipv6 disable=1" options doesn't always disable the IPv6 networking stack from +# loading, instruct also sysctl configuration to disable IPv6 according to: +# https://access.redhat.com/solutions/8709#rhel6disable + +declare -a IPV6_SETTINGS=("net.ipv6.conf.all.disable_ipv6" "net.ipv6.conf.default.disable_ipv6") + +for setting in "${IPV6_SETTINGS[@]}" +do + # Set runtime =1 for setting + /sbin/sysctl -q -n -w "$setting=1" + + # If setting is present in /etc/sysctl.conf, change value to "1" + # else, add "$setting = 1" to /etc/sysctl.conf + if grep -q ^"$setting" /etc/sysctl.conf ; then + sed -i "s/^$setting.*/$setting = 1/g" /etc/sysctl.conf + else + echo "" >> /etc/sysctl.conf + echo "# Set $setting = 1 per security requirements" >> /etc/sysctl.conf + echo "$setting = 1" >> /etc/sysctl.conf + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186188,66 +186350,6 @@ functionality require the IPv6 stack loaded to work. the vulnerability to exploitation. CCE-85904-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.disable_ipv6 from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.disable_ipv6.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.disable_ipv6" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv6.conf.all.disable_ipv6 -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.disable_ipv6="1" - -# -# If net.ipv6.conf.all.disable_ipv6 present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv6.conf.all.disable_ipv6 = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.disable_ipv6") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-85904-1" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186313,6 +186415,66 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_all_disable_ipv6 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.disable_ipv6 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.disable_ipv6.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.disable_ipv6" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv6.conf.all.disable_ipv6 +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.disable_ipv6="1" + +# +# If net.ipv6.conf.all.disable_ipv6 present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv6.conf.all.disable_ipv6 = 1" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.disable_ipv6") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-85904-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186402,66 +186564,6 @@ functionality require the IPv6 stack loaded to work. the vulnerability to exploitation. CCE-86004-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.disable_ipv6 from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.disable_ipv6.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.disable_ipv6" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv6.conf.default.disable_ipv6 -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.disable_ipv6="1" - -# -# If net.ipv6.conf.default.disable_ipv6 present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv6.conf.default.disable_ipv6 = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.disable_ipv6") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-86004-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186527,6 +186629,66 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_default_disable_ipv6 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.disable_ipv6 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.disable_ipv6.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.disable_ipv6" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv6.conf.default.disable_ipv6 +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.disable_ipv6="1" + +# +# If net.ipv6.conf.default.disable_ipv6 present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv6.conf.default.disable_ipv6 = 1" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.disable_ipv6") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "1" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.disable_ipv6\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.disable_ipv6\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-86004-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -186830,83 +186992,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit router advertisement message could result in a man-in-the-middle attack. CCE-81006-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_ra%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_ra.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_ra from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_ra_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_ra -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra="$sysctl_net_ipv6_conf_all_accept_ra_value" - -# -# If net.ipv6.conf.all.accept_ra present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81006-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -186980,34 +187065,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_ra - - - - - - - - - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_defrtr=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_defrtr = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84272-4 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_ra%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_ra.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_defrtr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_defrtr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_defrtr" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187019,37 +187103,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_defrtr_value='' +sysctl_net_ipv6_conf_all_accept_ra_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_defrtr +# Set runtime for net.ipv6.conf.all.accept_ra # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_defrtr="$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra="$sysctl_net_ipv6_conf_all_accept_ra_value" # -# If net.ipv6.conf.all.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_defrtr = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_defrtr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84272-4" + cce="CCE-81006-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187058,6 +187142,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_defrtr=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_defrtr = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84272-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187117,34 +187217,18 @@ fi - sysctl_net_ipv6_conf_all_accept_ra_defrtr - unknown_severity - - - - - - - - - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_pinfo=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_pinfo = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84280-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_pinfo from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_defrtr from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_pinfo.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_defrtr.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_pinfo" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra_defrtr" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187156,37 +187240,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_pinfo_value='' +sysctl_net_ipv6_conf_all_accept_ra_defrtr_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_pinfo +# Set runtime for net.ipv6.conf.all.accept_ra_defrtr # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_pinfo="$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_defrtr="$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" # -# If net.ipv6.conf.all.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_pinfo = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_defrtr = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_pinfo") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_defrtr") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_defrtr_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84280-7" + cce="CCE-84272-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187195,6 +187279,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_pinfo=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_pinfo = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84280-7 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187254,34 +187354,18 @@ fi - sysctl_net_ipv6_conf_all_accept_ra_pinfo - unknown_severity - - - - - - - - - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_rtr_pref=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_rtr_pref = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84288-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_pinfo from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_rtr_pref.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_pinfo.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_ra_rtr_pref" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_ra_pinfo" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187293,37 +187377,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value='' +sysctl_net_ipv6_conf_all_accept_ra_pinfo_value='' # -# Set runtime for net.ipv6.conf.all.accept_ra_rtr_pref +# Set runtime for net.ipv6.conf.all.accept_ra_pinfo # -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_pinfo="$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" # -# If net.ipv6.conf.all.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_pinfo = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_rtr_pref") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_pinfo") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_pinfo_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84288-0" + cce="CCE-84280-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187332,6 +187416,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.accept_ra_rtr_pref=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.accept_ra_rtr_pref = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84288-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187390,6 +187490,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_ra_rtr_pref - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_ra_rtr_pref.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.accept_ra_rtr_pref" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value='' + + +# +# Set runtime for net.ipv6.conf.all.accept_ra_rtr_pref +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" + +# +# If net.ipv6.conf.all.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_ra_rtr_pref") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84288-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -187483,83 +187645,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit ICMP redirect message could result in a man-in-the-middle attack. CCE-81009-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_redirects_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_redirects="$sysctl_net_ipv6_conf_all_accept_redirects_value" - -# -# If net.ipv6.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81009-3" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187639,6 +187724,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv6_conf_all_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_accept_redirects_value='' + + +# +# Set runtime for net.ipv6.conf.all.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_redirects="$sysctl_net_ipv6_conf_all_accept_redirects_value" + +# +# If net.ipv6.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-81009-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -187736,83 +187898,6 @@ Accepting source-routed packets in the IPv6 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81013-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.all.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_accept_source_route_value='' - - -# -# Set runtime for net.ipv6.conf.all.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_source_route="$sysctl_net_ipv6_conf_all_accept_source_route_value" - -# -# If net.ipv6.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81013-5" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -187887,34 +187972,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_accept_source_route - - - - - - - - - - Configure Auto Configuration on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.autoconf=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.autoconf = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84266-6 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.all.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_all_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.autoconf from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.autoconf.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.autoconf" matches to preserve user data + # comment out "net.ipv6.conf.all.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -187926,37 +188010,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_autoconf_value='' +sysctl_net_ipv6_conf_all_accept_source_route_value='' # -# Set runtime for net.ipv6.conf.all.autoconf +# Set runtime for net.ipv6.conf.all.accept_source_route # -/sbin/sysctl -q -n -w net.ipv6.conf.all.autoconf="$sysctl_net_ipv6_conf_all_autoconf_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.accept_source_route="$sysctl_net_ipv6_conf_all_accept_source_route_value" # -# If net.ipv6.conf.all.autoconf present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.autoconf = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.autoconf") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_autoconf_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.autoconf\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84266-6" + cce="CCE-81013-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -187965,6 +188049,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Auto Configuration on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.autoconf=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.autoconf = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84266-6 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188022,6 +188122,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_autoconf - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.autoconf from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.autoconf.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.autoconf" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_autoconf_value='' + + +# +# Set runtime for net.ipv6.conf.all.autoconf +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.autoconf="$sysctl_net_ipv6_conf_all_autoconf_value" + +# +# If net.ipv6.conf.all.autoconf present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.autoconf = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.autoconf") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_autoconf_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.autoconf\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84266-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -188134,68 +188296,6 @@ interface to another. The ability to forward packets between two networks is only appropriate for systems acting as routers. CCE-82863-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.all.forwarding from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.forwarding.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.forwarding" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_all_forwarding_value='' - - -# -# Set runtime for net.ipv6.conf.all.forwarding -# -/sbin/sysctl -q -n -w net.ipv6.conf.all.forwarding="$sysctl_net_ipv6_conf_all_forwarding_value" - -# -# If net.ipv6.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.forwarding = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.forwarding") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_forwarding_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-82863-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188272,34 +188372,18 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_forwarding - - - - - - - - - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.max_addresses=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.max_addresses = 1 - BP28(R22) - The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. - - CCE-84259-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.max_addresses from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.forwarding from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.max_addresses.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.forwarding.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.max_addresses" matches to preserve user data + # comment out "net.ipv6.conf.all.forwarding" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188311,37 +188395,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_max_addresses_value='' +sysctl_net_ipv6_conf_all_forwarding_value='' # -# Set runtime for net.ipv6.conf.all.max_addresses +# Set runtime for net.ipv6.conf.all.forwarding # -/sbin/sysctl -q -n -w net.ipv6.conf.all.max_addresses="$sysctl_net_ipv6_conf_all_max_addresses_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.forwarding="$sysctl_net_ipv6_conf_all_forwarding_value" # -# If net.ipv6.conf.all.max_addresses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.max_addresses = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.forwarding = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.max_addresses") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.forwarding") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_max_addresses_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_forwarding_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.max_addresses\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84259-1" + cce="CCE-82863-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188350,6 +188434,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.max_addresses=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.max_addresses = 1 + BP28(R22) + The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. + + CCE-84259-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188409,34 +188509,18 @@ fi - sysctl_net_ipv6_conf_all_max_addresses - unknown_severity - - - - - - - - - - Configure Denying Router Solicitations on All IPv6 Interfaces - To set the runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.router_solicitations=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.router_solicitations = 0 - BP28(R22) - To prevent discovery of the system by other systems, router solicitation requests should be denied. - - CCE-84109-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.all.router_solicitations from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.all.max_addresses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.router_solicitations.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.max_addresses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.all.router_solicitations" matches to preserve user data + # comment out "net.ipv6.conf.all.max_addresses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188448,37 +188532,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_all_router_solicitations_value='' +sysctl_net_ipv6_conf_all_max_addresses_value='' # -# Set runtime for net.ipv6.conf.all.router_solicitations +# Set runtime for net.ipv6.conf.all.max_addresses # -/sbin/sysctl -q -n -w net.ipv6.conf.all.router_solicitations="$sysctl_net_ipv6_conf_all_router_solicitations_value" +/sbin/sysctl -q -n -w net.ipv6.conf.all.max_addresses="$sysctl_net_ipv6_conf_all_max_addresses_value" # -# If net.ipv6.conf.all.router_solicitations present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.all.router_solicitations = value" to /etc/sysctl.conf +# If net.ipv6.conf.all.max_addresses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.max_addresses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.router_solicitations") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.max_addresses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_router_solicitations_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_max_addresses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.router_solicitations\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.max_addresses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84109-8" + cce="CCE-84259-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188487,6 +188571,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Denying Router Solicitations on All IPv6 Interfaces + To set the runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.all.router_solicitations=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.all.router_solicitations = 0 + BP28(R22) + To prevent discovery of the system by other systems, router solicitation requests should be denied. + + CCE-84109-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188545,6 +188645,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_all_router_solicitations - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.all.router_solicitations from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.all.router_solicitations.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.all.router_solicitations" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_all_router_solicitations_value='' + + +# +# Set runtime for net.ipv6.conf.all.router_solicitations +# +/sbin/sysctl -q -n -w net.ipv6.conf.all.router_solicitations="$sysctl_net_ipv6_conf_all_router_solicitations_value" + +# +# If net.ipv6.conf.all.router_solicitations present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.all.router_solicitations = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.all.router_solicitations") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_all_router_solicitations_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.all.router_solicitations\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.all.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84109-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -188634,83 +188796,6 @@ To make sure that the setting is persistent, add the following line to a file in An illicit router advertisement message could result in a man-in-the-middle attack. CCE-81007-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.default.accept_ra%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_ra.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.accept_ra from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_default_accept_ra_value='' - - -# -# Set runtime for net.ipv6.conf.default.accept_ra -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra="$sysctl_net_ipv6_conf_default_accept_ra_value" - -# -# If net.ipv6.conf.default.accept_ra present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81007-7" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188785,34 +188870,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_ra - - - - - - - - - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_defrtr=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_defrtr = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84268-2 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.default.accept_ra%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_ra.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_defrtr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_defrtr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_defrtr" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188824,37 +188908,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_defrtr_value='' +sysctl_net_ipv6_conf_default_accept_ra_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_defrtr +# Set runtime for net.ipv6.conf.default.accept_ra # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_defrtr="$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra="$sysctl_net_ipv6_conf_default_accept_ra_value" # -# If net.ipv6.conf.default.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_defrtr = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_defrtr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84268-2" + cce="CCE-81007-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -188863,6 +188947,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_defrtr=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_defrtr = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84268-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -188922,34 +189022,18 @@ fi - sysctl_net_ipv6_conf_default_accept_ra_defrtr - unknown_severity - - - - - - - - - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_pinfo=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_pinfo = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84051-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_pinfo from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_defrtr from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_pinfo.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_defrtr.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_pinfo" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra_defrtr" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -188961,37 +189045,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_pinfo_value='' +sysctl_net_ipv6_conf_default_accept_ra_defrtr_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_pinfo +# Set runtime for net.ipv6.conf.default.accept_ra_defrtr # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_pinfo="$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_defrtr="$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" # -# If net.ipv6.conf.default.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_pinfo = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra_defrtr present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_defrtr = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_pinfo") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_defrtr") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_defrtr_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_defrtr\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_defrtr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84051-2" + cce="CCE-84268-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189000,6 +189084,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_pinfo=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_pinfo = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84051-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189059,34 +189159,18 @@ fi - sysctl_net_ipv6_conf_default_accept_ra_pinfo - unknown_severity - - - - - - - - - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_rtr_pref=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_rtr_pref = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84291-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_pinfo from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_rtr_pref.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_pinfo.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_ra_rtr_pref" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_ra_pinfo" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189098,37 +189182,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value='' +sysctl_net_ipv6_conf_default_accept_ra_pinfo_value='' # -# Set runtime for net.ipv6.conf.default.accept_ra_rtr_pref +# Set runtime for net.ipv6.conf.default.accept_ra_pinfo # -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_pinfo="$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" # -# If net.ipv6.conf.default.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_ra_pinfo present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_pinfo = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_rtr_pref") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_pinfo") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_pinfo_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_pinfo\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_pinfo\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84291-4" + cce="CCE-84051-2" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189137,6 +189221,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.accept_ra_rtr_pref=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.accept_ra_rtr_pref = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84291-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189195,6 +189295,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_ra_rtr_pref - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.accept_ra_rtr_pref from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_ra_rtr_pref.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.accept_ra_rtr_pref" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value='' + + +# +# Set runtime for net.ipv6.conf.default.accept_ra_rtr_pref +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_ra_rtr_pref="$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" + +# +# If net.ipv6.conf.default.accept_ra_rtr_pref present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_ra_rtr_pref = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_ra_rtr_pref") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_ra_rtr_pref\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_ra_rtr_pref\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84291-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -189286,6 +189448,80 @@ To make sure that the setting is persistent, add the following line to a file in An illicit ICMP redirect message could result in a man-in-the-middle attack. CCE-81010-1 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv6.conf.default.accept_redirects.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects + +- name: Comment out any occurrences of net.ipv6.conf.default.accept_redirects from + config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv6.conf.default.accept_redirects + replace: '#net.ipv6.conf.default.accept_redirects' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects +- name: XCCDF Value sysctl_net_ipv6_conf_default_accept_redirects_value # promote to variable + set_fact: + sysctl_net_ipv6_conf_default_accept_redirects_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv6.conf.default.accept_redirects is set + sysctl: + name: net.ipv6.conf.default.accept_redirects + value: '{{ sysctl_net_ipv6_conf_default_accept_redirects_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81010-1 + - DISA-STIG-RHEL-08-040210 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv6_conf_default_accept_redirects + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -189362,80 +189598,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv6.conf.default.accept_redirects.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects - -- name: Comment out any occurrences of net.ipv6.conf.default.accept_redirects from - config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv6.conf.default.accept_redirects - replace: '#net.ipv6.conf.default.accept_redirects' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects -- name: XCCDF Value sysctl_net_ipv6_conf_default_accept_redirects_value # promote to variable - set_fact: - sysctl_net_ipv6_conf_default_accept_redirects_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv6.conf.default.accept_redirects is set - sysctl: - name: net.ipv6.conf.default.accept_redirects - value: '{{ sysctl_net_ipv6_conf_default_accept_redirects_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81010-1 - - DISA-STIG-RHEL-08-040210 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv6_conf_default_accept_redirects @@ -189537,83 +189699,6 @@ Accepting source-routed packets in the IPv6 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81015-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv6.conf.default.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv6.conf.default.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv6_conf_default_accept_source_route_value='' - - -# -# Set runtime for net.ipv6.conf.default.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_source_route="$sysctl_net_ipv6_conf_default_accept_source_route_value" - -# -# If net.ipv6.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81015-0" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189700,34 +189785,33 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_accept_source_route - - - - - - - - - - Configure Auto Configuration on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.autoconf=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.autoconf = 0 - BP28(R22) - An illicit router advertisement message could result in a man-in-the-middle attack. - - CCE-84264-1 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv6.conf.default.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv6_conf_default_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.autoconf from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.autoconf.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.autoconf" matches to preserve user data + # comment out "net.ipv6.conf.default.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189739,37 +189823,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_autoconf_value='' +sysctl_net_ipv6_conf_default_accept_source_route_value='' # -# Set runtime for net.ipv6.conf.default.autoconf +# Set runtime for net.ipv6.conf.default.accept_source_route # -/sbin/sysctl -q -n -w net.ipv6.conf.default.autoconf="$sysctl_net_ipv6_conf_default_autoconf_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.accept_source_route="$sysctl_net_ipv6_conf_default_accept_source_route_value" # -# If net.ipv6.conf.default.autoconf present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.autoconf = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.autoconf") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_autoconf_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.autoconf\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84264-1" + cce="CCE-81015-0" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189778,6 +189862,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Auto Configuration on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.autoconf kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.autoconf=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.autoconf = 0 + BP28(R22) + An illicit router advertisement message could result in a man-in-the-middle attack. + + CCE-84264-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189837,34 +189937,18 @@ fi - sysctl_net_ipv6_conf_default_autoconf - unknown_severity - - - - - - - - - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.max_addresses=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.max_addresses = 1 - BP28(R22) - The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. - - CCE-84257-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.max_addresses from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.autoconf from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.max_addresses.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.autoconf.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.max_addresses" matches to preserve user data + # comment out "net.ipv6.conf.default.autoconf" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -189876,37 +189960,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_max_addresses_value='' +sysctl_net_ipv6_conf_default_autoconf_value='' # -# Set runtime for net.ipv6.conf.default.max_addresses +# Set runtime for net.ipv6.conf.default.autoconf # -/sbin/sysctl -q -n -w net.ipv6.conf.default.max_addresses="$sysctl_net_ipv6_conf_default_max_addresses_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.autoconf="$sysctl_net_ipv6_conf_default_autoconf_value" # -# If net.ipv6.conf.default.max_addresses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.max_addresses = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.autoconf present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.autoconf = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.max_addresses") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.autoconf") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_max_addresses_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_autoconf_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.max_addresses\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.autoconf\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.autoconf\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84257-5" + cce="CCE-84264-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -189915,6 +189999,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.max_addresses kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.max_addresses=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.max_addresses = 1 + BP28(R22) + The number of global unicast IPv6 addresses for each interface should be limited exactly to the number of statically configured addresses. + + CCE-84257-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -189974,34 +190074,18 @@ fi - sysctl_net_ipv6_conf_default_max_addresses - unknown_severity - - - - - - - - - - Configure Denying Router Solicitations on All IPv6 Interfaces By Default - To set the runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.router_solicitations=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.router_solicitations = 0 - BP28(R22) - To prevent discovery of the system by other systems, router solicitation requests should be denied. - - CCE-83477-0 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv6.conf.default.router_solicitations from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv6.conf.default.max_addresses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.router_solicitations.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.max_addresses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv6.conf.default.router_solicitations" matches to preserve user data + # comment out "net.ipv6.conf.default.max_addresses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -190013,37 +190097,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv6_conf_default_router_solicitations_value='' +sysctl_net_ipv6_conf_default_max_addresses_value='' # -# Set runtime for net.ipv6.conf.default.router_solicitations +# Set runtime for net.ipv6.conf.default.max_addresses # -/sbin/sysctl -q -n -w net.ipv6.conf.default.router_solicitations="$sysctl_net_ipv6_conf_default_router_solicitations_value" +/sbin/sysctl -q -n -w net.ipv6.conf.default.max_addresses="$sysctl_net_ipv6_conf_default_max_addresses_value" # -# If net.ipv6.conf.default.router_solicitations present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv6.conf.default.router_solicitations = value" to /etc/sysctl.conf +# If net.ipv6.conf.default.max_addresses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.max_addresses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.router_solicitations") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.max_addresses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_router_solicitations_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_max_addresses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.router_solicitations\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.max_addresses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.max_addresses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83477-0" + cce="CCE-84257-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -190052,6 +190136,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Denying Router Solicitations on All IPv6 Interfaces By Default + To set the runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter, run the following command: $ sudo sysctl -w net.ipv6.conf.default.router_solicitations=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv6.conf.default.router_solicitations = 0 + BP28(R22) + To prevent discovery of the system by other systems, router solicitation requests should be denied. + + CCE-83477-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -190110,6 +190210,68 @@ fi - reboot_required - sysctl_net_ipv6_conf_default_router_solicitations - unknown_severity + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv6.conf.default.router_solicitations from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv6.conf.default.router_solicitations.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv6.conf.default.router_solicitations" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv6_conf_default_router_solicitations_value='' + + +# +# Set runtime for net.ipv6.conf.default.router_solicitations +# +/sbin/sysctl -q -n -w net.ipv6.conf.default.router_solicitations="$sysctl_net_ipv6_conf_default_router_solicitations_value" + +# +# If net.ipv6.conf.default.router_solicitations present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv6.conf.default.router_solicitations = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv6.conf.default.router_solicitations") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv6_conf_default_router_solicitations_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv6.conf.default.router_solicitations\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv6.conf.default.router_solicitations\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-83477-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -190357,6 +190519,60 @@ received from outside whose source is the 127.0.0.0/8 address block. In combination with suitable routing, this can be used to direct packets between two local interfaces over the wire and have them accepted properly. CCE-88789-3 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.all.accept_local.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + +- name: Comment out any occurrences of net.ipv4.conf.all.accept_local from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.all.accept_local + replace: '#net.ipv4.conf.all.accept_local' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + +- name: Ensure sysctl net.ipv4.conf.all.accept_local is set to 0 + sysctl: + name: net.ipv4.conf.all.accept_local + value: '0' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-88789-3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_all_accept_local + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -190416,60 +190632,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.accept_local.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local - -- name: Comment out any occurrences of net.ipv4.conf.all.accept_local from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.accept_local - replace: '#net.ipv4.conf.all.accept_local' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local - -- name: Ensure sysctl net.ipv4.conf.all.accept_local is set to 0 - sysctl: - name: net.ipv4.conf.all.accept_local - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88789-3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_accept_local @@ -190588,83 +190750,6 @@ message could result in a man-in-the-middle attack. This feature of the IPv4 protocol has few legitimate uses. It should be disabled unless absolutely required." CCE-80917-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_accept_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.all.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_redirects="$sysctl_net_ipv4_conf_all_accept_redirects_value" - -# -# If net.ipv4.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80917-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -190744,6 +190829,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_accept_redirects_value='' + + +# +# Set runtime for net.ipv4.conf.all.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_redirects="$sysctl_net_ipv4_conf_all_accept_redirects_value" + +# +# If net.ipv4.conf.all.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80917-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -190915,83 +191077,6 @@ forwarding is enabled and the system is functioning as a router. Accepting source-routed packets in the IPv4 protocol has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81011-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_accept_source_route_value='' - - -# -# Set runtime for net.ipv4.conf.all.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_source_route="$sysctl_net_ipv4_conf_all_accept_source_route_value" - -# -# If net.ipv4.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81011-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191072,36 +191157,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_accept_source_route - - - - - - - - - - Configure ARP filtering for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.arp_filter kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_filter= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_filter = - This behaviour may cause problems to system on a high availability or load balancing configuration. - BP28(R12) - Prevents the Linux Kernel from handling the ARP table globally. -By default, the kernel may respond to an ARP request from a certain interface with information -from another interface. - CCE-88555-8 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.arp_filter from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.accept_source_route from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_filter.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.accept_source_route.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.arp_filter" matches to preserve user data + # comment out "net.ipv4.conf.all.accept_source_route" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191113,37 +191195,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_arp_filter_value='' +sysctl_net_ipv4_conf_all_accept_source_route_value='' # -# Set runtime for net.ipv4.conf.all.arp_filter +# Set runtime for net.ipv4.conf.all.accept_source_route # -/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_filter="$sysctl_net_ipv4_conf_all_arp_filter_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.accept_source_route="$sysctl_net_ipv4_conf_all_accept_source_route_value" # -# If net.ipv4.conf.all.arp_filter present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.arp_filter = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.accept_source_route = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_filter") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.accept_source_route") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_filter_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_accept_source_route_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_filter\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.accept_source_route\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88555-8" + cce="CCE-81011-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191152,6 +191234,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure ARP filtering for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.arp_filter kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_filter= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_filter = + This behaviour may cause problems to system on a high availability or load balancing configuration. + BP28(R12) + Prevents the Linux Kernel from handling the ARP table globally. +By default, the kernel may respond to an ARP request from a certain interface with information +from another interface. + CCE-88555-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191210,34 +191310,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_arp_filter - - - - - - - - - - Configure Response Mode of ARP Requests for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_ignore= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_ignore = - The ARP response mode may impact behaviour of workloads and firewalls on the system. - BP28(R12) - Avoids ARP Flux on system that have more than one interface on the same subnet. - CCE-88889-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.arp_ignore from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.arp_filter from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_ignore.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_filter.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.arp_ignore" matches to preserve user data + # comment out "net.ipv4.conf.all.arp_filter" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191249,37 +191333,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_arp_ignore_value='' +sysctl_net_ipv4_conf_all_arp_filter_value='' # -# Set runtime for net.ipv4.conf.all.arp_ignore +# Set runtime for net.ipv4.conf.all.arp_filter # -/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_ignore="$sysctl_net_ipv4_conf_all_arp_ignore_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_filter="$sysctl_net_ipv4_conf_all_arp_filter_value" # -# If net.ipv4.conf.all.arp_ignore present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.arp_ignore = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.arp_filter present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.arp_filter = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_ignore") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_filter") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_ignore_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_filter_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_ignore\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_filter\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_ignore\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88889-1" + cce="CCE-88555-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191288,6 +191372,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Response Mode of ARP Requests for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.arp_ignore= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.arp_ignore = + The ARP response mode may impact behaviour of workloads and firewalls on the system. + BP28(R12) + Avoids ARP Flux on system that have more than one interface on the same subnet. + CCE-88889-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191346,34 +191446,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_arp_ignore - - - - - - - - - - Drop Gratuitious ARP frames on All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.drop_gratuitous_arp=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.drop_gratuitous_arp = 1 - This can cause problems if ARP proxies are used in the network. - BP28(R12) - Drop Gratuitous ARP frames to prevent ARP poisoning. - CCE-88001-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.drop_gratuitous_arp from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.arp_ignore from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.drop_gratuitous_arp.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.arp_ignore.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.drop_gratuitous_arp" matches to preserve user data + # comment out "net.ipv4.conf.all.arp_ignore" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191385,35 +191469,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" +sysctl_net_ipv4_conf_all_arp_ignore_value='' + # -# Set runtime for net.ipv4.conf.all.drop_gratuitous_arp +# Set runtime for net.ipv4.conf.all.arp_ignore # -/sbin/sysctl -q -n -w net.ipv4.conf.all.drop_gratuitous_arp="1" +/sbin/sysctl -q -n -w net.ipv4.conf.all.arp_ignore="$sysctl_net_ipv4_conf_all_arp_ignore_value" # -# If net.ipv4.conf.all.drop_gratuitous_arp present in /etc/sysctl.conf, change value to "1" -# else, add "net.ipv4.conf.all.drop_gratuitous_arp = 1" to /etc/sysctl.conf +# If net.ipv4.conf.all.arp_ignore present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.arp_ignore = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.drop_gratuitous_arp") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.arp_ignore") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_arp_ignore_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.drop_gratuitous_arp\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.arp_ignore\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.drop_gratuitous_arp\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.arp_ignore\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88001-3" + cce="CCE-88889-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191422,6 +191508,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Drop Gratuitious ARP frames on All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.drop_gratuitous_arp=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.drop_gratuitous_arp = 1 + This can cause problems if ARP proxies are used in the network. + BP28(R12) + Drop Gratuitous ARP frames to prevent ARP poisoning. + CCE-88001-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191476,44 +191578,18 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_drop_gratuitous_arp - - - - - - - - - Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.forwarding kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.forwarding=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.forwarding = 0 - There might be cases when certain applications can systematically override this option. -One such case is Libvirt; a toolkit for managing of virtualization platforms. -By default, Libvirt requires IP forwarding to be enabled to facilitate -network communication between the virtualization host and guest -machines. It enables IP forwarding after every reboot. - CCI-000366 - CM-6(b) - SRG-OS-000480-GPOS-00227 - RHEL-08-040259 - SV-250317r858808_rule - IP forwarding permits the kernel to forward packets from one network -interface to another. The ability to forward packets between two networks is -only appropriate for systems acting as routers. - - CCE-86220-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.forwarding from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.drop_gratuitous_arp from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.forwarding.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.drop_gratuitous_arp.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.forwarding" matches to preserve user data + # comment out "net.ipv4.conf.all.drop_gratuitous_arp" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -191525,37 +191601,35 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_forwarding_value='' - # -# Set runtime for net.ipv4.conf.all.forwarding +# Set runtime for net.ipv4.conf.all.drop_gratuitous_arp # -/sbin/sysctl -q -n -w net.ipv4.conf.all.forwarding="$sysctl_net_ipv4_conf_all_forwarding_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.drop_gratuitous_arp="1" # -# If net.ipv4.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.forwarding = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.drop_gratuitous_arp present in /etc/sysctl.conf, change value to "1" +# else, add "net.ipv4.conf.all.drop_gratuitous_arp = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.forwarding") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.drop_gratuitous_arp") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_forwarding_value" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.drop_gratuitous_arp\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.drop_gratuitous_arp\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-86220-1" + cce="CCE-88001-3" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -191564,6 +191638,32 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.forwarding kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.forwarding=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.forwarding = 0 + There might be cases when certain applications can systematically override this option. +One such case is Libvirt; a toolkit for managing of virtualization platforms. +By default, Libvirt requires IP forwarding to be enabled to facilitate +network communication between the virtualization host and guest +machines. It enables IP forwarding after every reboot. + CCI-000366 + CM-6(b) + SRG-OS-000480-GPOS-00227 + RHEL-08-040259 + SV-250317r858808_rule + IP forwarding permits the kernel to forward packets from one network +interface to another. The ability to forward packets between two networks is +only appropriate for systems acting as routers. + + CCE-86220-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -191627,6 +191727,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.forwarding from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.forwarding.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.forwarding" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_forwarding_value='' + + +# +# Set runtime for net.ipv4.conf.all.forwarding +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.forwarding="$sysctl_net_ipv4_conf_all_forwarding_value" + +# +# If net.ipv4.conf.all.forwarding present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.forwarding = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.forwarding") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_forwarding_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.forwarding\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.forwarding\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-86220-1" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -191754,6 +191916,77 @@ as well as spoofed packets, source-routed packets, and redirects could be a sign of nefarious network activity. Logging these packets enables this activity to be detected. CCE-81018-4 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.all.log_martians.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity + +- name: Comment out any occurrences of net.ipv4.conf.all.log_martians from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.all.log_martians + replace: '#net.ipv4.conf.all.log_martians' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity +- name: XCCDF Value sysctl_net_ipv4_conf_all_log_martians_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_all_log_martians_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.all.log_martians is set + sysctl: + name: net.ipv4.conf.all.log_martians + value: '{{ sysctl_net_ipv4_conf_all_log_martians_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81018-4 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_all_log_martians + - unknown_severity + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -191831,94 +192064,77 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + + Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.route_localnet kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.route_localnet=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.route_localnet = 0 + BP28(R12) + Refuse the routing of packets whose source or destination address is the local loopback. +This prohibits the use of network 127/8 for local routing purposes. +Enabling route_localnet can expose applications listening on localhost to external traffic. + CCE-88023-7 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.log_martians.*$ + contains: ^[\s]*net.ipv4.conf.all.route_localnet.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity + - sysctl_net_ipv4_conf_all_route_localnet -- name: Comment out any occurrences of net.ipv4.conf.all.log_martians from config +- name: Comment out any occurrences of net.ipv4.conf.all.route_localnet from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.log_martians - replace: '#net.ipv4.conf.all.log_martians' + regexp: ^[\s]*net.ipv4.conf.all.route_localnet + replace: '#net.ipv4.conf.all.route_localnet' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity -- name: XCCDF Value sysctl_net_ipv4_conf_all_log_martians_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_all_log_martians_value: !!str - tags: - - always + - sysctl_net_ipv4_conf_all_route_localnet -- name: Ensure sysctl net.ipv4.conf.all.log_martians is set +- name: Ensure sysctl net.ipv4.conf.all.route_localnet is set to 0 sysctl: - name: net.ipv4.conf.all.log_martians - value: '{{ sysctl_net_ipv4_conf_all_log_martians_value }}' + name: net.ipv4.conf.all.route_localnet + value: '0' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81018-4 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) + - CCE-88023-7 - disable_strategy - low_complexity - medium_disruption + - medium_severity - reboot_required - - sysctl_net_ipv4_conf_all_log_martians - - unknown_severity + - sysctl_net_ipv4_conf_all_route_localnet - - - - - - - - - - Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.route_localnet kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.route_localnet=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.route_localnet = 0 - BP28(R12) - Refuse the routing of packets whose source or destination address is the local loopback. -This prohibits the use of network 127/8 for local routing purposes. -Enabling route_localnet can expose applications listening on localhost to external traffic. - CCE-88023-7 # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -191978,60 +192194,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.all.route_localnet.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet - -- name: Comment out any occurrences of net.ipv4.conf.all.route_localnet from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.all.route_localnet - replace: '#net.ipv4.conf.all.route_localnet' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet - -- name: Ensure sysctl net.ipv4.conf.all.route_localnet is set to 0 - sysctl: - name: net.ipv4.conf.all.route_localnet - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-88023-7 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_all_route_localnet @@ -192139,83 +192301,6 @@ received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks. CCE-81021-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.rp_filter%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_rp_filter.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.rp_filter from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.rp_filter.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.rp_filter" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_rp_filter_value='' - - -# -# Set runtime for net.ipv4.conf.all.rp_filter -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.rp_filter="$sysctl_net_ipv4_conf_all_rp_filter_value" - -# -# If net.ipv4.conf.all.rp_filter present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.rp_filter = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.rp_filter") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_rp_filter_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.rp_filter\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.rp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81021-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192297,6 +192382,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_rp_filter + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.rp_filter%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_rp_filter.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.rp_filter from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.rp_filter.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.rp_filter" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_rp_filter_value='' + + +# +# Set runtime for net.ipv4.conf.all.rp_filter +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.rp_filter="$sysctl_net_ipv4_conf_all_rp_filter_value" + +# +# If net.ipv4.conf.all.rp_filter present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.rp_filter = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.rp_filter") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_rp_filter_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.rp_filter\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.rp_filter\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-81021-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -192458,83 +192620,6 @@ To make sure that the setting is persistent, add the following line to a file in default gateways) has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81016-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.secure_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_secure_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.secure_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.secure_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.secure_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_all_secure_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.all.secure_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.secure_redirects="$sysctl_net_ipv4_conf_all_secure_redirects_value" - -# -# If net.ipv4.conf.all.secure_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.secure_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.secure_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_secure_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.secure_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81016-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192615,34 +192700,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_all_secure_redirects - - - - - - - - - - Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces - To set the runtime status of the net.ipv4.conf.all.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.shared_media= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.shared_media = - BP28(R12) - This setting should be aligned with net.ipv4.conf.all.secure_redirects because it overrides it. -If shared_media is enabled for an interface secure_redirects will be enabled too. - CCE-88333-0 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.secure_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_secure_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.all.shared_media from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.all.secure_redirects from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.shared_media.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.secure_redirects.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.shared_media" matches to preserve user data + # comment out "net.ipv4.conf.all.secure_redirects" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -192654,37 +192738,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_all_shared_media_value='' +sysctl_net_ipv4_conf_all_secure_redirects_value='' # -# Set runtime for net.ipv4.conf.all.shared_media +# Set runtime for net.ipv4.conf.all.secure_redirects # -/sbin/sysctl -q -n -w net.ipv4.conf.all.shared_media="$sysctl_net_ipv4_conf_all_shared_media_value" +/sbin/sysctl -q -n -w net.ipv4.conf.all.secure_redirects="$sysctl_net_ipv4_conf_all_secure_redirects_value" # -# If net.ipv4.conf.all.shared_media present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.all.shared_media = value" to /etc/sysctl.conf +# If net.ipv4.conf.all.secure_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.secure_redirects = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.shared_media") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.secure_redirects") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_shared_media_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_secure_redirects_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.shared_media\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.secure_redirects\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88333-0" + cce="CCE-81016-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -192693,6 +192777,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces + To set the runtime status of the net.ipv4.conf.all.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.all.shared_media= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.all.shared_media = + BP28(R12) + This setting should be aligned with net.ipv4.conf.all.secure_redirects because it overrides it. +If shared_media is enabled for an interface secure_redirects will be enabled too. + CCE-88333-0 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -192751,6 +192851,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_shared_media + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.shared_media from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.shared_media.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.shared_media" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_all_shared_media_value='' + + +# +# Set runtime for net.ipv4.conf.all.shared_media +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.shared_media="$sysctl_net_ipv4_conf_all_shared_media_value" + +# +# If net.ipv4.conf.all.shared_media present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.all.shared_media = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.shared_media") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_all_shared_media_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.shared_media\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-88333-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -192919,83 +193081,6 @@ message could result in a man-in-the-middle attack. This feature of the IPv4 protocol has few legitimate uses. It should be disabled unless absolutely required. CCE-80919-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.accept_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.accept_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.accept_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_accept_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.default.accept_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_redirects="$sysctl_net_ipv4_conf_default_accept_redirects_value" - -# -# If net.ipv4.conf.default.accept_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.accept_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80919-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -193081,6 +193166,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_accept_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.accept_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.accept_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.accept_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_accept_redirects_value='' + + +# +# Set runtime for net.ipv4.conf.default.accept_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_redirects="$sysctl_net_ipv4_conf_default_accept_redirects_value" + +# +# If net.ipv4.conf.default.accept_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.accept_redirects = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_redirects_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80919-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -193253,83 +193415,6 @@ uses. It should be disabled unless it is absolutely required, such as when IPv4 forwarding is enabled and the system is legitimately functioning as a router. CCE-80920-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.accept_source_route%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_source_route.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.accept_source_route from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_source_route.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.accept_source_route" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_accept_source_route_value='' - - -# -# Set runtime for net.ipv4.conf.default.accept_source_route -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_source_route="$sysctl_net_ipv4_conf_default_accept_source_route_value" - -# -# If net.ipv4.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.accept_source_route = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_source_route") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_source_route_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80920-2" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -193409,6 +193494,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_accept_source_route + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.accept_source_route%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_accept_source_route.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.accept_source_route from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.accept_source_route.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.accept_source_route" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_accept_source_route_value='' + + +# +# Set runtime for net.ipv4.conf.default.accept_source_route +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.accept_source_route="$sysctl_net_ipv4_conf_default_accept_source_route_value" + +# +# If net.ipv4.conf.default.accept_source_route present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.accept_source_route = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.accept_source_route") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_accept_source_route_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.accept_source_route\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.accept_source_route\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80920-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -193536,6 +193698,77 @@ as well as spoofed packets, source-routed packets, and redirects could be a sign of nefarious network activity. Logging these packets enables this activity to be detected. CCE-81020-0 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.default.log_martians.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity + +- name: Comment out any occurrences of net.ipv4.conf.default.log_martians from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.default.log_martians + replace: '#net.ipv4.conf.default.log_martians' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity +- name: XCCDF Value sysctl_net_ipv4_conf_default_log_martians_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_default_log_martians_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.default.log_martians is set + sysctl: + name: net.ipv4.conf.default.log_martians + value: '{{ sysctl_net_ipv4_conf_default_log_martians_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81020-0 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5(3)(a) + - disable_strategy + - low_complexity + - medium_disruption + - reboot_required + - sysctl_net_ipv4_conf_default_log_martians + - unknown_severity + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -193612,77 +193845,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.default.log_martians.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity - -- name: Comment out any occurrences of net.ipv4.conf.default.log_martians from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.default.log_martians - replace: '#net.ipv4.conf.default.log_martians' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity -- name: XCCDF Value sysctl_net_ipv4_conf_default_log_martians_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_default_log_martians_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv4.conf.default.log_martians is set - sysctl: - name: net.ipv4.conf.default.log_martians - value: '{{ sysctl_net_ipv4_conf_default_log_martians_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81020-0 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5(3)(a) - - disable_strategy - - low_complexity - - medium_disruption - - reboot_required - - sysctl_net_ipv4_conf_default_log_martians - - unknown_severity @@ -193786,6 +193948,80 @@ received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks. CCE-81022-6 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.conf.default.rp_filter.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter + +- name: Comment out any occurrences of net.ipv4.conf.default.rp_filter from config + files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.conf.default.rp_filter + replace: '#net.ipv4.conf.default.rp_filter' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter +- name: XCCDF Value sysctl_net_ipv4_conf_default_rp_filter_value # promote to variable + set_fact: + sysctl_net_ipv4_conf_default_rp_filter_value: !!str + tags: + - always + +- name: Ensure sysctl net.ipv4.conf.default.rp_filter is set + sysctl: + name: net.ipv4.conf.default.rp_filter + value: '{{ sysctl_net_ipv4_conf_default_rp_filter_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81022-6 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-7(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_conf_default_rp_filter + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -193862,80 +194098,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.conf.default.rp_filter.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter - -- name: Comment out any occurrences of net.ipv4.conf.default.rp_filter from config - files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.conf.default.rp_filter - replace: '#net.ipv4.conf.default.rp_filter' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter -- name: XCCDF Value sysctl_net_ipv4_conf_default_rp_filter_value # promote to variable - set_fact: - sysctl_net_ipv4_conf_default_rp_filter_value: !!str - tags: - - always - -- name: Ensure sysctl net.ipv4.conf.default.rp_filter is set - sysctl: - name: net.ipv4.conf.default.rp_filter - value: '{{ sysctl_net_ipv4_conf_default_rp_filter_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81022-6 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-7(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_conf_default_rp_filter @@ -194099,83 +194261,6 @@ To make sure that the setting is persistent, add the following line to a file in default gateways) has few legitimate uses. It should be disabled unless it is absolutely required. CCE-81017-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.secure_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_secure_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.secure_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.secure_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.secure_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_conf_default_secure_redirects_value='' - - -# -# Set runtime for net.ipv4.conf.default.secure_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.secure_redirects="$sysctl_net_ipv4_conf_default_secure_redirects_value" - -# -# If net.ipv4.conf.default.secure_redirects present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.secure_redirects = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.secure_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_secure_redirects_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.secure_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81017-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194250,34 +194335,33 @@ fi - reboot_required - sysctl_net_ipv4_conf_default_secure_redirects - - - - - - - - - - Configure Sending and Accepting Shared Media Redirects by Default - To set the runtime status of the net.ipv4.conf.default.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.default.shared_media= -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.default.shared_media = - BP28(R12) - This setting should be aligned with net.ipv4.conf.default.secure_redirects because it overrides it. -If shared_media is enabled for an interface secure_redirects will be enabled too. - CCE-88444-5 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.secure_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_secure_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.conf.default.shared_media from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.conf.default.secure_redirects from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.shared_media.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.secure_redirects.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.shared_media" matches to preserve user data + # comment out "net.ipv4.conf.default.secure_redirects" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -194289,37 +194373,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_conf_default_shared_media_value='' +sysctl_net_ipv4_conf_default_secure_redirects_value='' # -# Set runtime for net.ipv4.conf.default.shared_media +# Set runtime for net.ipv4.conf.default.secure_redirects # -/sbin/sysctl -q -n -w net.ipv4.conf.default.shared_media="$sysctl_net_ipv4_conf_default_shared_media_value" +/sbin/sysctl -q -n -w net.ipv4.conf.default.secure_redirects="$sysctl_net_ipv4_conf_default_secure_redirects_value" # -# If net.ipv4.conf.default.shared_media present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.conf.default.shared_media = value" to /etc/sysctl.conf +# If net.ipv4.conf.default.secure_redirects present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.secure_redirects = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.shared_media") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.secure_redirects") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_shared_media_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_secure_redirects_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.shared_media\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.secure_redirects\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.secure_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-88444-5" + cce="CCE-81017-6" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -194328,6 +194412,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure Sending and Accepting Shared Media Redirects by Default + To set the runtime status of the net.ipv4.conf.default.shared_media kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.conf.default.shared_media= +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.conf.default.shared_media = + BP28(R12) + This setting should be aligned with net.ipv4.conf.default.secure_redirects because it overrides it. +If shared_media is enabled for an interface secure_redirects will be enabled too. + CCE-88444-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194386,6 +194486,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_shared_media + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.shared_media from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.shared_media.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.shared_media" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_conf_default_shared_media_value='' + + +# +# Set runtime for net.ipv4.conf.default.shared_media +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.shared_media="$sysctl_net_ipv4_conf_default_shared_media_value" + +# +# If net.ipv4.conf.default.shared_media present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.conf.default.shared_media = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.shared_media") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_conf_default_shared_media_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.shared_media\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.shared_media\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-88444-5" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -194554,83 +194716,6 @@ and provides a vector for amplification attacks. Ignoring ICMP echo requests (pings) sent to broadcast or multicast addresses makes the system slightly more difficult to enumerate on the network. CCE-80922-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.icmp_echo_ignore_broadcasts%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_echo_ignore_broadcasts.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.icmp_echo_ignore_broadcasts from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_echo_ignore_broadcasts.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.icmp_echo_ignore_broadcasts" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value='' - - -# -# Set runtime for net.ipv4.icmp_echo_ignore_broadcasts -# -/sbin/sysctl -q -n -w net.ipv4.icmp_echo_ignore_broadcasts="$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" - -# -# If net.ipv4.icmp_echo_ignore_broadcasts present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.icmp_echo_ignore_broadcasts = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_echo_ignore_broadcasts") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_echo_ignore_broadcasts\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_echo_ignore_broadcasts\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80922-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194713,6 +194798,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_icmp_echo_ignore_broadcasts + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.icmp_echo_ignore_broadcasts%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_echo_ignore_broadcasts.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.icmp_echo_ignore_broadcasts from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_echo_ignore_broadcasts.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.icmp_echo_ignore_broadcasts" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value='' + + +# +# Set runtime for net.ipv4.icmp_echo_ignore_broadcasts +# +/sbin/sysctl -q -n -w net.ipv4.icmp_echo_ignore_broadcasts="$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" + +# +# If net.ipv4.icmp_echo_ignore_broadcasts present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.icmp_echo_ignore_broadcasts = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_echo_ignore_broadcasts") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_echo_ignore_broadcasts_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_echo_ignore_broadcasts\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_echo_ignore_broadcasts\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80922-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -194826,83 +194988,6 @@ To make sure that the setting is persistent, add the following line to a file in Ignoring bogus ICMP error responses reduces log size, although some activity would not be logged. CCE-81023-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.icmp_ignore_bogus_error_responses%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_ignore_bogus_error_responses.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.icmp_ignore_bogus_error_responses from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_ignore_bogus_error_responses.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.icmp_ignore_bogus_error_responses" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value='' - - -# -# Set runtime for net.ipv4.icmp_ignore_bogus_error_responses -# -/sbin/sysctl -q -n -w net.ipv4.icmp_ignore_bogus_error_responses="$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" - -# -# If net.ipv4.icmp_ignore_bogus_error_responses present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.icmp_ignore_bogus_error_responses = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_ignore_bogus_error_responses") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_ignore_bogus_error_responses\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_ignore_bogus_error_responses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-81023-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -194980,35 +195065,33 @@ fi - sysctl_net_ipv4_icmp_ignore_bogus_error_responses - unknown_severity - - - - - - - - - - Set Kernel Parameter to Increase Local Port Range - To set the runtime status of the net.ipv4.ip_local_port_range kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.ip_local_port_range=32768 65535 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.ip_local_port_range = 32768 65535 - BP28(R22) - This setting defines the local port range that is used by TCP and UDP to -choose the local port. The first number is the first, the second the last -local port number. - CCE-84277-3 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.icmp_ignore_bogus_error_responses%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_icmp_ignore_bogus_error_responses.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.ip_local_port_range from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.icmp_ignore_bogus_error_responses from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_local_port_range.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.icmp_ignore_bogus_error_responses.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.ip_local_port_range" matches to preserve user data + # comment out "net.ipv4.icmp_ignore_bogus_error_responses" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195020,35 +195103,37 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" +sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value='' + # -# Set runtime for net.ipv4.ip_local_port_range +# Set runtime for net.ipv4.icmp_ignore_bogus_error_responses # -/sbin/sysctl -q -n -w net.ipv4.ip_local_port_range="32768 65535" +/sbin/sysctl -q -n -w net.ipv4.icmp_ignore_bogus_error_responses="$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" # -# If net.ipv4.ip_local_port_range present in /etc/sysctl.conf, change value to "32768 65535" -# else, add "net.ipv4.ip_local_port_range = 32768 65535" to /etc/sysctl.conf +# If net.ipv4.icmp_ignore_bogus_error_responses present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.icmp_ignore_bogus_error_responses = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.ip_local_port_range") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.icmp_ignore_bogus_error_responses") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "32768 65535" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_icmp_ignore_bogus_error_responses_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.ip_local_port_range\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.icmp_ignore_bogus_error_responses\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.ip_local_port_range\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.icmp_ignore_bogus_error_responses\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84277-3" + cce="CCE-81023-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195057,6 +195142,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Set Kernel Parameter to Increase Local Port Range + To set the runtime status of the net.ipv4.ip_local_port_range kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.ip_local_port_range=32768 65535 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.ip_local_port_range = 32768 65535 + BP28(R22) + This setting defines the local port range that is used by TCP and UDP to +choose the local port. The first number is the first, the second the last +local port number. + CCE-84277-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195110,56 +195212,18 @@ fi - reboot_required - sysctl_net_ipv4_ip_local_port_range - - - - - - - - - Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments - Make sure that the system is configured to limit the maximal rate for sending -duplicate acknowledgments in response to incoming TCP packets that are for -an existing connection but that are invalid due to any of these reasons: - -(a) out-of-window sequence number, (b) out-of-window acknowledgment number, -or (c) PAWS (Protection Against Wrapped Sequence numbers) check failure -This measure protects against or limits effects of DoS attacks against the system. -Set the system to implement rate-limiting measures by adding the following line to -/etc/sysctl.conf or a configuration file in the /etc/sysctl.d/ directory -(or modify the line to have the required value): -net.ipv4.tcp_invalid_ratelimit = -Issue the following command to make the changes take effect: -# sysctl --system - CCI-002385 - CIP-007-3 R4 - CIP-007-3 R4.1 - CIP-007-3 R4.2 - CIP-007-3 R5.1 - SC-5 - SRG-OS-000420-GPOS-00186 - Denial of Service (DoS) is a condition when a resource is not available for legitimate users. When -this occurs, the organization either cannot accomplish its mission or must -operate at degraded capacity. - -This can help mitigate simple “ack loop” DoS attacks, wherein a buggy or -malicious middlebox or man-in-the-middle can rewrite TCP header fields in -manner that causes each endpoint to think that the other is sending invalid -TCP segments, thus causing each side to send an unterminating stream of -duplicate acknowledgments for invalid segments. - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.tcp_invalid_ratelimit from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.ip_local_port_range from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_invalid_ratelimit.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_local_port_range.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_invalid_ratelimit" matches to preserve user data + # comment out "net.ipv4.ip_local_port_range" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195171,36 +195235,36 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_tcp_invalid_ratelimit_value='' - # -# Set runtime for net.ipv4.tcp_invalid_ratelimit +# Set runtime for net.ipv4.ip_local_port_range # -/sbin/sysctl -q -n -w net.ipv4.tcp_invalid_ratelimit="$sysctl_net_ipv4_tcp_invalid_ratelimit_value" +/sbin/sysctl -q -n -w net.ipv4.ip_local_port_range="32768 65535" # -# If net.ipv4.tcp_invalid_ratelimit present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_invalid_ratelimit = value" to /etc/sysctl.conf +# If net.ipv4.ip_local_port_range present in /etc/sysctl.conf, change value to "32768 65535" +# else, add "net.ipv4.ip_local_port_range = 32768 65535" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_invalid_ratelimit") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.ip_local_port_range") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_invalid_ratelimit_value" +printf -v formatted_output "%s = %s" "$stripped_key" "32768 65535" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_invalid_ratelimit\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.ip_local_port_range\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_invalid_ratelimit\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.ip_local_port_range\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi + cce="CCE-84277-3" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195208,6 +195272,44 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments + Make sure that the system is configured to limit the maximal rate for sending +duplicate acknowledgments in response to incoming TCP packets that are for +an existing connection but that are invalid due to any of these reasons: + +(a) out-of-window sequence number, (b) out-of-window acknowledgment number, +or (c) PAWS (Protection Against Wrapped Sequence numbers) check failure +This measure protects against or limits effects of DoS attacks against the system. +Set the system to implement rate-limiting measures by adding the following line to +/etc/sysctl.conf or a configuration file in the /etc/sysctl.d/ directory +(or modify the line to have the required value): +net.ipv4.tcp_invalid_ratelimit = +Issue the following command to make the changes take effect: +# sysctl --system + CCI-002385 + CIP-007-3 R4 + CIP-007-3 R4.1 + CIP-007-3 R4.2 + CIP-007-3 R5.1 + SC-5 + SRG-OS-000420-GPOS-00186 + Denial of Service (DoS) is a condition when a resource is not available for legitimate users. When +this occurs, the organization either cannot accomplish its mission or must +operate at degraded capacity. + +This can help mitigate simple “ack loop” DoS attacks, wherein a buggy or +malicious middlebox or man-in-the-middle can rewrite TCP header fields in +manner that causes each endpoint to think that the other is sending invalid +TCP segments, thus causing each side to send an unterminating stream of +duplicate acknowledgments for invalid segments. - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195267,35 +195369,18 @@ fi - reboot_required - sysctl_net_ipv4_tcp_invalid_ratelimit - - - - - - - - - - Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces - To set the runtime status of the net.ipv4.tcp_rfc1337 kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.tcp_rfc1337=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.tcp_rfc1337 = 1 - BP28(R22) - Enable TCP behavior conformant with RFC 1337. When disabled, if a RST is -received in TIME_WAIT state, we close the socket immediately without waiting -for the end of the TIME_WAIT period. - CCE-84270-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.ipv4.tcp_rfc1337 from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.ipv4.tcp_invalid_ratelimit from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_rfc1337.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_invalid_ratelimit.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_rfc1337" matches to preserve user data + # comment out "net.ipv4.tcp_invalid_ratelimit" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -195307,38 +195392,36 @@ done SYSCONFIG_FILE="/etc/sysctl.conf" -sysctl_net_ipv4_tcp_rfc1337_value='' +sysctl_net_ipv4_tcp_invalid_ratelimit_value='' # -# Set runtime for net.ipv4.tcp_rfc1337 +# Set runtime for net.ipv4.tcp_invalid_ratelimit # -/sbin/sysctl -q -n -w net.ipv4.tcp_rfc1337="$sysctl_net_ipv4_tcp_rfc1337_value" +/sbin/sysctl -q -n -w net.ipv4.tcp_invalid_ratelimit="$sysctl_net_ipv4_tcp_invalid_ratelimit_value" # -# If net.ipv4.tcp_rfc1337 present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_rfc1337 = value" to /etc/sysctl.conf +# If net.ipv4.tcp_invalid_ratelimit present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_invalid_ratelimit = value" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_rfc1337") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_invalid_ratelimit") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_rfc1337_value" +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_invalid_ratelimit_value" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_rfc1337\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_invalid_ratelimit\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_rfc1337\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_invalid_ratelimit\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-84270-8" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -195346,6 +195429,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces + To set the runtime status of the net.ipv4.tcp_rfc1337 kernel parameter, run the following command: $ sudo sysctl -w net.ipv4.tcp_rfc1337=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.ipv4.tcp_rfc1337 = 1 + BP28(R22) + Enable TCP behavior conformant with RFC 1337. When disabled, if a RST is +received in TIME_WAIT state, we close the socket immediately without waiting +for the end of the TIME_WAIT period. + CCE-84270-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195403,6 +195503,68 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_tcp_rfc1337 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.tcp_rfc1337 from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_rfc1337.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.tcp_rfc1337" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_tcp_rfc1337_value='' + + +# +# Set runtime for net.ipv4.tcp_rfc1337 +# +/sbin/sysctl -q -n -w net.ipv4.tcp_rfc1337="$sysctl_net_ipv4_tcp_rfc1337_value" + +# +# If net.ipv4.tcp_rfc1337 present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_rfc1337 = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_rfc1337") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_rfc1337_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_rfc1337\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_rfc1337\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-84270-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -195515,83 +195677,6 @@ verifying the initiator is attempting a valid connection and is not a flood source. This feature is activated when a flood condition is detected, and enables the system to continue servicing valid connection requests. CCE-80923-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.tcp_syncookies%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_tcp_syncookies.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.tcp_syncookies from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_syncookies.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.tcp_syncookies" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - -sysctl_net_ipv4_tcp_syncookies_value='' - - -# -# Set runtime for net.ipv4.tcp_syncookies -# -/sbin/sysctl -q -n -w net.ipv4.tcp_syncookies="$sysctl_net_ipv4_tcp_syncookies_value" - -# -# If net.ipv4.tcp_syncookies present in /etc/sysctl.conf, change value to appropriate value -# else, add "net.ipv4.tcp_syncookies = value" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_syncookies") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_syncookies_value" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_syncookies\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_syncookies\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80923-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -195679,6 +195764,83 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_tcp_syncookies + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.tcp_syncookies%3D1%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_tcp_syncookies.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.tcp_syncookies from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.tcp_syncookies.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.tcp_syncookies" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + +sysctl_net_ipv4_tcp_syncookies_value='' + + +# +# Set runtime for net.ipv4.tcp_syncookies +# +/sbin/sysctl -q -n -w net.ipv4.tcp_syncookies="$sysctl_net_ipv4_tcp_syncookies_value" + +# +# If net.ipv4.tcp_syncookies present in /etc/sysctl.conf, change value to appropriate value +# else, add "net.ipv4.tcp_syncookies = value" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.tcp_syncookies") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "$sysctl_net_ipv4_tcp_syncookies_value" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.tcp_syncookies\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.tcp_syncookies\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80923-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -195856,81 +196018,6 @@ from the system's route table possibly revealing portions of the network topolog The ability to send ICMP redirects is only appropriate for systems acting as routers. CCE-80918-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.all.send_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_send_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.all.send_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.send_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.all.send_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv4.conf.all.send_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.all.send_redirects="0" - -# -# If net.ipv4.conf.all.send_redirects present in /etc/sysctl.conf, change value to "0" -# else, add "net.ipv4.conf.all.send_redirects = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.send_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.send_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80918-6" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -196011,6 +196098,81 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_all_send_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.all.send_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_all_send_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.all.send_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.all.send_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.all.send_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv4.conf.all.send_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.all.send_redirects="0" + +# +# If net.ipv4.conf.all.send_redirects present in /etc/sysctl.conf, change value to "0" +# else, add "net.ipv4.conf.all.send_redirects = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.all.send_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.all.send_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.all.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80918-6" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196180,81 +196342,6 @@ from the system's route table possibly revealing portions of the network topolog The ability to send ICMP redirects is only appropriate for systems acting as routers. CCE-80921-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,net.ipv4.conf.default.send_redirects%3D0%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_send_redirects.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.conf.default.send_redirects from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.send_redirects.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.ipv4.conf.default.send_redirects" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for net.ipv4.conf.default.send_redirects -# -/sbin/sysctl -q -n -w net.ipv4.conf.default.send_redirects="0" - -# -# If net.ipv4.conf.default.send_redirects present in /etc/sysctl.conf, change value to "0" -# else, add "net.ipv4.conf.default.send_redirects = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.send_redirects") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.send_redirects\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80921-0" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -196335,6 +196422,81 @@ fi - medium_severity - reboot_required - sysctl_net_ipv4_conf_default_send_redirects + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,net.ipv4.conf.default.send_redirects%3D0%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_net_ipv4_conf_default_send_redirects.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.conf.default.send_redirects from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.conf.default.send_redirects.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "net.ipv4.conf.default.send_redirects" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for net.ipv4.conf.default.send_redirects +# +/sbin/sysctl -q -n -w net.ipv4.conf.default.send_redirects="0" + +# +# If net.ipv4.conf.default.send_redirects present in /etc/sysctl.conf, change value to "0" +# else, add "net.ipv4.conf.default.send_redirects = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.ipv4.conf.default.send_redirects") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^net.ipv4.conf.default.send_redirects\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^net.ipv4.conf.default.send_redirects\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80921-0" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196471,12 +196633,92 @@ not required, system network information may be unnecessarily transmitted across the network. CCE-81024-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of net.ipv4.ip_forward from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*net.ipv4.ip_forward.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + +- name: Comment out any occurrences of net.ipv4.ip_forward from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*net.ipv4.ip_forward + replace: '#net.ipv4.ip_forward' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + +- name: Ensure sysctl net.ipv4.ip_forward is set to 0 + sysctl: + name: net.ipv4.ip_forward + value: '0' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81024-2 + - NIST-800-171-3.1.20 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-SC-5 + - NIST-800-53-SC-7(a) + - PCI-DSS-Req-1.3.1 + - PCI-DSS-Req-1.3.2 + - PCI-DSSv4-1.4.3 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_net_ipv4_ip_forward + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of net.ipv4.ip_forward from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do matching_list=$(grep -P '^(?!#).*[\s]*net.ipv4.ip_forward.*$' $f | uniq ) if ! test -z "$matching_list"; then @@ -196530,86 +196772,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*net.ipv4.ip_forward.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward - -- name: Comment out any occurrences of net.ipv4.ip_forward from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*net.ipv4.ip_forward - replace: '#net.ipv4.ip_forward' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward - -- name: Ensure sysctl net.ipv4.ip_forward is set to 0 - sysctl: - name: net.ipv4.ip_forward - value: '0' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81024-2 - - NIST-800-171-3.1.20 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-SC-5 - - NIST-800-53-SC-7(a) - - PCI-DSS-Req-1.3.1 - - PCI-DSS-Req-1.3.2 - - PCI-DSSv4-1.4.3 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_net_ipv4_ip_forward @@ -196818,8 +196980,25 @@ originating from within a corporate network to include malicious mobile code and configured software on a host. CCE-86376-1 - -package --add=nftables + - name: Ensure nftables is installed + package: + name: nftables + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86376-1 + - PCI-DSSv4-1.2.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_nftables_installed + + +[[packages]] +name = "nftables" +version = "*" include install_nftables @@ -196828,6 +197007,9 @@ class install_nftables { ensure => 'installed', } } + + +package --add=nftables # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -196839,26 +197021,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "nftables" -version = "*" - - - name: Ensure nftables is installed - package: - name: nftables - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86376-1 - - PCI-DSSv4-1.2.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_nftables_installed @@ -196880,31 +197042,6 @@ in the /etc/sysconfig/nftables.conf file during boot or t the nftables service CCE-86725-9 - include enable_nftables - -class enable_nftables { - service {'nftables': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q nftables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'nftables.service' -"$SYSTEMCTL_EXEC" start 'nftables.service' -"$SYSTEMCTL_EXEC" enable 'nftables.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["nftables"] - - name: Gather the package facts package_facts: manager: auto @@ -196942,6 +197079,31 @@ enabled = ["nftables"] - medium_severity - no_reboot_needed - service_nftables_enabled + + +[customizations.services] +enabled = ["nftables"] + + include enable_nftables + +class enable_nftables { + service {'nftables': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q nftables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'nftables.service' +"$SYSTEMCTL_EXEC" start 'nftables.service' +"$SYSTEMCTL_EXEC" enable 'nftables.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -196962,55 +197124,6 @@ The nftables service can be disabled with the following c is actually one of the backends for firewalld management tools. CCE-88428-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nftables.service - enabled: false - mask: true - - name: nftables.socket - enabled: false - mask: true - - include disable_nftables - -class disable_nftables { - service {'nftables': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q firewalld && rpm --quiet -q nftables ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nftables.service' -"$SYSTEMCTL_EXEC" disable 'nftables.service' -"$SYSTEMCTL_EXEC" mask 'nftables.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nftables.socket; then - "$SYSTEMCTL_EXEC" stop 'nftables.socket' - "$SYSTEMCTL_EXEC" mask 'nftables.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nftables.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nftables"] - - name: Gather the package facts package_facts: manager: auto @@ -197093,6 +197206,55 @@ disabled = ["nftables"] - medium_severity - no_reboot_needed - service_nftables_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: nftables.service + enabled: false + mask: true + - name: nftables.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["nftables"] + + include disable_nftables + +class disable_nftables { + service {'nftables': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q firewalld && rpm --quiet -q nftables ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'nftables.service' +"$SYSTEMCTL_EXEC" disable 'nftables.service' +"$SYSTEMCTL_EXEC" mask 'nftables.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files nftables.socket; then + "$SYSTEMCTL_EXEC" stop 'nftables.socket' + "$SYSTEMCTL_EXEC" mask 'nftables.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'nftables.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197112,27 +197274,6 @@ network traffic. Note: adding rules to a running nftables can cause loss of connectivity to the system. CCE-86162-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q nftables; then - -#Set nftables family name -var_nftables_family='' - - -#Set nftables table name -var_nftables_table='' - - -IS_TABLE=$(nft list tables) -if [ -z "$IS_TABLE" ] -then - nft create table "$var_nftables_family" "$var_nftables_table" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -197183,6 +197324,27 @@ fi - no_reboot_needed - restrict_strategy - set_nftables_table + + # Remediation is applicable only in certain platforms +if rpm --quiet -q nftables; then + +#Set nftables family name +var_nftables_family='' + + +#Set nftables table name +var_nftables_table='' + + +IS_TABLE=$(nft list tables) +if [ -z "$IS_TABLE" ] +then + nft create table "$var_nftables_family" "$var_nftables_table" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197224,31 +197386,6 @@ The ufw service can be enabled with the following command SRG-OS-000297-GPOS-00115 The ufw service must be enabled and running in order for ufw to protect the system - include enable_ufw - -class enable_ufw { - service {'ufw': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q ufw ); }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ufw.service' -"$SYSTEMCTL_EXEC" start 'ufw.service' -"$SYSTEMCTL_EXEC" enable 'ufw.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ufw"] - - name: Gather the package facts package_facts: manager: auto @@ -197286,6 +197423,31 @@ enabled = ["ufw"] - medium_severity - no_reboot_needed - service_ufw_enabled + + +[customizations.services] +enabled = ["ufw"] + + include enable_ufw + +class enable_ufw { + service {'ufw': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q ufw ); }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ufw.service' +"$SYSTEMCTL_EXEC" start 'ufw.service' +"$SYSTEMCTL_EXEC" enable 'ufw.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197325,50 +197487,16 @@ add the following line to file /etc/modprobe.d/atm.conf: SRG-OS-000095-GPOS-00049 SRG-OS-000480-GPOS-00227 RHEL-08-040021 - SV-230494r792911_rule + SV-230494r942918_rule Disabling ATM protects the system against exploitation of any flaws in its implementation. CCE-82028-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20atm%20/bin/true%0Ablacklist%20atm%0A - mode: 0644 - path: /etc/modprobe.d/atm.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install atm" /etc/modprobe.d/atm.conf ; then - - sed -i 's#^install atm.*#install atm /bin/true#g' /etc/modprobe.d/atm.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/atm.conf - echo "install atm /bin/true" >> /etc/modprobe.d/atm.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist atm$" /etc/modprobe.d/atm.conf ; then - echo "blacklist atm" >> /etc/modprobe.d/atm.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'atm' is disabled lineinfile: create: true dest: /etc/modprobe.d/atm.conf regexp: install\s+atm - line: install atm /bin/true + line: install atm /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82028-2 @@ -197398,6 +197526,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20atm%20/bin/true%0Ablacklist%20atm%0A + mode: 0644 + path: /etc/modprobe.d/atm.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install atm" /etc/modprobe.d/atm.conf ; then + + sed -i 's#^install atm.*#install atm /bin/true#g' /etc/modprobe.d/atm.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/atm.conf + echo "install atm /bin/false" >> /etc/modprobe.d/atm.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist atm$" /etc/modprobe.d/atm.conf ; then + echo "blacklist atm" >> /etc/modprobe.d/atm.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197426,50 +197588,16 @@ add the following line to file /etc/modprobe.d/can.conf: SRG-OS-000095-GPOS-00049 SRG-OS-000480-GPOS-00227 RHEL-08-040022 - SV-230495r792914_rule + SV-230495r942921_rule Disabling CAN protects the system against exploitation of any flaws in its implementation. CCE-82059-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20can%20/bin/true%0Ablacklist%20can%0A - mode: 0644 - path: /etc/modprobe.d/can.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install can" /etc/modprobe.d/can.conf ; then - - sed -i 's#^install can.*#install can /bin/true#g' /etc/modprobe.d/can.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/can.conf - echo "install can /bin/true" >> /etc/modprobe.d/can.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist can$" /etc/modprobe.d/can.conf ; then - echo "blacklist can" >> /etc/modprobe.d/can.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'can' is disabled lineinfile: create: true dest: /etc/modprobe.d/can.conf regexp: install\s+can - line: install can /bin/true + line: install can /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82059-7 @@ -197499,6 +197627,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20can%20/bin/true%0Ablacklist%20can%0A + mode: 0644 + path: /etc/modprobe.d/can.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install can" /etc/modprobe.d/can.conf ; then + + sed -i 's#^install can.*#install can /bin/true#g' /etc/modprobe.d/can.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/can.conf + echo "install can /bin/false" >> /etc/modprobe.d/can.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist can$" /etc/modprobe.d/can.conf ; then + echo "blacklist can" >> /etc/modprobe.d/can.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197598,46 +197760,12 @@ add the following line to file /etc/modprobe.d/dccp.conf: Disabling DCCP protects the system against exploitation of any flaws in its implementation. CCE-80833-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20dccp%20/bin/true%0Ablacklist%20dccp%0A - mode: 0644 - path: /etc/modprobe.d/dccp.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install dccp" /etc/modprobe.d/dccp.conf ; then - - sed -i 's#^install dccp.*#install dccp /bin/true#g' /etc/modprobe.d/dccp.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/dccp.conf - echo "install dccp /bin/true" >> /etc/modprobe.d/dccp.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist dccp$" /etc/modprobe.d/dccp.conf ; then - echo "blacklist dccp" >> /etc/modprobe.d/dccp.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'dccp' is disabled lineinfile: create: true dest: /etc/modprobe.d/dccp.conf regexp: install\s+dccp - line: install dccp /bin/true + line: install dccp /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80833-7 @@ -197677,6 +197805,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20dccp%20/bin/true%0Ablacklist%20dccp%0A + mode: 0644 + path: /etc/modprobe.d/dccp.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install dccp" /etc/modprobe.d/dccp.conf ; then + + sed -i 's#^install dccp.*#install dccp /bin/true#g' /etc/modprobe.d/dccp.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/dccp.conf + echo "install dccp /bin/false" >> /etc/modprobe.d/dccp.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist dccp$" /etc/modprobe.d/dccp.conf ; then + echo "blacklist dccp" >> /etc/modprobe.d/dccp.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197702,50 +197864,16 @@ add the following line to file /etc/modprobe.d/firewire-core.confFMT_SMF_EXT.1 SRG-OS-000095-GPOS-00049 RHEL-08-040026 - SV-230499r792924_rule + SV-230499r942933_rule Disabling FireWire protects the system against exploitation of any flaws in its implementation. CCE-82005-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20firewire-core%20/bin/true%0Ablacklist%20firewire-core%0A - mode: 0644 - path: /etc/modprobe.d/firewire-core.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install firewire-core" /etc/modprobe.d/firewire-core.conf ; then - - sed -i 's#^install firewire-core.*#install firewire-core /bin/true#g' /etc/modprobe.d/firewire-core.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/firewire-core.conf - echo "install firewire-core /bin/true" >> /etc/modprobe.d/firewire-core.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist firewire-core$" /etc/modprobe.d/firewire-core.conf ; then - echo "blacklist firewire-core" >> /etc/modprobe.d/firewire-core.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'firewire-core' is disabled lineinfile: create: true dest: /etc/modprobe.d/firewire-core.conf regexp: install\s+firewire-core - line: install firewire-core /bin/true + line: install firewire-core /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82005-0 @@ -197775,6 +197903,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20firewire-core%20/bin/true%0Ablacklist%20firewire-core%0A + mode: 0644 + path: /etc/modprobe.d/firewire-core.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install firewire-core" /etc/modprobe.d/firewire-core.conf ; then + + sed -i 's#^install firewire-core.*#install firewire-core /bin/true#g' /etc/modprobe.d/firewire-core.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/firewire-core.conf + echo "install firewire-core /bin/false" >> /etc/modprobe.d/firewire-core.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist firewire-core$" /etc/modprobe.d/firewire-core.conf ; then + echo "blacklist firewire-core" >> /etc/modprobe.d/firewire-core.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -197866,46 +198028,12 @@ add the following line to file /etc/modprobe.d/rds.conf: Disabling RDS protects the system against exploitation of any flaws in its implementation. CCE-82870-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20rds%20/bin/true%0Ablacklist%20rds%0A - mode: 0644 - path: /etc/modprobe.d/rds.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install rds" /etc/modprobe.d/rds.conf ; then - - sed -i 's#^install rds.*#install rds /bin/true#g' /etc/modprobe.d/rds.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/rds.conf - echo "install rds /bin/true" >> /etc/modprobe.d/rds.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist rds$" /etc/modprobe.d/rds.conf ; then - echo "blacklist rds" >> /etc/modprobe.d/rds.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'rds' is disabled lineinfile: create: true dest: /etc/modprobe.d/rds.conf regexp: install\s+rds - line: install rds /bin/true + line: install rds /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82870-7 @@ -197937,6 +198065,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20rds%20/bin/true%0Ablacklist%20rds%0A + mode: 0644 + path: /etc/modprobe.d/rds.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install rds" /etc/modprobe.d/rds.conf ; then + + sed -i 's#^install rds.*#install rds /bin/true#g' /etc/modprobe.d/rds.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/rds.conf + echo "install rds /bin/false" >> /etc/modprobe.d/rds.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist rds$" /etc/modprobe.d/rds.conf ; then + echo "blacklist rds" >> /etc/modprobe.d/rds.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198036,50 +198198,16 @@ add the following line to file /etc/modprobe.d/sctp.conf: SRG-OS-000480-GPOS-00227 RHEL-08-040023 3.1.2 - SV-230496r792917_rule + SV-230496r942924_rule Disabling SCTP protects the system against exploitation of any flaws in its implementation. CCE-80834-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20sctp%20/bin/true%0Ablacklist%20sctp%0A - mode: 0644 - path: /etc/modprobe.d/sctp.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install sctp" /etc/modprobe.d/sctp.conf ; then - - sed -i 's#^install sctp.*#install sctp /bin/true#g' /etc/modprobe.d/sctp.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/sctp.conf - echo "install sctp /bin/true" >> /etc/modprobe.d/sctp.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist sctp$" /etc/modprobe.d/sctp.conf ; then - echo "blacklist sctp" >> /etc/modprobe.d/sctp.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'sctp' is disabled lineinfile: create: true dest: /etc/modprobe.d/sctp.conf regexp: install\s+sctp - line: install sctp /bin/true + line: install sctp /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80834-5 @@ -198121,6 +198249,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20sctp%20/bin/true%0Ablacklist%20sctp%0A + mode: 0644 + path: /etc/modprobe.d/sctp.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install sctp" /etc/modprobe.d/sctp.conf ; then + + sed -i 's#^install sctp.*#install sctp /bin/true#g' /etc/modprobe.d/sctp.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/sctp.conf + echo "install sctp /bin/false" >> /etc/modprobe.d/sctp.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist sctp$" /etc/modprobe.d/sctp.conf ; then + echo "blacklist sctp" >> /etc/modprobe.d/sctp.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198217,50 +198379,16 @@ the tipc kernel module will be loaded.FMT_SMF_EXT.1 SRG-OS-000095-GPOS-00049 RHEL-08-040024 - SV-230497r792920_rule + SV-230497r942927_rule Disabling TIPC protects the system against exploitation of any flaws in its implementation. CCE-82297-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20tipc%20/bin/true%0Ablacklist%20tipc%0A - mode: 0644 - path: /etc/modprobe.d/tipc.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install tipc" /etc/modprobe.d/tipc.conf ; then - - sed -i 's#^install tipc.*#install tipc /bin/true#g' /etc/modprobe.d/tipc.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/tipc.conf - echo "install tipc /bin/true" >> /etc/modprobe.d/tipc.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist tipc$" /etc/modprobe.d/tipc.conf ; then - echo "blacklist tipc" >> /etc/modprobe.d/tipc.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'tipc' is disabled lineinfile: create: true dest: /etc/modprobe.d/tipc.conf regexp: install\s+tipc - line: install tipc /bin/true + line: install tipc /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82297-3 @@ -198294,6 +198422,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20tipc%20/bin/true%0Ablacklist%20tipc%0A + mode: 0644 + path: /etc/modprobe.d/tipc.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install tipc" /etc/modprobe.d/tipc.conf ; then + + sed -i 's#^install tipc.*#install tipc /bin/true#g' /etc/modprobe.d/tipc.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/tipc.conf + echo "install tipc /bin/false" >> /etc/modprobe.d/tipc.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist tipc$" /etc/modprobe.d/tipc.conf ; then + echo "blacklist tipc" >> /etc/modprobe.d/tipc.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198433,55 +198595,6 @@ connections to Bluetooth devices, which entails some security risk. Nevertheless, variation in this risk decision may be expected due to the utility of Bluetooth connectivity and its limited range. - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: bluetooth.service - enabled: false - mask: true - - name: bluetooth.socket - enabled: false - mask: true - - include disable_bluetooth - -class disable_bluetooth { - service {'bluetooth': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'bluetooth.service' -"$SYSTEMCTL_EXEC" disable 'bluetooth.service' -"$SYSTEMCTL_EXEC" mask 'bluetooth.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files bluetooth.socket; then - "$SYSTEMCTL_EXEC" stop 'bluetooth.socket' - "$SYSTEMCTL_EXEC" mask 'bluetooth.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'bluetooth.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["bluetooth"] - - name: Block Disable service bluetooth block: @@ -198560,6 +198673,55 @@ disabled = ["bluetooth"] - medium_severity - no_reboot_needed - service_bluetooth_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: bluetooth.service + enabled: false + mask: true + - name: bluetooth.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["bluetooth"] + + include disable_bluetooth + +class disable_bluetooth { + service {'bluetooth': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'bluetooth.service' +"$SYSTEMCTL_EXEC" disable 'bluetooth.service' +"$SYSTEMCTL_EXEC" mask 'bluetooth.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files bluetooth.socket; then + "$SYSTEMCTL_EXEC" stop 'bluetooth.socket' + "$SYSTEMCTL_EXEC" mask 'bluetooth.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'bluetooth.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198678,52 +198840,18 @@ to prevent the loading of the Bluetooth module: SRG-OS-000095-GPOS-00049 SRG-OS-000300-GPOS-00118 RHEL-08-040111 - SV-230507r833336_rule + SV-230507r942939_rule If Bluetooth functionality must be disabled, preventing the kernel from loading the kernel module provides an additional safeguard against its activation. CCE-80832-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20bluetooth%20/bin/true%0Ablacklist%20bluetooth%0A - mode: 0644 - path: /etc/modprobe.d/bluetooth.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install bluetooth" /etc/modprobe.d/bluetooth.conf ; then - - sed -i 's#^install bluetooth.*#install bluetooth /bin/true#g' /etc/modprobe.d/bluetooth.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/bluetooth.conf - echo "install bluetooth /bin/true" >> /etc/modprobe.d/bluetooth.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist bluetooth$" /etc/modprobe.d/bluetooth.conf ; then - echo "blacklist bluetooth" >> /etc/modprobe.d/bluetooth.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'bluetooth' is disabled lineinfile: create: true dest: /etc/modprobe.d/bluetooth.conf regexp: install\s+bluetooth - line: install bluetooth /bin/true + line: install bluetooth /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80832-9 @@ -198767,6 +198895,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20bluetooth%20/bin/true%0Ablacklist%20bluetooth%0A + mode: 0644 + path: /etc/modprobe.d/bluetooth.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install bluetooth" /etc/modprobe.d/bluetooth.conf ; then + + sed -i 's#^install bluetooth.*#install bluetooth /bin/true#g' /etc/modprobe.d/bluetooth.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/bluetooth.conf + echo "install bluetooth /bin/false" >> /etc/modprobe.d/bluetooth.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist bluetooth$" /etc/modprobe.d/bluetooth.conf ; then + echo "blacklist bluetooth" >> /etc/modprobe.d/bluetooth.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198796,46 +198958,12 @@ add the following line to file /etc/modprobe.d/cfg80211.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20cfg80211%20/bin/true%0Ablacklist%20cfg80211%0A - mode: 0644 - path: /etc/modprobe.d/cfg80211.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install cfg80211" /etc/modprobe.d/cfg80211.conf ; then - - sed -i 's#^install cfg80211.*#install cfg80211 /bin/true#g' /etc/modprobe.d/cfg80211.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cfg80211.conf - echo "install cfg80211 /bin/true" >> /etc/modprobe.d/cfg80211.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist cfg80211$" /etc/modprobe.d/cfg80211.conf ; then - echo "blacklist cfg80211" >> /etc/modprobe.d/cfg80211.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'cfg80211' is disabled lineinfile: create: true dest: /etc/modprobe.d/cfg80211.conf regexp: install\s+cfg80211 - line: install cfg80211 /bin/true + line: install cfg80211 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -198873,6 +199001,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20cfg80211%20/bin/true%0Ablacklist%20cfg80211%0A + mode: 0644 + path: /etc/modprobe.d/cfg80211.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install cfg80211" /etc/modprobe.d/cfg80211.conf ; then + + sed -i 's#^install cfg80211.*#install cfg80211 /bin/true#g' /etc/modprobe.d/cfg80211.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cfg80211.conf + echo "install cfg80211 /bin/false" >> /etc/modprobe.d/cfg80211.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist cfg80211$" /etc/modprobe.d/cfg80211.conf ; then + echo "blacklist cfg80211" >> /etc/modprobe.d/cfg80211.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -198902,46 +199064,12 @@ add the following line to file /etc/modprobe.d/iwlmvm.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20iwlmvm%20/bin/true%0Ablacklist%20iwlmvm%0A - mode: 0644 - path: /etc/modprobe.d/iwlmvm.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install iwlmvm" /etc/modprobe.d/iwlmvm.conf ; then - - sed -i 's#^install iwlmvm.*#install iwlmvm /bin/true#g' /etc/modprobe.d/iwlmvm.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlmvm.conf - echo "install iwlmvm /bin/true" >> /etc/modprobe.d/iwlmvm.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist iwlmvm$" /etc/modprobe.d/iwlmvm.conf ; then - echo "blacklist iwlmvm" >> /etc/modprobe.d/iwlmvm.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'iwlmvm' is disabled lineinfile: create: true dest: /etc/modprobe.d/iwlmvm.conf regexp: install\s+iwlmvm - line: install iwlmvm /bin/true + line: install iwlmvm /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -198979,6 +199107,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20iwlmvm%20/bin/true%0Ablacklist%20iwlmvm%0A + mode: 0644 + path: /etc/modprobe.d/iwlmvm.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install iwlmvm" /etc/modprobe.d/iwlmvm.conf ; then + + sed -i 's#^install iwlmvm.*#install iwlmvm /bin/true#g' /etc/modprobe.d/iwlmvm.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlmvm.conf + echo "install iwlmvm /bin/false" >> /etc/modprobe.d/iwlmvm.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist iwlmvm$" /etc/modprobe.d/iwlmvm.conf ; then + echo "blacklist iwlmvm" >> /etc/modprobe.d/iwlmvm.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199008,46 +199170,12 @@ add the following line to file /etc/modprobe.d/iwlwifi.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20iwlwifi%20/bin/true%0Ablacklist%20iwlwifi%0A - mode: 0644 - path: /etc/modprobe.d/iwlwifi.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install iwlwifi" /etc/modprobe.d/iwlwifi.conf ; then - - sed -i 's#^install iwlwifi.*#install iwlwifi /bin/true#g' /etc/modprobe.d/iwlwifi.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlwifi.conf - echo "install iwlwifi /bin/true" >> /etc/modprobe.d/iwlwifi.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist iwlwifi$" /etc/modprobe.d/iwlwifi.conf ; then - echo "blacklist iwlwifi" >> /etc/modprobe.d/iwlwifi.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'iwlwifi' is disabled lineinfile: create: true dest: /etc/modprobe.d/iwlwifi.conf regexp: install\s+iwlwifi - line: install iwlwifi /bin/true + line: install iwlwifi /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -199085,6 +199213,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20iwlwifi%20/bin/true%0Ablacklist%20iwlwifi%0A + mode: 0644 + path: /etc/modprobe.d/iwlwifi.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install iwlwifi" /etc/modprobe.d/iwlwifi.conf ; then + + sed -i 's#^install iwlwifi.*#install iwlwifi /bin/true#g' /etc/modprobe.d/iwlwifi.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/iwlwifi.conf + echo "install iwlwifi /bin/false" >> /etc/modprobe.d/iwlwifi.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist iwlwifi$" /etc/modprobe.d/iwlwifi.conf ; then + echo "blacklist iwlwifi" >> /etc/modprobe.d/iwlwifi.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199114,46 +199276,12 @@ add the following line to file /etc/modprobe.d/mac80211.conf - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20mac80211%20/bin/true%0Ablacklist%20mac80211%0A - mode: 0644 - path: /etc/modprobe.d/mac80211.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install mac80211" /etc/modprobe.d/mac80211.conf ; then - - sed -i 's#^install mac80211.*#install mac80211 /bin/true#g' /etc/modprobe.d/mac80211.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/mac80211.conf - echo "install mac80211 /bin/true" >> /etc/modprobe.d/mac80211.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist mac80211$" /etc/modprobe.d/mac80211.conf ; then - echo "blacklist mac80211" >> /etc/modprobe.d/mac80211.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'mac80211' is disabled lineinfile: create: true dest: /etc/modprobe.d/mac80211.conf regexp: install\s+mac80211 - line: install mac80211 /bin/true + line: install mac80211 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - NIST-800-53-AC-18(3) @@ -199191,6 +199319,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20mac80211%20/bin/true%0Ablacklist%20mac80211%0A + mode: 0644 + path: /etc/modprobe.d/mac80211.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install mac80211" /etc/modprobe.d/mac80211.conf ; then + + sed -i 's#^install mac80211.*#install mac80211 /bin/true#g' /etc/modprobe.d/mac80211.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/mac80211.conf + echo "install mac80211 /bin/false" >> /etc/modprobe.d/mac80211.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist mac80211$" /etc/modprobe.d/mac80211.conf ; then + echo "blacklist mac80211" >> /etc/modprobe.d/mac80211.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -199432,25 +199594,6 @@ serve to create a man-in-the-middle attack or be used to create a denial of service to valid network resources. CCE-83501-7 - -if ! rpm -q --quiet "NetworkManager" ; then - yum install -y "NetworkManager" -fi - -if command -v nmcli >/dev/null 2>&1 && systemctl is-active NetworkManager >/dev/null 2>&1; then - nmcli radio all off -fi - -if command -v wicked >/dev/null 2>&1 && systemctl is-active wickedd >/dev/null 2>&1; then - if [ -n "$(find /sys/class/net/*/ -type d -name wireless)" ]; then - interfaces=$(find /sys/class/net/*/wireless -type d -name wireless | xargs -0 dirname | xargs basename) - for iface in $interfaces; do - wicked ifdown $iface - sed -i 's/STARTMODE=.*/STARTMODE=off/' /etc/sysconfig/network/ifcfg-$iface - done - fi -fi - - name: Gather the package facts package_facts: manager: auto @@ -199546,6 +199689,25 @@ fi - no_reboot_needed - unknown_strategy - wireless_disable_interfaces + + +if ! rpm -q --quiet "NetworkManager" ; then + yum install -y "NetworkManager" +fi + +if command -v nmcli >/dev/null 2>&1 && systemctl is-active NetworkManager >/dev/null 2>&1; then + nmcli radio all off +fi + +if command -v wicked >/dev/null 2>&1 && systemctl is-active wickedd >/dev/null 2>&1; then + if [ -n "$(find /sys/class/net/*/ -type d -name wireless)" ]; then + interfaces=$(find /sys/class/net/*/wireless -type d -name wireless | xargs -0 dirname | xargs basename) + for iface in $interfaces; do + wicked ifdown $iface + sed -i 's/STARTMODE=.*/STARTMODE=off/' /etc/sysconfig/network/ifcfg-$iface + done + fi +fi @@ -199644,16 +199806,6 @@ Following this, the files should be deleted or assigned to root user. CCE-83375-6 - -# At least under containerized env /proc can have files w/o possilibity to -# modify even as root. And touching /proc is not good idea anyways. -find / -path /proc -prune -o \ - -not -fstype afs -not -fstype ceph -not -fstype cifs -not -fstype smb3 -not -fstype smbfs \ - -not -fstype sshfs -not -fstype ncpfs -not -fstype ncp -not -fstype nfs -not -fstype nfs4 \ - -not -fstype gfs -not -fstype gfs2 -not -fstype glusterfs -not -fstype gpfs \ - -not -fstype pvfs2 -not -fstype ocfs2 -not -fstype lustre -not -fstype davfs \ - -not -fstype fuse.sshfs -type d -perm -0002 -uid +0 -exec chown root {} \; - - name: Ensure All World-Writable Directories Are Owned by root User - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -199824,6 +199976,16 @@ find / -path /proc -prune -o \ - medium_severity - no_reboot_needed - restrict_strategy + + +# At least under containerized env /proc can have files w/o possilibity to +# modify even as root. And touching /proc is not good idea anyways. +find / -path /proc -prune -o \ + -not -fstype afs -not -fstype ceph -not -fstype cifs -not -fstype smb3 -not -fstype smbfs \ + -not -fstype sshfs -not -fstype ncpfs -not -fstype ncp -not -fstype nfs -not -fstype nfs4 \ + -not -fstype gfs -not -fstype gfs2 -not -fstype glusterfs -not -fstype gpfs \ + -not -fstype pvfs2 -not -fstype ocfs2 -not -fstype lustre -not -fstype davfs \ + -not -fstype fuse.sshfs -type d -perm -0002 -uid +0 -exec chown root {} \; @@ -199914,11 +200076,6 @@ system, or those designed to be temporary file repositories. The setting is norm for directories used by the system, by users for temporary file storage (such as /tmp), and for directories requiring global read/write access. CCE-80783-4 - df --local -P | awk '{if (NR!=1) print $6}' \ -| xargs -I '$6' find '$6' -xdev -type d \ -\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null \ --exec chmod a+t {} + - - name: Verify that All World-Writable Directories Have Sticky Bits Set - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -200116,6 +200273,11 @@ and for directories requiring global read/write access. - medium_severity - no_reboot_needed - restrict_strategy + + df --local -P | awk '{if (NR!=1) print $6}' \ +| xargs -I '$6' find '$6' -xdev -type d \ +\( -perm -0002 -a ! -perm -1000 \) 2>/dev/null \ +-exec chmod a+t {} + @@ -200271,13 +200433,6 @@ the audit log. Misconfigured audits may also make it more difficult to establish correlate, and investigate the events relating to an incident or identify those responsible for one. CCE-85871-2 - - - - - -chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf - - name: Test for existence /etc/audit/auditd.conf stat: path: /etc/audit/auditd.conf @@ -200308,6 +200463,13 @@ chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /etc/audit/auditd.conf @@ -200333,13 +200495,6 @@ the audit log. Misconfigured audits may also make it more difficult to establish correlate, and investigate the events relating to an incident or identify those responsible for one. CCE-85875-3 - - - - - -find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/audit/rules.d/ file(s) command: find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*rules$" @@ -200375,6 +200530,13 @@ find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /etc/audit/rules.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*rules$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -200944,6 +201106,68 @@ based on insecure file system accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of open() or creat(). CCE-81027-5 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*fs.protected_hardlinks.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + +- name: Comment out any occurrences of fs.protected_hardlinks from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*fs.protected_hardlinks + replace: '#fs.protected_hardlinks' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + +- name: Ensure sysctl fs.protected_hardlinks is set to 1 + sysctl: + name: fs.protected_hardlinks + value: '1' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81027-5 + - DISA-STIG-RHEL-08-010374 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_fs_protected_hardlinks + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -201019,20 +201243,57 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Enable Kernel Parameter to Enforce DAC on Symlinks + To set the runtime status of the fs.protected_symlinks kernel parameter, run the following command: $ sudo sysctl -w fs.protected_symlinks=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: fs.protected_symlinks = 1 + BP28(R23) + CCI-002165 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-6(a) + AC-6(1) + SRG-OS-000312-GPOS-00122 + SRG-OS-000312-GPOS-00123 + SRG-OS-000324-GPOS-00125 + RHEL-08-010373 + SV-230267r858751_rule + By enabling this kernel parameter, symbolic links are permitted to be followed +only when outside a sticky world-writable directory, or when the UID of the +link and follower match, or when the directory owner matches the symlink's owner. +Disallowing such symlinks helps mitigate vulnerabilities based on insecure file system +accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of +open() or creat(). + + CCE-81030-9 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*fs.protected_hardlinks.*$ + contains: ^[\s]*fs.protected_symlinks.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201040,18 +201301,18 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks -- name: Comment out any occurrences of fs.protected_hardlinks from config files +- name: Comment out any occurrences of fs.protected_symlinks from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*fs.protected_hardlinks - replace: '#fs.protected_hardlinks' + regexp: ^[\s]*fs.protected_symlinks + replace: '#fs.protected_symlinks' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201059,19 +201320,19 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks -- name: Ensure sysctl fs.protected_hardlinks is set to 1 +- name: Ensure sysctl fs.protected_symlinks is set to 1 sysctl: - name: fs.protected_hardlinks + name: fs.protected_symlinks value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-81027-5 - - DISA-STIG-RHEL-08-010374 + - CCE-81030-9 + - DISA-STIG-RHEL-08-010373 - NIST-800-53-AC-6(1) - NIST-800-53-CM-6(a) - disable_strategy @@ -201079,45 +201340,8 @@ fi - medium_disruption - medium_severity - reboot_required - - sysctl_fs_protected_hardlinks + - sysctl_fs_protected_symlinks - - - - - - - - - Enable Kernel Parameter to Enforce DAC on Symlinks - To set the runtime status of the fs.protected_symlinks kernel parameter, run the following command: $ sudo sysctl -w fs.protected_symlinks=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: fs.protected_symlinks = 1 - BP28(R23) - CCI-002165 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-6(a) - AC-6(1) - SRG-OS-000312-GPOS-00122 - SRG-OS-000312-GPOS-00123 - SRG-OS-000324-GPOS-00125 - RHEL-08-010373 - SV-230267r858751_rule - By enabling this kernel parameter, symbolic links are permitted to be followed -only when outside a sticky world-writable directory, or when the UID of the -link and follower match, or when the directory owner matches the symlink's owner. -Disallowing such symlinks helps mitigate vulnerabilities based on insecure file system -accessed by privileged programs, avoiding an exploitation vector exploiting unsafe use of -open() or creat(). - - CCE-81030-9 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -201192,68 +201416,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*fs.protected_symlinks.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks - -- name: Comment out any occurrences of fs.protected_symlinks from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*fs.protected_symlinks - replace: '#fs.protected_symlinks' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks - -- name: Ensure sysctl fs.protected_symlinks is set to 1 - sysctl: - name: fs.protected_symlinks - value: '1' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81030-9 - - DISA-STIG-RHEL-08-010373 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_fs_protected_symlinks @@ -201301,8 +201463,6 @@ password reuse. Protection of this file is critical for system security. CCE-83475-4 - chgrp 0 /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -201335,6 +201495,8 @@ Protection of this file is important for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/group- @@ -201355,8 +201517,6 @@ Protection of this file is important for system security. The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83535-5 - chgrp 0 /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -201389,6 +201549,8 @@ it contains group password hashes. Protection of this file is critical for syste - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/gshadow- @@ -201410,8 +201572,6 @@ it contains group password hashes. Protection of this file is critical for syste it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83324-4 - chgrp 0 /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -201444,6 +201604,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/passwd- @@ -201463,8 +201625,6 @@ Protection of this file is critical for system security. it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83415-0 - chgrp 0 /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -201495,6 +201655,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/shadow- @@ -201565,8 +201727,6 @@ Protection of this file is critical for system security. The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80796-6 - chgrp 0 /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -201603,6 +201763,8 @@ on the system. Protection of this file is important for system security. + chgrp 0 /etc/group @@ -201670,8 +201832,6 @@ on the system. Protection of this file is important for system security.The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80797-4 - chgrp 0 /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -201702,6 +201862,8 @@ is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/gshadow @@ -201772,8 +201934,6 @@ is critical for system security. The /etc/passwd file contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-80798-2 - chgrp 0 /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -201810,6 +201970,8 @@ the system. Protection of this file is critical for system security. + chgrp 0 /etc/passwd @@ -201880,8 +202042,6 @@ the system. Protection of this file is critical for system security.The /etc/shadow file stores password hashes. Protection of this file is critical for system security. CCE-80799-0 - chgrp 0 /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -201918,6 +202078,8 @@ critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /etc/shadow @@ -201937,8 +202099,6 @@ To properly set the group owner of /etc/shells, run the c The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-87030-3 - chgrp 0 /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -201969,6 +202129,8 @@ Since this file is used by many system programs this file should be protected. + chgrp 0 /etc/shells @@ -201990,8 +202152,6 @@ Since this file is used by many system programs this file should be protected. CCE-83473-9 - chown 0 /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -202024,6 +202184,8 @@ Protection of this file is important for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/group- @@ -202044,8 +202206,6 @@ Protection of this file is important for system security. The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83533-0 - chown 0 /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -202078,6 +202238,8 @@ it contains group password hashes. Protection of this file is critical for syste - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/gshadow- @@ -202099,8 +202261,6 @@ it contains group password hashes. Protection of this file is critical for syste it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83326-9 - chown 0 /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -202133,6 +202293,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/passwd- @@ -202154,8 +202316,6 @@ Protection of this file is critical for system security. it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83413-5 - chown 0 /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -202188,6 +202348,8 @@ Protection of this file is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/shadow- @@ -202259,8 +202421,6 @@ Protection of this file is critical for system security. The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80801-4 - chown 0 /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -202297,6 +202457,8 @@ on the system. Protection of this file is important for system security. + chown 0 /etc/group @@ -202366,8 +202528,6 @@ on the system. Protection of this file is important for system security.The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80802-2 - chown 0 /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -202398,6 +202558,8 @@ is critical for system security. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/gshadow @@ -202469,8 +202631,6 @@ is critical for system security. The /etc/passwd file contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-80803-0 - chown 0 /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -202507,6 +202667,8 @@ the system. Protection of this file is critical for system security. + chown 0 /etc/passwd @@ -202582,8 +202744,6 @@ critical for system security. Failure to give ownership of this file to root provides the designated owner with access to sensitive information which could weaken the system security posture. CCE-80804-8 - chown 0 /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -202620,6 +202780,8 @@ which could weaken the system security posture. - low_disruption - medium_severity - no_reboot_needed + + chown 0 /etc/shadow @@ -202639,8 +202801,6 @@ To properly set the owner of /etc/shells, run the command The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-87055-0 - chown 0 /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -202671,6 +202831,8 @@ Since this file is used by many system programs this file should be protected. + chown 0 /etc/shells @@ -202694,13 +202856,6 @@ To properly set the permissions of /etc/group-, run the c it contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-83483-8 - - - - - -chmod u-xs,g-xws,o-xwt /etc/group- - - name: Test for existence /etc/group- stat: path: /etc/group- @@ -202733,6 +202888,13 @@ chmod u-xs,g-xws,o-xwt /etc/group- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/group- @@ -202753,13 +202915,6 @@ To properly set the permissions of /etc/gshadow-, run the The /etc/gshadow- file is a backup of /etc/gshadow, and as such, it contains group password hashes. Protection of this file is critical for system security. CCE-83573-6 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- - - name: Test for existence /etc/gshadow- stat: path: /etc/gshadow- @@ -202788,6 +202943,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow- @@ -202811,13 +202973,6 @@ To properly set the permissions of /etc/passwd-, run the it contains information about the users that are configured on the system. Protection of this file is critical for system security. CCE-83332-7 - - - - - -chmod u-xs,g-xws,o-xwt /etc/passwd- - - name: Test for existence /etc/passwd- stat: path: /etc/passwd- @@ -202850,6 +203005,13 @@ chmod u-xs,g-xws,o-xwt /etc/passwd- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/passwd- @@ -202873,13 +203035,6 @@ To properly set the permissions of /etc/shadow-, run the it contains the list of local system accounts and password hashes. Protection of this file is critical for system security. CCE-83417-6 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- - - name: Test for existence /etc/shadow- stat: path: /etc/shadow- @@ -202912,6 +203067,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow- @@ -202986,13 +203148,6 @@ To properly set the permissions of /etc/group, run the co The /etc/group file contains information regarding groups that are configured on the system. Protection of this file is important for system security. CCE-80810-5 - - - - - -chmod u-xs,g-xws,o-xwt /etc/group - - name: Test for existence /etc/group stat: path: /etc/group @@ -203029,6 +203184,13 @@ chmod u-xs,g-xws,o-xwt /etc/group - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/group @@ -203100,13 +203262,6 @@ To properly set the permissions of /etc/gshadow, run the The /etc/gshadow file contains group password hashes. Protection of this file is critical for system security. CCE-80811-3 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow - - name: Test for existence /etc/gshadow stat: path: /etc/gshadow @@ -203137,6 +203292,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/gshadow @@ -203213,13 +203375,6 @@ world the risk of its compromise is increased. The file contains the list of accounts on the system and associated information, and protection of this file is critical for system security. CCE-80812-1 - - - - - -chmod u-xs,g-xws,o-xwt /etc/passwd - - name: Test for existence /etc/passwd stat: path: /etc/passwd @@ -203256,6 +203411,13 @@ chmod u-xs,g-xws,o-xwt /etc/passwd - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/passwd @@ -203333,13 +203495,6 @@ critical for system security. Failure to give ownership of this file to root provides the designated owner with access to sensitive information which could weaken the system security posture. CCE-80813-9 - - - - - -chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow - - name: Test for existence /etc/shadow stat: path: /etc/shadow @@ -203376,6 +203531,13 @@ chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xwrs,g-xwrs,o-xwrt /etc/shadow @@ -203395,13 +203557,6 @@ To properly set the permissions of /etc/shells, run the c The /etc/shells file contains the list of full pathnames to shells on the system. Since this file is used by many system programs this file should be protected. CCE-86634-3 - - - - - -chmod u-xs,g-xws,o-xwt /etc/shells - - name: Test for existence /etc/shells stat: path: /etc/shells @@ -203432,6 +203587,13 @@ chmod u-xs,g-xws,o-xwt /etc/shells - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwt /etc/shells @@ -203458,8 +203620,6 @@ personnel. messages in the system and should only be accessed by authorized personnel. CCE-83659-3 - find -H /var/log/ -maxdepth 1 -type d -exec chgrp 0 {} \; - - name: Ensure group owner on /var/log/ file: path: /var/log/ @@ -203474,6 +203634,8 @@ personnel. - low_disruption - medium_severity - no_reboot_needed + + find -H /var/log/ -maxdepth 1 -type d -exec chgrp 0 {} \; @@ -203492,8 +203654,6 @@ personnel. The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83660-1 - chgrp 0 /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203522,6 +203682,8 @@ the system and should only be accessed by authorized personnel. + chgrp 0 /var/log/messages @@ -203537,8 +203699,6 @@ the system and should only be accessed by authorized personnel.SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - chgrp 4 /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203563,6 +203723,8 @@ the system and should only be accessed by authorized personnel. + chgrp 4 /var/log/syslog @@ -203583,8 +203745,6 @@ the system and should only be accessed by authorized personnel. CCE-83661-9 - find -H /var/log/ -maxdepth 1 -type d -exec chown 0 {} \; - - name: Ensure owner on directory /var/log/ file: path: /var/log/ @@ -203599,6 +203759,8 @@ personnel. - low_disruption - medium_severity - no_reboot_needed + + find -H /var/log/ -maxdepth 1 -type d -exec chown 0 {} \; @@ -203617,8 +203779,6 @@ personnel. The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83662-7 - chown 0 /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203647,6 +203807,8 @@ the system and should only be accessed by authorized personnel. + chown 0 /var/log/messages @@ -203662,8 +203824,6 @@ the system and should only be accessed by authorized personnel.SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - chown 104 /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203688,6 +203848,8 @@ the system and should only be accessed by authorized personnel. + chown 104 /var/log/syslog @@ -203710,13 +203872,6 @@ To properly set the permissions of /var/log, run the comm messages in the system and should only be accessed by authorized personnel. CCE-83663-5 - - - - - -find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - - name: Find /var/log/ file(s) command: 'find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d ' register: files_found @@ -203749,6 +203904,13 @@ find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws, - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /var/log/ -maxdepth 1 -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; @@ -203769,13 +203931,6 @@ To properly set the permissions of /var/log/messages, run The /var/log/messages file contains logs of error messages in the system and should only be accessed by authorized personnel. CCE-83665-0 - - - - - -chmod u-xs,g-xws,o-xwrt /var/log/messages - - name: Test for existence /var/log/messages stat: path: /var/log/messages @@ -203804,6 +203959,13 @@ chmod u-xs,g-xws,o-xwrt /var/log/messages - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /var/log/messages @@ -203821,13 +203983,6 @@ To properly set the permissions of /var/log/syslog, run t SRG-OS-000206-GPOS-00084 The /var/log/syslog file contains logs of error messages in the system and should only be accessed by authorized personnel. - - - - - -chmod u-xs,g-xws,o-xwrt /var/log/syslog - - name: Test for existence /var/log/syslog stat: path: /var/log/syslog @@ -203852,6 +204007,13 @@ chmod u-xs,g-xws,o-xwrt /var/log/syslog - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-xs,g-xws,o-xwrt /var/log/syslog @@ -203895,11 +204057,6 @@ space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership of library directories is necessary to protect the integrity of the system. CCE-85894-4 - find -H /lib/ -type d -exec chgrp 0 {} \; -find -H /lib64/ -type d -exec chgrp 0 {} \; -find -H /usr/lib/ -type d -exec chgrp 0 {} \; -find -H /usr/lib64/ -type d -exec chgrp 0 {} \; - - name: Ensure group owner on /lib/ recursively file: path: /lib/ @@ -203971,6 +204128,11 @@ find -H /usr/lib64/ -type d -exec chgrp 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /lib/ -type d -exec chgrp 0 {} \; +find -H /lib64/ -type d -exec chgrp 0 {} \; +find -H /usr/lib/ -type d -exec chgrp 0 {} \; +find -H /usr/lib64/ -type d -exec chgrp 0 {} \; @@ -203997,13 +204159,6 @@ following command: System binaries are executed by privileged users as well as system services, and restrictive permissions are necessary to ensure that their execution of these programs cannot be co-opted. - find -H /bin/ -type d -exec chown 0 {} \; -find -H /sbin/ -type d -exec chown 0 {} \; -find -H /usr/bin/ -type d -exec chown 0 {} \; -find -H /usr/sbin/ -type d -exec chown 0 {} \; -find -H /usr/local/bin/ -type d -exec chown 0 {} \; -find -H /usr/local/sbin/ -type d -exec chown 0 {} \; - - name: Ensure owner on directory /bin/ recursively file: path: /bin/ @@ -204087,6 +204242,13 @@ find -H /usr/local/sbin/ -type d -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /bin/ -type d -exec chown 0 {} \; +find -H /sbin/ -type d -exec chown 0 {} \; +find -H /usr/bin/ -type d -exec chown 0 {} \; +find -H /usr/sbin/ -type d -exec chown 0 {} \; +find -H /usr/local/bin/ -type d -exec chown 0 {} \; +find -H /usr/local/sbin/ -type d -exec chown 0 {} \; @@ -204122,11 +204284,6 @@ space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership of library directories is necessary to protect the integrity of the system. CCE-89021-0 - find -H /lib/ -type d -exec chown 0 {} \; -find -H /lib64/ -type d -exec chown 0 {} \; -find -H /usr/lib/ -type d -exec chown 0 {} \; -find -H /usr/lib64/ -type d -exec chown 0 {} \; - - name: Ensure owner on directory /lib/ recursively file: path: /lib/ @@ -204198,6 +204355,11 @@ find -H /usr/lib64/ -type d -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + find -H /lib/ -type d -exec chown 0 {} \; +find -H /lib64/ -type d -exec chown 0 {} \; +find -H /usr/lib/ -type d -exec chown 0 {} \; +find -H /usr/lib64/ -type d -exec chown 0 {} \; @@ -204225,23 +204387,6 @@ following command: System binaries are executed by privileged users, as well as system services, and restrictive permissions are necessary to ensure execution of these programs cannot be co-opted. - - - - - -find -H /bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/local/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - -find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; - - name: Find /bin/ file(s) recursively command: 'find -H /bin/ -perm /u+s,g+ws,o+wt -type d ' register: files_found @@ -204415,6 +204560,23 @@ find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/local/bin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; + +find -H /usr/local/sbin/ -perm /u+s,g+ws,o+wt -type d -exec chmod u-s,g-ws,o-wt {} \; @@ -204457,19 +204619,6 @@ privileged programs which execute with escalated privileges. Only qualified and individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-88692-9 - - - - - -find -H /lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /usr/lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - -find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - - name: Find /lib/ file(s) recursively command: 'find -H /lib/ -perm /g+w,o+w -type d ' register: files_found @@ -204625,6 +204774,19 @@ find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /usr/lib/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; + +find -H /usr/lib64/ -perm /g+w,o+w -type d -exec chmod g-w,o-w {} \; @@ -204657,6 +204819,7 @@ generators CCI-001494 SRG-OS-000256-GPiOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.10 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -204666,14 +204829,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86455-3 - chgrp 0 /sbin/auditctl -chgrp 0 /sbin/aureport -chgrp 0 /sbin/ausearch -chgrp 0 /sbin/autrace -chgrp 0 /sbin/auditd -chgrp 0 /sbin/audispd -chgrp 0 /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -204862,6 +205017,14 @@ chgrp 0 /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + chgrp 0 /sbin/auditctl +chgrp 0 /sbin/aureport +chgrp 0 /sbin/ausearch +chgrp 0 /sbin/autrace +chgrp 0 /sbin/auditd +chgrp 0 /sbin/audispd +chgrp 0 /sbin/augenrules @@ -204903,12 +205066,6 @@ escalated privileges. Only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-86519-6 - -for SYSCMDFILES in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin -do - find -L $SYSCMDFILES \! -group root -type f -exec chgrp root '{}' \; -done - - name: Retrieve the system command files and set their group ownership to root command: find -L {{ item }} ! -group root -type f -exec chgrp root '{}' \; with_items: @@ -204932,6 +205089,12 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + +for SYSCMDFILES in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin +do + find -L $SYSCMDFILES \! -group root -type f -exec chgrp root '{}' \; +done @@ -204964,6 +205127,7 @@ generators CCI-001494 SRG-OS-000256-GPiOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.9 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -204973,14 +205137,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86453-8 - chown 0 /sbin/auditctl -chown 0 /sbin/aureport -chown 0 /sbin/ausearch -chown 0 /sbin/autrace -chown 0 /sbin/auditd -chown 0 /sbin/audispd -chown 0 /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -205169,6 +205325,14 @@ chown 0 /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + chown 0 /sbin/auditctl +chown 0 /sbin/aureport +chown 0 /sbin/ausearch +chown 0 /sbin/autrace +chown 0 /sbin/auditd +chown 0 /sbin/audispd +chown 0 /sbin/augenrules @@ -205253,15 +205417,6 @@ following command: and restrictive permissions are necessary to ensure that their execution of these programs cannot be co-opted. CCE-80806-3 - find /bin/ \ -/usr/bin/ \ -/usr/local/bin/ \ -/sbin/ \ -/usr/sbin/ \ -/usr/local/sbin/ \ -/usr/libexec \ -\! -user root -execdir chown root {} \; - - name: Read list of system executables without root ownership command: find /bin/ /usr/bin/ /usr/local/bin/ /sbin/ /usr/sbin/ /usr/local/sbin/ /usr/libexec \! -user root @@ -205302,6 +205457,15 @@ execution of these programs cannot be co-opted. - medium_severity - no_reboot_needed - restrict_strategy + + find /bin/ \ +/usr/bin/ \ +/usr/local/bin/ \ +/sbin/ \ +/usr/sbin/ \ +/usr/local/sbin/ \ +/usr/libexec \ +\! -user root -execdir chown root {} \; @@ -205387,15 +205551,6 @@ ownership with the following command: space of processes (including privileged ones) or of the kernel itself at runtime. Proper ownership is necessary to protect the integrity of the system. CCE-80807-1 - -find /lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /usr/lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - -find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - - name: Find /lib/ file(s) matching ^.*$ recursively command: find -H /lib/ -type f ! -uid 0 -regex "^.*$" register: files_found @@ -205559,6 +205714,15 @@ find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; - low_disruption - medium_severity - no_reboot_needed + + +find /lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /usr/lib/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; + +find /usr/lib64/ -type f ! -uid 0 -regex '^.*$' -exec chown 0 {} \; @@ -205591,6 +205755,7 @@ generators CCI-001494 SRG-OS-000256-GPOS-00097 SRG-OS-000257-GPOS-00098 + 5.2.4.8 Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit information. @@ -205600,25 +205765,6 @@ will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys to make access decisions regarding the access to audit tools. CCE-86447-0 - - - - - -chmod u-s,g-ws,o-wt /sbin/auditctl - -chmod u-s,g-ws,o-wt /sbin/aureport - -chmod u-s,g-ws,o-wt /sbin/ausearch - -chmod u-s,g-ws,o-wt /sbin/autrace - -chmod u-s,g-ws,o-wt /sbin/auditd - -chmod u-s,g-ws,o-wt /sbin/audispd - -chmod u-s,g-ws,o-wt /sbin/augenrules - - name: Test for existence /sbin/auditctl stat: path: /sbin/auditctl @@ -205807,6 +205953,25 @@ chmod u-s,g-ws,o-wt /sbin/augenrules - low_disruption - medium_severity - no_reboot_needed + + + + + + +chmod u-s,g-ws,o-wt /sbin/auditctl + +chmod u-s,g-ws,o-wt /sbin/aureport + +chmod u-s,g-ws,o-wt /sbin/ausearch + +chmod u-s,g-ws,o-wt /sbin/autrace + +chmod u-s,g-ws,o-wt /sbin/auditd + +chmod u-s,g-ws,o-wt /sbin/audispd + +chmod u-s,g-ws,o-wt /sbin/augenrules @@ -205891,11 +206056,6 @@ following command: and restrictive permissions are necessary to ensure execution of these programs cannot be co-opted. CCE-80809-7 - DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec" -for dirPath in $DIRS; do - find "$dirPath" -perm /022 -exec chmod go-w '{}' \; -done - - name: Read list of world and group writable system executables ansible.builtin.command: find /bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec -perm /022 -type f @@ -205937,6 +206097,11 @@ done - medium_severity - no_reboot_needed - restrict_strategy + + DIRS="/bin /usr/bin /usr/local/bin /sbin /usr/sbin /usr/local/sbin /usr/libexec" +for dirPath in $DIRS; do + find "$dirPath" -perm /022 -exec chmod go-w '{}' \; +done @@ -206022,19 +206187,6 @@ its permission with the following command: space of processes (including privileged ones) or of the kernel itself at runtime. Restrictive permissions are necessary to protect the integrity of the system. CCE-80815-4 - - - - - -find -H /lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /usr/lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - -find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; - - name: Find /lib/ file(s) recursively command: find -H /lib/ -perm /g+w,o+w -type f -regex "^.*$" register: files_found @@ -206198,6 +206350,19 @@ find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w { - low_disruption - medium_severity - no_reboot_needed + + + + + + +find -H /lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /usr/lib/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; + +find -H /usr/lib64/ -perm /g+w,o+w -type f -regex '^.*$' -exec chmod g-w,o-w {} \; @@ -206236,15 +206401,6 @@ also include privileged programs which execute with escalated privileges. Only q and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. CCE-86523-8 - -find /lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /usr/lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - -find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - - name: Find /lib/ file(s) matching ^.*$ recursively command: find -H /lib/ -type f ! -group 0 -regex "^.*$" register: files_found @@ -206392,6 +206548,15 @@ find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; - medium_severity - no_reboot_needed - root_permissions_syslibrary_files + + +find /lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /usr/lib/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; + +find /usr/lib64/ -type f ! -group 0 -regex '^.*$' -exec chgrp 0 {} \; @@ -206517,52 +206682,6 @@ Additionally, automatically mounting filesystems permits easy introduction of unknown devices, thereby facilitating malicious activity. CCE-80873-3 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - enabled: false - name: autofs.service - - include disable_autofs - -class disable_autofs { - service {'autofs': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q autofs ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'autofs.service' -"$SYSTEMCTL_EXEC" disable 'autofs.service' -"$SYSTEMCTL_EXEC" mask 'autofs.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files autofs.socket; then - "$SYSTEMCTL_EXEC" stop 'autofs.socket' - "$SYSTEMCTL_EXEC" mask 'autofs.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'autofs.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["autofs"] - - name: Gather the package facts package_facts: manager: auto @@ -206662,6 +206781,52 @@ disabled = ["autofs"] - medium_severity - no_reboot_needed - service_autofs_disabled + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - enabled: false + name: autofs.service + + +[customizations.services] +disabled = ["autofs"] + + include disable_autofs + +class disable_autofs { + service {'autofs': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q autofs ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'autofs.service' +"$SYSTEMCTL_EXEC" disable 'autofs.service' +"$SYSTEMCTL_EXEC" mask 'autofs.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files autofs.socket; then + "$SYSTEMCTL_EXEC" stop 'autofs.socket' + "$SYSTEMCTL_EXEC" mask 'autofs.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'autofs.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -206874,51 +207039,17 @@ decompress the image. SRG-OS-000095-GPOS-00049 RHEL-08-040025 1.1.1.1 - SV-230498r792922_rule + SV-230498r942930_rule Removing support for unneeded filesystem types reduces the local attack surface of the server. CCE-81031-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20cramfs%20/bin/true%0Ablacklist%20cramfs%0A - mode: 0644 - path: /etc/modprobe.d/cramfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install cramfs" /etc/modprobe.d/cramfs.conf ; then - - sed -i 's#^install cramfs.*#install cramfs /bin/true#g' /etc/modprobe.d/cramfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cramfs.conf - echo "install cramfs /bin/true" >> /etc/modprobe.d/cramfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist cramfs$" /etc/modprobe.d/cramfs.conf ; then - echo "blacklist cramfs" >> /etc/modprobe.d/cramfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'cramfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/cramfs.conf regexp: install\s+cramfs - line: install cramfs /bin/true + line: install cramfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-81031-7 @@ -206954,6 +207085,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20cramfs%20/bin/true%0Ablacklist%20cramfs%0A + mode: 0644 + path: /etc/modprobe.d/cramfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install cramfs" /etc/modprobe.d/cramfs.conf ; then + + sed -i 's#^install cramfs.*#install cramfs /bin/true#g' /etc/modprobe.d/cramfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/cramfs.conf + echo "install cramfs /bin/false" >> /etc/modprobe.d/cramfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist cramfs$" /etc/modprobe.d/cramfs.conf ; then + echo "blacklist cramfs" >> /etc/modprobe.d/cramfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207047,46 +207212,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86615-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20freevxfs%20/bin/true%0Ablacklist%20freevxfs%0A - mode: 0644 - path: /etc/modprobe.d/freevxfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install freevxfs" /etc/modprobe.d/freevxfs.conf ; then - - sed -i 's#^install freevxfs.*#install freevxfs /bin/true#g' /etc/modprobe.d/freevxfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/freevxfs.conf - echo "install freevxfs /bin/true" >> /etc/modprobe.d/freevxfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist freevxfs$" /etc/modprobe.d/freevxfs.conf ; then - echo "blacklist freevxfs" >> /etc/modprobe.d/freevxfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'freevxfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/freevxfs.conf regexp: install\s+freevxfs - line: install freevxfs /bin/true + line: install freevxfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86615-2 @@ -207120,6 +207251,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20freevxfs%20/bin/true%0Ablacklist%20freevxfs%0A + mode: 0644 + path: /etc/modprobe.d/freevxfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install freevxfs" /etc/modprobe.d/freevxfs.conf ; then + + sed -i 's#^install freevxfs.*#install freevxfs /bin/true#g' /etc/modprobe.d/freevxfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/freevxfs.conf + echo "install freevxfs /bin/false" >> /etc/modprobe.d/freevxfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist freevxfs$" /etc/modprobe.d/freevxfs.conf ; then + echo "blacklist freevxfs" >> /etc/modprobe.d/freevxfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207210,46 +207375,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86616-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20hfs%20/bin/true%0Ablacklist%20hfs%0A - mode: 0644 - path: /etc/modprobe.d/hfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install hfs" /etc/modprobe.d/hfs.conf ; then - - sed -i 's#^install hfs.*#install hfs /bin/true#g' /etc/modprobe.d/hfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfs.conf - echo "install hfs /bin/true" >> /etc/modprobe.d/hfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist hfs$" /etc/modprobe.d/hfs.conf ; then - echo "blacklist hfs" >> /etc/modprobe.d/hfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'hfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/hfs.conf regexp: install\s+hfs - line: install hfs /bin/true + line: install hfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86616-0 @@ -207283,6 +207414,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20hfs%20/bin/true%0Ablacklist%20hfs%0A + mode: 0644 + path: /etc/modprobe.d/hfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install hfs" /etc/modprobe.d/hfs.conf ; then + + sed -i 's#^install hfs.*#install hfs /bin/true#g' /etc/modprobe.d/hfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfs.conf + echo "install hfs /bin/false" >> /etc/modprobe.d/hfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist hfs$" /etc/modprobe.d/hfs.conf ; then + echo "blacklist hfs" >> /etc/modprobe.d/hfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207373,46 +207538,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86617-8 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20hfsplus%20/bin/true%0Ablacklist%20hfsplus%0A - mode: 0644 - path: /etc/modprobe.d/hfsplus.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install hfsplus" /etc/modprobe.d/hfsplus.conf ; then - - sed -i 's#^install hfsplus.*#install hfsplus /bin/true#g' /etc/modprobe.d/hfsplus.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfsplus.conf - echo "install hfsplus /bin/true" >> /etc/modprobe.d/hfsplus.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist hfsplus$" /etc/modprobe.d/hfsplus.conf ; then - echo "blacklist hfsplus" >> /etc/modprobe.d/hfsplus.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'hfsplus' is disabled lineinfile: create: true dest: /etc/modprobe.d/hfsplus.conf regexp: install\s+hfsplus - line: install hfsplus /bin/true + line: install hfsplus /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86617-8 @@ -207446,6 +207577,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20hfsplus%20/bin/true%0Ablacklist%20hfsplus%0A + mode: 0644 + path: /etc/modprobe.d/hfsplus.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install hfsplus" /etc/modprobe.d/hfsplus.conf ; then + + sed -i 's#^install hfsplus.*#install hfsplus /bin/true#g' /etc/modprobe.d/hfsplus.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/hfsplus.conf + echo "install hfsplus /bin/false" >> /etc/modprobe.d/hfsplus.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist hfsplus$" /etc/modprobe.d/hfsplus.conf ; then + echo "blacklist hfsplus" >> /etc/modprobe.d/hfsplus.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207536,46 +207701,12 @@ This effectively prevents usage of this uncommon filesystem. CCE-86618-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20jffs2%20/bin/true%0Ablacklist%20jffs2%0A - mode: 0644 - path: /etc/modprobe.d/jffs2.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install jffs2" /etc/modprobe.d/jffs2.conf ; then - - sed -i 's#^install jffs2.*#install jffs2 /bin/true#g' /etc/modprobe.d/jffs2.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/jffs2.conf - echo "install jffs2 /bin/true" >> /etc/modprobe.d/jffs2.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist jffs2$" /etc/modprobe.d/jffs2.conf ; then - echo "blacklist jffs2" >> /etc/modprobe.d/jffs2.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'jffs2' is disabled lineinfile: create: true dest: /etc/modprobe.d/jffs2.conf regexp: install\s+jffs2 - line: install jffs2 /bin/true + line: install jffs2 /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86618-6 @@ -207609,6 +207740,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20jffs2%20/bin/true%0Ablacklist%20jffs2%0A + mode: 0644 + path: /etc/modprobe.d/jffs2.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install jffs2" /etc/modprobe.d/jffs2.conf ; then + + sed -i 's#^install jffs2.*#install jffs2 /bin/true#g' /etc/modprobe.d/jffs2.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/jffs2.conf + echo "install jffs2 /bin/false" >> /etc/modprobe.d/jffs2.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist jffs2$" /etc/modprobe.d/jffs2.conf ; then + echo "blacklist jffs2" >> /etc/modprobe.d/jffs2.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207704,46 +207869,12 @@ to first decompress the image. surface of the system. CCE-83498-6 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20squashfs%20/bin/true%0Ablacklist%20squashfs%0A - mode: 0644 - path: /etc/modprobe.d/squashfs.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install squashfs" /etc/modprobe.d/squashfs.conf ; then - - sed -i 's#^install squashfs.*#install squashfs /bin/true#g' /etc/modprobe.d/squashfs.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/squashfs.conf - echo "install squashfs /bin/true" >> /etc/modprobe.d/squashfs.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist squashfs$" /etc/modprobe.d/squashfs.conf ; then - echo "blacklist squashfs" >> /etc/modprobe.d/squashfs.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'squashfs' is disabled lineinfile: create: true dest: /etc/modprobe.d/squashfs.conf regexp: install\s+squashfs - line: install squashfs /bin/true + line: install squashfs /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-83498-6 @@ -207777,6 +207908,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20squashfs%20/bin/true%0Ablacklist%20squashfs%0A + mode: 0644 + path: /etc/modprobe.d/squashfs.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install squashfs" /etc/modprobe.d/squashfs.conf ; then + + sed -i 's#^install squashfs.*#install squashfs /bin/true#g' /etc/modprobe.d/squashfs.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/squashfs.conf + echo "install squashfs /bin/false" >> /etc/modprobe.d/squashfs.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist squashfs$" /etc/modprobe.d/squashfs.conf ; then + echo "blacklist squashfs" >> /etc/modprobe.d/squashfs.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -207873,46 +208038,12 @@ writing DVDs and newer optical disc formats. attack surface of the system. CCE-82729-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20udf%20/bin/true%0Ablacklist%20udf%0A - mode: 0644 - path: /etc/modprobe.d/udf.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install udf" /etc/modprobe.d/udf.conf ; then - - sed -i 's#^install udf.*#install udf /bin/true#g' /etc/modprobe.d/udf.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/udf.conf - echo "install udf /bin/true" >> /etc/modprobe.d/udf.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist udf$" /etc/modprobe.d/udf.conf ; then - echo "blacklist udf" >> /etc/modprobe.d/udf.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'udf' is disabled lineinfile: create: true dest: /etc/modprobe.d/udf.conf regexp: install\s+udf - line: install udf /bin/true + line: install udf /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82729-5 @@ -207946,6 +208077,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20udf%20/bin/true%0Ablacklist%20udf%0A + mode: 0644 + path: /etc/modprobe.d/udf.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install udf" /etc/modprobe.d/udf.conf ; then + + sed -i 's#^install udf.*#install udf /bin/true#g' /etc/modprobe.d/udf.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/udf.conf + echo "install udf /bin/false" >> /etc/modprobe.d/udf.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist udf$" /etc/modprobe.d/udf.conf ; then + echo "blacklist udf" >> /etc/modprobe.d/udf.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208047,51 +208212,17 @@ module, but will not prevent an administrator (or another program) from using th SRG-OS-000480-GPOS-00227 RHEL-08-040080 1.1.1.8 - SV-230503r809319_rule + SV-230503r942936_rule USB storage devices such as thumb drives can be used to introduce malicious software. CCE-80835-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20usb-storage%20/bin/true%0Ablacklist%20usb-storage%0A - mode: 0644 - path: /etc/modprobe.d/usb-storage.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install usb-storage" /etc/modprobe.d/usb-storage.conf ; then - - sed -i 's#^install usb-storage.*#install usb-storage /bin/true#g' /etc/modprobe.d/usb-storage.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/usb-storage.conf - echo "install usb-storage /bin/true" >> /etc/modprobe.d/usb-storage.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist usb-storage$" /etc/modprobe.d/usb-storage.conf ; then - echo "blacklist usb-storage" >> /etc/modprobe.d/usb-storage.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'usb-storage' is disabled lineinfile: create: true dest: /etc/modprobe.d/usb-storage.conf regexp: install\s+usb-storage - line: install usb-storage /bin/true + line: install usb-storage /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-80835-2 @@ -208131,6 +208262,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20usb-storage%20/bin/true%0Ablacklist%20usb-storage%0A + mode: 0644 + path: /etc/modprobe.d/usb-storage.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install usb-storage" /etc/modprobe.d/usb-storage.conf ; then + + sed -i 's#^install usb-storage.*#install usb-storage /bin/true#g' /etc/modprobe.d/usb-storage.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/usb-storage.conf + echo "install usb-storage /bin/false" >> /etc/modprobe.d/usb-storage.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist usb-storage$" /etc/modprobe.d/usb-storage.conf ; then + echo "blacklist usb-storage" >> /etc/modprobe.d/usb-storage.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208229,46 +208394,12 @@ all of which are supported by the vfat kernel module. CCE-82170-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20vfat%20/bin/true%0Ablacklist%20vfat%0A - mode: 0644 - path: /etc/modprobe.d/vfat.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install vfat" /etc/modprobe.d/vfat.conf ; then - - sed -i 's#^install vfat.*#install vfat /bin/true#g' /etc/modprobe.d/vfat.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/vfat.conf - echo "install vfat /bin/true" >> /etc/modprobe.d/vfat.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist vfat$" /etc/modprobe.d/vfat.conf ; then - echo "blacklist vfat" >> /etc/modprobe.d/vfat.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'vfat' is disabled lineinfile: create: true dest: /etc/modprobe.d/vfat.conf regexp: install\s+vfat - line: install vfat /bin/true + line: install vfat /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-82170-2 @@ -208302,6 +208433,40 @@ fi - low_severity - medium_disruption - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20vfat%20/bin/true%0Ablacklist%20vfat%0A + mode: 0644 + path: /etc/modprobe.d/vfat.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install vfat" /etc/modprobe.d/vfat.conf ; then + + sed -i 's#^install vfat.*#install vfat /bin/true#g' /etc/modprobe.d/vfat.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/vfat.conf + echo "install vfat /bin/false" >> /etc/modprobe.d/vfat.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist vfat$" /etc/modprobe.d/vfat.conf ; then + echo "blacklist vfat" >> /etc/modprobe.d/vfat.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -208355,57 +208520,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from boot partitions. CCE-86038-7 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && [ -d /sys/firmware/efi ] ); then - -function perform_remediation { - - # the mount point /boot/efi has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot/efi")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/boot/efi' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /boot/efi in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot/efi)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /boot/efi defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/boot/efi"; then - if mountpoint -q "/boot/efi"; then - mount -o remount --target "/boot/efi" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /boot/efi: Check information associated to mountpoint' command: findmnt --fstab '/boot/efi' register: device_name @@ -208526,57 +208640,29 @@ fi - mount_option_boot_efi_nosuid - no_reboot_needed - - - - - - - - - Add noauto Option to /boot - The noauto mount option is used to prevent automatic mounting of th -/boot partition. -Add the noauto option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - Although contents of the /boot partition should not be needed -during normal system operation, they might need to be accessible during -system maintenance and upgrades. Make sure that applying this rule will -not break upgrade or maintenance processes affecting the system. - BP28(R12) - The /boot partition contains the kernel and the bootloader. Access -to the partition after the boot process finishes should not be needed. Files -contained within this partition can be analysed and gained information can -be used for exploit creation. - - CCE-83345-9 - -part /boot --mountoptions="noauto" - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && [ -d /sys/firmware/efi ] ); then function perform_remediation { - # the mount point /boot has to be defined in /etc/fstab + # the mount point /boot/efi has to be defined in /etc/fstab # before this remediation can be executed. In case it is not defined, the # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot")" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot/efi")" grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/boot' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /boot in /etc/fstab" >&2; return 1; } + || { echo "The mount point '/boot/efi' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /boot/efi in /etc/fstab" >&2; return 1; } - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot)" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot/efi)" # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noauto)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208584,17 +208670,17 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}noauto 0 0" >> /etc/fstab + echo " /boot/efi defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noauto"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noauto|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi - if mkdir -p "/boot"; then - if mountpoint -q "/boot"; then - mount -o remount --target "/boot" + if mkdir -p "/boot/efi"; then + if mountpoint -q "/boot/efi"; then + mount -o remount --target "/boot/efi" fi fi } @@ -208605,6 +208691,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noauto Option to /boot + The noauto mount option is used to prevent automatic mounting of th +/boot partition. +Add the noauto option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + Although contents of the /boot partition should not be needed +during normal system operation, they might need to be accessible during +system maintenance and upgrades. Make sure that applying this rule will +not break upgrade or maintenance processes affecting the system. + BP28(R12) + The /boot partition contains the kernel and the bootloader. Access +to the partition after the boot process finishes should not be needed. Files +contained within this partition can be analysed and gained information can +be used for exploit creation. + + CCE-83345-9 - name: 'Add noauto Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -208703,50 +208814,10 @@ fi - mount_option_boot_noauto - no_reboot_needed - - - - - - - - - Add nodev Option to /boot - The nodev mount option can be used to prevent device files from -being created in /boot. -Legitimate character and block devices should exist only in -the /dev directory on the root partition or within chroot -jails built for system services. -Add the nodev option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - The only legitimate location for device files is the /dev directory -located on the root partition. The only exception to this is chroot jails. - - CCE-82941-6 - -part /boot --mountoptions="nodev" + +part /boot --mountoptions="noauto" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -208768,7 +208839,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noauto)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208776,11 +208847,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}noauto 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noauto"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noauto|" /etc/fstab fi @@ -208797,6 +208868,46 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nodev Option to /boot + The nodev mount option can be used to prevent device files from +being created in /boot. +Legitimate character and block devices should exist only in +the /dev directory on the root partition or within chroot +jails built for system services. +Add the nodev option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + The only legitimate location for device files is the /dev directory +located on the root partition. The only exception to this is chroot jails. + + CCE-82941-6 - name: 'Add nodev Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -208925,30 +209036,10 @@ fi - mount_option_boot_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /boot - The noexec mount option can be used to prevent binaries from being -executed out of /boot. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - BP28(R12) - The /boot partition contains the kernel and the bootloader. No -binaries should be executed from this partition after the booting process -finishes. - - CCE-83316-0 - -part /boot --mountoptions="noexec" + +part /boot --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -208970,7 +209061,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -208978,11 +209069,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -208999,6 +209090,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /boot + The noexec mount option can be used to prevent binaries from being +executed out of /boot. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + BP28(R12) + The /boot partition contains the kernel and the bootloader. No +binaries should be executed from this partition after the booting process +finishes. + + CCE-83316-0 - name: 'Add noexec Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -209097,53 +209208,10 @@ fi - mount_option_boot_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /boot - The nosuid mount option can be used to prevent -execution of setuid programs in /boot. The SUID and SGID permissions -should not be required on the boot partition. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/boot. - BP28(R12) - CCI-000366 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - SRG-OS-000480-GPOS-00227 - RHEL-08-010571 - SV-230300r743959_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from boot partitions. - - CCE-81033-3 - -part /boot --mountoptions="nosuid" + +part /boot --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { @@ -209165,7 +209233,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -209173,11 +209241,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /boot defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /boot defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -209194,6 +209262,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /boot + The nosuid mount option can be used to prevent +execution of setuid programs in /boot. The SUID and SGID permissions +should not be required on the boot partition. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/boot. + BP28(R12) + CCI-000366 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + SRG-OS-000480-GPOS-00227 + RHEL-08-010571 + SV-230300r743959_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from boot partitions. + + CCE-81033-3 - name: 'Add nosuid Option to /boot: Check information associated to mountpoint' command: findmnt --fstab '/boot' register: device_name @@ -209326,6 +209437,60 @@ fi - medium_severity - mount_option_boot_nosuid - no_reboot_needed + + +part /boot --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + # the mount point /boot has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/boot")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/boot' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /boot in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /boot)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /boot defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/boot"; then + if mountpoint -q "/boot"; then + mount -o remount --target "/boot" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -209441,48 +209606,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-80837-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -209615,6 +209738,48 @@ fi - medium_severity - mount_option_dev_shm_nodev - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="tmpfs" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -209731,48 +209896,6 @@ Add the noexec option to the fourth column of such as /dev/shm can expose the system to potential compromise. CCE-80838-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -209906,6 +210029,48 @@ fi - medium_severity - mount_option_dev_shm_noexec - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="tmpfs" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -210021,48 +210186,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from temporary storage partitions. CCE-80839-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="tmpfs" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/dev/shm"; then - if mountpoint -q "/dev/shm"; then - mount -o remount --target "/dev/shm" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /dev/shm: Check information associated to mountpoint' command: findmnt '/dev/shm' register: device_name @@ -210197,74 +210320,38 @@ fi - mount_option_dev_shm_nosuid - no_reboot_needed - - - - - - - - - Add grpquota Option to /home - The grpquota mount option allows for the filesystem to have disk quotas configured. -Add the grpquota option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - The quota options for XFS file systems can only be activated when mounting the partition. -It is not possible to enable them by remounting an already mounted partition. Therefore, -if the desired options were not defined before mounting the partition, dismount and mount -it again to apply the quota options. - CM-6(b) - To ensure the availability of disk space on /home, it is important to limit the impact a -single user or group can cause for other users (or the wider system) by intentionally or -accidentally filling up the partition. Quotas can also be applied to inodes for filesystems -where inode exhaustion is a concern. - - CCE-86039-5 - -part /home --mountoptions="grpquota" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then function perform_remediation { - # the mount point /home has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /dev/shm)" # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|grpquota)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" + fs_type="tmpfs" if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}grpquota 0 0" >> /etc/fstab + echo "tmpfs /dev/shm tmpfs defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "grpquota"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,grpquota|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi - if mkdir -p "/home"; then - if mountpoint -q "/home"; then - mount -o remount --target "/home" + if mkdir -p "/dev/shm"; then + if mountpoint -q "/dev/shm"; then + mount -o remount --target "/dev/shm" fi fi } @@ -210275,6 +210362,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add grpquota Option to /home + The grpquota mount option allows for the filesystem to have disk quotas configured. +Add the grpquota option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + The quota options for XFS file systems can only be activated when mounting the partition. +It is not possible to enable them by remounting an already mounted partition. Therefore, +if the desired options were not defined before mounting the partition, dismount and mount +it again to apply the quota options. + CM-6(b) + To ensure the availability of disk space on /home, it is important to limit the impact a +single user or group can cause for other users (or the wider system) by intentionally or +accidentally filling up the partition. Quotas can also be applied to inodes for filesystems +where inode exhaustion is a concern. + + CCE-86039-5 - name: 'Add grpquota Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210383,34 +210494,10 @@ fi - mount_option_home_grpquota - no_reboot_needed - - - - - - - - - Add nodev Option to /home - The nodev mount option can be used to prevent device files from -being created in /home. -Legitimate character and block devices should exist only in -the /dev directory on the root partition or within chroot -jails built for system services. -Add the nodev option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - BP28(R12) - SRG-OS-000368-GPOS-00154 - 1.1.2.3.2 - The only legitimate location for device files is the /dev directory -located on the root partition. The only exception to this is chroot jails. - - CCE-81048-1 - -part /home --mountoptions="nodev" + +part /home --mountoptions="grpquota" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -210432,7 +210519,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|grpquota)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -210440,11 +210527,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}grpquota 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "grpquota"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,grpquota|" /etc/fstab fi @@ -210461,6 +210548,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nodev Option to /home + The nodev mount option can be used to prevent device files from +being created in /home. +Legitimate character and block devices should exist only in +the /dev directory on the root partition or within chroot +jails built for system services. +Add the nodev option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + BP28(R12) + SRG-OS-000368-GPOS-00154 + 1.1.2.3.2 + The only legitimate location for device files is the /dev directory +located on the root partition. The only exception to this is chroot jails. + + CCE-81048-1 - name: 'Add nodev Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210564,36 +210675,11 @@ fi - no_reboot_needed - unknown_severity - - - - - - - - - Add noexec Option to /home - The noexec mount option can be used to prevent binaries from being -executed out of /home. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - BP28(R12) - CCI-000366 - CM-6(b) - SRG-OS-000480-GPOS-00227 - RHEL-08-010590 - SV-230302r627750_rule - The /home directory contains data of individual users. Binaries in -this directory should not be considered as trusted and users should not be -able to execute them. - - CCE-83328-5 - -part /home --mountoptions="noexec" + +part /home --mountoptions="nodev" - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -210614,7 +210700,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -210622,11 +210708,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -210643,6 +210729,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /home + The noexec mount option can be used to prevent binaries from being +executed out of /home. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + BP28(R12) + CCI-000366 + CM-6(b) + SRG-OS-000480-GPOS-00227 + RHEL-08-010590 + SV-230302r627750_rule + The /home directory contains data of individual users. Binaries in +this directory should not be considered as trusted and users should not be +able to execute them. + + CCE-83328-5 - name: 'Add noexec Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -210750,6 +210861,60 @@ fi - medium_severity - mount_option_home_noexec - no_reboot_needed + + +part /home --mountoptions="noexec" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + # the mount point /home has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /home defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/home"; then + if mountpoint -q "/home"; then + mount -o remount --target "/home" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -210867,60 +211032,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from user home directory partitions. CCE-81050-7 - -part /home --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then - -function perform_remediation { - - # the mount point /home has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /home defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/home"; then - if mountpoint -q "/home"; then - mount -o remount --target "/home" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -211059,34 +211170,10 @@ fi - mount_option_home_nosuid - no_reboot_needed - - - - - - - - - Add usrquota Option to /home - The usrquota mount option allows for the filesystem to have disk quotas configured. -Add the usrquota option to the fourth column of -/etc/fstab for the line which controls mounting of -/home. - The quota options for XFS file systems can only be activated when mounting the partition. -It is not possible to enable them by remounting an already mounted partition. Therefore, -if the desired options were not defined before mounting the partition, dismount and mount -it again to apply the quota options. - CM-6(b) - To ensure the availability of disk space on /home, it is important to limit the impact a -single user or group can cause for other users (or the wider system) by intentionally or -accidentally filling up the partition. Quotas can also be applied to inodes for filesystems -where inode exhaustion is a concern. - - CCE-86035-3 - -part /home --mountoptions="usrquota" + +part /home --mountoptions="nosuid" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then function perform_remediation { @@ -211108,7 +211195,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|usrquota)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -211116,11 +211203,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /home defaults,${previous_mount_opts}usrquota 0 0" >> /etc/fstab + echo " /home defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "usrquota"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,usrquota|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab fi @@ -211137,6 +211224,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add usrquota Option to /home + The usrquota mount option allows for the filesystem to have disk quotas configured. +Add the usrquota option to the fourth column of +/etc/fstab for the line which controls mounting of +/home. + The quota options for XFS file systems can only be activated when mounting the partition. +It is not possible to enable them by remounting an already mounted partition. Therefore, +if the desired options were not defined before mounting the partition, dismount and mount +it again to apply the quota options. + CM-6(b) + To ensure the availability of disk space on /home, it is important to limit the impact a +single user or group can cause for other users (or the wider system) by intentionally or +accidentally filling up the partition. Quotas can also be applied to inodes for filesystems +where inode exhaustion is a concern. + + CCE-86035-3 - name: 'Add usrquota Option to /home: Check information associated to mountpoint' command: findmnt --fstab '/home' register: device_name @@ -211244,6 +211355,60 @@ fi - medium_severity - mount_option_home_usrquota - no_reboot_needed + + +part /home --mountoptions="usrquota" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/home" > /dev/null || findmnt --fstab "/home" > /dev/null ); then + +function perform_remediation { + + # the mount point /home has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/home")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/home' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /home in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /home)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|usrquota)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /home defaults,${previous_mount_opts}usrquota 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "usrquota"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,usrquota|" /etc/fstab + fi + + + if mkdir -p "/home"; then + if mountpoint -q "/home"; then + mount -o remount --target "/home" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211354,6 +211519,35 @@ The only exception to this is chroot jails, for which it is not advised to set nodev on these filesystems. CCE-82069-6 + - name: Ensure non-root local partitions are mounted with nodev option + mount: + path: '{{ item.mount }}' + src: '{{ item.device }}' + opts: '{{ item.options }},nodev' + state: mounted + fstype: '{{ item.fstype }}' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - item.mount is match('/\w') + - item.options is not search('nodev') + with_items: + - '{{ ansible_facts.mounts }}' + tags: + - CCE-82069-6 + - DISA-STIG-RHEL-08-010580 + - NIST-800-53-AC-6 + - NIST-800-53-AC-6(1) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-MP-7 + - configure_strategy + - high_disruption + - low_complexity + - medium_severity + - mount_option_nodev_nonroot_local_partitions + - no_reboot_needed + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -211404,35 +211598,6 @@ done else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure non-root local partitions are mounted with nodev option - mount: - path: '{{ item.mount }}' - src: '{{ item.device }}' - opts: '{{ item.options }},nodev' - state: mounted - fstype: '{{ item.fstype }}' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - item.mount is match('/\w') - - item.options is not search('nodev') - with_items: - - '{{ ansible_facts.mounts }}' - tags: - - CCE-82069-6 - - DISA-STIG-RHEL-08-010580 - - NIST-800-53-AC-6 - - NIST-800-53-AC-6(1) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-MP-7 - - configure_strategy - - high_disruption - - low_complexity - - medium_severity - - mount_option_nodev_nonroot_local_partitions - - no_reboot_needed @@ -211570,26 +211735,6 @@ not advised to set nodev on partitions which contain thei filesystems. CCE-82742-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="nodev" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -211618,6 +211763,26 @@ fi - medium_severity - mount_option_nodev_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="nodev" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211754,26 +211919,6 @@ Add the noexec option to the fourth column of the system to potential compromise. CCE-82746-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="noexec" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -211802,6 +211947,26 @@ fi - medium_severity - mount_option_noexec_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="noexec" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -211964,26 +212129,6 @@ users to introduce SUID or SGID binaries from partitions mounted off of removable media would allow them to introduce their own highly-privileged programs. CCE-82744-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_removable_partition='' - - -device_regex="^\s*$var_removable_partition\s\+" -mount_option="nosuid" - -if grep -q $device_regex /etc/fstab ; then - previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') - sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab -else - echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_removable_partition # promote to variable set_fact: var_removable_partition: !!str @@ -212012,6 +212157,26 @@ fi - medium_severity - mount_option_nosuid_removable_partitions - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_removable_partition='' + + +device_regex="^\s*$var_removable_partition\s\+" +mount_option="nosuid" + +if grep -q $device_regex /etc/fstab ; then + previous_opts=$(grep $device_regex /etc/fstab | awk '{print $4}') + sed -i "s|\($device_regex.*$previous_opts\)|\1,$mount_option|" /etc/fstab +else + echo "Not remediating, because there is no record of $var_removable_partition in /etc/fstab" >&2 +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212035,60 +212200,6 @@ Add the nosuid option to the fourth column of not be able to execute SUID or SGID binaries from this directory. CCE-83319-4 - -part /opt --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/opt" > /dev/null || findmnt --fstab "/opt" > /dev/null ); then - -function perform_remediation { - - # the mount point /opt has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/opt")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/opt' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /opt in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /opt)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /opt defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/opt"; then - if mountpoint -q "/opt"; then - mount -o remount --target "/opt" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /opt: Check information associated to mountpoint' command: findmnt --fstab '/opt' register: device_name @@ -212191,6 +212302,60 @@ fi - medium_severity - mount_option_opt_nosuid - no_reboot_needed + + +part /opt --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/opt" > /dev/null || findmnt --fstab "/opt" > /dev/null ); then + +function perform_remediation { + + # the mount point /opt has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/opt")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/opt' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /opt in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /opt)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /opt defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/opt"; then + if mountpoint -q "/opt"; then + mount -o remount --target "/opt" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212226,51 +212391,6 @@ related to their own processes in a system. Otherwise, sensitive information fro other users could be seem. CCE-85882-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -function perform_remediation { - - - - var_mount_option_proc_hidepid='' - - mountoption="hidepid=$var_mount_option_proc_hidepid" - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /proc)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|$mountoption)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="proc" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo "proc /proc proc defaults,${previous_mount_opts}$mountoption 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "$mountoption"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,$mountoption|" /etc/fstab - fi - - - if mkdir -p "/proc"; then - if mountpoint -q "/proc"; then - mount -o remount --target "/proc" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_mount_option_proc_hidepid # promote to variable set_fact: var_mount_option_proc_hidepid: !!str @@ -212374,6 +212494,51 @@ fi - low_severity - mount_option_proc_hidepid - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +function perform_remediation { + + + + var_mount_option_proc_hidepid='' + + mountoption="hidepid=$var_mount_option_proc_hidepid" + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /proc)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|$mountoption)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="proc" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo "proc /proc proc defaults,${previous_mount_opts}$mountoption 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "$mountoption"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,$mountoption|" /etc/fstab + fi + + + if mkdir -p "/proc"; then + if mountpoint -q "/proc"; then + mount -o remount --target "/proc" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212397,60 +212562,6 @@ Add the nosuid option to the fourth column of not be able to execute SUID or SGID binaries from this directory. CCE-83322-8 - -part /srv --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/srv" > /dev/null || findmnt --fstab "/srv" > /dev/null ); then - -function perform_remediation { - - # the mount point /srv has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/srv")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/srv' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /srv in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /srv)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /srv defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/srv"; then - if mountpoint -q "/srv"; then - mount -o remount --target "/srv" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /srv: Check information associated to mountpoint' command: findmnt --fstab '/srv' register: device_name @@ -212553,6 +212664,60 @@ fi - medium_severity - mount_option_srv_nosuid - no_reboot_needed + + +part /srv --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/srv" > /dev/null || findmnt --fstab "/srv" > /dev/null ); then + +function perform_remediation { + + # the mount point /srv has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/srv")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/srv' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /srv in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /srv)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /srv defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/srv"; then + if mountpoint -q "/srv"; then + mount -o remount --target "/srv" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212669,60 +212834,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82623-0 - -part /tmp --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -212859,6 +212970,60 @@ fi - medium_severity - mount_option_tmp_nodev - no_reboot_needed + + +part /tmp --mountoptions="nodev" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -212975,60 +213140,6 @@ such as /tmp should never be necessary in normal operatio can expose the system to potential compromise. CCE-82139-7 - -part /tmp --mountoptions="noexec" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -213166,6 +213277,60 @@ fi - medium_severity - mount_option_tmp_noexec - no_reboot_needed + + +part /tmp --mountoptions="noexec" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -213282,60 +213447,6 @@ Add the nosuid option to the fourth column of should not be able to execute SUID or SGID binaries from temporary storage partitions. CCE-82140-5 - -part /tmp --mountoptions="nosuid" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi - - - if mkdir -p "/tmp"; then - if mountpoint -q "/tmp"; then - mount -o remount --target "/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nosuid Option to /tmp: Check information associated to mountpoint' command: findmnt --fstab '/tmp' register: device_name @@ -213473,6 +213584,60 @@ fi - medium_severity - mount_option_tmp_nosuid - no_reboot_needed + + +part /tmp --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/tmp" > /dev/null || findmnt --fstab "/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/tmp"; then + if mountpoint -q "/tmp"; then + mount -o remount --target "/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -213518,60 +213683,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82080-3 - -part /var/log/audit --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/log/audit has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log/audit")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/log/audit' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/log/audit in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log/audit)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/log/audit defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/log/audit"; then - if mountpoint -q "/var/log/audit"; then - mount -o remount --target "/var/log/audit" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -213713,52 +213824,10 @@ fi - mount_option_var_log_audit_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var/log/audit - The noexec mount option can be used to prevent binaries -from being executed out of /var/log/audit. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log/audit. - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040131 - 1.1.2.7.4 - SV-230519r854060_rule - Allowing users to execute binaries from directories containing audit log files -such as /var/log/audit should never be necessary in normal operation and -can expose the system to potential compromise. - - CCE-82975-4 - -part /var/log/audit --mountoptions="noexec" + +part /var/log/audit --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then function perform_remediation { @@ -213780,7 +213849,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -213788,11 +213857,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log/audit defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var/log/audit defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -213809,6 +213878,48 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var/log/audit + The noexec mount option can be used to prevent binaries +from being executed out of /var/log/audit. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log/audit. + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040131 + 1.1.2.7.4 + SV-230519r854060_rule + Allowing users to execute binaries from directories containing audit log files +such as /var/log/audit should never be necessary in normal operation and +can expose the system to potential compromise. + + CCE-82975-4 - name: 'Add noexec Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -213950,53 +214061,10 @@ fi - mount_option_var_log_audit_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/log/audit - The nosuid mount option can be used to prevent -execution of setuid programs in /var/log/audit. The SUID and SGID permissions -should not be required in directories containing audit log files. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log/audit. - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040130 - 1.1.2.7.3 - SV-230518r854059_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from partitions -designated for audit log files. - - CCE-82921-8 - -part /var/log/audit --mountoptions="nosuid" + +part /var/log/audit --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then function perform_remediation { @@ -214018,7 +214086,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214026,11 +214094,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log/audit defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/log/audit defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -214047,6 +214115,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/log/audit + The nosuid mount option can be used to prevent +execution of setuid programs in /var/log/audit. The SUID and SGID permissions +should not be required in directories containing audit log files. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log/audit. + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040130 + 1.1.2.7.3 + SV-230518r854059_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from partitions +designated for audit log files. + + CCE-82921-8 - name: 'Add nosuid Option to /var/log/audit: Check information associated to mountpoint' command: findmnt --fstab '/var/log/audit' register: device_name @@ -214187,6 +214298,60 @@ fi - medium_severity - mount_option_var_log_audit_nosuid - no_reboot_needed + + +part /var/log/audit --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log/audit" > /dev/null || findmnt --fstab "/var/log/audit" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/log/audit has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log/audit")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/log/audit' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/log/audit in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log/audit)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/log/audit defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/log/audit"; then + if mountpoint -q "/var/log/audit"; then + mount -o remount --target "/var/log/audit" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -214232,60 +214397,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82077-9 - -part /var/log --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/log has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/log' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/log in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/log defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/log"; then - if mountpoint -q "/var/log"; then - mount -o remount --target "/var/log" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214425,53 +214536,10 @@ fi - mount_option_var_log_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var/log - The noexec mount option can be used to prevent binaries -from being executed out of /var/log. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log. - BP28(R12) - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040128 - 1.1.2.6.4 - SV-230516r854057_rule - Allowing users to execute binaries from directories containing log files -such as /var/log should never be necessary in normal operation and -can expose the system to potential compromise. - - CCE-82008-4 - -part /var/log --mountoptions="noexec" + +part /var/log --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then function perform_remediation { @@ -214493,7 +214561,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214501,11 +214569,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var/log defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -214522,6 +214590,49 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var/log + The noexec mount option can be used to prevent binaries +from being executed out of /var/log. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log. + BP28(R12) + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040128 + 1.1.2.6.4 + SV-230516r854057_rule + Allowing users to execute binaries from directories containing log files +such as /var/log should never be necessary in normal operation and +can expose the system to potential compromise. + + CCE-82008-4 - name: 'Add noexec Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214662,54 +214773,10 @@ fi - mount_option_var_log_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/log - The nosuid mount option can be used to prevent -execution of setuid programs in /var/log. The SUID and SGID permissions -should not be required in directories containing log files. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/log. - BP28(R12) - CCI-001764 - CIP-003-8 R5.1.1 - CIP-003-8 R5.3 - CIP-004-6 R2.3 - CIP-007-3 R2.1 - CIP-007-3 R2.2 - CIP-007-3 R2.3 - CIP-007-3 R5.1 - CIP-007-3 R5.1.1 - CIP-007-3 R5.1.2 - CM-7(a) - CM-7(b) - CM-6(a) - AC-6 - AC-6(1) - MP-7 - PR.IP-1 - PR.PT-2 - PR.PT-3 - SRG-OS-000368-GPOS-00154 - RHEL-08-040127 - 1.1.2.6.3 - SV-230515r854056_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from partitions -designated for log files. - - CCE-82065-4 - -part /var/log --mountoptions="nosuid" + +part /var/log --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then function perform_remediation { @@ -214731,7 +214798,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -214739,11 +214806,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/log defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/log defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -214760,6 +214827,50 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/log + The nosuid mount option can be used to prevent +execution of setuid programs in /var/log. The SUID and SGID permissions +should not be required in directories containing log files. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/log. + BP28(R12) + CCI-001764 + CIP-003-8 R5.1.1 + CIP-003-8 R5.3 + CIP-004-6 R2.3 + CIP-007-3 R2.1 + CIP-007-3 R2.2 + CIP-007-3 R2.3 + CIP-007-3 R5.1 + CIP-007-3 R5.1.1 + CIP-007-3 R5.1.2 + CM-7(a) + CM-7(b) + CM-6(a) + AC-6 + AC-6(1) + MP-7 + PR.IP-1 + PR.PT-2 + PR.PT-3 + SRG-OS-000368-GPOS-00154 + RHEL-08-040127 + 1.1.2.6.3 + SV-230515r854056_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from partitions +designated for log files. + + CCE-82065-4 - name: 'Add nosuid Option to /var/log: Check information associated to mountpoint' command: findmnt --fstab '/var/log' register: device_name @@ -214899,6 +215010,60 @@ fi - medium_severity - mount_option_var_log_nosuid - no_reboot_needed + + +part /var/log --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/log" > /dev/null || findmnt --fstab "/var/log" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/log has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/log")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/log' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/log in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/log)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/log defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/log"; then + if mountpoint -q "/var/log"; then + mount -o remount --target "/var/log" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -214941,60 +215106,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82062-1 - -part /var --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then - -function perform_remediation { - - # the mount point /var has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var"; then - if mountpoint -q "/var"; then - mount -o remount --target "/var" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215127,29 +215238,10 @@ fi - mount_option_var_nodev - no_reboot_needed - - - - - - - - - Add noexec Option to /var - The noexec mount option can be used to prevent binaries from being -executed out of /var. -Add the noexec option to the fourth column of -/etc/fstab for the line which controls mounting of -/var. - BP28(R12) - The /var directory contains variable system data such as logs, -mails and caches. No binaries should be executed from this directory. - - CCE-83330-1 - -part /var --mountoptions="noexec" + +part /var --mountoptions="nodev" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then function perform_remediation { @@ -215171,7 +215263,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -215179,11 +215271,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + echo " /var defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab fi @@ -215200,6 +215292,25 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add noexec Option to /var + The noexec mount option can be used to prevent binaries from being +executed out of /var. +Add the noexec option to the fourth column of +/etc/fstab for the line which controls mounting of +/var. + BP28(R12) + The /var directory contains variable system data such as logs, +mails and caches. No binaries should be executed from this directory. + + CCE-83330-1 - name: 'Add noexec Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215303,30 +215414,10 @@ fi - mount_option_var_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var - The nosuid mount option can be used to prevent -execution of setuid programs in /var. The SUID and SGID permissions -should not be required for this directory. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var. - BP28(R12) - 1.1.2.4.3 - The presence of SUID and SGID executables should be tightly controlled. - - CCE-83383-0 - -part /var --mountoptions="nosuid" + +part /var --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then function perform_remediation { @@ -215348,7 +215439,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -215356,11 +215447,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -215377,6 +215468,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var + The nosuid mount option can be used to prevent +execution of setuid programs in /var. The SUID and SGID permissions +should not be required for this directory. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var. + BP28(R12) + 1.1.2.4.3 + The presence of SUID and SGID executables should be tightly controlled. + + CCE-83383-0 - name: 'Add nosuid Option to /var: Check information associated to mountpoint' command: findmnt --fstab '/var' register: device_name @@ -215479,6 +215590,60 @@ fi - medium_severity - mount_option_var_nosuid - no_reboot_needed + + +part /var --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var" > /dev/null || findmnt --fstab "/var" > /dev/null ); then + +function perform_remediation { + + # the mount point /var has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var"; then + if mountpoint -q "/var"; then + mount -o remount --target "/var" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -215612,60 +215777,6 @@ Add the nodev option to the fourth column of located on the root partition. The only exception to this is chroot jails. CCE-82068-8 - -part /var/tmp --mountoptions="nodev" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi - - - if mkdir -p "/var/tmp"; then - if mountpoint -q "/var/tmp"; then - mount -o remount --target "/var/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add nodev Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -215774,6 +215885,60 @@ fi - medium_severity - mount_option_var_tmp_nodev - no_reboot_needed + + +part /var/tmp --mountoptions="nodev" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/tmp defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi + + + if mkdir -p "/var/tmp"; then + if mountpoint -q "/var/tmp"; then + mount -o remount --target "/var/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -215800,60 +215965,6 @@ such as /var/tmp should never be necessary in normal oper can expose the system to potential compromise. CCE-82151-2 - -part /var/tmp --mountoptions="noexec" - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then - -function perform_remediation { - - # the mount point /var/tmp has to be defined in /etc/fstab - # before this remediation can be executed. In case it is not defined, the - # remediation aborts and no changes regarding the mount point are done. - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" - - grep "$mount_point_match_regexp" -q /etc/fstab \ - || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; - echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } - - - - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " /var/tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi - - - if mkdir -p "/var/tmp"; then - if mountpoint -q "/var/tmp"; then - mount -o remount --target "/var/tmp" - fi - fi -} - -perform_remediation - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: 'Add noexec Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -215964,35 +216075,10 @@ fi - mount_option_var_tmp_noexec - no_reboot_needed - - - - - - - - - Add nosuid Option to /var/tmp - The nosuid mount option can be used to prevent -execution of setuid programs in /var/tmp. The SUID and SGID permissions -should not be required in these world-writable directories. -Add the nosuid option to the fourth column of -/etc/fstab for the line which controls mounting of -/var/tmp. - BP28(R12) - CCI-001764 - SRG-OS-000368-GPOS-00154 - RHEL-08-040133 - 1.1.2.5.3 - SV-230521r854062_rule - The presence of SUID and SGID executables should be tightly controlled. Users -should not be able to execute SUID or SGID binaries from temporary storage partitions. - - CCE-82154-6 - -part /var/tmp --mountoptions="nosuid" + +part /var/tmp --mountoptions="noexec" - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then function perform_remediation { @@ -216014,7 +216100,7 @@ function perform_remediation { if ! grep -q "$mount_point_match_regexp" /etc/fstab; then # runtime opts without some automatic kernel/userspace-added defaults previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") [ "$previous_mount_opts" ] && previous_mount_opts+="," # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in # fstab as "block". The next variable is to satisfy shellcheck SC2050. @@ -216022,11 +216108,11 @@ function perform_remediation { if [ "$fs_type" == "iso9660" ] ; then previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") fi - echo " /var/tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + echo " /var/tmp defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab fi @@ -216043,6 +216129,31 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Add nosuid Option to /var/tmp + The nosuid mount option can be used to prevent +execution of setuid programs in /var/tmp. The SUID and SGID permissions +should not be required in these world-writable directories. +Add the nosuid option to the fourth column of +/etc/fstab for the line which controls mounting of +/var/tmp. + BP28(R12) + CCI-001764 + SRG-OS-000368-GPOS-00154 + RHEL-08-040133 + 1.1.2.5.3 + SV-230521r854062_rule + The presence of SUID and SGID executables should be tightly controlled. Users +should not be able to execute SUID or SGID binaries from temporary storage partitions. + + CCE-82154-6 - name: 'Add nosuid Option to /var/tmp: Check information associated to mountpoint' command: findmnt --fstab '/var/tmp' register: device_name @@ -216152,6 +216263,60 @@ fi - medium_severity - mount_option_var_tmp_nosuid - no_reboot_needed + + +part /var/tmp --mountoptions="nosuid" + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && findmnt --kernel "/var/tmp" > /dev/null || findmnt --fstab "/var/tmp" > /dev/null ); then + +function perform_remediation { + + # the mount point /var/tmp has to be defined in /etc/fstab + # before this remediation can be executed. In case it is not defined, the + # remediation aborts and no changes regarding the mount point are done. + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" "/var/tmp")" + + grep "$mount_point_match_regexp" -q /etc/fstab \ + || { echo "The mount point '/var/tmp' is not even in /etc/fstab, so we can't set up mount options" >&2; + echo "Not remediating, because there is no record of /var/tmp in /etc/fstab" >&2; return 1; } + + + + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" /var/tmp)" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " /var/tmp defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi + + + if mkdir -p "/var/tmp"; then + if mountpoint -q "/var/tmp"; then + mount -o remount --target "/var/tmp" + fi + fi +} + +perform_remediation + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -216194,51 +216359,17 @@ or compromised programs. SRG-OS-000095-GPOS-00049 SRG-OS-000370-GPOS-00155 RHEL-08-040020 - SV-230493r809316_rule + SV-230493r942915_rule Failing to disconnect from collaborative computing devices (i.e., cameras) can result in subsequent compromises of organizational information. Providing easy methods to physically disconnect from such devices after a collaborative computing session helps to ensure participants actually carry out the disconnect activity without having to go through complex and tedious procedures. CCE-86960-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,install%20uvcvideo%20/bin/true%0Ablacklist%20uvcvideo%0A - mode: 0644 - path: /etc/modprobe.d/uvcvideo.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if LC_ALL=C grep -q -m 1 "^install uvcvideo" /etc/modprobe.d/uvcvideo.conf ; then - - sed -i 's#^install uvcvideo.*#install uvcvideo /bin/true#g' /etc/modprobe.d/uvcvideo.conf -else - echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/uvcvideo.conf - echo "install uvcvideo /bin/true" >> /etc/modprobe.d/uvcvideo.conf -fi - -if ! LC_ALL=C grep -q -m 1 "^blacklist uvcvideo$" /etc/modprobe.d/uvcvideo.conf ; then - echo "blacklist uvcvideo" >> /etc/modprobe.d/uvcvideo.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure kernel module 'uvcvideo' is disabled lineinfile: create: true dest: /etc/modprobe.d/uvcvideo.conf regexp: install\s+uvcvideo - line: install uvcvideo /bin/true + line: install uvcvideo /bin/false when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - CCE-86960-2 @@ -216270,6 +216401,40 @@ fi - medium_disruption - medium_severity - reboot_required + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,install%20uvcvideo%20/bin/true%0Ablacklist%20uvcvideo%0A + mode: 0644 + path: /etc/modprobe.d/uvcvideo.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if LC_ALL=C grep -q -m 1 "^install uvcvideo" /etc/modprobe.d/uvcvideo.conf ; then + + sed -i 's#^install uvcvideo.*#install uvcvideo /bin/true#g' /etc/modprobe.d/uvcvideo.conf +else + echo -e "\n# Disable per security requirements" >> /etc/modprobe.d/uvcvideo.conf + echo "install uvcvideo /bin/false" >> /etc/modprobe.d/uvcvideo.conf +fi + +if ! LC_ALL=C grep -q -m 1 "^blacklist uvcvideo$" /etc/modprobe.d/uvcvideo.conf ; then + echo "blacklist uvcvideo" >> /etc/modprobe.d/uvcvideo.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -216294,6 +216459,68 @@ terminates an application. The memory image could contain sensitive data and is only for developers trying to debug problems. CCE-82215-5 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.core_pattern.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + +- name: Comment out any occurrences of kernel.core_pattern from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.core_pattern + replace: '#kernel.core_pattern' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + +- name: Ensure sysctl kernel.core_pattern is set to |/bin/false + sysctl: + name: kernel.core_pattern + value: '|/bin/false' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82215-5 + - DISA-STIG-RHEL-08-010671 + - NIST-800-53-SC-7(10) + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_core_pattern + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216369,89 +216596,77 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Configure file name of core dumps + To set the runtime status of the kernel.core_uses_pid kernel parameter, run the following command: $ sudo sysctl -w kernel.core_uses_pid=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.core_uses_pid = 0 + FMT_SMF_EXT.1 + The default coredump filename is core. By setting +core_uses_pid to 1, the coredump filename becomes +core.PID. If core_pattern does not include +%p (default does not) and core_uses_pid is set, then +.PID will be appended to the filename. +When combined with kernel.core_pattern = "" configuration, it +is ensured that no core dumps are generated and also no confusing error +messages are printed by a shell. + + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.core_pattern.*$ + contains: ^[\s]*kernel.core_uses_pid.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid -- name: Comment out any occurrences of kernel.core_pattern from config files +- name: Comment out any occurrences of kernel.core_uses_pid from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.core_pattern - replace: '#kernel.core_pattern' + regexp: ^[\s]*kernel.core_uses_pid + replace: '#kernel.core_uses_pid' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid -- name: Ensure sysctl kernel.core_pattern is set to |/bin/false +- name: Ensure sysctl kernel.core_uses_pid is set to 0 sysctl: - name: kernel.core_pattern - value: '|/bin/false' + name: kernel.core_uses_pid + value: '0' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82215-5 - - DISA-STIG-RHEL-08-010671 - - NIST-800-53-SC-7(10) - - PCI-DSSv4-3.3.1 - disable_strategy - low_complexity - medium_disruption - medium_severity - reboot_required - - sysctl_kernel_core_pattern + - sysctl_kernel_core_uses_pid - - - - - - - - - Configure file name of core dumps - To set the runtime status of the kernel.core_uses_pid kernel parameter, run the following command: $ sudo sysctl -w kernel.core_uses_pid=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.core_uses_pid = 0 - FMT_SMF_EXT.1 - The default coredump filename is core. By setting -core_uses_pid to 1, the coredump filename becomes -core.PID. If core_pattern does not include -%p (default does not) and core_uses_pid is set, then -.PID will be appended to the filename. -When combined with kernel.core_pattern = "" configuration, it -is ensured that no core dumps are generated and also no confusing error -messages are printed by a shell. - # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -216510,89 +216725,104 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Restrict Access to Kernel Message Buffer + To set the runtime status of the kernel.dmesg_restrict kernel parameter, run the following command: $ sudo sysctl -w kernel.dmesg_restrict=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.dmesg_restrict = 1 + BP28(R23) + 3.1.5 + CCI-001090 + CCI-001314 + 164.308(a)(1)(ii)(D) + 164.308(a)(3) + 164.308(a)(4) + 164.310(b) + 164.310(c) + 164.312(a) + 164.312(e) + SI-11(a) + SI-11(b) + SRG-OS-000132-GPOS-00067 + SRG-OS-000138-GPOS-00069 + SRG-APP-000243-CTR-000600 + RHEL-08-010375 + SV-230269r858756_rule + Unprivileged access to the kernel syslog can expose sensitive kernel +address information. + + CCE-80913-7 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.core_uses_pid.*$ + contains: ^[\s]*kernel.dmesg_restrict.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict -- name: Comment out any occurrences of kernel.core_uses_pid from config files +- name: Comment out any occurrences of kernel.dmesg_restrict from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.core_uses_pid - replace: '#kernel.core_uses_pid' + regexp: ^[\s]*kernel.dmesg_restrict + replace: '#kernel.dmesg_restrict' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict -- name: Ensure sysctl kernel.core_uses_pid is set to 0 +- name: Ensure sysctl kernel.dmesg_restrict is set to 1 sysctl: - name: kernel.core_uses_pid - value: '0' + name: kernel.dmesg_restrict + value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: + - CCE-80913-7 + - DISA-STIG-RHEL-08-010375 + - NIST-800-171-3.1.5 + - NIST-800-53-SI-11(a) + - NIST-800-53-SI-11(b) - disable_strategy - low_complexity + - low_severity - medium_disruption - - medium_severity - reboot_required - - sysctl_kernel_core_uses_pid + - sysctl_kernel_dmesg_restrict - - - - - - - - - Restrict Access to Kernel Message Buffer - To set the runtime status of the kernel.dmesg_restrict kernel parameter, run the following command: $ sudo sysctl -w kernel.dmesg_restrict=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.dmesg_restrict = 1 - BP28(R23) - 3.1.5 - CCI-001090 - CCI-001314 - 164.308(a)(1)(ii)(D) - 164.308(a)(3) - 164.308(a)(4) - 164.310(b) - 164.310(c) - 164.312(a) - 164.312(e) - SI-11(a) - SI-11(b) - SRG-OS-000132-GPOS-00067 - SRG-OS-000138-GPOS-00069 - SRG-APP-000243-CTR-000600 - RHEL-08-010375 - SV-230269r858756_rule - Unprivileged access to the kernel syslog can expose sensitive kernel -address information. - - CCE-80913-7 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216668,93 +216898,87 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: List /etc/sysctl.d/*.conf files + + + + + + + + + Disable Kernel Image Loading + To set the runtime status of the kernel.kexec_load_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.kexec_load_disabled=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.kexec_load_disabled = 1 + CCI-001749 + CM-6 + SRG-OS-000480-GPOS-00227 + SRG-OS-000366-GPOS-00153 + RHEL-08-010372 + SV-230266r877463_rule + Disabling kexec_load allows greater control of the kernel memory. +It makes it impossible to load another kernel image after it has been disabled. + + + CCE-80952-5 + - name: List /etc/sysctl.d/*.conf files find: paths: - /etc/sysctl.d/ - /run/sysctl.d/ - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.dmesg_restrict.*$ + contains: ^[\s]*kernel.kexec_load_disabled.*$ patterns: '*.conf' file_type: any register: find_sysctl_d when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled -- name: Comment out any occurrences of kernel.dmesg_restrict from config files +- name: Comment out any occurrences of kernel.kexec_load_disabled from config files replace: path: '{{ item.path }}' - regexp: ^[\s]*kernel.dmesg_restrict - replace: '#kernel.dmesg_restrict' + regexp: ^[\s]*kernel.kexec_load_disabled + replace: '#kernel.kexec_load_disabled' loop: '{{ find_sysctl_d.files }}' when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled -- name: Ensure sysctl kernel.dmesg_restrict is set to 1 +- name: Ensure sysctl kernel.kexec_load_disabled is set to 1 sysctl: - name: kernel.dmesg_restrict + name: kernel.kexec_load_disabled value: '1' sysctl_file: /etc/sysctl.conf state: present reload: true when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80913-7 - - DISA-STIG-RHEL-08-010375 - - NIST-800-171-3.1.5 - - NIST-800-53-SI-11(a) - - NIST-800-53-SI-11(b) + - CCE-80952-5 + - DISA-STIG-RHEL-08-010372 + - NIST-800-53-CM-6 - disable_strategy - low_complexity - - low_severity - medium_disruption + - medium_severity - reboot_required - - sysctl_kernel_dmesg_restrict + - sysctl_kernel_kexec_load_disabled - - - - - - - - - Disable Kernel Image Loading - To set the runtime status of the kernel.kexec_load_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.kexec_load_disabled=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.kexec_load_disabled = 1 - CCI-001749 - CM-6 - SRG-OS-000480-GPOS-00227 - SRG-OS-000366-GPOS-00153 - RHEL-08-010372 - SV-230266r877463_rule - Disabling kexec_load allows greater control of the kernel memory. -It makes it impossible to load another kernel image after it has been disabled. - - - CCE-80952-5 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -216829,65 +217053,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.kexec_load_disabled.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled - -- name: Comment out any occurrences of kernel.kexec_load_disabled from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.kexec_load_disabled - replace: '#kernel.kexec_load_disabled' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled - -- name: Ensure sysctl kernel.kexec_load_disabled is set to 1 - sysctl: - name: kernel.kexec_load_disabled - value: '1' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80952-5 - - DISA-STIG-RHEL-08-010372 - - NIST-800-53-CM-6 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kexec_load_disabled @@ -216980,66 +217145,6 @@ would have allowed the system to continue operating will now result in a panic.< panicking the system will impede them from continuing. CCE-87666-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of kernel.panic_on_oops from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*kernel.panic_on_oops.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.panic_on_oops" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for kernel.panic_on_oops -# -/sbin/sysctl -q -n -w kernel.panic_on_oops="1" - -# -# If kernel.panic_on_oops present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.panic_on_oops = 1" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.panic_on_oops") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.panic_on_oops\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.panic_on_oops\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-87666-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217093,35 +217198,18 @@ fi - reboot_required - sysctl_kernel_panic_on_oops - - - - - - - - - Limit CPU consumption of the Perf system - To set the runtime status of the kernel.perf_cpu_time_max_percent kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_cpu_time_max_percent=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_cpu_time_max_percent = 1 - BP28(R23) - The kernel.perf_cpu_time_max_percent configures a treshold of -maximum percentile of CPU that can be used by Perf system. Restricting usage -of Perf system decreases risk of potential availability problems. - - CCE-83373-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_cpu_time_max_percent from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.panic_on_oops from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_cpu_time_max_percent.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.panic_on_oops.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_cpu_time_max_percent" matches to preserve user data + # comment out "kernel.panic_on_oops" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217135,18 +217223,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_cpu_time_max_percent +# Set runtime for kernel.panic_on_oops # -/sbin/sysctl -q -n -w kernel.perf_cpu_time_max_percent="1" +/sbin/sysctl -q -n -w kernel.panic_on_oops="1" # -# If kernel.perf_cpu_time_max_percent present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.perf_cpu_time_max_percent = 1" to /etc/sysctl.conf +# If kernel.panic_on_oops present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.panic_on_oops = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_cpu_time_max_percent") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.panic_on_oops") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -217154,14 +217242,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_cpu_time_max_percent\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.panic_on_oops\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_cpu_time_max_percent\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.panic_on_oops\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83373-1" + cce="CCE-87666-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217170,6 +217258,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Limit CPU consumption of the Perf system + To set the runtime status of the kernel.perf_cpu_time_max_percent kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_cpu_time_max_percent=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_cpu_time_max_percent = 1 + BP28(R23) + The kernel.perf_cpu_time_max_percent configures a treshold of +maximum percentile of CPU that can be used by Perf system. Restricting usage +of Perf system decreases risk of potential availability problems. + + CCE-83373-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217224,36 +217329,18 @@ fi - reboot_required - sysctl_kernel_perf_cpu_time_max_percent - - - - - - - - - Limit sampling frequency of the Perf system - To set the runtime status of the kernel.perf_event_max_sample_rate kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_max_sample_rate=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_max_sample_rate = 1 - BP28(R23) - The kernel.perf_event_max_sample_rate parameter configures maximum -frequency of collecting of samples for the Perf system. It is expressed in -samples per second. Restricting usage of Perf system decreases risk -of potential availability problems. - - CCE-83368-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_event_max_sample_rate from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_cpu_time_max_percent from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_max_sample_rate.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_cpu_time_max_percent.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_event_max_sample_rate" matches to preserve user data + # comment out "kernel.perf_cpu_time_max_percent" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217267,18 +217354,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_event_max_sample_rate +# Set runtime for kernel.perf_cpu_time_max_percent # -/sbin/sysctl -q -n -w kernel.perf_event_max_sample_rate="1" +/sbin/sysctl -q -n -w kernel.perf_cpu_time_max_percent="1" # -# If kernel.perf_event_max_sample_rate present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.perf_event_max_sample_rate = 1" to /etc/sysctl.conf +# If kernel.perf_cpu_time_max_percent present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.perf_cpu_time_max_percent = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_max_sample_rate") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_cpu_time_max_percent") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -217286,14 +217373,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_max_sample_rate\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_cpu_time_max_percent\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_max_sample_rate\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_cpu_time_max_percent\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83368-1" + cce="CCE-83373-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217302,6 +217389,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Limit sampling frequency of the Perf system + To set the runtime status of the kernel.perf_event_max_sample_rate kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_max_sample_rate=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_max_sample_rate = 1 + BP28(R23) + The kernel.perf_event_max_sample_rate parameter configures maximum +frequency of collecting of samples for the Perf system. It is expressed in +samples per second. Restricting usage of Perf system decreases risk +of potential availability problems. + + CCE-83368-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217356,56 +217461,18 @@ fi - reboot_required - sysctl_kernel_perf_event_max_sample_rate - - - - - - - - - Disallow kernel profiling by unprivileged users - To set the runtime status of the kernel.perf_event_paranoid kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_paranoid=2 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_paranoid = 2 - BP28(R23) - CCI-001090 - AC-6 - FMT_SMF_EXT.1 - SRG-OS-000132-GPOS-00067 - SRG-OS-000138-GPOS-00069 - SRG-APP-000243-CTR-000600 - RHEL-08-010376 - SV-230270r858758_rule - Kernel profiling can reveal sensitive information about kernel behaviour. - - CCE-81054-9 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,kernel.perf_event_paranoid%3D2%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_perf_event_paranoid.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.perf_event_paranoid from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_event_max_sample_rate from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_paranoid.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_max_sample_rate.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.perf_event_paranoid" matches to preserve user data + # comment out "kernel.perf_event_max_sample_rate" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217419,33 +217486,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.perf_event_paranoid +# Set runtime for kernel.perf_event_max_sample_rate # -/sbin/sysctl -q -n -w kernel.perf_event_paranoid="2" +/sbin/sysctl -q -n -w kernel.perf_event_max_sample_rate="1" # -# If kernel.perf_event_paranoid present in /etc/sysctl.conf, change value to "2" -# else, add "kernel.perf_event_paranoid = 2" to /etc/sysctl.conf +# If kernel.perf_event_max_sample_rate present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.perf_event_max_sample_rate = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_paranoid") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_max_sample_rate") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "2" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_paranoid\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_max_sample_rate\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_paranoid\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_max_sample_rate\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-81054-9" + cce="CCE-83368-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217454,6 +217521,29 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disallow kernel profiling by unprivileged users + To set the runtime status of the kernel.perf_event_paranoid kernel parameter, run the following command: $ sudo sysctl -w kernel.perf_event_paranoid=2 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.perf_event_paranoid = 2 + BP28(R23) + CCI-001090 + AC-6 + FMT_SMF_EXT.1 + SRG-OS-000132-GPOS-00067 + SRG-OS-000138-GPOS-00069 + SRG-APP-000243-CTR-000600 + RHEL-08-010376 + SV-230270r858758_rule + Kernel profiling can reveal sensitive information about kernel behaviour. + + CCE-81054-9 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217513,36 +217603,33 @@ fi - reboot_required - sysctl_kernel_perf_event_paranoid - - - - - - - - - Configure maximum number of process identifiers - To set the runtime status of the kernel.pid_max kernel parameter, run the following command: $ sudo sysctl -w kernel.pid_max=65536 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.pid_max = 65536 - BP28(R23) - The kernel.pid_max parameter configures upper limit on process -identifiers (PID). If this number is not high enough, it might happen that -forking of new processes is not possible, because all available PIDs are -exhausted. Increasing this number enhances availability. - - CCE-83366-5 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,kernel.perf_event_paranoid%3D2%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_kernel_perf_event_paranoid.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.pid_max from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.perf_event_paranoid from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.pid_max.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.perf_event_paranoid.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.pid_max" matches to preserve user data + # comment out "kernel.perf_event_paranoid" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217556,33 +217643,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.pid_max +# Set runtime for kernel.perf_event_paranoid # -/sbin/sysctl -q -n -w kernel.pid_max="65536" +/sbin/sysctl -q -n -w kernel.perf_event_paranoid="2" # -# If kernel.pid_max present in /etc/sysctl.conf, change value to "65536" -# else, add "kernel.pid_max = 65536" to /etc/sysctl.conf +# If kernel.perf_event_paranoid present in /etc/sysctl.conf, change value to "2" +# else, add "kernel.perf_event_paranoid = 2" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.pid_max") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.perf_event_paranoid") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "65536" +printf -v formatted_output "%s = %s" "$stripped_key" "2" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.pid_max\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.perf_event_paranoid\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.pid_max\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.perf_event_paranoid\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83366-5" + cce="CCE-81054-9" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217591,6 +217678,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Configure maximum number of process identifiers + To set the runtime status of the kernel.pid_max kernel parameter, run the following command: $ sudo sysctl -w kernel.pid_max=65536 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.pid_max = 65536 + BP28(R23) + The kernel.pid_max parameter configures upper limit on process +identifiers (PID). If this number is not high enough, it might happen that +forking of new processes is not possible, because all available PIDs are +exhausted. Increasing this number enhances availability. + + CCE-83366-5 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217644,36 +217749,18 @@ fi - reboot_required - sysctl_kernel_pid_max - - - - - - - - - Disallow magic SysRq key - To set the runtime status of the kernel.sysrq kernel parameter, run the following command: $ sudo sysctl -w kernel.sysrq=0 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.sysrq = 0 - BP28(R23) - The Magic SysRq key allows sending certain commands directly to the running -kernel. It can dump various system and process information, potentially -revealing sensitive information. It can also reboot or shutdown the machine, -disturbing its availability. - - CCE-83355-8 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.sysrq from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.pid_max from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.sysrq.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.pid_max.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.sysrq" matches to preserve user data + # comment out "kernel.pid_max" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217687,33 +217774,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.sysrq +# Set runtime for kernel.pid_max # -/sbin/sysctl -q -n -w kernel.sysrq="0" +/sbin/sysctl -q -n -w kernel.pid_max="65536" # -# If kernel.sysrq present in /etc/sysctl.conf, change value to "0" -# else, add "kernel.sysrq = 0" to /etc/sysctl.conf +# If kernel.pid_max present in /etc/sysctl.conf, change value to "65536" +# else, add "kernel.pid_max = 65536" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.sysrq") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.pid_max") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" +printf -v formatted_output "%s = %s" "$stripped_key" "65536" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.sysrq\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.pid_max\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.sysrq\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.pid_max\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83355-8" + cce="CCE-83366-5" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217722,6 +217809,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disallow magic SysRq key + To set the runtime status of the kernel.sysrq kernel parameter, run the following command: $ sudo sysctl -w kernel.sysrq=0 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.sysrq = 0 + BP28(R23) + The Magic SysRq key allows sending certain commands directly to the running +kernel. It can dump various system and process information, potentially +revealing sensitive information. It can also reboot or shutdown the machine, +disturbing its availability. + + CCE-83355-8 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217775,57 +217880,18 @@ fi - reboot_required - sysctl_kernel_sysrq - - - - - - - - - Disable Access to Network bpf() Syscall From Unprivileged Processes - To set the runtime status of the kernel.unprivileged_bpf_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.unprivileged_bpf_disabled=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.unprivileged_bpf_disabled = 1 - BP28(R9) - CCI-000366 - AC-6 - SC-7(10) - FMT_SMF_EXT.1 - SRG-OS-000132-GPOS-00067 - SRG-OS-000480-GPOS-00227 - RHEL-08-040281 - SV-230545r858822_rule - Loading and accessing the packet filters programs and maps using the bpf() -syscall has the potential of revealing sensitive information about the kernel state. - - CCE-82974-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,kernel.unprivileged_bpf_disabled%3D1%0A - mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_unprivileged_bpf_disabled.conf - overwrite: true - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.unprivileged_bpf_disabled from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.sysrq from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.unprivileged_bpf_disabled.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.sysrq.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.unprivileged_bpf_disabled" matches to preserve user data + # comment out "kernel.sysrq" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -217839,33 +217905,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.unprivileged_bpf_disabled +# Set runtime for kernel.sysrq # -/sbin/sysctl -q -n -w kernel.unprivileged_bpf_disabled="1" +/sbin/sysctl -q -n -w kernel.sysrq="0" # -# If kernel.unprivileged_bpf_disabled present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.unprivileged_bpf_disabled = 1" to /etc/sysctl.conf +# If kernel.sysrq present in /etc/sysctl.conf, change value to "0" +# else, add "kernel.sysrq = 0" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.unprivileged_bpf_disabled") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.sysrq") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "1" +printf -v formatted_output "%s = %s" "$stripped_key" "0" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.unprivileged_bpf_disabled\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.sysrq\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.unprivileged_bpf_disabled\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.sysrq\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82974-7" + cce="CCE-83355-8" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -217874,6 +217940,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable Access to Network bpf() Syscall From Unprivileged Processes + To set the runtime status of the kernel.unprivileged_bpf_disabled kernel parameter, run the following command: $ sudo sysctl -w kernel.unprivileged_bpf_disabled=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.unprivileged_bpf_disabled = 1 + BP28(R9) + CCI-000366 + AC-6 + SC-7(10) + FMT_SMF_EXT.1 + SRG-OS-000132-GPOS-00067 + SRG-OS-000480-GPOS-00227 + RHEL-08-040281 + SV-230545r858822_rule + Loading and accessing the packet filters programs and maps using the bpf() +syscall has the potential of revealing sensitive information about the kernel state. + + CCE-82974-7 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -217937,33 +218027,7 @@ fi - reboot_required - sysctl_kernel_unprivileged_bpf_disabled - - - - - - - - - Restrict usage of ptrace to descendant processes - To set the runtime status of the kernel.yama.ptrace_scope kernel parameter, run the following command: $ sudo sysctl -w kernel.yama.ptrace_scope=1 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.yama.ptrace_scope = 1 - BP28(R25) - CCI-000366 - SC-7(10) - SRG-OS-000132-GPOS-00067 - SRG-OS-000480-GPOS-00227 - RHEL-08-040282 - 1.4.2 - SV-230546r858824_rule - Unrestricted usage of ptrace allows compromised binaries to run ptrace -on another processes of the user. Like this, the attacker can steal -sensitive information from the target processes (e.g. SSH sessions, web browser, ...) -without any additional assistance from the user (i.e. without resorting to phishing). - - - CCE-80953-3 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -217973,23 +218037,23 @@ spec: storage: files: - contents: - source: data:,kernel.yama.ptrace_scope%3D1%0A + source: data:,kernel.unprivileged_bpf_disabled%3D1%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_kernel_yama_ptrace_scope.conf + path: /etc/sysctl.d/75-sysctl_kernel_unprivileged_bpf_disabled.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of kernel.yama.ptrace_scope from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.unprivileged_bpf_disabled from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*kernel.yama.ptrace_scope.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.unprivileged_bpf_disabled.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "kernel.yama.ptrace_scope" matches to preserve user data + # comment out "kernel.unprivileged_bpf_disabled" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218003,18 +218067,18 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for kernel.yama.ptrace_scope +# Set runtime for kernel.unprivileged_bpf_disabled # -/sbin/sysctl -q -n -w kernel.yama.ptrace_scope="1" +/sbin/sysctl -q -n -w kernel.unprivileged_bpf_disabled="1" # -# If kernel.yama.ptrace_scope present in /etc/sysctl.conf, change value to "1" -# else, add "kernel.yama.ptrace_scope = 1" to /etc/sysctl.conf +# If kernel.unprivileged_bpf_disabled present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.unprivileged_bpf_disabled = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.yama.ptrace_scope") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.unprivileged_bpf_disabled") # shellcheck disable=SC2059 printf -v formatted_output "%s = %s" "$stripped_key" "1" @@ -218022,14 +218086,14 @@ printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^kernel.yama.ptrace_scope\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.unprivileged_bpf_disabled\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^kernel.yama.ptrace_scope\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.unprivileged_bpf_disabled\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-80953-3" + cce="CCE-82974-7" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218038,6 +218102,32 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Restrict usage of ptrace to descendant processes + To set the runtime status of the kernel.yama.ptrace_scope kernel parameter, run the following command: $ sudo sysctl -w kernel.yama.ptrace_scope=1 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: kernel.yama.ptrace_scope = 1 + BP28(R25) + CCI-000366 + SC-7(10) + SRG-OS-000132-GPOS-00067 + SRG-OS-000480-GPOS-00227 + RHEL-08-040282 + 1.4.2 + SV-230546r858824_rule + Unrestricted usage of ptrace allows compromised binaries to run ptrace +on another processes of the user. Like this, the attacker can steal +sensitive information from the target processes (e.g. SSH sessions, web browser, ...) +without any additional assistance from the user (i.e. without resorting to phishing). + + + CCE-80953-3 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218097,31 +218187,7 @@ fi - reboot_required - sysctl_kernel_yama_ptrace_scope - - - - - - - - - Harden the operation of the BPF just-in-time compiler - To set the runtime status of the net.core.bpf_jit_harden kernel parameter, run the following command: $ sudo sysctl -w net.core.bpf_jit_harden=2 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.core.bpf_jit_harden = 2 - BP28(R12) - CCI-000366 - CM-6 - SC-7(10) - FMT_SMF_EXT.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-040286 - SV-244554r858832_rule - When hardened, the extended Berkeley Packet Filter just-in-time compiler -will randomize any kernel addresses in the BPF programs and maps, -and will not expose the JIT addresses in /proc/kallsyms. - - CCE-82934-1 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218131,23 +218197,23 @@ spec: storage: files: - contents: - source: data:,net.core.bpf_jit_harden%3D2%0A + source: data:,kernel.yama.ptrace_scope%3D1%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_net_core_bpf_jit_harden.conf + path: /etc/sysctl.d/75-sysctl_kernel_yama_ptrace_scope.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of net.core.bpf_jit_harden from /etc/sysctl.d/*.conf files +# Comment out any occurrences of kernel.yama.ptrace_scope from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*net.core.bpf_jit_harden.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*kernel.yama.ptrace_scope.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "net.core.bpf_jit_harden" matches to preserve user data + # comment out "kernel.yama.ptrace_scope" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218161,33 +218227,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for net.core.bpf_jit_harden +# Set runtime for kernel.yama.ptrace_scope # -/sbin/sysctl -q -n -w net.core.bpf_jit_harden="2" +/sbin/sysctl -q -n -w kernel.yama.ptrace_scope="1" # -# If net.core.bpf_jit_harden present in /etc/sysctl.conf, change value to "2" -# else, add "net.core.bpf_jit_harden = 2" to /etc/sysctl.conf +# If kernel.yama.ptrace_scope present in /etc/sysctl.conf, change value to "1" +# else, add "kernel.yama.ptrace_scope = 1" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.core.bpf_jit_harden") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^kernel.yama.ptrace_scope") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "2" +printf -v formatted_output "%s = %s" "$stripped_key" "1" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^net.core.bpf_jit_harden\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^kernel.yama.ptrace_scope\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^net.core.bpf_jit_harden\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^kernel.yama.ptrace_scope\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82934-1" + cce="CCE-80953-3" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218196,6 +218262,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Harden the operation of the BPF just-in-time compiler + To set the runtime status of the net.core.bpf_jit_harden kernel parameter, run the following command: $ sudo sysctl -w net.core.bpf_jit_harden=2 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: net.core.bpf_jit_harden = 2 + BP28(R12) + CCI-000366 + CM-6 + SC-7(10) + FMT_SMF_EXT.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-040286 + SV-244554r858832_rule + When hardened, the extended Berkeley Packet Filter just-in-time compiler +will randomize any kernel addresses in the BPF programs and maps, +and will not expose the JIT addresses in /proc/kallsyms. + + CCE-82934-1 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218258,42 +218348,7 @@ fi - reboot_required - sysctl_net_core_bpf_jit_harden - - - - - - - - - Disable the use of user namespaces - To set the runtime status of the user.max_user_namespaces kernel parameter, -run the following command: -$ sudo sysctl -w user.max_user_namespaces=0 - -To make sure that the setting is persistent, -add the following line to a file in the directory /etc/sysctl.d: -user.max_user_namespaces = 0 -When containers are deployed on the machine, the value should be set -to large non-zero value. - This configuration baseline was created to deploy the base operating system for general purpose -workloads. When the operating system is configured for certain purposes, such as to host Linux Containers, -it is expected that user.max_user_namespaces will be enabled. - CCI-000366 - SC-39 - CM-6(a) - FMT_SMF_EXT.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-040284 - SV-230548r858828_rule - It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or system objectives. -These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. -They increase the risk to the platform by providing additional attack vectors. -User namespaces are used primarily for Linux containers. The value 0 -disallows the use of user namespaces. - - CCE-82211-4 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218303,23 +218358,23 @@ spec: storage: files: - contents: - source: data:,user.max_user_namespaces%20%3D%200%0A + source: data:,net.core.bpf_jit_harden%3D2%0A mode: 0644 - path: /etc/sysctl.d/75-sysctl_user_max_user_namespaces.conf + path: /etc/sysctl.d/75-sysctl_net_core_bpf_jit_harden.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of user.max_user_namespaces from /etc/sysctl.d/*.conf files +# Comment out any occurrences of net.core.bpf_jit_harden from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*user.max_user_namespaces.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*net.core.bpf_jit_harden.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "user.max_user_namespaces" matches to preserve user data + # comment out "net.core.bpf_jit_harden" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218333,33 +218388,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for user.max_user_namespaces +# Set runtime for net.core.bpf_jit_harden # -/sbin/sysctl -q -n -w user.max_user_namespaces="0" +/sbin/sysctl -q -n -w net.core.bpf_jit_harden="2" # -# If user.max_user_namespaces present in /etc/sysctl.conf, change value to "0" -# else, add "user.max_user_namespaces = 0" to /etc/sysctl.conf +# If net.core.bpf_jit_harden present in /etc/sysctl.conf, change value to "2" +# else, add "net.core.bpf_jit_harden = 2" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^user.max_user_namespaces") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^net.core.bpf_jit_harden") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" +printf -v formatted_output "%s = %s" "$stripped_key" "2" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^user.max_user_namespaces\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^net.core.bpf_jit_harden\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^user.max_user_namespaces\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^net.core.bpf_jit_harden\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-82211-4" + cce="CCE-82934-1" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218368,6 +218423,41 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable the use of user namespaces + To set the runtime status of the user.max_user_namespaces kernel parameter, +run the following command: +$ sudo sysctl -w user.max_user_namespaces=0 + +To make sure that the setting is persistent, +add the following line to a file in the directory /etc/sysctl.d: +user.max_user_namespaces = 0 +When containers are deployed on the machine, the value should be set +to large non-zero value. + This configuration baseline was created to deploy the base operating system for general purpose +workloads. When the operating system is configured for certain purposes, such as to host Linux Containers, +it is expected that user.max_user_namespaces will be enabled. + CCI-000366 + SC-39 + CM-6(a) + FMT_SMF_EXT.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-040284 + SV-230548r858828_rule + It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or system objectives. +These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. +They increase the risk to the platform by providing additional attack vectors. +User namespaces are used primarily for Linux containers. The value 0 +disallows the use of user namespaces. + + CCE-82211-4 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218430,36 +218520,33 @@ fi - reboot_required - sysctl_user_max_user_namespaces - - - - - - - - - Prevent applications from mapping low portion of virtual memory - To set the runtime status of the vm.mmap_min_addr kernel parameter, run the following command: $ sudo sysctl -w vm.mmap_min_addr=65536 -To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: vm.mmap_min_addr = 65536 - BP28(R23) - The vm.mmap_min_addr parameter specifies the minimum virtual -address that a process is allowed to mmap. Allowing a process to mmap low -portion of virtual memory can have security implications such as such as -heightened risk of kernel null pointer dereference defects. - - CCE-83363-2 - # Remediation is applicable only in certain platforms + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,user.max_user_namespaces%20%3D%200%0A + mode: 0644 + path: /etc/sysctl.d/75-sysctl_user_max_user_namespaces.conf + overwrite: true + + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -# Comment out any occurrences of vm.mmap_min_addr from /etc/sysctl.d/*.conf files +# Comment out any occurrences of user.max_user_namespaces from /etc/sysctl.d/*.conf files for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - matching_list=$(grep -P '^(?!#).*[\s]*vm.mmap_min_addr.*$' $f | uniq ) + matching_list=$(grep -P '^(?!#).*[\s]*user.max_user_namespaces.*$' $f | uniq ) if ! test -z "$matching_list"; then while IFS= read -r entry; do escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "vm.mmap_min_addr" matches to preserve user data + # comment out "user.max_user_namespaces" matches to preserve user data sed -i "s/^${escaped_entry}$/# &/g" $f done <<< "$matching_list" fi @@ -218473,33 +218560,33 @@ SYSCONFIG_FILE="/etc/sysctl.conf" # -# Set runtime for vm.mmap_min_addr +# Set runtime for user.max_user_namespaces # -/sbin/sysctl -q -n -w vm.mmap_min_addr="65536" +/sbin/sysctl -q -n -w user.max_user_namespaces="0" # -# If vm.mmap_min_addr present in /etc/sysctl.conf, change value to "65536" -# else, add "vm.mmap_min_addr = 65536" to /etc/sysctl.conf +# If user.max_user_namespaces present in /etc/sysctl.conf, change value to "0" +# else, add "user.max_user_namespaces = 0" to /etc/sysctl.conf # # Strip any search characters in the key arg so that the key can be replaced without # adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^vm.mmap_min_addr") +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^user.max_user_namespaces") # shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "65536" +printf -v formatted_output "%s = %s" "$stripped_key" "0" # If the key exists, change it. Otherwise, add it to the config_file. # We search for the key string followed by a word boundary (matched by \>), # so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^vm.mmap_min_addr\\>" "${SYSCONFIG_FILE}"; then +if LC_ALL=C grep -q -m 1 -i -e "^user.max_user_namespaces\\>" "${SYSCONFIG_FILE}"; then escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^vm.mmap_min_addr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" + LC_ALL=C sed -i --follow-symlinks "s/^user.max_user_namespaces\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" else if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" fi - cce="CCE-83363-2" + cce="CCE-82211-4" printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" fi @@ -218508,6 +218595,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Prevent applications from mapping low portion of virtual memory + To set the runtime status of the vm.mmap_min_addr kernel parameter, run the following command: $ sudo sysctl -w vm.mmap_min_addr=65536 +To make sure that the setting is persistent, add the following line to a file in the directory /etc/sysctl.d: vm.mmap_min_addr = 65536 + BP28(R23) + The vm.mmap_min_addr parameter specifies the minimum virtual +address that a process is allowed to mmap. Allowing a process to mmap low +portion of virtual memory can have security implications such as such as +heightened risk of kernel null pointer dereference defects. + + CCE-83363-2 - name: List /etc/sysctl.d/*.conf files find: paths: @@ -218560,6 +218665,66 @@ fi - medium_severity - reboot_required - sysctl_vm_mmap_min_addr + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of vm.mmap_min_addr from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*vm.mmap_min_addr.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "vm.mmap_min_addr" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for vm.mmap_min_addr +# +/sbin/sysctl -q -n -w vm.mmap_min_addr="65536" + +# +# If vm.mmap_min_addr present in /etc/sysctl.conf, change value to "65536" +# else, add "vm.mmap_min_addr = 65536" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^vm.mmap_min_addr") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "65536" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^vm.mmap_min_addr\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^vm.mmap_min_addr\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-83363-2" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218604,21 +218769,6 @@ terminates an application. The memory image could contain sensitive data and is generally useful only for developers trying to debug problems. CCE-82881-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SOCKET_NAME="systemd-coredump.socket" -SYSTEMCTL_EXEC='/usr/bin/systemctl' - -if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then - "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" - "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable acquiring, saving, and processing core dumps - Collect systemd Socket Units Present in the System ansible.builtin.command: @@ -218657,6 +218807,21 @@ fi - medium_severity - no_reboot_needed - service_systemd-coredump_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SOCKET_NAME="systemd-coredump.socket" +SYSTEMCTL_EXEC='/usr/bin/systemctl' + +if "$SYSTEMCTL_EXEC" -q list-unit-files --type socket | grep -q "$SOCKET_NAME"; then + "$SYSTEMCTL_EXEC" stop "$SOCKET_NAME" + "$SYSTEMCTL_EXEC" mask "$SOCKET_NAME" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218695,43 +218860,6 @@ debuging. Permitting temporary enablement of core dumps during such situations should be reviewed through local needs and policy. CCE-82251-0 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%20%20This%20file%20is%20part%20of%20systemd.%0A%23%0A%23%20%20systemd%20is%20free%20software%3B%20you%20can%20redistribute%20it%20and/or%20modify%20it%0A%23%20%20under%20the%20terms%20of%20the%20GNU%20Lesser%20General%20Public%20License%20as%20published%20by%0A%23%20%20the%20Free%20Software%20Foundation%3B%20either%20version%202.1%20of%20the%20License%2C%20or%0A%23%20%20%28at%20your%20option%29%20any%20later%20version.%0A%23%0A%23%20Entries%20in%20this%20file%20show%20the%20compile%20time%20defaults.%0A%23%20You%20can%20change%20settings%20by%20editing%20this%20file.%0A%23%20Defaults%20can%20be%20restored%20by%20simply%20deleting%20this%20file.%0A%23%0A%23%20See%20coredump.conf%285%29%20for%20details.%0A%0A%5BCoredump%5D%0A%23Storage%3Dexternal%0A%23Compress%3Dyes%0A%23ProcessSizeMax%3D2G%0A%23ExternalSizeMax%3D2G%0A%23JournalSizeMax%3D767M%0A%23MaxUse%3D%0A%23KeepFree%3D%0AStorage%3Dnone%0AProcessSizeMax%3D0%0A - mode: 0644 - path: /etc/systemd/coredump.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if rpm --quiet -q systemd; then - -if [ -e "/etc/systemd/coredump.conf" ] ; then - - LC_ALL=C sed -i "/^\s*ProcessSizeMax\s*=\s*/Id" "/etc/systemd/coredump.conf" -else - touch "/etc/systemd/coredump.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/systemd/coredump.conf" - -cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" -# Insert at the end of the file -printf '%s\n' "ProcessSizeMax=0" >> "/etc/systemd/coredump.conf" -# Clean up after ourselves. -rm "/etc/systemd/coredump.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -218790,39 +218918,7 @@ fi - no_reboot_needed - restrict_strategy - - - - - - - - - Disable storing core dump - The Storage option in [Coredump] sectionof /etc/systemd/coredump.conf -can be set to none to disable storing core dumps permanently. - If the /etc/systemd/coredump.conf file -does not already contain the [Coredump] section, -the value will not be configured correctly. - CCI-000366 - CM-6 - FMT_SMF_EXT.1 - Req-3.2 - 3.3.1 - SRG-OS-000480-GPOS-00227 - RHEL-08-010674 - 1.4.4 - SV-230314r627750_rule - A core dump includes a memory image taken at the time the operating system -terminates an application. The memory image could contain sensitive data -and is generally useful only for developers or system operators trying to -debug problems. Enabling core dumps on production systems is not recommended, -however there may be overriding operational requirements to enable advanced -debuging. Permitting temporary enablement of core dumps during such situations -should be reviewed through local needs and policy. - - CCE-82252-8 - --- + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -218837,12 +218933,12 @@ spec: path: /etc/systemd/coredump.conf overwrite: true - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if rpm --quiet -q systemd; then if [ -e "/etc/systemd/coredump.conf" ] ; then - LC_ALL=C sed -i "/^\s*Storage\s*=\s*/Id" "/etc/systemd/coredump.conf" + LC_ALL=C sed -i "/^\s*ProcessSizeMax\s*=\s*/Id" "/etc/systemd/coredump.conf" else touch "/etc/systemd/coredump.conf" fi @@ -218851,7 +218947,7 @@ sed -i -e '$a\' "/etc/systemd/coredump.conf" cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" # Insert at the end of the file -printf '%s\n' "Storage=none" >> "/etc/systemd/coredump.conf" +printf '%s\n' "ProcessSizeMax=0" >> "/etc/systemd/coredump.conf" # Clean up after ourselves. rm "/etc/systemd/coredump.conf.bak" @@ -218859,6 +218955,38 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + Disable storing core dump + The Storage option in [Coredump] sectionof /etc/systemd/coredump.conf +can be set to none to disable storing core dumps permanently. + If the /etc/systemd/coredump.conf file +does not already contain the [Coredump] section, +the value will not be configured correctly. + CCI-000366 + CM-6 + FMT_SMF_EXT.1 + Req-3.2 + 3.3.1 + SRG-OS-000480-GPOS-00227 + RHEL-08-010674 + 1.4.4 + SV-230314r627750_rule + A core dump includes a memory image taken at the time the operating system +terminates an application. The memory image could contain sensitive data +and is generally useful only for developers or system operators trying to +debug problems. Enabling core dumps on production systems is not recommended, +however there may be overriding operational requirements to enable advanced +debuging. Permitting temporary enablement of core dumps during such situations +should be reviewed through local needs and policy. + + CCE-82252-8 - name: Gather the package facts package_facts: manager: auto @@ -218916,6 +219044,43 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%20%20This%20file%20is%20part%20of%20systemd.%0A%23%0A%23%20%20systemd%20is%20free%20software%3B%20you%20can%20redistribute%20it%20and/or%20modify%20it%0A%23%20%20under%20the%20terms%20of%20the%20GNU%20Lesser%20General%20Public%20License%20as%20published%20by%0A%23%20%20the%20Free%20Software%20Foundation%3B%20either%20version%202.1%20of%20the%20License%2C%20or%0A%23%20%20%28at%20your%20option%29%20any%20later%20version.%0A%23%0A%23%20Entries%20in%20this%20file%20show%20the%20compile%20time%20defaults.%0A%23%20You%20can%20change%20settings%20by%20editing%20this%20file.%0A%23%20Defaults%20can%20be%20restored%20by%20simply%20deleting%20this%20file.%0A%23%0A%23%20See%20coredump.conf%285%29%20for%20details.%0A%0A%5BCoredump%5D%0A%23Storage%3Dexternal%0A%23Compress%3Dyes%0A%23ProcessSizeMax%3D2G%0A%23ExternalSizeMax%3D2G%0A%23JournalSizeMax%3D767M%0A%23MaxUse%3D%0A%23KeepFree%3D%0AStorage%3Dnone%0AProcessSizeMax%3D0%0A + mode: 0644 + path: /etc/systemd/coredump.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if rpm --quiet -q systemd; then + +if [ -e "/etc/systemd/coredump.conf" ] ; then + + LC_ALL=C sed -i "/^\s*Storage\s*=\s*/Id" "/etc/systemd/coredump.conf" +else + touch "/etc/systemd/coredump.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/systemd/coredump.conf" + +cp "/etc/systemd/coredump.conf" "/etc/systemd/coredump.conf.bak" +# Insert at the end of the file +printf '%s\n' "Storage=none" >> "/etc/systemd/coredump.conf" +# Clean up after ourselves. +rm "/etc/systemd/coredump.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -218963,40 +219128,6 @@ terminates an application. The memory image could contain sensitive data and is only for developers trying to debug problems. CCE-81038-2 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%2A%20%20%20%20%20hard%20%20%20core%20%20%20%200 - mode: 0644 - path: /etc/security/limits.d/75-disable_users_coredumps.conf - overwrite: true - - # Remediation is applicable only in certain platforms -if rpm --quiet -q pam; then - -SECURITY_LIMITS_FILE="/etc/security/limits.conf" - -if grep -qE '^\s*\*\s+hard\s+core' $SECURITY_LIMITS_FILE; then - sed -ri 's/(hard\s+core\s+)[[:digit:]]+/\1 0/' $SECURITY_LIMITS_FILE -else - echo "* hard core 0" >> $SECURITY_LIMITS_FILE -fi - -if ls /etc/security/limits.d/*.conf > /dev/null; then - sed -ri '/^\s*\*\s+hard\s+core/d' /etc/security/limits.d/*.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -219032,6 +219163,40 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%2A%20%20%20%20%20hard%20%20%20core%20%20%20%200 + mode: 0644 + path: /etc/security/limits.d/75-disable_users_coredumps.conf + overwrite: true + + # Remediation is applicable only in certain platforms +if rpm --quiet -q pam; then + +SECURITY_LIMITS_FILE="/etc/security/limits.conf" + +if grep -qE '^\s*\*\s+hard\s+core' $SECURITY_LIMITS_FILE; then + sed -ri 's/(hard\s+core\s+)[[:digit:]]+/\1 0/' $SECURITY_LIMITS_FILE +else + echo "* hard core 0" >> $SECURITY_LIMITS_FILE +fi + +if ls /etc/security/limits.d/*.conf > /dev/null; then + sed -ri '/^\s*\*\s+hard\s+core/d' /etc/security/limits.d/*.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219063,66 +219228,6 @@ setuid program to write a core file decreases the risk of unauthorized access of such data. CCE-80912-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Comment out any occurrences of fs.suid_dumpable from /etc/sysctl.d/*.conf files - -for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do - - matching_list=$(grep -P '^(?!#).*[\s]*fs.suid_dumpable.*$' $f | uniq ) - if ! test -z "$matching_list"; then - while IFS= read -r entry; do - escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") - # comment out "fs.suid_dumpable" matches to preserve user data - sed -i "s/^${escaped_entry}$/# &/g" $f - done <<< "$matching_list" - fi -done - -# -# Set sysctl config file which to save the desired value -# - -SYSCONFIG_FILE="/etc/sysctl.conf" - - -# -# Set runtime for fs.suid_dumpable -# -/sbin/sysctl -q -n -w fs.suid_dumpable="0" - -# -# If fs.suid_dumpable present in /etc/sysctl.conf, change value to "0" -# else, add "fs.suid_dumpable = 0" to /etc/sysctl.conf -# - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^fs.suid_dumpable") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s = %s" "$stripped_key" "0" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^fs.suid_dumpable\\>" "${SYSCONFIG_FILE}"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^fs.suid_dumpable\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" -else - if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" - fi - cce="CCE-80912-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" - printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: List /etc/sysctl.d/*.conf files find: paths: @@ -219184,6 +219289,66 @@ fi - medium_severity - reboot_required - sysctl_fs_suid_dumpable + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Comment out any occurrences of fs.suid_dumpable from /etc/sysctl.d/*.conf files + +for f in /etc/sysctl.d/*.conf /run/sysctl.d/*.conf /usr/local/lib/sysctl.d/*.conf; do + + matching_list=$(grep -P '^(?!#).*[\s]*fs.suid_dumpable.*$' $f | uniq ) + if ! test -z "$matching_list"; then + while IFS= read -r entry; do + escaped_entry=$(sed -e 's|/|\\/|g' <<< "$entry") + # comment out "fs.suid_dumpable" matches to preserve user data + sed -i "s/^${escaped_entry}$/# &/g" $f + done <<< "$matching_list" + fi +done + +# +# Set sysctl config file which to save the desired value +# + +SYSCONFIG_FILE="/etc/sysctl.conf" + + +# +# Set runtime for fs.suid_dumpable +# +/sbin/sysctl -q -n -w fs.suid_dumpable="0" + +# +# If fs.suid_dumpable present in /etc/sysctl.conf, change value to "0" +# else, add "fs.suid_dumpable = 0" to /etc/sysctl.conf +# + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^fs.suid_dumpable") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s = %s" "$stripped_key" "0" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^fs.suid_dumpable\\>" "${SYSCONFIG_FILE}"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^fs.suid_dumpable\\>.*/$escaped_formatted_output/gi" "${SYSCONFIG_FILE}" +else + if [[ -s "${SYSCONFIG_FILE}" ]] && [[ -n "$(tail -c 1 -- "${SYSCONFIG_FILE}" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "${SYSCONFIG_FILE}" + fi + cce="CCE-80912-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "${SYSCONFIG_FILE}" >> "${SYSCONFIG_FILE}" + printf '%s\n' "$formatted_output" >> "${SYSCONFIG_FILE}" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219344,15 +219509,6 @@ prevents execution in that address range. This is enabled by default on the latest Red Hat and Fedora systems if supported by the hardware. CCE-80914-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -grubby --update-kernel=ALL --remove-args=noexec --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Update grub defaults and the bootloader menu command: /sbin/grubby --update-kernel=ALL --remove-args="noexec" when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] @@ -219367,6 +219523,15 @@ fi - reboot_required - restrict_strategy - sysctl_kernel_exec_shield + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +grubby --update-kernel=ALL --remove-args=noexec --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -219421,6 +219586,79 @@ be compromised. This option disallow any program without the CAP_SYSLOG capabili to get the addresses of kernel pointers by replacing them with 0. CCE-80915-2 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.kptr_restrict.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict + +- name: Comment out any occurrences of kernel.kptr_restrict from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.kptr_restrict + replace: '#kernel.kptr_restrict' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict +- name: XCCDF Value sysctl_kernel_kptr_restrict_value # promote to variable + set_fact: + sysctl_kernel_kptr_restrict_value: !!str + tags: + - always + +- name: Ensure sysctl kernel.kptr_restrict is set + sysctl: + name: kernel.kptr_restrict + value: '{{ sysctl_kernel_kptr_restrict_value }}' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80915-2 + - DISA-STIG-RHEL-08-040283 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - NIST-800-53-SC-30(5) + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_kptr_restrict + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -219497,79 +219735,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.kptr_restrict.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict - -- name: Comment out any occurrences of kernel.kptr_restrict from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.kptr_restrict - replace: '#kernel.kptr_restrict' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict -- name: XCCDF Value sysctl_kernel_kptr_restrict_value # promote to variable - set_fact: - sysctl_kernel_kptr_restrict_value: !!str - tags: - - always - -- name: Ensure sysctl kernel.kptr_restrict is set - sysctl: - name: kernel.kptr_restrict - value: '{{ sysctl_kernel_kptr_restrict_value }}' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80915-2 - - DISA-STIG-RHEL-08-040283 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - NIST-800-53-SC-30(5) - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_kptr_restrict @@ -219635,6 +219800,80 @@ existing code in order to re-purpose it using return oriented programming (ROP) techniques. CCE-80916-0 + - name: List /etc/sysctl.d/*.conf files + find: + paths: + - /etc/sysctl.d/ + - /run/sysctl.d/ + - /usr/local/lib/sysctl.d/ + contains: ^[\s]*kernel.randomize_va_space.*$ + patterns: '*.conf' + file_type: any + register: find_sysctl_d + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + +- name: Comment out any occurrences of kernel.randomize_va_space from config files + replace: + path: '{{ item.path }}' + regexp: ^[\s]*kernel.randomize_va_space + replace: '#kernel.randomize_va_space' + loop: '{{ find_sysctl_d.files }}' + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + +- name: Ensure sysctl kernel.randomize_va_space is set to 2 + sysctl: + name: kernel.randomize_va_space + value: '2' + sysctl_file: /etc/sysctl.conf + state: present + reload: true + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80916-0 + - DISA-STIG-RHEL-08-010430 + - NIST-800-171-3.1.7 + - NIST-800-53-CM-6(a) + - NIST-800-53-SC-30 + - NIST-800-53-SC-30(2) + - PCI-DSS-Req-2.2.1 + - PCI-DSSv4-3.3.1 + - disable_strategy + - low_complexity + - medium_disruption + - medium_severity + - reboot_required + - sysctl_kernel_randomize_va_space + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -219709,80 +219948,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: List /etc/sysctl.d/*.conf files - find: - paths: - - /etc/sysctl.d/ - - /run/sysctl.d/ - - /usr/local/lib/sysctl.d/ - contains: ^[\s]*kernel.randomize_va_space.*$ - patterns: '*.conf' - file_type: any - register: find_sysctl_d - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space - -- name: Comment out any occurrences of kernel.randomize_va_space from config files - replace: - path: '{{ item.path }}' - regexp: ^[\s]*kernel.randomize_va_space - replace: '#kernel.randomize_va_space' - loop: '{{ find_sysctl_d.files }}' - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space - -- name: Ensure sysctl kernel.randomize_va_space is set to 2 - sysctl: - name: kernel.randomize_va_space - value: '2' - sysctl_file: /etc/sysctl.conf - state: present - reload: true - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80916-0 - - DISA-STIG-RHEL-08-010430 - - NIST-800-171-3.1.7 - - NIST-800-53-CM-6(a) - - NIST-800-53-SC-30 - - NIST-800-53-SC-30(2) - - PCI-DSS-Req-2.2.1 - - PCI-DSSv4-3.3.1 - - disable_strategy - - low_complexity - - medium_disruption - - medium_severity - - reboot_required - - sysctl_kernel_randomize_va_space @@ -219938,18 +220103,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-80944-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -grubby --update-kernel=ALL --args=page_poison=1 --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "page_poison=1" - - name: Gather the package facts package_facts: manager: auto @@ -219979,6 +220132,18 @@ append = "page_poison=1" - medium_severity - reboot_required - restrict_strategy + + [customizations.kernel] +append = "page_poison=1" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +grubby --update-kernel=ALL --args=page_poison=1 --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -220012,22 +220177,6 @@ This prevents many types of use-after-free vulnerabilities at little performance Also prevents leak of data and detection of corrupted memory. CCE-80945-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -var_slub_debug_options='' - - - -grubby --update-kernel=ALL --args=slub_debug=$var_slub_debug_options --env=/boot/grub2/grubenv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - [customizations.kernel] -append = "slub_debug=" - - name: Gather the package facts package_facts: manager: auto @@ -220063,6 +220212,22 @@ append = "slub_debug=[customizations.kernel] +append = "slub_debug=" + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +var_slub_debug_options='' + + + +grubby --update-kernel=ALL --args=slub_debug=$var_slub_debug_options --env=/boot/grub2/grubenv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -220133,8 +220298,25 @@ with enhanced security functionality designed to add mandatory access controls t The libselinux package contains the core library of the Security-enhanced Linux system. CCE-82877-2 - -package --add=libselinux + - name: Ensure libselinux is installed + package: + name: libselinux + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82877-2 + - PCI-DSSv4-1.2.6 + - enable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_libselinux_installed + + +[[packages]] +name = "libselinux" +version = "*" include install_libselinux @@ -220143,6 +220325,9 @@ class install_libselinux { ensure => 'installed', } } + + +package --add=libselinux # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220154,26 +220339,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "libselinux" -version = "*" - - - name: Ensure libselinux is installed - package: - name: libselinux - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82877-2 - - PCI-DSSv4-1.2.6 - - enable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_libselinux_installed @@ -220191,8 +220356,24 @@ $ sudo yum install policycoreutils-python-utilsThis package is required to operate and manage an SELinux environment and its policies. It provides utilities such as semanage, audit2allow, audit2why, chcat and sandbox. CCE-82724-6 - -package --add=policycoreutils-python-utils + - name: Ensure policycoreutils-python-utils is installed + package: + name: policycoreutils-python-utils + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82724-6 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_policycoreutils-python-utils_installed + + +[[packages]] +name = "policycoreutils-python-utils" +version = "*" include install_policycoreutils-python-utils @@ -220201,6 +220382,9 @@ class install_policycoreutils-python-utils { ensure => 'installed', } } + + +package --add=policycoreutils-python-utils # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220212,25 +220396,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "policycoreutils-python-utils" -version = "*" - - - name: Ensure policycoreutils-python-utils is installed - package: - name: policycoreutils-python-utils - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82724-6 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_policycoreutils-python-utils_installed @@ -220262,8 +220427,25 @@ basic operation of an SELinux-enabled system. These utilities include setfiles to label filesystems, newrole to switch roles, and so on. CCE-82976-2 - -package --add=policycoreutils + - name: Ensure policycoreutils is installed + package: + name: policycoreutils + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82976-2 + - DISA-STIG-RHEL-08-010171 + - enable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_policycoreutils_installed + + +[[packages]] +name = "policycoreutils" +version = "*" include install_policycoreutils @@ -220272,6 +220454,9 @@ class install_policycoreutils { ensure => 'installed', } } + + +package --add=policycoreutils # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220283,26 +220468,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "policycoreutils" -version = "*" - - - name: Ensure policycoreutils is installed - package: - name: policycoreutils - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82976-2 - - DISA-STIG-RHEL-08-010171 - - enable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_policycoreutils_installed @@ -220323,8 +220488,19 @@ $ sudo yum erase mcstrans Since this service is not used very often, disable it to reduce the amount of potentially vulnerable code running on the system. CCE-82756-8 - -package --remove=mcstrans + - name: Ensure mcstrans is removed + package: + name: mcstrans + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82756-8 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_mcstrans_removed include remove_mcstrans @@ -220333,6 +220509,9 @@ class remove_mcstrans { ensure => 'purged', } } + + +package --remove=mcstrans # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220352,20 +220531,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure mcstrans is removed - package: - name: mcstrans - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82756-8 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_mcstrans_removed @@ -220382,8 +220547,19 @@ $ sudo yum erase setroubleshoot-plugins The SETroubleshoot service is an unnecessary daemon to have running on a server. CCE-84250-0 - -package --remove=setroubleshoot-plugins + - name: Ensure setroubleshoot-plugins is removed + package: + name: setroubleshoot-plugins + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-84250-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot-plugins_removed include remove_setroubleshoot-plugins @@ -220392,6 +220568,9 @@ class remove_setroubleshoot-plugins { ensure => 'purged', } } + + +package --remove=setroubleshoot-plugins # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220411,20 +220590,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot-plugins is removed - package: - name: setroubleshoot-plugins - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-84250-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot-plugins_removed @@ -220445,8 +220610,19 @@ $ sudo yum erase setroubleshoot-server The SETroubleshoot service is an unnecessary daemon to have running on a server. CCE-83490-3 - -package --remove=setroubleshoot-server + - name: Ensure setroubleshoot-server is removed + package: + name: setroubleshoot-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83490-3 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot-server_removed include remove_setroubleshoot-server @@ -220455,6 +220631,9 @@ class remove_setroubleshoot-server { ensure => 'purged', } } + + +package --remove=setroubleshoot-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220474,20 +220653,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot-server is removed - package: - name: setroubleshoot-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83490-3 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot-server_removed @@ -220510,8 +220675,19 @@ $ sudo yum erase setroubleshoot have running on a server, especially if X Windows is removed or disabled. CCE-82755-0 - -package --remove=setroubleshoot + - name: Ensure setroubleshoot is removed + package: + name: setroubleshoot + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82755-0 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_setroubleshoot_removed include remove_setroubleshoot @@ -220520,6 +220696,9 @@ class remove_setroubleshoot { ensure => 'purged', } } + + +package --remove=setroubleshoot # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -220539,20 +220718,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure setroubleshoot is removed - package: - name: setroubleshoot - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82755-0 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_setroubleshoot_removed @@ -220903,16 +221068,6 @@ it from confining system services at boot time. Further, it increases the chances that it will remain off during system operation. CCE-80827-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then - -sed -i --follow-symlinks "s/selinux=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* -sed -i --follow-symlinks "s/enforcing=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -221066,6 +221221,16 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q grub2-common; }; then + +sed -i --follow-symlinks "s/selinux=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* +sed -i --follow-symlinks "s/enforcing=0//gI" /etc/default/grub /etc/grub2.cfg /etc/grub.d/* + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221435,31 +221600,6 @@ before setting it to "enforcing", which is strongly recommended. CCE-86151-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUX=permissive" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -fixfiles onboot -fixfiles -f relabel - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure SELinux is Not Disabled block: @@ -221497,6 +221637,31 @@ fi - reboot_required - restrict_strategy - selinux_not_disabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUX=permissive" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +fixfiles onboot +fixfiles -f relabel + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221695,31 +221860,6 @@ temporary cases, SELinux policies should be developed, and once work is completed, the system should be reconfigured to . CCE-80868-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_selinux_policy_name='' - - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUXTYPE=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUXTYPE=$var_selinux_policy_name" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_selinux_policy_name # promote to variable set_fact: var_selinux_policy_name: !!str @@ -221771,6 +221911,31 @@ fi - reboot_required - restrict_strategy - selinux_policytype + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_selinux_policy_name='' + + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUXTYPE=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUXTYPE=$var_selinux_policy_name" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -221962,34 +222127,6 @@ potentially compromised processes to the security policy, which is designed to prevent them from causing damage to the system or further elevating their privileges. CCE-80869-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_selinux_state='' - - -if [ -e "/etc/selinux/config" ] ; then - - LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" -else - touch "/etc/selinux/config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/selinux/config" - -cp "/etc/selinux/config" "/etc/selinux/config.bak" -# Insert at the end of the file -printf '%s\n' "SELINUX=$var_selinux_state" >> "/etc/selinux/config" -# Clean up after ourselves. -rm "/etc/selinux/config.bak" - -fixfiles onboot -fixfiles -f relabel - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_selinux_state # promote to variable set_fact: var_selinux_state: !!str @@ -222040,6 +222177,34 @@ fi - no_reboot_needed - restrict_strategy - selinux_state + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_selinux_state='' + + +if [ -e "/etc/selinux/config" ] ; then + + LC_ALL=C sed -i "/^SELINUX=/Id" "/etc/selinux/config" +else + touch "/etc/selinux/config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/selinux/config" + +cp "/etc/selinux/config" "/etc/selinux/config.bak" +# Insert at the end of the file +printf '%s\n' "SELINUX=$var_selinux_state" >> "/etc/selinux/config" +# Clean up after ourselves. +rm "/etc/selinux/config.bak" + +fixfiles onboot +fixfiles -f relabel + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -224761,29 +224926,6 @@ To disable the abrt_anon_write SELinux boolean, run the f $ sudo setsebool -P abrt_anon_write off 3.7.2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_abrt_anon_write='' - - setsebool -P abrt_anon_write $var_abrt_anon_write - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the abrt_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -224821,24 +224963,7 @@ fi - no_reboot_needed - sebool_abrt_anon_write - - - - - - - - - - Disable the abrt_handle_event SELinux Boolean - By default, the SELinux boolean abrt_handle_event is disabled. -If this setting is enabled, it should be disabled. - -To disable the abrt_handle_event SELinux boolean, run the following command: -$ sudo setsebool -P abrt_handle_event off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -224848,9 +224973,9 @@ fi if selinuxenabled; then - var_abrt_handle_event='' + var_abrt_anon_write='' - setsebool -P abrt_handle_event $var_abrt_handle_event + setsebool -P abrt_anon_write $var_abrt_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -224861,6 +224986,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the abrt_handle_event SELinux Boolean + By default, the SELinux boolean abrt_handle_event is disabled. +If this setting is enabled, it should be disabled. + +To disable the abrt_handle_event SELinux boolean, run the following command: +$ sudo setsebool -P abrt_handle_event off + 3.7.2 + - name: Disable the abrt_handle_event SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -224899,25 +225041,7 @@ fi - no_reboot_needed - sebool_abrt_handle_event - - - - - - - - - - Disable the abrt_upload_watch_anon_write SELinux Boolean - By default, the SELinux boolean abrt_upload_watch_anon_write is enabled. -This setting should be disabled as it allows the Automatic Bug Report Tool (ABRT) -to modify public files used for public file transfer services. - -To disable the abrt_upload_watch_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P abrt_upload_watch_anon_write off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -224927,9 +225051,9 @@ fi if selinuxenabled; then - var_abrt_upload_watch_anon_write='' + var_abrt_handle_event='' - setsebool -P abrt_upload_watch_anon_write $var_abrt_upload_watch_anon_write + setsebool -P abrt_handle_event $var_abrt_handle_event else echo "Skipping remediation, SELinux is disabled"; @@ -224940,6 +225064,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the abrt_upload_watch_anon_write SELinux Boolean + By default, the SELinux boolean abrt_upload_watch_anon_write is enabled. +This setting should be disabled as it allows the Automatic Bug Report Tool (ABRT) +to modify public files used for public file transfer services. + +To disable the abrt_upload_watch_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P abrt_upload_watch_anon_write off + 3.7.2 + - name: Disable the abrt_upload_watch_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -224978,25 +225120,7 @@ fi - no_reboot_needed - sebool_abrt_upload_watch_anon_write - - - - - - - - - - Enable the antivirus_can_scan_system SELinux Boolean - By default, the SELinux boolean antivirus_can_scan_system is disabled. -This setting should be enabled as it allows antivirus programs to read non-security -files on a system. - -To enable the antivirus_can_scan_system SELinux boolean, run the following command: -$ sudo setsebool -P antivirus_can_scan_system on - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225006,9 +225130,9 @@ fi if selinuxenabled; then - var_antivirus_can_scan_system='' + var_abrt_upload_watch_anon_write='' - setsebool -P antivirus_can_scan_system $var_antivirus_can_scan_system + setsebool -P abrt_upload_watch_anon_write $var_abrt_upload_watch_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -225019,6 +225143,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the antivirus_can_scan_system SELinux Boolean + By default, the SELinux boolean antivirus_can_scan_system is disabled. +This setting should be enabled as it allows antivirus programs to read non-security +files on a system. + +To enable the antivirus_can_scan_system SELinux boolean, run the following command: +$ sudo setsebool -P antivirus_can_scan_system on + 3.7.2 + - name: Enable the antivirus_can_scan_system SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225057,24 +225199,7 @@ fi - no_reboot_needed - sebool_antivirus_can_scan_system - - - - - - - - - - Disable the antivirus_use_jit SELinux Boolean - By default, the SELinux boolean antivirus_use_jit is disabled. -If this setting is enabled, it should be disabled. - -To disable the antivirus_use_jit SELinux boolean, run the following command: -$ sudo setsebool -P antivirus_use_jit off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225084,9 +225209,9 @@ fi if selinuxenabled; then - var_antivirus_use_jit='' + var_antivirus_can_scan_system='' - setsebool -P antivirus_use_jit $var_antivirus_use_jit + setsebool -P antivirus_can_scan_system $var_antivirus_can_scan_system else echo "Skipping remediation, SELinux is disabled"; @@ -225097,6 +225222,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the antivirus_use_jit SELinux Boolean + By default, the SELinux boolean antivirus_use_jit is disabled. +If this setting is enabled, it should be disabled. + +To disable the antivirus_use_jit SELinux boolean, run the following command: +$ sudo setsebool -P antivirus_use_jit off + 3.7.2 + - name: Disable the antivirus_use_jit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225134,6 +225276,29 @@ fi - medium_severity - no_reboot_needed - sebool_antivirus_use_jit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_antivirus_use_jit='' + + setsebool -P antivirus_use_jit $var_antivirus_use_jit + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225159,29 +225324,6 @@ To enable the auditadm_exec_content SELinux boolean, run 0957 CCE-84297-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_auditadm_exec_content='' - - setsebool -P auditadm_exec_content $var_auditadm_exec_content - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the auditadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225221,6 +225363,29 @@ fi - medium_severity - no_reboot_needed - sebool_auditadm_exec_content + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_auditadm_exec_content='' + + setsebool -P auditadm_exec_content $var_auditadm_exec_content + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225254,29 +225419,6 @@ To disable the authlogin_nsswitch_use_ldap SELinux boolea 1561 CCE-84296-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_authlogin_nsswitch_use_ldap='' - - setsebool -P authlogin_nsswitch_use_ldap $var_authlogin_nsswitch_use_ldap - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the authlogin_nsswitch_use_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225316,6 +225458,29 @@ fi - medium_severity - no_reboot_needed - sebool_authlogin_nsswitch_use_ldap + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_authlogin_nsswitch_use_ldap='' + + setsebool -P authlogin_nsswitch_use_ldap $var_authlogin_nsswitch_use_ldap + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -225349,29 +225514,6 @@ To disable the authlogin_radius SELinux boolean, run the 1561 CCE-84294-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_authlogin_radius='' - - setsebool -P authlogin_radius $var_authlogin_radius - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the authlogin_radius SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225412,24 +225554,7 @@ fi - no_reboot_needed - sebool_authlogin_radius - - - - - - - - - - Disable the authlogin_yubikey SELinux Boolean - By default, the SELinux boolean authlogin_yubikey is disabled. -If this setting is enabled, it should be disabled. - -To disable the authlogin_yubikey SELinux boolean, run the following command: -$ sudo setsebool -P authlogin_yubikey off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225439,9 +225564,9 @@ fi if selinuxenabled; then - var_authlogin_yubikey='' + var_authlogin_radius='' - setsebool -P authlogin_yubikey $var_authlogin_yubikey + setsebool -P authlogin_radius $var_authlogin_radius else echo "Skipping remediation, SELinux is disabled"; @@ -225452,6 +225577,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the authlogin_yubikey SELinux Boolean + By default, the SELinux boolean authlogin_yubikey is disabled. +If this setting is enabled, it should be disabled. + +To disable the authlogin_yubikey SELinux boolean, run the following command: +$ sudo setsebool -P authlogin_yubikey off + 3.7.2 + - name: Disable the authlogin_yubikey SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225490,24 +225632,7 @@ fi - no_reboot_needed - sebool_authlogin_yubikey - - - - - - - - - - Disable the awstats_purge_apache_log_files SELinux Boolean - By default, the SELinux boolean awstats_purge_apache_log_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the awstats_purge_apache_log_files SELinux boolean, run the following command: -$ sudo setsebool -P awstats_purge_apache_log_files off - 3.7.2 - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225517,9 +225642,9 @@ fi if selinuxenabled; then - var_awstats_purge_apache_log_files='' + var_authlogin_yubikey='' - setsebool -P awstats_purge_apache_log_files $var_awstats_purge_apache_log_files + setsebool -P authlogin_yubikey $var_authlogin_yubikey else echo "Skipping remediation, SELinux is disabled"; @@ -225530,6 +225655,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the awstats_purge_apache_log_files SELinux Boolean + By default, the SELinux boolean awstats_purge_apache_log_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the awstats_purge_apache_log_files SELinux boolean, run the following command: +$ sudo setsebool -P awstats_purge_apache_log_files off + 3.7.2 + - name: Disable the awstats_purge_apache_log_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225568,26 +225710,7 @@ fi - no_reboot_needed - sebool_awstats_purge_apache_log_files - - - - - - - - - - Disable the boinc_execmem SELinux Boolean - By default, the SELinux boolean boinc_execmem is enabled. -This setting should be disabled. - -To disable the boinc_execmem SELinux boolean, run the following command: -$ sudo setsebool -P boinc_execmem off - BP28(R67) - 3.7.2 - - CCE-83304-6 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225597,9 +225720,9 @@ fi if selinuxenabled; then - var_boinc_execmem='' + var_awstats_purge_apache_log_files='' - setsebool -P boinc_execmem $var_boinc_execmem + setsebool -P awstats_purge_apache_log_files $var_awstats_purge_apache_log_files else echo "Skipping remediation, SELinux is disabled"; @@ -225610,6 +225733,25 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the boinc_execmem SELinux Boolean + By default, the SELinux boolean boinc_execmem is enabled. +This setting should be disabled. + +To disable the boinc_execmem SELinux boolean, run the following command: +$ sudo setsebool -P boinc_execmem off + BP28(R67) + 3.7.2 + + CCE-83304-6 - name: Disable the boinc_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -225649,23 +225791,7 @@ fi - no_reboot_needed - sebool_boinc_execmem - - - - - - - - - - Disable the cdrecord_read_content SELinux Boolean - By default, the SELinux boolean cdrecord_read_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the cdrecord_read_content SELinux boolean, run the following command: -$ sudo setsebool -P cdrecord_read_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225675,9 +225801,9 @@ fi if selinuxenabled; then - var_cdrecord_read_content='' + var_boinc_execmem='' - setsebool -P cdrecord_read_content $var_cdrecord_read_content + setsebool -P boinc_execmem $var_boinc_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -225688,6 +225814,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cdrecord_read_content SELinux Boolean + By default, the SELinux boolean cdrecord_read_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the cdrecord_read_content SELinux boolean, run the following command: +$ sudo setsebool -P cdrecord_read_content off + - name: Disable the cdrecord_read_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225724,23 +225866,7 @@ fi - no_reboot_needed - sebool_cdrecord_read_content - - - - - - - - - - Disable the cluster_can_network_connect SELinux Boolean - By default, the SELinux boolean cluster_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P cluster_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225750,9 +225876,9 @@ fi if selinuxenabled; then - var_cluster_can_network_connect='' + var_cdrecord_read_content='' - setsebool -P cluster_can_network_connect $var_cluster_can_network_connect + setsebool -P cdrecord_read_content $var_cdrecord_read_content else echo "Skipping remediation, SELinux is disabled"; @@ -225763,6 +225889,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_can_network_connect SELinux Boolean + By default, the SELinux boolean cluster_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P cluster_can_network_connect off + - name: Disable the cluster_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225799,23 +225941,7 @@ fi - no_reboot_needed - sebool_cluster_can_network_connect - - - - - - - - - - Disable the cluster_manage_all_files SELinux Boolean - By default, the SELinux boolean cluster_manage_all_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_manage_all_files SELinux boolean, run the following command: -$ sudo setsebool -P cluster_manage_all_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225825,9 +225951,9 @@ fi if selinuxenabled; then - var_cluster_manage_all_files='' + var_cluster_can_network_connect='' - setsebool -P cluster_manage_all_files $var_cluster_manage_all_files + setsebool -P cluster_can_network_connect $var_cluster_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -225838,6 +225964,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_manage_all_files SELinux Boolean + By default, the SELinux boolean cluster_manage_all_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_manage_all_files SELinux boolean, run the following command: +$ sudo setsebool -P cluster_manage_all_files off + - name: Disable the cluster_manage_all_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225874,25 +226016,7 @@ fi - no_reboot_needed - sebool_cluster_manage_all_files - - - - - - - - - - Disable the cluster_use_execmem SELinux Boolean - By default, the SELinux boolean cluster_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the cluster_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P cluster_use_execmem off - BP28(R67) - - CCE-83305-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225902,9 +226026,9 @@ fi if selinuxenabled; then - var_cluster_use_execmem='' + var_cluster_manage_all_files='' - setsebool -P cluster_use_execmem $var_cluster_use_execmem + setsebool -P cluster_manage_all_files $var_cluster_manage_all_files else echo "Skipping remediation, SELinux is disabled"; @@ -225915,6 +226039,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cluster_use_execmem SELinux Boolean + By default, the SELinux boolean cluster_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the cluster_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P cluster_use_execmem off + BP28(R67) + + CCE-83305-3 - name: Disable the cluster_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -225953,23 +226095,7 @@ fi - no_reboot_needed - sebool_cluster_use_execmem - - - - - - - - - - Disable the cobbler_anon_write SELinux Boolean - By default, the SELinux boolean cobbler_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -225979,9 +226105,9 @@ fi if selinuxenabled; then - var_cobbler_anon_write='' + var_cluster_use_execmem='' - setsebool -P cobbler_anon_write $var_cobbler_anon_write + setsebool -P cluster_use_execmem $var_cluster_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -225992,6 +226118,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_anon_write SELinux Boolean + By default, the SELinux boolean cobbler_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_anon_write off + - name: Disable the cobbler_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226028,23 +226170,7 @@ fi - no_reboot_needed - sebool_cobbler_anon_write - - - - - - - - - - Disable the cobbler_can_network_connect SELinux Boolean - By default, the SELinux boolean cobbler_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226054,9 +226180,9 @@ fi if selinuxenabled; then - var_cobbler_can_network_connect='' + var_cobbler_anon_write='' - setsebool -P cobbler_can_network_connect $var_cobbler_can_network_connect + setsebool -P cobbler_anon_write $var_cobbler_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -226067,6 +226193,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_can_network_connect SELinux Boolean + By default, the SELinux boolean cobbler_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_can_network_connect off + - name: Disable the cobbler_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226103,23 +226245,7 @@ fi - no_reboot_needed - sebool_cobbler_can_network_connect - - - - - - - - - - Disable the cobbler_use_cifs SELinux Boolean - By default, the SELinux boolean cobbler_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226129,9 +226255,9 @@ fi if selinuxenabled; then - var_cobbler_use_cifs='' + var_cobbler_can_network_connect='' - setsebool -P cobbler_use_cifs $var_cobbler_use_cifs + setsebool -P cobbler_can_network_connect $var_cobbler_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226142,6 +226268,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_use_cifs SELinux Boolean + By default, the SELinux boolean cobbler_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_use_cifs off + - name: Disable the cobbler_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226178,23 +226320,7 @@ fi - no_reboot_needed - sebool_cobbler_use_cifs - - - - - - - - - - Disable the cobbler_use_nfs SELinux Boolean - By default, the SELinux boolean cobbler_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the cobbler_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P cobbler_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226204,9 +226330,9 @@ fi if selinuxenabled; then - var_cobbler_use_nfs='' + var_cobbler_use_cifs='' - setsebool -P cobbler_use_nfs $var_cobbler_use_nfs + setsebool -P cobbler_use_cifs $var_cobbler_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -226217,6 +226343,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cobbler_use_nfs SELinux Boolean + By default, the SELinux boolean cobbler_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the cobbler_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P cobbler_use_nfs off + - name: Disable the cobbler_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226252,23 +226394,7 @@ fi - no_reboot_needed - sebool_cobbler_use_nfs - - - - - - - - - - Disable the collectd_tcp_network_connect SELinux Boolean - By default, the SELinux boolean collectd_tcp_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the collectd_tcp_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P collectd_tcp_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226278,9 +226404,9 @@ fi if selinuxenabled; then - var_collectd_tcp_network_connect='' + var_cobbler_use_nfs='' - setsebool -P collectd_tcp_network_connect $var_collectd_tcp_network_connect + setsebool -P cobbler_use_nfs $var_cobbler_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -226291,6 +226417,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the collectd_tcp_network_connect SELinux Boolean + By default, the SELinux boolean collectd_tcp_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the collectd_tcp_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P collectd_tcp_network_connect off + - name: Disable the collectd_tcp_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226327,23 +226469,7 @@ fi - no_reboot_needed - sebool_collectd_tcp_network_connect - - - - - - - - - - Disable the condor_tcp_network_connect SELinux Boolean - By default, the SELinux boolean condor_tcp_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the condor_tcp_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P condor_tcp_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226353,9 +226479,9 @@ fi if selinuxenabled; then - var_condor_tcp_network_connect='' + var_collectd_tcp_network_connect='' - setsebool -P condor_tcp_network_connect $var_condor_tcp_network_connect + setsebool -P collectd_tcp_network_connect $var_collectd_tcp_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226366,6 +226492,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the condor_tcp_network_connect SELinux Boolean + By default, the SELinux boolean condor_tcp_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the condor_tcp_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P condor_tcp_network_connect off + - name: Disable the condor_tcp_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226402,23 +226544,7 @@ fi - no_reboot_needed - sebool_condor_tcp_network_connect - - - - - - - - - - Disable the conman_can_network SELinux Boolean - By default, the SELinux boolean conman_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the conman_can_network SELinux boolean, run the following command: -$ sudo setsebool -P conman_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226428,9 +226554,9 @@ fi if selinuxenabled; then - var_conman_can_network='' + var_condor_tcp_network_connect='' - setsebool -P conman_can_network $var_conman_can_network + setsebool -P condor_tcp_network_connect $var_condor_tcp_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -226441,6 +226567,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the conman_can_network SELinux Boolean + By default, the SELinux boolean conman_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the conman_can_network SELinux boolean, run the following command: +$ sudo setsebool -P conman_can_network off + - name: Disable the conman_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226477,23 +226619,7 @@ fi - no_reboot_needed - sebool_conman_can_network - - - - - - - - - - Disable the container_connect_any SELinux Boolean - By default, the SELinux boolean container_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the container_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P container_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226503,9 +226629,9 @@ fi if selinuxenabled; then - var_container_connect_any='' + var_conman_can_network='' - setsebool -P container_connect_any $var_container_connect_any + setsebool -P conman_can_network $var_conman_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -226516,6 +226642,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the container_connect_any SELinux Boolean + By default, the SELinux boolean container_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the container_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P container_connect_any off + - name: Disable the container_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226552,23 +226694,7 @@ fi - no_reboot_needed - sebool_container_connect_any - - - - - - - - - - Disable the cron_can_relabel SELinux Boolean - By default, the SELinux boolean cron_can_relabel is disabled. -If this setting is enabled, it should be disabled. - -To disable the cron_can_relabel SELinux boolean, run the following command: -$ sudo setsebool -P cron_can_relabel off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226578,9 +226704,9 @@ fi if selinuxenabled; then - var_cron_can_relabel='' + var_container_connect_any='' - setsebool -P cron_can_relabel $var_cron_can_relabel + setsebool -P container_connect_any $var_container_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -226591,6 +226717,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cron_can_relabel SELinux Boolean + By default, the SELinux boolean cron_can_relabel is disabled. +If this setting is enabled, it should be disabled. + +To disable the cron_can_relabel SELinux boolean, run the following command: +$ sudo setsebool -P cron_can_relabel off + - name: Disable the cron_can_relabel SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226627,23 +226769,7 @@ fi - no_reboot_needed - sebool_cron_can_relabel - - - - - - - - - - Disable the cron_system_cronjob_use_shares SELinux Boolean - By default, the SELinux boolean cron_system_cronjob_use_shares is disabled. -If this setting is enabled, it should be disabled. - -To disable the cron_system_cronjob_use_shares SELinux boolean, run the following command: -$ sudo setsebool -P cron_system_cronjob_use_shares off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226653,9 +226779,9 @@ fi if selinuxenabled; then - var_cron_system_cronjob_use_shares='' + var_cron_can_relabel='' - setsebool -P cron_system_cronjob_use_shares $var_cron_system_cronjob_use_shares + setsebool -P cron_can_relabel $var_cron_can_relabel else echo "Skipping remediation, SELinux is disabled"; @@ -226666,6 +226792,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cron_system_cronjob_use_shares SELinux Boolean + By default, the SELinux boolean cron_system_cronjob_use_shares is disabled. +If this setting is enabled, it should be disabled. + +To disable the cron_system_cronjob_use_shares SELinux boolean, run the following command: +$ sudo setsebool -P cron_system_cronjob_use_shares off + - name: Disable the cron_system_cronjob_use_shares SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226702,24 +226844,7 @@ fi - no_reboot_needed - sebool_cron_system_cronjob_use_shares - - - - - - - - - - Enable the cron_userdomain_transition SELinux Boolean - By default, the SELinux boolean cron_userdomain_transition is enabled. -This setting should be enabled as end user cron jobs run in their default -associated user domain(s) instead of the general cronjob domain. - -To enable the cron_userdomain_transition SELinux boolean, run the following command: -$ sudo setsebool -P cron_userdomain_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226729,9 +226854,9 @@ fi if selinuxenabled; then - var_cron_userdomain_transition='' + var_cron_system_cronjob_use_shares='' - setsebool -P cron_userdomain_transition $var_cron_userdomain_transition + setsebool -P cron_system_cronjob_use_shares $var_cron_system_cronjob_use_shares else echo "Skipping remediation, SELinux is disabled"; @@ -226742,6 +226867,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the cron_userdomain_transition SELinux Boolean + By default, the SELinux boolean cron_userdomain_transition is enabled. +This setting should be enabled as end user cron jobs run in their default +associated user domain(s) instead of the general cronjob domain. + +To enable the cron_userdomain_transition SELinux boolean, run the following command: +$ sudo setsebool -P cron_userdomain_transition on + - name: Enable the cron_userdomain_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -226778,25 +226920,7 @@ fi - no_reboot_needed - sebool_cron_userdomain_transition - - - - - - - - - - Disable the cups_execmem SELinux Boolean - By default, the SELinux boolean cups_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the cups_execmem SELinux boolean, run the following command: -$ sudo setsebool -P cups_execmem off - BP28(R67) - - CCE-83306-1 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226806,9 +226930,9 @@ fi if selinuxenabled; then - var_cups_execmem='' + var_cron_userdomain_transition='' - setsebool -P cups_execmem $var_cups_execmem + setsebool -P cron_userdomain_transition $var_cron_userdomain_transition else echo "Skipping remediation, SELinux is disabled"; @@ -226819,6 +226943,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cups_execmem SELinux Boolean + By default, the SELinux boolean cups_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the cups_execmem SELinux boolean, run the following command: +$ sudo setsebool -P cups_execmem off + BP28(R67) + + CCE-83306-1 - name: Disable the cups_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226856,23 +226998,7 @@ fi - no_reboot_needed - sebool_cups_execmem - - - - - - - - - - Disable the cvs_read_shadow SELinux Boolean - By default, the SELinux boolean cvs_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the cvs_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P cvs_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226882,9 +227008,9 @@ fi if selinuxenabled; then - var_cvs_read_shadow='' + var_cups_execmem='' - setsebool -P cvs_read_shadow $var_cvs_read_shadow + setsebool -P cups_execmem $var_cups_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -226895,6 +227021,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the cvs_read_shadow SELinux Boolean + By default, the SELinux boolean cvs_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the cvs_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P cvs_read_shadow off + - name: Disable the cvs_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -226930,23 +227072,7 @@ fi - no_reboot_needed - sebool_cvs_read_shadow - - - - - - - - - - Disable the daemons_dump_core SELinux Boolean - By default, the SELinux boolean daemons_dump_core is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_dump_core SELinux boolean, run the following command: -$ sudo setsebool -P daemons_dump_core off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -226956,9 +227082,9 @@ fi if selinuxenabled; then - var_daemons_dump_core='' + var_cvs_read_shadow='' - setsebool -P daemons_dump_core $var_daemons_dump_core + setsebool -P cvs_read_shadow $var_cvs_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -226969,6 +227095,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_dump_core SELinux Boolean + By default, the SELinux boolean daemons_dump_core is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_dump_core SELinux boolean, run the following command: +$ sudo setsebool -P daemons_dump_core off + - name: Disable the daemons_dump_core SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227005,23 +227147,7 @@ fi - no_reboot_needed - sebool_daemons_dump_core - - - - - - - - - - Disable the daemons_enable_cluster_mode SELinux Boolean - By default, the SELinux boolean daemons_enable_cluster_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_enable_cluster_mode SELinux boolean, run the following command: -$ sudo setsebool -P daemons_enable_cluster_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227031,9 +227157,9 @@ fi if selinuxenabled; then - var_daemons_enable_cluster_mode='' + var_daemons_dump_core='' - setsebool -P daemons_enable_cluster_mode $var_daemons_enable_cluster_mode + setsebool -P daemons_dump_core $var_daemons_dump_core else echo "Skipping remediation, SELinux is disabled"; @@ -227044,6 +227170,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_enable_cluster_mode SELinux Boolean + By default, the SELinux boolean daemons_enable_cluster_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_enable_cluster_mode SELinux boolean, run the following command: +$ sudo setsebool -P daemons_enable_cluster_mode off + - name: Disable the daemons_enable_cluster_mode SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227080,23 +227222,7 @@ fi - no_reboot_needed - sebool_daemons_enable_cluster_mode - - - - - - - - - - Disable the daemons_use_tcp_wrapper SELinux Boolean - By default, the SELinux boolean daemons_use_tcp_wrapper is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_use_tcp_wrapper SELinux boolean, run the following command: -$ sudo setsebool -P daemons_use_tcp_wrapper off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227106,9 +227232,9 @@ fi if selinuxenabled; then - var_daemons_use_tcp_wrapper='' + var_daemons_enable_cluster_mode='' - setsebool -P daemons_use_tcp_wrapper $var_daemons_use_tcp_wrapper + setsebool -P daemons_enable_cluster_mode $var_daemons_enable_cluster_mode else echo "Skipping remediation, SELinux is disabled"; @@ -227119,14 +227245,30 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the daemons_use_tcp_wrapper SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy + + + + + + + + + + Disable the daemons_use_tcp_wrapper SELinux Boolean + By default, the SELinux boolean daemons_use_tcp_wrapper is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_use_tcp_wrapper SELinux boolean, run the following command: +$ sudo setsebool -P daemons_use_tcp_wrapper off + + - name: Disable the daemons_use_tcp_wrapper SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy - low_complexity - low_disruption - medium_severity @@ -227155,23 +227297,7 @@ fi - no_reboot_needed - sebool_daemons_use_tcp_wrapper - - - - - - - - - - Disable the daemons_use_tty SELinux Boolean - By default, the SELinux boolean daemons_use_tty is disabled. -If this setting is enabled, it should be disabled. - -To disable the daemons_use_tty SELinux boolean, run the following command: -$ sudo setsebool -P daemons_use_tty off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227181,9 +227307,9 @@ fi if selinuxenabled; then - var_daemons_use_tty='' + var_daemons_use_tcp_wrapper='' - setsebool -P daemons_use_tty $var_daemons_use_tty + setsebool -P daemons_use_tcp_wrapper $var_daemons_use_tcp_wrapper else echo "Skipping remediation, SELinux is disabled"; @@ -227194,6 +227320,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the daemons_use_tty SELinux Boolean + By default, the SELinux boolean daemons_use_tty is disabled. +If this setting is enabled, it should be disabled. + +To disable the daemons_use_tty SELinux boolean, run the following command: +$ sudo setsebool -P daemons_use_tty off + - name: Disable the daemons_use_tty SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227229,23 +227371,7 @@ fi - no_reboot_needed - sebool_daemons_use_tty - - - - - - - - - - Enable the dbadm_exec_content SELinux Boolean - By default, the SELinux boolean dbadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the dbadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227255,9 +227381,9 @@ fi if selinuxenabled; then - var_dbadm_exec_content='' + var_daemons_use_tty='' - setsebool -P dbadm_exec_content $var_dbadm_exec_content + setsebool -P daemons_use_tty $var_daemons_use_tty else echo "Skipping remediation, SELinux is disabled"; @@ -227268,6 +227394,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the dbadm_exec_content SELinux Boolean + By default, the SELinux boolean dbadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the dbadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_exec_content on + - name: Enable the dbadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227304,23 +227446,7 @@ fi - no_reboot_needed - sebool_dbadm_exec_content - - - - - - - - - - Disable the dbadm_manage_user_files SELinux Boolean - By default, the SELinux boolean dbadm_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the dbadm_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227330,9 +227456,9 @@ fi if selinuxenabled; then - var_dbadm_manage_user_files='' + var_dbadm_exec_content='' - setsebool -P dbadm_manage_user_files $var_dbadm_manage_user_files + setsebool -P dbadm_exec_content $var_dbadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -227343,6 +227469,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dbadm_manage_user_files SELinux Boolean + By default, the SELinux boolean dbadm_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the dbadm_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_manage_user_files off + - name: Disable the dbadm_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227379,23 +227521,7 @@ fi - no_reboot_needed - sebool_dbadm_manage_user_files - - - - - - - - - - Disable the dbadm_read_user_files SELinux Boolean - By default, the SELinux boolean dbadm_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the dbadm_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P dbadm_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227405,9 +227531,9 @@ fi if selinuxenabled; then - var_dbadm_read_user_files='' + var_dbadm_manage_user_files='' - setsebool -P dbadm_read_user_files $var_dbadm_read_user_files + setsebool -P dbadm_manage_user_files $var_dbadm_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -227418,6 +227544,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dbadm_read_user_files SELinux Boolean + By default, the SELinux boolean dbadm_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the dbadm_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P dbadm_read_user_files off + - name: Disable the dbadm_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227453,6 +227595,29 @@ fi - medium_severity - no_reboot_needed - sebool_dbadm_read_user_files + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_dbadm_read_user_files='' + + setsebool -P dbadm_read_user_files $var_dbadm_read_user_files + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -227493,29 +227658,6 @@ If this setting is enabled, it should be disabled. To disable the deny_ptrace SELinux boolean, run the following command: $ sudo setsebool -P deny_ptrace off - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_deny_ptrace='' - - setsebool -P deny_ptrace $var_deny_ptrace - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the deny_ptrace SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227551,23 +227693,7 @@ fi - no_reboot_needed - sebool_deny_ptrace - - - - - - - - - - Disable the dhcpc_exec_iptables SELinux Boolean - By default, the SELinux boolean dhcpc_exec_iptables is disabled. -If this setting is enabled, it should be disabled. - -To disable the dhcpc_exec_iptables SELinux boolean, run the following command: -$ sudo setsebool -P dhcpc_exec_iptables off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227577,9 +227703,9 @@ fi if selinuxenabled; then - var_dhcpc_exec_iptables='' + var_deny_ptrace='' - setsebool -P dhcpc_exec_iptables $var_dhcpc_exec_iptables + setsebool -P deny_ptrace $var_deny_ptrace else echo "Skipping remediation, SELinux is disabled"; @@ -227590,6 +227716,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dhcpc_exec_iptables SELinux Boolean + By default, the SELinux boolean dhcpc_exec_iptables is disabled. +If this setting is enabled, it should be disabled. + +To disable the dhcpc_exec_iptables SELinux boolean, run the following command: +$ sudo setsebool -P dhcpc_exec_iptables off + - name: Disable the dhcpc_exec_iptables SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227626,23 +227768,7 @@ fi - no_reboot_needed - sebool_dhcpc_exec_iptables - - - - - - - - - - Disable the dhcpd_use_ldap SELinux Boolean - By default, the SELinux boolean dhcpd_use_ldap is disabled. -If this setting is enabled, it should be disabled. - -To disable the dhcpd_use_ldap SELinux boolean, run the following command: -$ sudo setsebool -P dhcpd_use_ldap off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227652,9 +227778,9 @@ fi if selinuxenabled; then - var_dhcpd_use_ldap='' + var_dhcpc_exec_iptables='' - setsebool -P dhcpd_use_ldap $var_dhcpd_use_ldap + setsebool -P dhcpc_exec_iptables $var_dhcpc_exec_iptables else echo "Skipping remediation, SELinux is disabled"; @@ -227665,6 +227791,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the dhcpd_use_ldap SELinux Boolean + By default, the SELinux boolean dhcpd_use_ldap is disabled. +If this setting is enabled, it should be disabled. + +To disable the dhcpd_use_ldap SELinux boolean, run the following command: +$ sudo setsebool -P dhcpd_use_ldap off + - name: Disable the dhcpd_use_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227700,23 +227842,7 @@ fi - no_reboot_needed - sebool_dhcpd_use_ldap - - - - - - - - - - Enable the domain_fd_use SELinux Boolean - By default, the SELinux boolean domain_fd_use is enabled. -If this setting is disabled, it should be enabled. - -To enable the domain_fd_use SELinux boolean, run the following command: -$ sudo setsebool -P domain_fd_use on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227726,9 +227852,9 @@ fi if selinuxenabled; then - var_domain_fd_use='' + var_dhcpd_use_ldap='' - setsebool -P domain_fd_use $var_domain_fd_use + setsebool -P dhcpd_use_ldap $var_dhcpd_use_ldap else echo "Skipping remediation, SELinux is disabled"; @@ -227739,6 +227865,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the domain_fd_use SELinux Boolean + By default, the SELinux boolean domain_fd_use is enabled. +If this setting is disabled, it should be enabled. + +To enable the domain_fd_use SELinux boolean, run the following command: +$ sudo setsebool -P domain_fd_use on + - name: Enable the domain_fd_use SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -227774,23 +227916,7 @@ fi - no_reboot_needed - sebool_domain_fd_use - - - - - - - - - - Disable the domain_kernel_load_modules SELinux Boolean - By default, the SELinux boolean domain_kernel_load_modules is disabled. -If this setting is enabled, it should be disabled. - -To disable the domain_kernel_load_modules SELinux boolean, run the following command: -$ sudo setsebool -P domain_kernel_load_modules off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227800,9 +227926,9 @@ fi if selinuxenabled; then - var_domain_kernel_load_modules='' + var_domain_fd_use='' - setsebool -P domain_kernel_load_modules $var_domain_kernel_load_modules + setsebool -P domain_fd_use $var_domain_fd_use else echo "Skipping remediation, SELinux is disabled"; @@ -227813,6 +227939,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the domain_kernel_load_modules SELinux Boolean + By default, the SELinux boolean domain_kernel_load_modules is disabled. +If this setting is enabled, it should be disabled. + +To disable the domain_kernel_load_modules SELinux boolean, run the following command: +$ sudo setsebool -P domain_kernel_load_modules off + - name: Disable the domain_kernel_load_modules SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227849,23 +227991,7 @@ fi - no_reboot_needed - sebool_domain_kernel_load_modules - - - - - - - - - - Disable the entropyd_use_audio SELinux Boolean - By default, the SELinux boolean entropyd_use_audio is enabled. -This setting should be disabled as it uses audit input to generate entropy. - -To disable the entropyd_use_audio SELinux boolean, run the following command: -$ sudo setsebool -P entropyd_use_audio off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227875,9 +228001,9 @@ fi if selinuxenabled; then - var_entropyd_use_audio='' + var_domain_kernel_load_modules='' - setsebool -P entropyd_use_audio $var_entropyd_use_audio + setsebool -P domain_kernel_load_modules $var_domain_kernel_load_modules else echo "Skipping remediation, SELinux is disabled"; @@ -227888,6 +228014,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the entropyd_use_audio SELinux Boolean + By default, the SELinux boolean entropyd_use_audio is enabled. +This setting should be disabled as it uses audit input to generate entropy. + +To disable the entropyd_use_audio SELinux boolean, run the following command: +$ sudo setsebool -P entropyd_use_audio off + - name: Disable the entropyd_use_audio SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227924,23 +228066,7 @@ fi - no_reboot_needed - sebool_entropyd_use_audio - - - - - - - - - - Disable the exim_can_connect_db SELinux Boolean - By default, the SELinux boolean exim_can_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_can_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P exim_can_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -227950,9 +228076,9 @@ fi if selinuxenabled; then - var_exim_can_connect_db='' + var_entropyd_use_audio='' - setsebool -P exim_can_connect_db $var_exim_can_connect_db + setsebool -P entropyd_use_audio $var_entropyd_use_audio else echo "Skipping remediation, SELinux is disabled"; @@ -227963,6 +228089,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_can_connect_db SELinux Boolean + By default, the SELinux boolean exim_can_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_can_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P exim_can_connect_db off + - name: Disable the exim_can_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -227999,23 +228141,7 @@ fi - no_reboot_needed - sebool_exim_can_connect_db - - - - - - - - - - Disable the exim_manage_user_files SELinux Boolean - By default, the SELinux boolean exim_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P exim_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228025,9 +228151,9 @@ fi if selinuxenabled; then - var_exim_manage_user_files='' + var_exim_can_connect_db='' - setsebool -P exim_manage_user_files $var_exim_manage_user_files + setsebool -P exim_can_connect_db $var_exim_can_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -228038,6 +228164,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_manage_user_files SELinux Boolean + By default, the SELinux boolean exim_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P exim_manage_user_files off + - name: Disable the exim_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228074,23 +228216,7 @@ fi - no_reboot_needed - sebool_exim_manage_user_files - - - - - - - - - - Disable the exim_read_user_files SELinux Boolean - By default, the SELinux boolean exim_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the exim_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P exim_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228100,9 +228226,9 @@ fi if selinuxenabled; then - var_exim_read_user_files='' + var_exim_manage_user_files='' - setsebool -P exim_read_user_files $var_exim_read_user_files + setsebool -P exim_manage_user_files $var_exim_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -228113,6 +228239,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the exim_read_user_files SELinux Boolean + By default, the SELinux boolean exim_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the exim_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P exim_read_user_files off + - name: Disable the exim_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228149,23 +228291,7 @@ fi - no_reboot_needed - sebool_exim_read_user_files - - - - - - - - - - Disable the fcron_crond SELinux Boolean - By default, the SELinux boolean fcron_crond is disabled. -If this setting is enabled, it should be disabled. - -To disable the fcron_crond SELinux boolean, run the following command: -$ sudo setsebool -P fcron_crond off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228175,9 +228301,9 @@ fi if selinuxenabled; then - var_fcron_crond='' + var_exim_read_user_files='' - setsebool -P fcron_crond $var_fcron_crond + setsebool -P exim_read_user_files $var_exim_read_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -228188,6 +228314,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fcron_crond SELinux Boolean + By default, the SELinux boolean fcron_crond is disabled. +If this setting is enabled, it should be disabled. + +To disable the fcron_crond SELinux boolean, run the following command: +$ sudo setsebool -P fcron_crond off + - name: Disable the fcron_crond SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228223,23 +228365,7 @@ fi - no_reboot_needed - sebool_fcron_crond - - - - - - - - - - Disable the fenced_can_network_connect SELinux Boolean - By default, the SELinux boolean fenced_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the fenced_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P fenced_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228249,9 +228375,9 @@ fi if selinuxenabled; then - var_fenced_can_network_connect='' + var_fcron_crond='' - setsebool -P fenced_can_network_connect $var_fenced_can_network_connect + setsebool -P fcron_crond $var_fcron_crond else echo "Skipping remediation, SELinux is disabled"; @@ -228262,6 +228388,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fenced_can_network_connect SELinux Boolean + By default, the SELinux boolean fenced_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the fenced_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P fenced_can_network_connect off + - name: Disable the fenced_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228298,23 +228440,7 @@ fi - no_reboot_needed - sebool_fenced_can_network_connect - - - - - - - - - - Disable the fenced_can_ssh SELinux Boolean - By default, the SELinux boolean fenced_can_ssh is disabled. -If this setting is enabled, it should be disabled. - -To disable the fenced_can_ssh SELinux boolean, run the following command: -$ sudo setsebool -P fenced_can_ssh off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228324,9 +228450,9 @@ fi if selinuxenabled; then - var_fenced_can_ssh='' + var_fenced_can_network_connect='' - setsebool -P fenced_can_ssh $var_fenced_can_ssh + setsebool -P fenced_can_network_connect $var_fenced_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -228337,6 +228463,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the fenced_can_ssh SELinux Boolean + By default, the SELinux boolean fenced_can_ssh is disabled. +If this setting is enabled, it should be disabled. + +To disable the fenced_can_ssh SELinux boolean, run the following command: +$ sudo setsebool -P fenced_can_ssh off + - name: Disable the fenced_can_ssh SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228371,6 +228513,29 @@ fi - medium_severity - no_reboot_needed - sebool_fenced_can_ssh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_fenced_can_ssh='' + + setsebool -P fenced_can_ssh $var_fenced_can_ssh + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -228426,29 +228591,6 @@ To enable the fips_mode SELinux boolean, run the followin SC-12 PR.DS-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_fips_mode='' - - setsebool -P fips_mode $var_fips_mode - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the fips_mode SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228497,23 +228639,7 @@ fi - no_reboot_needed - sebool_fips_mode - - - - - - - - - - Disable the ftpd_anon_write SELinux Boolean - By default, the SELinux boolean ftpd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228523,9 +228649,9 @@ fi if selinuxenabled; then - var_ftpd_anon_write='' + var_fips_mode='' - setsebool -P ftpd_anon_write $var_ftpd_anon_write + setsebool -P fips_mode $var_fips_mode else echo "Skipping remediation, SELinux is disabled"; @@ -228536,6 +228662,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_anon_write SELinux Boolean + By default, the SELinux boolean ftpd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_anon_write off + - name: Disable the ftpd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228571,23 +228713,7 @@ fi - no_reboot_needed - sebool_ftpd_anon_write - - - - - - - - - - Disable the ftpd_connect_all_unreserved SELinux Boolean - By default, the SELinux boolean ftpd_connect_all_unreserved is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_connect_all_unreserved SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_connect_all_unreserved off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228597,9 +228723,9 @@ fi if selinuxenabled; then - var_ftpd_connect_all_unreserved='' + var_ftpd_anon_write='' - setsebool -P ftpd_connect_all_unreserved $var_ftpd_connect_all_unreserved + setsebool -P ftpd_anon_write $var_ftpd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -228610,6 +228736,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_connect_all_unreserved SELinux Boolean + By default, the SELinux boolean ftpd_connect_all_unreserved is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_connect_all_unreserved SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_connect_all_unreserved off + - name: Disable the ftpd_connect_all_unreserved SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228646,23 +228788,7 @@ fi - no_reboot_needed - sebool_ftpd_connect_all_unreserved - - - - - - - - - - Disable the ftpd_connect_db SELinux Boolean - By default, the SELinux boolean ftpd_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228672,9 +228798,9 @@ fi if selinuxenabled; then - var_ftpd_connect_db='' + var_ftpd_connect_all_unreserved='' - setsebool -P ftpd_connect_db $var_ftpd_connect_db + setsebool -P ftpd_connect_all_unreserved $var_ftpd_connect_all_unreserved else echo "Skipping remediation, SELinux is disabled"; @@ -228685,6 +228811,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_connect_db SELinux Boolean + By default, the SELinux boolean ftpd_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_connect_db off + - name: Disable the ftpd_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228720,23 +228862,7 @@ fi - no_reboot_needed - sebool_ftpd_connect_db - - - - - - - - - - Disable the ftpd_full_access SELinux Boolean - By default, the SELinux boolean ftpd_full_access is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_full_access SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_full_access off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228746,9 +228872,9 @@ fi if selinuxenabled; then - var_ftpd_full_access='' + var_ftpd_connect_db='' - setsebool -P ftpd_full_access $var_ftpd_full_access + setsebool -P ftpd_connect_db $var_ftpd_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -228759,6 +228885,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_full_access SELinux Boolean + By default, the SELinux boolean ftpd_full_access is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_full_access SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_full_access off + - name: Disable the ftpd_full_access SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -228795,23 +228937,7 @@ fi - no_reboot_needed - sebool_ftpd_full_access - - - - - - - - - - Disable the ftpd_use_cifs SELinux Boolean - By default, the SELinux boolean ftpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228821,9 +228947,9 @@ fi if selinuxenabled; then - var_ftpd_use_cifs='' + var_ftpd_full_access='' - setsebool -P ftpd_use_cifs $var_ftpd_use_cifs + setsebool -P ftpd_full_access $var_ftpd_full_access else echo "Skipping remediation, SELinux is disabled"; @@ -228834,6 +228960,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_cifs SELinux Boolean + By default, the SELinux boolean ftpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_cifs off + - name: Disable the ftpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228869,23 +229011,7 @@ fi - no_reboot_needed - sebool_ftpd_use_cifs - - - - - - - - - - Disable the ftpd_use_fusefs SELinux Boolean - By default, the SELinux boolean ftpd_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228895,9 +229021,9 @@ fi if selinuxenabled; then - var_ftpd_use_fusefs='' + var_ftpd_use_cifs='' - setsebool -P ftpd_use_fusefs $var_ftpd_use_fusefs + setsebool -P ftpd_use_cifs $var_ftpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -228908,6 +229034,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_fusefs SELinux Boolean + By default, the SELinux boolean ftpd_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_fusefs off + - name: Disable the ftpd_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -228943,23 +229085,7 @@ fi - no_reboot_needed - sebool_ftpd_use_fusefs - - - - - - - - - - Disable the ftpd_use_nfs SELinux Boolean - By default, the SELinux boolean ftpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -228969,9 +229095,9 @@ fi if selinuxenabled; then - var_ftpd_use_nfs='' + var_ftpd_use_fusefs='' - setsebool -P ftpd_use_nfs $var_ftpd_use_nfs + setsebool -P ftpd_use_fusefs $var_ftpd_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -228982,6 +229108,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_nfs SELinux Boolean + By default, the SELinux boolean ftpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_nfs off + - name: Disable the ftpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -229017,23 +229159,7 @@ fi - no_reboot_needed - sebool_ftpd_use_nfs - - - - - - - - - - Disable the ftpd_use_passive_mode SELinux Boolean - By default, the SELinux boolean ftpd_use_passive_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the ftpd_use_passive_mode SELinux boolean, run the following command: -$ sudo setsebool -P ftpd_use_passive_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229043,9 +229169,9 @@ fi if selinuxenabled; then - var_ftpd_use_passive_mode='' + var_ftpd_use_nfs='' - setsebool -P ftpd_use_passive_mode $var_ftpd_use_passive_mode + setsebool -P ftpd_use_nfs $var_ftpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229056,6 +229182,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ftpd_use_passive_mode SELinux Boolean + By default, the SELinux boolean ftpd_use_passive_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the ftpd_use_passive_mode SELinux boolean, run the following command: +$ sudo setsebool -P ftpd_use_passive_mode off + - name: Disable the ftpd_use_passive_mode SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229092,23 +229234,7 @@ fi - no_reboot_needed - sebool_ftpd_use_passive_mode - - - - - - - - - - Disable the git_cgi_enable_homedirs SELinux Boolean - By default, the SELinux boolean git_cgi_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229118,9 +229244,9 @@ fi if selinuxenabled; then - var_git_cgi_enable_homedirs='' + var_ftpd_use_passive_mode='' - setsebool -P git_cgi_enable_homedirs $var_git_cgi_enable_homedirs + setsebool -P ftpd_use_passive_mode $var_ftpd_use_passive_mode else echo "Skipping remediation, SELinux is disabled"; @@ -229131,18 +229257,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the git_cgi_enable_homedirs SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the git_cgi_enable_homedirs SELinux Boolean + By default, the SELinux boolean git_cgi_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_enable_homedirs off + + - name: Disable the git_cgi_enable_homedirs SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_git_cgi_enable_homedirs - name: XCCDF Value var_git_cgi_enable_homedirs # promote to variable set_fact: @@ -229167,23 +229309,7 @@ fi - no_reboot_needed - sebool_git_cgi_enable_homedirs - - - - - - - - - - Disable the git_cgi_use_cifs SELinux Boolean - By default, the SELinux boolean git_cgi_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229193,9 +229319,9 @@ fi if selinuxenabled; then - var_git_cgi_use_cifs='' + var_git_cgi_enable_homedirs='' - setsebool -P git_cgi_use_cifs $var_git_cgi_use_cifs + setsebool -P git_cgi_enable_homedirs $var_git_cgi_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -229206,6 +229332,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_cgi_use_cifs SELinux Boolean + By default, the SELinux boolean git_cgi_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_use_cifs off + - name: Disable the git_cgi_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229242,23 +229384,7 @@ fi - no_reboot_needed - sebool_git_cgi_use_cifs - - - - - - - - - - Disable the git_cgi_use_nfs SELinux Boolean - By default, the SELinux boolean git_cgi_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_cgi_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P git_cgi_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229268,9 +229394,9 @@ fi if selinuxenabled; then - var_git_cgi_use_nfs='' + var_git_cgi_use_cifs='' - setsebool -P git_cgi_use_nfs $var_git_cgi_use_nfs + setsebool -P git_cgi_use_cifs $var_git_cgi_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -229281,6 +229407,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_cgi_use_nfs SELinux Boolean + By default, the SELinux boolean git_cgi_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_cgi_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P git_cgi_use_nfs off + - name: Disable the git_cgi_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -229316,23 +229458,7 @@ fi - no_reboot_needed - sebool_git_cgi_use_nfs - - - - - - - - - - Disable the git_session_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean git_session_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_session_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P git_session_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229342,9 +229468,9 @@ fi if selinuxenabled; then - var_git_session_bind_all_unreserved_ports='' + var_git_cgi_use_nfs='' - setsebool -P git_session_bind_all_unreserved_ports $var_git_session_bind_all_unreserved_ports + setsebool -P git_cgi_use_nfs $var_git_cgi_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229355,6 +229481,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_session_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean git_session_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_session_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P git_session_bind_all_unreserved_ports off + - name: Disable the git_session_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229391,23 +229533,7 @@ fi - no_reboot_needed - sebool_git_session_bind_all_unreserved_ports - - - - - - - - - - Disable the git_session_users SELinux Boolean - By default, the SELinux boolean git_session_users is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_session_users SELinux boolean, run the following command: -$ sudo setsebool -P git_session_users off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229417,9 +229543,9 @@ fi if selinuxenabled; then - var_git_session_users='' + var_git_session_bind_all_unreserved_ports='' - setsebool -P git_session_users $var_git_session_users + setsebool -P git_session_bind_all_unreserved_ports $var_git_session_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -229430,6 +229556,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_session_users SELinux Boolean + By default, the SELinux boolean git_session_users is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_session_users SELinux boolean, run the following command: +$ sudo setsebool -P git_session_users off + - name: Disable the git_session_users SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229466,23 +229608,7 @@ fi - no_reboot_needed - sebool_git_session_users - - - - - - - - - - Disable the git_system_enable_homedirs SELinux Boolean - By default, the SELinux boolean git_system_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229492,9 +229618,9 @@ fi if selinuxenabled; then - var_git_system_enable_homedirs='' + var_git_session_users='' - setsebool -P git_system_enable_homedirs $var_git_system_enable_homedirs + setsebool -P git_session_users $var_git_session_users else echo "Skipping remediation, SELinux is disabled"; @@ -229505,6 +229631,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_enable_homedirs SELinux Boolean + By default, the SELinux boolean git_system_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_enable_homedirs off + - name: Disable the git_system_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229541,23 +229683,7 @@ fi - no_reboot_needed - sebool_git_system_enable_homedirs - - - - - - - - - - Disable the git_system_use_cifs SELinux Boolean - By default, the SELinux boolean git_system_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229567,9 +229693,9 @@ fi if selinuxenabled; then - var_git_system_use_cifs='' + var_git_system_enable_homedirs='' - setsebool -P git_system_use_cifs $var_git_system_use_cifs + setsebool -P git_system_enable_homedirs $var_git_system_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -229580,6 +229706,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_use_cifs SELinux Boolean + By default, the SELinux boolean git_system_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_use_cifs off + - name: Disable the git_system_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229616,23 +229758,7 @@ fi - no_reboot_needed - sebool_git_system_use_cifs - - - - - - - - - - Disable the git_system_use_nfs SELinux Boolean - By default, the SELinux boolean git_system_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the git_system_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P git_system_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229642,9 +229768,9 @@ fi if selinuxenabled; then - var_git_system_use_nfs='' + var_git_system_use_cifs='' - setsebool -P git_system_use_nfs $var_git_system_use_nfs + setsebool -P git_system_use_cifs $var_git_system_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -229655,6 +229781,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the git_system_use_nfs SELinux Boolean + By default, the SELinux boolean git_system_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the git_system_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P git_system_use_nfs off + - name: Disable the git_system_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229691,23 +229833,7 @@ fi - no_reboot_needed - sebool_git_system_use_nfs - - - - - - - - - - Disable the gitosis_can_sendmail SELinux Boolean - By default, the SELinux boolean gitosis_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the gitosis_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P gitosis_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229717,9 +229843,9 @@ fi if selinuxenabled; then - var_gitosis_can_sendmail='' + var_git_system_use_nfs='' - setsebool -P gitosis_can_sendmail $var_gitosis_can_sendmail + setsebool -P git_system_use_nfs $var_git_system_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -229730,6 +229856,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gitosis_can_sendmail SELinux Boolean + By default, the SELinux boolean gitosis_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the gitosis_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P gitosis_can_sendmail off + - name: Disable the gitosis_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229766,23 +229908,7 @@ fi - no_reboot_needed - sebool_gitosis_can_sendmail - - - - - - - - - - Disable the glance_api_can_network SELinux Boolean - By default, the SELinux boolean glance_api_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_api_can_network SELinux boolean, run the following command: -$ sudo setsebool -P glance_api_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229792,9 +229918,9 @@ fi if selinuxenabled; then - var_glance_api_can_network='' + var_gitosis_can_sendmail='' - setsebool -P glance_api_can_network $var_glance_api_can_network + setsebool -P gitosis_can_sendmail $var_gitosis_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -229805,6 +229931,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_api_can_network SELinux Boolean + By default, the SELinux boolean glance_api_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_api_can_network SELinux boolean, run the following command: +$ sudo setsebool -P glance_api_can_network off + - name: Disable the glance_api_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229841,25 +229983,7 @@ fi - no_reboot_needed - sebool_glance_api_can_network - - - - - - - - - - Disable the glance_use_execmem SELinux Boolean - By default, the SELinux boolean glance_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P glance_use_execmem off - BP28(R67) - - CCE-83308-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229869,9 +229993,9 @@ fi if selinuxenabled; then - var_glance_use_execmem='' + var_glance_api_can_network='' - setsebool -P glance_use_execmem $var_glance_use_execmem + setsebool -P glance_api_can_network $var_glance_api_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -229882,6 +230006,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_use_execmem SELinux Boolean + By default, the SELinux boolean glance_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P glance_use_execmem off + BP28(R67) + + CCE-83308-7 - name: Disable the glance_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229920,23 +230062,7 @@ fi - no_reboot_needed - sebool_glance_use_execmem - - - - - - - - - - Disable the glance_use_fusefs SELinux Boolean - By default, the SELinux boolean glance_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the glance_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P glance_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -229946,9 +230072,9 @@ fi if selinuxenabled; then - var_glance_use_fusefs='' + var_glance_use_execmem='' - setsebool -P glance_use_fusefs $var_glance_use_fusefs + setsebool -P glance_use_execmem $var_glance_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -229959,6 +230085,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the glance_use_fusefs SELinux Boolean + By default, the SELinux boolean glance_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the glance_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P glance_use_fusefs off + - name: Disable the glance_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -229995,23 +230137,7 @@ fi - no_reboot_needed - sebool_glance_use_fusefs - - - - - - - - - - Disable the global_ssp SELinux Boolean - By default, the SELinux boolean global_ssp is disabled. -If this setting is enabled, it should be disabled. - -To disable the global_ssp SELinux boolean, run the following command: -$ sudo setsebool -P global_ssp off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230021,9 +230147,9 @@ fi if selinuxenabled; then - var_global_ssp='' + var_glance_use_fusefs='' - setsebool -P global_ssp $var_global_ssp + setsebool -P glance_use_fusefs $var_glance_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -230034,6 +230160,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the global_ssp SELinux Boolean + By default, the SELinux boolean global_ssp is disabled. +If this setting is enabled, it should be disabled. + +To disable the global_ssp SELinux boolean, run the following command: +$ sudo setsebool -P global_ssp off + - name: Disable the global_ssp SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -230068,23 +230210,7 @@ fi - no_reboot_needed - sebool_global_ssp - - - - - - - - - - Disable the gluster_anon_write SELinux Boolean - By default, the SELinux boolean gluster_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the gluster_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P gluster_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230094,9 +230220,9 @@ fi if selinuxenabled; then - var_gluster_anon_write='' + var_global_ssp='' - setsebool -P gluster_anon_write $var_gluster_anon_write + setsebool -P global_ssp $var_global_ssp else echo "Skipping remediation, SELinux is disabled"; @@ -230107,6 +230233,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gluster_anon_write SELinux Boolean + By default, the SELinux boolean gluster_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the gluster_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P gluster_anon_write off + - name: Disable the gluster_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230143,23 +230285,7 @@ fi - no_reboot_needed - sebool_gluster_anon_write - - - - - - - - - - Disable the gluster_export_all_ro SELinux Boolean - By default, the SELinux boolean gluster_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the gluster_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P gluster_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230169,9 +230295,9 @@ fi if selinuxenabled; then - var_gluster_export_all_ro='' + var_gluster_anon_write='' - setsebool -P gluster_export_all_ro $var_gluster_export_all_ro + setsebool -P gluster_anon_write $var_gluster_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230182,6 +230308,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gluster_export_all_ro SELinux Boolean + By default, the SELinux boolean gluster_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the gluster_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P gluster_export_all_ro off + - name: Disable the gluster_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230218,24 +230360,7 @@ fi - no_reboot_needed - sebool_gluster_export_all_ro - - - - - - - - - - Configure the gluster_export_all_rw SELinux Boolean - By default, the SELinux boolean gluster_export_all_rw is enabled. -If GlusterFS is in use, this setting should be enabled. Otherwise, -disable it. - -To disable the gluster_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P gluster_export_all_rw off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230245,9 +230370,9 @@ fi if selinuxenabled; then - var_gluster_export_all_rw='' + var_gluster_export_all_ro='' - setsebool -P gluster_export_all_rw $var_gluster_export_all_rw + setsebool -P gluster_export_all_ro $var_gluster_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -230258,6 +230383,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the gluster_export_all_rw SELinux Boolean + By default, the SELinux boolean gluster_export_all_rw is enabled. +If GlusterFS is in use, this setting should be enabled. Otherwise, +disable it. + +To disable the gluster_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P gluster_export_all_rw off + - name: Configure the gluster_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230294,23 +230436,7 @@ fi - no_reboot_needed - sebool_gluster_export_all_rw - - - - - - - - - - Disable the gpg_web_anon_write SELinux Boolean - By default, the SELinux boolean gpg_web_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the gpg_web_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P gpg_web_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230320,9 +230446,9 @@ fi if selinuxenabled; then - var_gpg_web_anon_write='' + var_gluster_export_all_rw='' - setsebool -P gpg_web_anon_write $var_gpg_web_anon_write + setsebool -P gluster_export_all_rw $var_gluster_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -230333,6 +230459,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the gpg_web_anon_write SELinux Boolean + By default, the SELinux boolean gpg_web_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the gpg_web_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P gpg_web_anon_write off + - name: Disable the gpg_web_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230369,25 +230511,7 @@ fi - no_reboot_needed - sebool_gpg_web_anon_write - - - - - - - - - - Enable the gssd_read_tmp SELinux Boolean - By default, the SELinux boolean gssd_read_tmp is enabled. -This setting allows gssd processes to access Kerberos to read -TGTs in the temp directory. If this setting is disabled, it should -be enabled. - -To enable the gssd_read_tmp SELinux boolean, run the following command: -$ sudo setsebool -P gssd_read_tmp on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230397,9 +230521,9 @@ fi if selinuxenabled; then - var_gssd_read_tmp='' + var_gpg_web_anon_write='' - setsebool -P gssd_read_tmp $var_gssd_read_tmp + setsebool -P gpg_web_anon_write $var_gpg_web_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230410,6 +230534,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the gssd_read_tmp SELinux Boolean + By default, the SELinux boolean gssd_read_tmp is enabled. +This setting allows gssd processes to access Kerberos to read +TGTs in the temp directory. If this setting is disabled, it should +be enabled. + +To enable the gssd_read_tmp SELinux boolean, run the following command: +$ sudo setsebool -P gssd_read_tmp on + - name: Enable the gssd_read_tmp SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -230445,23 +230587,7 @@ fi - no_reboot_needed - sebool_gssd_read_tmp - - - - - - - - - - Disable the guest_exec_content SELinux Boolean - By default, the SELinux boolean guest_exec_content is enabled. -This setting should be disabled as no guest accounts should be used. - -To disable the guest_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P guest_exec_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230471,9 +230597,9 @@ fi if selinuxenabled; then - var_guest_exec_content='' + var_gssd_read_tmp='' - setsebool -P guest_exec_content $var_guest_exec_content + setsebool -P gssd_read_tmp $var_gssd_read_tmp else echo "Skipping remediation, SELinux is disabled"; @@ -230484,6 +230610,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the guest_exec_content SELinux Boolean + By default, the SELinux boolean guest_exec_content is enabled. +This setting should be disabled as no guest accounts should be used. + +To disable the guest_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P guest_exec_content off + - name: Disable the guest_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230520,23 +230662,7 @@ fi - no_reboot_needed - sebool_guest_exec_content - - - - - - - - - - Disable the haproxy_connect_any SELinux Boolean - By default, the SELinux boolean haproxy_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the haproxy_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P haproxy_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230546,9 +230672,9 @@ fi if selinuxenabled; then - var_haproxy_connect_any='' + var_guest_exec_content='' - setsebool -P haproxy_connect_any $var_haproxy_connect_any + setsebool -P guest_exec_content $var_guest_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -230559,6 +230685,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the haproxy_connect_any SELinux Boolean + By default, the SELinux boolean haproxy_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the haproxy_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P haproxy_connect_any off + - name: Disable the haproxy_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230595,23 +230737,7 @@ fi - no_reboot_needed - sebool_haproxy_connect_any - - - - - - - - - - Disable the httpd_anon_write SELinux Boolean - By default, the SELinux boolean httpd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P httpd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230621,9 +230747,9 @@ fi if selinuxenabled; then - var_httpd_anon_write='' + var_haproxy_connect_any='' - setsebool -P httpd_anon_write $var_httpd_anon_write + setsebool -P haproxy_connect_any $var_haproxy_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -230634,6 +230760,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_anon_write SELinux Boolean + By default, the SELinux boolean httpd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P httpd_anon_write off + - name: Disable the httpd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230670,24 +230812,7 @@ fi - no_reboot_needed - sebool_httpd_anon_write - - - - - - - - - - Configure the httpd_builtin_scripting SELinux Boolean - By default, the SELinux boolean httpd_builtin_scripting is enabled. -This setting should be disabled if httpd is not running php -or some similary scripting language. - -To disable the httpd_builtin_scripting SELinux boolean, run the following command: -$ sudo setsebool -P httpd_builtin_scripting off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230697,9 +230822,9 @@ fi if selinuxenabled; then - var_httpd_builtin_scripting='' + var_httpd_anon_write='' - setsebool -P httpd_builtin_scripting $var_httpd_builtin_scripting + setsebool -P httpd_anon_write $var_httpd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -230710,6 +230835,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the httpd_builtin_scripting SELinux Boolean + By default, the SELinux boolean httpd_builtin_scripting is enabled. +This setting should be disabled if httpd is not running php +or some similary scripting language. + +To disable the httpd_builtin_scripting SELinux boolean, run the following command: +$ sudo setsebool -P httpd_builtin_scripting off + - name: Configure the httpd_builtin_scripting SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230746,23 +230888,7 @@ fi - no_reboot_needed - sebool_httpd_builtin_scripting - - - - - - - - - - Disable the httpd_can_check_spam SELinux Boolean - By default, the SELinux boolean httpd_can_check_spam is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_check_spam SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_check_spam off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230772,9 +230898,9 @@ fi if selinuxenabled; then - var_httpd_can_check_spam='' + var_httpd_builtin_scripting='' - setsebool -P httpd_can_check_spam $var_httpd_can_check_spam + setsebool -P httpd_builtin_scripting $var_httpd_builtin_scripting else echo "Skipping remediation, SELinux is disabled"; @@ -230785,6 +230911,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_check_spam SELinux Boolean + By default, the SELinux boolean httpd_can_check_spam is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_check_spam SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_check_spam off + - name: Disable the httpd_can_check_spam SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230821,23 +230963,7 @@ fi - no_reboot_needed - sebool_httpd_can_check_spam - - - - - - - - - - Disable the httpd_can_connect_ftp SELinux Boolean - By default, the SELinux boolean httpd_can_connect_ftp is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_ftp SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_ftp off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230847,9 +230973,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_ftp='' + var_httpd_can_check_spam='' - setsebool -P httpd_can_connect_ftp $var_httpd_can_connect_ftp + setsebool -P httpd_can_check_spam $var_httpd_can_check_spam else echo "Skipping remediation, SELinux is disabled"; @@ -230860,6 +230986,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_ftp SELinux Boolean + By default, the SELinux boolean httpd_can_connect_ftp is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_ftp SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_ftp off + - name: Disable the httpd_can_connect_ftp SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230896,23 +231038,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_ftp - - - - - - - - - - Disable the httpd_can_connect_ldap SELinux Boolean - By default, the SELinux boolean httpd_can_connect_ldap is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_ldap SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_ldap off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230922,9 +231048,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_ldap='' + var_httpd_can_connect_ftp='' - setsebool -P httpd_can_connect_ldap $var_httpd_can_connect_ldap + setsebool -P httpd_can_connect_ftp $var_httpd_can_connect_ftp else echo "Skipping remediation, SELinux is disabled"; @@ -230935,6 +231061,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_ldap SELinux Boolean + By default, the SELinux boolean httpd_can_connect_ldap is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_ldap SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_ldap off + - name: Disable the httpd_can_connect_ldap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -230971,23 +231113,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_ldap - - - - - - - - - - Disable the httpd_can_connect_mythtv SELinux Boolean - By default, the SELinux boolean httpd_can_connect_mythtv is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_mythtv SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_mythtv off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -230997,9 +231123,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_mythtv='' + var_httpd_can_connect_ldap='' - setsebool -P httpd_can_connect_mythtv $var_httpd_can_connect_mythtv + setsebool -P httpd_can_connect_ldap $var_httpd_can_connect_ldap else echo "Skipping remediation, SELinux is disabled"; @@ -231010,6 +231136,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_connect_mythtv SELinux Boolean + By default, the SELinux boolean httpd_can_connect_mythtv is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_mythtv SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_mythtv off + - name: Disable the httpd_can_connect_mythtv SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231046,23 +231188,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_mythtv - - - - - - - - - - Disable the httpd_can_connect_zabbix SELinux Boolean - By default, the SELinux boolean httpd_can_connect_zabbix is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_connect_zabbix SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_connect_zabbix off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231072,9 +231198,9 @@ fi if selinuxenabled; then - var_httpd_can_connect_zabbix='' + var_httpd_can_connect_mythtv='' - setsebool -P httpd_can_connect_zabbix $var_httpd_can_connect_zabbix + setsebool -P httpd_can_connect_mythtv $var_httpd_can_connect_mythtv else echo "Skipping remediation, SELinux is disabled"; @@ -231085,18 +231211,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the httpd_can_connect_zabbix SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the httpd_can_connect_zabbix SELinux Boolean + By default, the SELinux boolean httpd_can_connect_zabbix is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_connect_zabbix SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_connect_zabbix off + + - name: Disable the httpd_can_connect_zabbix SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_httpd_can_connect_zabbix - name: XCCDF Value var_httpd_can_connect_zabbix # promote to variable set_fact: @@ -231121,23 +231263,7 @@ fi - no_reboot_needed - sebool_httpd_can_connect_zabbix - - - - - - - - - - Disable the httpd_can_network_connect SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231147,9 +231273,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect='' + var_httpd_can_connect_zabbix='' - setsebool -P httpd_can_network_connect $var_httpd_can_network_connect + setsebool -P httpd_can_connect_zabbix $var_httpd_can_connect_zabbix else echo "Skipping remediation, SELinux is disabled"; @@ -231160,6 +231286,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect off + - name: Disable the httpd_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231196,23 +231338,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect - - - - - - - - - - Disable the httpd_can_network_connect_cobbler SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect_cobbler is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect_cobbler SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect_cobbler off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231222,9 +231348,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect_cobbler='' + var_httpd_can_network_connect='' - setsebool -P httpd_can_network_connect_cobbler $var_httpd_can_network_connect_cobbler + setsebool -P httpd_can_network_connect $var_httpd_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -231235,6 +231361,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect_cobbler SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect_cobbler is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect_cobbler SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect_cobbler off + - name: Disable the httpd_can_network_connect_cobbler SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231271,23 +231413,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect_cobbler - - - - - - - - - - Disable the httpd_can_network_connect_db SELinux Boolean - By default, the SELinux boolean httpd_can_network_connect_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_connect_db SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_connect_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231297,9 +231423,9 @@ fi if selinuxenabled; then - var_httpd_can_network_connect_db='' + var_httpd_can_network_connect_cobbler='' - setsebool -P httpd_can_network_connect_db $var_httpd_can_network_connect_db + setsebool -P httpd_can_network_connect_cobbler $var_httpd_can_network_connect_cobbler else echo "Skipping remediation, SELinux is disabled"; @@ -231310,6 +231436,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_connect_db SELinux Boolean + By default, the SELinux boolean httpd_can_network_connect_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_connect_db SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_connect_db off + - name: Disable the httpd_can_network_connect_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231346,23 +231488,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_connect_db - - - - - - - - - - Disable the httpd_can_network_memcache SELinux Boolean - By default, the SELinux boolean httpd_can_network_memcache is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_memcache SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_memcache off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231372,9 +231498,9 @@ fi if selinuxenabled; then - var_httpd_can_network_memcache='' + var_httpd_can_network_connect_db='' - setsebool -P httpd_can_network_memcache $var_httpd_can_network_memcache + setsebool -P httpd_can_network_connect_db $var_httpd_can_network_connect_db else echo "Skipping remediation, SELinux is disabled"; @@ -231385,6 +231511,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_memcache SELinux Boolean + By default, the SELinux boolean httpd_can_network_memcache is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_memcache SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_memcache off + - name: Disable the httpd_can_network_memcache SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231421,23 +231563,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_memcache - - - - - - - - - - Disable the httpd_can_network_relay SELinux Boolean - By default, the SELinux boolean httpd_can_network_relay is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_network_relay SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_network_relay off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231447,9 +231573,9 @@ fi if selinuxenabled; then - var_httpd_can_network_relay='' + var_httpd_can_network_memcache='' - setsebool -P httpd_can_network_relay $var_httpd_can_network_relay + setsebool -P httpd_can_network_memcache $var_httpd_can_network_memcache else echo "Skipping remediation, SELinux is disabled"; @@ -231460,6 +231586,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_network_relay SELinux Boolean + By default, the SELinux boolean httpd_can_network_relay is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_network_relay SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_network_relay off + - name: Disable the httpd_can_network_relay SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231496,23 +231638,7 @@ fi - no_reboot_needed - sebool_httpd_can_network_relay - - - - - - - - - - Disable the httpd_can_sendmail SELinux Boolean - By default, the SELinux boolean httpd_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P httpd_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231522,9 +231648,9 @@ fi if selinuxenabled; then - var_httpd_can_sendmail='' + var_httpd_can_network_relay='' - setsebool -P httpd_can_sendmail $var_httpd_can_sendmail + setsebool -P httpd_can_network_relay $var_httpd_can_network_relay else echo "Skipping remediation, SELinux is disabled"; @@ -231535,6 +231661,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_can_sendmail SELinux Boolean + By default, the SELinux boolean httpd_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P httpd_can_sendmail off + - name: Disable the httpd_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231571,23 +231713,7 @@ fi - no_reboot_needed - sebool_httpd_can_sendmail - - - - - - - - - - Disable the httpd_dbus_avahi SELinux Boolean - By default, the SELinux boolean httpd_dbus_avahi is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dbus_avahi SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dbus_avahi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231597,9 +231723,9 @@ fi if selinuxenabled; then - var_httpd_dbus_avahi='' + var_httpd_can_sendmail='' - setsebool -P httpd_dbus_avahi $var_httpd_dbus_avahi + setsebool -P httpd_can_sendmail $var_httpd_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -231610,6 +231736,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dbus_avahi SELinux Boolean + By default, the SELinux boolean httpd_dbus_avahi is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dbus_avahi SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dbus_avahi off + - name: Disable the httpd_dbus_avahi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231646,23 +231788,7 @@ fi - no_reboot_needed - sebool_httpd_dbus_avahi - - - - - - - - - - Disable the httpd_dbus_sssd SELinux Boolean - By default, the SELinux boolean httpd_dbus_sssd is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dbus_sssd SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dbus_sssd off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231672,9 +231798,9 @@ fi if selinuxenabled; then - var_httpd_dbus_sssd='' + var_httpd_dbus_avahi='' - setsebool -P httpd_dbus_sssd $var_httpd_dbus_sssd + setsebool -P httpd_dbus_avahi $var_httpd_dbus_avahi else echo "Skipping remediation, SELinux is disabled"; @@ -231685,6 +231811,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dbus_sssd SELinux Boolean + By default, the SELinux boolean httpd_dbus_sssd is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dbus_sssd SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dbus_sssd off + - name: Disable the httpd_dbus_sssd SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -231720,23 +231862,7 @@ fi - no_reboot_needed - sebool_httpd_dbus_sssd - - - - - - - - - - Disable the httpd_dontaudit_search_dirs SELinux Boolean - By default, the SELinux boolean httpd_dontaudit_search_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_dontaudit_search_dirs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_dontaudit_search_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231746,9 +231872,9 @@ fi if selinuxenabled; then - var_httpd_dontaudit_search_dirs='' + var_httpd_dbus_sssd='' - setsebool -P httpd_dontaudit_search_dirs $var_httpd_dontaudit_search_dirs + setsebool -P httpd_dbus_sssd $var_httpd_dbus_sssd else echo "Skipping remediation, SELinux is disabled"; @@ -231759,6 +231885,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_dontaudit_search_dirs SELinux Boolean + By default, the SELinux boolean httpd_dontaudit_search_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_dontaudit_search_dirs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_dontaudit_search_dirs off + - name: Disable the httpd_dontaudit_search_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231795,24 +231937,7 @@ fi - no_reboot_needed - sebool_httpd_dontaudit_search_dirs - - - - - - - - - - Configure the httpd_enable_cgi SELinux Boolean - By default, the SELinux boolean httpd_enable_cgi is enabled. -This setting should be disabled unless httpd is used with CGI -scripting. - -To disable the httpd_enable_cgi SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_cgi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231822,9 +231947,9 @@ fi if selinuxenabled; then - var_httpd_enable_cgi='' + var_httpd_dontaudit_search_dirs='' - setsebool -P httpd_enable_cgi $var_httpd_enable_cgi + setsebool -P httpd_dontaudit_search_dirs $var_httpd_dontaudit_search_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -231835,6 +231960,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the httpd_enable_cgi SELinux Boolean + By default, the SELinux boolean httpd_enable_cgi is enabled. +This setting should be disabled unless httpd is used with CGI +scripting. + +To disable the httpd_enable_cgi SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_cgi off + - name: Configure the httpd_enable_cgi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231871,23 +232013,7 @@ fi - no_reboot_needed - sebool_httpd_enable_cgi - - - - - - - - - - Disable the httpd_enable_ftp_server SELinux Boolean - By default, the SELinux boolean httpd_enable_ftp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_enable_ftp_server SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_ftp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231897,9 +232023,9 @@ fi if selinuxenabled; then - var_httpd_enable_ftp_server='' + var_httpd_enable_cgi='' - setsebool -P httpd_enable_ftp_server $var_httpd_enable_ftp_server + setsebool -P httpd_enable_cgi $var_httpd_enable_cgi else echo "Skipping remediation, SELinux is disabled"; @@ -231910,6 +232036,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_enable_ftp_server SELinux Boolean + By default, the SELinux boolean httpd_enable_ftp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_enable_ftp_server SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_ftp_server off + - name: Disable the httpd_enable_ftp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -231946,23 +232088,7 @@ fi - no_reboot_needed - sebool_httpd_enable_ftp_server - - - - - - - - - - Disable the httpd_enable_homedirs SELinux Boolean - By default, the SELinux boolean httpd_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -231972,9 +232098,9 @@ fi if selinuxenabled; then - var_httpd_enable_homedirs='' + var_httpd_enable_ftp_server='' - setsebool -P httpd_enable_homedirs $var_httpd_enable_homedirs + setsebool -P httpd_enable_ftp_server $var_httpd_enable_ftp_server else echo "Skipping remediation, SELinux is disabled"; @@ -231985,6 +232111,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_enable_homedirs SELinux Boolean + By default, the SELinux boolean httpd_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_enable_homedirs off + - name: Disable the httpd_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232021,25 +232163,7 @@ fi - no_reboot_needed - sebool_httpd_enable_homedirs - - - - - - - - - - Disable the httpd_execmem SELinux Boolean - By default, the SELinux boolean httpd_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_execmem SELinux boolean, run the following command: -$ sudo setsebool -P httpd_execmem off - BP28(R67) - - CCE-83309-5 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232049,9 +232173,9 @@ fi if selinuxenabled; then - var_httpd_execmem='' + var_httpd_enable_homedirs='' - setsebool -P httpd_execmem $var_httpd_execmem + setsebool -P httpd_enable_homedirs $var_httpd_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -232062,6 +232186,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_execmem SELinux Boolean + By default, the SELinux boolean httpd_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_execmem SELinux boolean, run the following command: +$ sudo setsebool -P httpd_execmem off + BP28(R67) + + CCE-83309-5 - name: Disable the httpd_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232099,23 +232241,7 @@ fi - no_reboot_needed - sebool_httpd_execmem - - - - - - - - - - Enable the httpd_graceful_shutdown SELinux Boolean - By default, the SELinux boolean httpd_graceful_shutdown is enabled. -If this setting is disabled, it should be enabled. - -To enable the httpd_graceful_shutdown SELinux boolean, run the following command: -$ sudo setsebool -P httpd_graceful_shutdown on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232125,9 +232251,9 @@ fi if selinuxenabled; then - var_httpd_graceful_shutdown='' + var_httpd_execmem='' - setsebool -P httpd_graceful_shutdown $var_httpd_graceful_shutdown + setsebool -P httpd_execmem $var_httpd_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -232138,6 +232264,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the httpd_graceful_shutdown SELinux Boolean + By default, the SELinux boolean httpd_graceful_shutdown is enabled. +If this setting is disabled, it should be enabled. + +To enable the httpd_graceful_shutdown SELinux boolean, run the following command: +$ sudo setsebool -P httpd_graceful_shutdown on + - name: Enable the httpd_graceful_shutdown SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232174,23 +232316,7 @@ fi - no_reboot_needed - sebool_httpd_graceful_shutdown - - - - - - - - - - Disable the httpd_manage_ipa SELinux Boolean - By default, the SELinux boolean httpd_manage_ipa is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_manage_ipa SELinux boolean, run the following command: -$ sudo setsebool -P httpd_manage_ipa off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232200,9 +232326,9 @@ fi if selinuxenabled; then - var_httpd_manage_ipa='' + var_httpd_graceful_shutdown='' - setsebool -P httpd_manage_ipa $var_httpd_manage_ipa + setsebool -P httpd_graceful_shutdown $var_httpd_graceful_shutdown else echo "Skipping remediation, SELinux is disabled"; @@ -232213,6 +232339,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_manage_ipa SELinux Boolean + By default, the SELinux boolean httpd_manage_ipa is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_manage_ipa SELinux boolean, run the following command: +$ sudo setsebool -P httpd_manage_ipa off + - name: Disable the httpd_manage_ipa SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232249,23 +232391,7 @@ fi - no_reboot_needed - sebool_httpd_manage_ipa - - - - - - - - - - Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - By default, the SELinux boolean httpd_mod_auth_ntlm_winbind is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_mod_auth_ntlm_winbind SELinux boolean, run the following command: -$ sudo setsebool -P httpd_mod_auth_ntlm_winbind off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232275,9 +232401,9 @@ fi if selinuxenabled; then - var_httpd_mod_auth_ntlm_winbind='' + var_httpd_manage_ipa='' - setsebool -P httpd_mod_auth_ntlm_winbind $var_httpd_mod_auth_ntlm_winbind + setsebool -P httpd_manage_ipa $var_httpd_manage_ipa else echo "Skipping remediation, SELinux is disabled"; @@ -232288,6 +232414,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean + By default, the SELinux boolean httpd_mod_auth_ntlm_winbind is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_mod_auth_ntlm_winbind SELinux boolean, run the following command: +$ sudo setsebool -P httpd_mod_auth_ntlm_winbind off + - name: Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232324,23 +232466,7 @@ fi - no_reboot_needed - sebool_httpd_mod_auth_ntlm_winbind - - - - - - - - - - Disable the httpd_mod_auth_pam SELinux Boolean - By default, the SELinux boolean httpd_mod_auth_pam is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_mod_auth_pam SELinux boolean, run the following command: -$ sudo setsebool -P httpd_mod_auth_pam off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232350,9 +232476,9 @@ fi if selinuxenabled; then - var_httpd_mod_auth_pam='' + var_httpd_mod_auth_ntlm_winbind='' - setsebool -P httpd_mod_auth_pam $var_httpd_mod_auth_pam + setsebool -P httpd_mod_auth_ntlm_winbind $var_httpd_mod_auth_ntlm_winbind else echo "Skipping remediation, SELinux is disabled"; @@ -232363,6 +232489,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_mod_auth_pam SELinux Boolean + By default, the SELinux boolean httpd_mod_auth_pam is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_mod_auth_pam SELinux boolean, run the following command: +$ sudo setsebool -P httpd_mod_auth_pam off + - name: Disable the httpd_mod_auth_pam SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232399,23 +232541,7 @@ fi - no_reboot_needed - sebool_httpd_mod_auth_pam - - - - - - - - - - Disable the httpd_read_user_content SELinux Boolean - By default, the SELinux boolean httpd_read_user_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_read_user_content SELinux boolean, run the following command: -$ sudo setsebool -P httpd_read_user_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232425,9 +232551,9 @@ fi if selinuxenabled; then - var_httpd_read_user_content='' + var_httpd_mod_auth_pam='' - setsebool -P httpd_read_user_content $var_httpd_read_user_content + setsebool -P httpd_mod_auth_pam $var_httpd_mod_auth_pam else echo "Skipping remediation, SELinux is disabled"; @@ -232438,6 +232564,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_read_user_content SELinux Boolean + By default, the SELinux boolean httpd_read_user_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_read_user_content SELinux boolean, run the following command: +$ sudo setsebool -P httpd_read_user_content off + - name: Disable the httpd_read_user_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232474,23 +232616,7 @@ fi - no_reboot_needed - sebool_httpd_read_user_content - - - - - - - - - - Disable the httpd_run_ipa SELinux Boolean - By default, the SELinux boolean httpd_run_ipa is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_ipa SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_ipa off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232500,9 +232626,9 @@ fi if selinuxenabled; then - var_httpd_run_ipa='' + var_httpd_read_user_content='' - setsebool -P httpd_run_ipa $var_httpd_run_ipa + setsebool -P httpd_read_user_content $var_httpd_read_user_content else echo "Skipping remediation, SELinux is disabled"; @@ -232513,6 +232639,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_ipa SELinux Boolean + By default, the SELinux boolean httpd_run_ipa is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_ipa SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_ipa off + - name: Disable the httpd_run_ipa SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232548,23 +232690,7 @@ fi - no_reboot_needed - sebool_httpd_run_ipa - - - - - - - - - - Disable the httpd_run_preupgrade SELinux Boolean - By default, the SELinux boolean httpd_run_preupgrade is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_preupgrade SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_preupgrade off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232574,9 +232700,9 @@ fi if selinuxenabled; then - var_httpd_run_preupgrade='' + var_httpd_run_ipa='' - setsebool -P httpd_run_preupgrade $var_httpd_run_preupgrade + setsebool -P httpd_run_ipa $var_httpd_run_ipa else echo "Skipping remediation, SELinux is disabled"; @@ -232587,6 +232713,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_preupgrade SELinux Boolean + By default, the SELinux boolean httpd_run_preupgrade is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_preupgrade SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_preupgrade off + - name: Disable the httpd_run_preupgrade SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232623,23 +232765,7 @@ fi - no_reboot_needed - sebool_httpd_run_preupgrade - - - - - - - - - - Disable the httpd_run_stickshift SELinux Boolean - By default, the SELinux boolean httpd_run_stickshift is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_run_stickshift SELinux boolean, run the following command: -$ sudo setsebool -P httpd_run_stickshift off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232649,9 +232775,9 @@ fi if selinuxenabled; then - var_httpd_run_stickshift='' + var_httpd_run_preupgrade='' - setsebool -P httpd_run_stickshift $var_httpd_run_stickshift + setsebool -P httpd_run_preupgrade $var_httpd_run_preupgrade else echo "Skipping remediation, SELinux is disabled"; @@ -232662,6 +232788,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_run_stickshift SELinux Boolean + By default, the SELinux boolean httpd_run_stickshift is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_run_stickshift SELinux boolean, run the following command: +$ sudo setsebool -P httpd_run_stickshift off + - name: Disable the httpd_run_stickshift SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232698,23 +232840,7 @@ fi - no_reboot_needed - sebool_httpd_run_stickshift - - - - - - - - - - Disable the httpd_serve_cobbler_files SELinux Boolean - By default, the SELinux boolean httpd_serve_cobbler_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_serve_cobbler_files SELinux boolean, run the following command: -$ sudo setsebool -P httpd_serve_cobbler_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232724,9 +232850,9 @@ fi if selinuxenabled; then - var_httpd_serve_cobbler_files='' + var_httpd_run_stickshift='' - setsebool -P httpd_serve_cobbler_files $var_httpd_serve_cobbler_files + setsebool -P httpd_run_stickshift $var_httpd_run_stickshift else echo "Skipping remediation, SELinux is disabled"; @@ -232737,6 +232863,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_serve_cobbler_files SELinux Boolean + By default, the SELinux boolean httpd_serve_cobbler_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_serve_cobbler_files SELinux boolean, run the following command: +$ sudo setsebool -P httpd_serve_cobbler_files off + - name: Disable the httpd_serve_cobbler_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232773,23 +232915,7 @@ fi - no_reboot_needed - sebool_httpd_serve_cobbler_files - - - - - - - - - - Disable the httpd_setrlimit SELinux Boolean - By default, the SELinux boolean httpd_setrlimit is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_setrlimit SELinux boolean, run the following command: -$ sudo setsebool -P httpd_setrlimit off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232799,9 +232925,9 @@ fi if selinuxenabled; then - var_httpd_setrlimit='' + var_httpd_serve_cobbler_files='' - setsebool -P httpd_setrlimit $var_httpd_setrlimit + setsebool -P httpd_serve_cobbler_files $var_httpd_serve_cobbler_files else echo "Skipping remediation, SELinux is disabled"; @@ -232812,6 +232938,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_setrlimit SELinux Boolean + By default, the SELinux boolean httpd_setrlimit is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_setrlimit SELinux boolean, run the following command: +$ sudo setsebool -P httpd_setrlimit off + - name: Disable the httpd_setrlimit SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232847,23 +232989,7 @@ fi - no_reboot_needed - sebool_httpd_setrlimit - - - - - - - - - - Disable the httpd_ssi_exec SELinux Boolean - By default, the SELinux boolean httpd_ssi_exec is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_ssi_exec SELinux boolean, run the following command: -$ sudo setsebool -P httpd_ssi_exec off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232873,9 +232999,9 @@ fi if selinuxenabled; then - var_httpd_ssi_exec='' + var_httpd_setrlimit='' - setsebool -P httpd_ssi_exec $var_httpd_ssi_exec + setsebool -P httpd_setrlimit $var_httpd_setrlimit else echo "Skipping remediation, SELinux is disabled"; @@ -232886,6 +233012,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_ssi_exec SELinux Boolean + By default, the SELinux boolean httpd_ssi_exec is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_ssi_exec SELinux boolean, run the following command: +$ sudo setsebool -P httpd_ssi_exec off + - name: Disable the httpd_ssi_exec SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -232921,23 +233063,7 @@ fi - no_reboot_needed - sebool_httpd_ssi_exec - - - - - - - - - - Disable the httpd_sys_script_anon_write SELinux Boolean - By default, the SELinux boolean httpd_sys_script_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_sys_script_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P httpd_sys_script_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -232947,9 +233073,9 @@ fi if selinuxenabled; then - var_httpd_sys_script_anon_write='' + var_httpd_ssi_exec='' - setsebool -P httpd_sys_script_anon_write $var_httpd_sys_script_anon_write + setsebool -P httpd_ssi_exec $var_httpd_ssi_exec else echo "Skipping remediation, SELinux is disabled"; @@ -232960,6 +233086,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_sys_script_anon_write SELinux Boolean + By default, the SELinux boolean httpd_sys_script_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_sys_script_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P httpd_sys_script_anon_write off + - name: Disable the httpd_sys_script_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -232996,23 +233138,7 @@ fi - no_reboot_needed - sebool_httpd_sys_script_anon_write - - - - - - - - - - Disable the httpd_tmp_exec SELinux Boolean - By default, the SELinux boolean httpd_tmp_exec is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_tmp_exec SELinux boolean, run the following command: -$ sudo setsebool -P httpd_tmp_exec off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233022,9 +233148,9 @@ fi if selinuxenabled; then - var_httpd_tmp_exec='' + var_httpd_sys_script_anon_write='' - setsebool -P httpd_tmp_exec $var_httpd_tmp_exec + setsebool -P httpd_sys_script_anon_write $var_httpd_sys_script_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -233035,6 +233161,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_tmp_exec SELinux Boolean + By default, the SELinux boolean httpd_tmp_exec is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_tmp_exec SELinux boolean, run the following command: +$ sudo setsebool -P httpd_tmp_exec off + - name: Disable the httpd_tmp_exec SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233070,23 +233212,7 @@ fi - no_reboot_needed - sebool_httpd_tmp_exec - - - - - - - - - - Disable the httpd_tty_comm SELinux Boolean - By default, the SELinux boolean httpd_tty_comm is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_tty_comm SELinux boolean, run the following command: -$ sudo setsebool -P httpd_tty_comm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233096,9 +233222,9 @@ fi if selinuxenabled; then - var_httpd_tty_comm='' + var_httpd_tmp_exec='' - setsebool -P httpd_tty_comm $var_httpd_tty_comm + setsebool -P httpd_tmp_exec $var_httpd_tmp_exec else echo "Skipping remediation, SELinux is disabled"; @@ -233109,6 +233235,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_tty_comm SELinux Boolean + By default, the SELinux boolean httpd_tty_comm is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_tty_comm SELinux boolean, run the following command: +$ sudo setsebool -P httpd_tty_comm off + - name: Disable the httpd_tty_comm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233144,23 +233286,7 @@ fi - no_reboot_needed - sebool_httpd_tty_comm - - - - - - - - - - Disable the httpd_unified SELinux Boolean - By default, the SELinux boolean httpd_unified is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_unified SELinux boolean, run the following command: -$ sudo setsebool -P httpd_unified off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233170,9 +233296,9 @@ fi if selinuxenabled; then - var_httpd_unified='' + var_httpd_tty_comm='' - setsebool -P httpd_unified $var_httpd_unified + setsebool -P httpd_tty_comm $var_httpd_tty_comm else echo "Skipping remediation, SELinux is disabled"; @@ -233183,6 +233309,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_unified SELinux Boolean + By default, the SELinux boolean httpd_unified is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_unified SELinux boolean, run the following command: +$ sudo setsebool -P httpd_unified off + - name: Disable the httpd_unified SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233218,23 +233360,7 @@ fi - no_reboot_needed - sebool_httpd_unified - - - - - - - - - - Disable the httpd_use_cifs SELinux Boolean - By default, the SELinux boolean httpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233244,9 +233370,9 @@ fi if selinuxenabled; then - var_httpd_use_cifs='' + var_httpd_unified='' - setsebool -P httpd_use_cifs $var_httpd_use_cifs + setsebool -P httpd_unified $var_httpd_unified else echo "Skipping remediation, SELinux is disabled"; @@ -233257,6 +233383,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_cifs SELinux Boolean + By default, the SELinux boolean httpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_cifs off + - name: Disable the httpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233292,23 +233434,7 @@ fi - no_reboot_needed - sebool_httpd_use_cifs - - - - - - - - - - Disable the httpd_use_fusefs SELinux Boolean - By default, the SELinux boolean httpd_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233318,9 +233444,9 @@ fi if selinuxenabled; then - var_httpd_use_fusefs='' + var_httpd_use_cifs='' - setsebool -P httpd_use_fusefs $var_httpd_use_fusefs + setsebool -P httpd_use_cifs $var_httpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -233331,6 +233457,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_fusefs SELinux Boolean + By default, the SELinux boolean httpd_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_fusefs off + - name: Disable the httpd_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233367,23 +233509,7 @@ fi - no_reboot_needed - sebool_httpd_use_fusefs - - - - - - - - - - Disable the httpd_use_gpg SELinux Boolean - By default, the SELinux boolean httpd_use_gpg is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_gpg SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_gpg off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233393,9 +233519,9 @@ fi if selinuxenabled; then - var_httpd_use_gpg='' + var_httpd_use_fusefs='' - setsebool -P httpd_use_gpg $var_httpd_use_gpg + setsebool -P httpd_use_fusefs $var_httpd_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -233406,6 +233532,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_gpg SELinux Boolean + By default, the SELinux boolean httpd_use_gpg is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_gpg SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_gpg off + - name: Disable the httpd_use_gpg SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233441,23 +233583,7 @@ fi - no_reboot_needed - sebool_httpd_use_gpg - - - - - - - - - - Disable the httpd_use_nfs SELinux Boolean - By default, the SELinux boolean httpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233467,9 +233593,9 @@ fi if selinuxenabled; then - var_httpd_use_nfs='' + var_httpd_use_gpg='' - setsebool -P httpd_use_nfs $var_httpd_use_nfs + setsebool -P httpd_use_gpg $var_httpd_use_gpg else echo "Skipping remediation, SELinux is disabled"; @@ -233480,6 +233606,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_nfs SELinux Boolean + By default, the SELinux boolean httpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_nfs off + - name: Disable the httpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233515,23 +233657,7 @@ fi - no_reboot_needed - sebool_httpd_use_nfs - - - - - - - - - - Disable the httpd_use_openstack SELinux Boolean - By default, the SELinux boolean httpd_use_openstack is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_openstack SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_openstack off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233541,9 +233667,9 @@ fi if selinuxenabled; then - var_httpd_use_openstack='' + var_httpd_use_nfs='' - setsebool -P httpd_use_openstack $var_httpd_use_openstack + setsebool -P httpd_use_nfs $var_httpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -233554,6 +233680,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_openstack SELinux Boolean + By default, the SELinux boolean httpd_use_openstack is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_openstack SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_openstack off + - name: Disable the httpd_use_openstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233590,23 +233732,7 @@ fi - no_reboot_needed - sebool_httpd_use_openstack - - - - - - - - - - Disable the httpd_use_sasl SELinux Boolean - By default, the SELinux boolean httpd_use_sasl is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_use_sasl SELinux boolean, run the following command: -$ sudo setsebool -P httpd_use_sasl off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233616,9 +233742,9 @@ fi if selinuxenabled; then - var_httpd_use_sasl='' + var_httpd_use_openstack='' - setsebool -P httpd_use_sasl $var_httpd_use_sasl + setsebool -P httpd_use_openstack $var_httpd_use_openstack else echo "Skipping remediation, SELinux is disabled"; @@ -233629,6 +233755,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_use_sasl SELinux Boolean + By default, the SELinux boolean httpd_use_sasl is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_use_sasl SELinux boolean, run the following command: +$ sudo setsebool -P httpd_use_sasl off + - name: Disable the httpd_use_sasl SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -233664,23 +233806,7 @@ fi - no_reboot_needed - sebool_httpd_use_sasl - - - - - - - - - - Disable the httpd_verify_dns SELinux Boolean - By default, the SELinux boolean httpd_verify_dns is disabled. -If this setting is enabled, it should be disabled. - -To disable the httpd_verify_dns SELinux boolean, run the following command: -$ sudo setsebool -P httpd_verify_dns off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233690,9 +233816,9 @@ fi if selinuxenabled; then - var_httpd_verify_dns='' + var_httpd_use_sasl='' - setsebool -P httpd_verify_dns $var_httpd_verify_dns + setsebool -P httpd_use_sasl $var_httpd_use_sasl else echo "Skipping remediation, SELinux is disabled"; @@ -233703,6 +233829,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the httpd_verify_dns SELinux Boolean + By default, the SELinux boolean httpd_verify_dns is disabled. +If this setting is enabled, it should be disabled. + +To disable the httpd_verify_dns SELinux boolean, run the following command: +$ sudo setsebool -P httpd_verify_dns off + - name: Disable the httpd_verify_dns SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233739,23 +233881,7 @@ fi - no_reboot_needed - sebool_httpd_verify_dns - - - - - - - - - - Disable the icecast_use_any_tcp_ports SELinux Boolean - By default, the SELinux boolean icecast_use_any_tcp_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the icecast_use_any_tcp_ports SELinux boolean, run the following command: -$ sudo setsebool -P icecast_use_any_tcp_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233765,9 +233891,9 @@ fi if selinuxenabled; then - var_icecast_use_any_tcp_ports='' + var_httpd_verify_dns='' - setsebool -P icecast_use_any_tcp_ports $var_icecast_use_any_tcp_ports + setsebool -P httpd_verify_dns $var_httpd_verify_dns else echo "Skipping remediation, SELinux is disabled"; @@ -233778,6 +233904,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the icecast_use_any_tcp_ports SELinux Boolean + By default, the SELinux boolean icecast_use_any_tcp_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the icecast_use_any_tcp_ports SELinux boolean, run the following command: +$ sudo setsebool -P icecast_use_any_tcp_ports off + - name: Disable the icecast_use_any_tcp_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233814,23 +233956,7 @@ fi - no_reboot_needed - sebool_icecast_use_any_tcp_ports - - - - - - - - - - Disable the irc_use_any_tcp_ports SELinux Boolean - By default, the SELinux boolean irc_use_any_tcp_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the irc_use_any_tcp_ports SELinux boolean, run the following command: -$ sudo setsebool -P irc_use_any_tcp_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233840,9 +233966,9 @@ fi if selinuxenabled; then - var_irc_use_any_tcp_ports='' + var_icecast_use_any_tcp_ports='' - setsebool -P irc_use_any_tcp_ports $var_irc_use_any_tcp_ports + setsebool -P icecast_use_any_tcp_ports $var_icecast_use_any_tcp_ports else echo "Skipping remediation, SELinux is disabled"; @@ -233853,6 +233979,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the irc_use_any_tcp_ports SELinux Boolean + By default, the SELinux boolean irc_use_any_tcp_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the irc_use_any_tcp_ports SELinux boolean, run the following command: +$ sudo setsebool -P irc_use_any_tcp_ports off + - name: Disable the irc_use_any_tcp_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233889,23 +234031,7 @@ fi - no_reboot_needed - sebool_irc_use_any_tcp_ports - - - - - - - - - - Disable the irssi_use_full_network SELinux Boolean - By default, the SELinux boolean irssi_use_full_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the irssi_use_full_network SELinux boolean, run the following command: -$ sudo setsebool -P irssi_use_full_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233915,9 +234041,9 @@ fi if selinuxenabled; then - var_irssi_use_full_network='' + var_irc_use_any_tcp_ports='' - setsebool -P irssi_use_full_network $var_irssi_use_full_network + setsebool -P irc_use_any_tcp_ports $var_irc_use_any_tcp_ports else echo "Skipping remediation, SELinux is disabled"; @@ -233928,6 +234054,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the irssi_use_full_network SELinux Boolean + By default, the SELinux boolean irssi_use_full_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the irssi_use_full_network SELinux boolean, run the following command: +$ sudo setsebool -P irssi_use_full_network off + - name: Disable the irssi_use_full_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -233964,23 +234106,7 @@ fi - no_reboot_needed - sebool_irssi_use_full_network - - - - - - - - - - Disable the kdumpgui_run_bootloader SELinux Boolean - By default, the SELinux boolean kdumpgui_run_bootloader is disabled. -If this setting is enabled, it should be disabled. - -To disable the kdumpgui_run_bootloader SELinux boolean, run the following command: -$ sudo setsebool -P kdumpgui_run_bootloader off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -233990,9 +234116,9 @@ fi if selinuxenabled; then - var_kdumpgui_run_bootloader='' + var_irssi_use_full_network='' - setsebool -P kdumpgui_run_bootloader $var_kdumpgui_run_bootloader + setsebool -P irssi_use_full_network $var_irssi_use_full_network else echo "Skipping remediation, SELinux is disabled"; @@ -234003,6 +234129,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the kdumpgui_run_bootloader SELinux Boolean + By default, the SELinux boolean kdumpgui_run_bootloader is disabled. +If this setting is enabled, it should be disabled. + +To disable the kdumpgui_run_bootloader SELinux boolean, run the following command: +$ sudo setsebool -P kdumpgui_run_bootloader off + - name: Disable the kdumpgui_run_bootloader SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234038,6 +234180,29 @@ fi - medium_severity - no_reboot_needed - sebool_kdumpgui_run_bootloader + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_kdumpgui_run_bootloader='' + + setsebool -P kdumpgui_run_bootloader $var_kdumpgui_run_bootloader + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -234060,29 +234225,6 @@ To enable the kerberos_enabled SELinux boolean, run the f 1402 CCE-84293-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_kerberos_enabled='' - - setsebool -P kerberos_enabled $var_kerberos_enabled - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the kerberos_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -234120,23 +234262,7 @@ fi - no_reboot_needed - sebool_kerberos_enabled - - - - - - - - - - Disable the ksmtuned_use_cifs SELinux Boolean - By default, the SELinux boolean ksmtuned_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ksmtuned_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P ksmtuned_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234146,9 +234272,9 @@ fi if selinuxenabled; then - var_ksmtuned_use_cifs='' + var_kerberos_enabled='' - setsebool -P ksmtuned_use_cifs $var_ksmtuned_use_cifs + setsebool -P kerberos_enabled $var_kerberos_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -234159,6 +234285,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ksmtuned_use_cifs SELinux Boolean + By default, the SELinux boolean ksmtuned_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ksmtuned_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P ksmtuned_use_cifs off + - name: Disable the ksmtuned_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234195,23 +234337,7 @@ fi - no_reboot_needed - sebool_ksmtuned_use_cifs - - - - - - - - - - Disable the ksmtuned_use_nfs SELinux Boolean - By default, the SELinux boolean ksmtuned_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ksmtuned_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P ksmtuned_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234221,9 +234347,9 @@ fi if selinuxenabled; then - var_ksmtuned_use_nfs='' + var_ksmtuned_use_cifs='' - setsebool -P ksmtuned_use_nfs $var_ksmtuned_use_nfs + setsebool -P ksmtuned_use_cifs $var_ksmtuned_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -234234,6 +234360,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ksmtuned_use_nfs SELinux Boolean + By default, the SELinux boolean ksmtuned_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ksmtuned_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P ksmtuned_use_nfs off + - name: Disable the ksmtuned_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234270,23 +234412,7 @@ fi - no_reboot_needed - sebool_ksmtuned_use_nfs - - - - - - - - - - Enable the logadm_exec_content SELinux Boolean - By default, the SELinux boolean logadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the logadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P logadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234296,9 +234422,9 @@ fi if selinuxenabled; then - var_logadm_exec_content='' + var_ksmtuned_use_nfs='' - setsebool -P logadm_exec_content $var_logadm_exec_content + setsebool -P ksmtuned_use_nfs $var_ksmtuned_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -234309,6 +234435,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the logadm_exec_content SELinux Boolean + By default, the SELinux boolean logadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the logadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P logadm_exec_content on + - name: Enable the logadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234345,23 +234487,7 @@ fi - no_reboot_needed - sebool_logadm_exec_content - - - - - - - - - - Disable the logging_syslogd_can_sendmail SELinux Boolean - By default, the SELinux boolean logging_syslogd_can_sendmail is disabled. -If this setting is enabled, it should be disabled. - -To disable the logging_syslogd_can_sendmail SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_can_sendmail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234371,9 +234497,9 @@ fi if selinuxenabled; then - var_logging_syslogd_can_sendmail='' + var_logadm_exec_content='' - setsebool -P logging_syslogd_can_sendmail $var_logging_syslogd_can_sendmail + setsebool -P logadm_exec_content $var_logadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -234384,6 +234510,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logging_syslogd_can_sendmail SELinux Boolean + By default, the SELinux boolean logging_syslogd_can_sendmail is disabled. +If this setting is enabled, it should be disabled. + +To disable the logging_syslogd_can_sendmail SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_can_sendmail off + - name: Disable the logging_syslogd_can_sendmail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234420,23 +234562,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_can_sendmail - - - - - - - - - - Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - By default, the SELinux boolean logging_syslogd_run_nagios_plugins is disabled. -If this setting is enabled, it should be disabled. - -To disable the logging_syslogd_run_nagios_plugins SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_run_nagios_plugins off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234446,9 +234572,9 @@ fi if selinuxenabled; then - var_logging_syslogd_run_nagios_plugins='' + var_logging_syslogd_can_sendmail='' - setsebool -P logging_syslogd_run_nagios_plugins $var_logging_syslogd_run_nagios_plugins + setsebool -P logging_syslogd_can_sendmail $var_logging_syslogd_can_sendmail else echo "Skipping remediation, SELinux is disabled"; @@ -234459,6 +234585,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logging_syslogd_run_nagios_plugins SELinux Boolean + By default, the SELinux boolean logging_syslogd_run_nagios_plugins is disabled. +If this setting is enabled, it should be disabled. + +To disable the logging_syslogd_run_nagios_plugins SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_run_nagios_plugins off + - name: Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234495,24 +234637,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_run_nagios_plugins - - - - - - - - - - Enable the logging_syslogd_use_tty SELinux Boolean - By default, the SELinux boolean logging_syslogd_use_tty is enabled. -If this setting is disabled, it should be enabled as it allows syslog -the ability to read/write to terminal. - -To enable the logging_syslogd_use_tty SELinux boolean, run the following command: -$ sudo setsebool -P logging_syslogd_use_tty on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234522,9 +234647,9 @@ fi if selinuxenabled; then - var_logging_syslogd_use_tty='' + var_logging_syslogd_run_nagios_plugins='' - setsebool -P logging_syslogd_use_tty $var_logging_syslogd_use_tty + setsebool -P logging_syslogd_run_nagios_plugins $var_logging_syslogd_run_nagios_plugins else echo "Skipping remediation, SELinux is disabled"; @@ -234535,6 +234660,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the logging_syslogd_use_tty SELinux Boolean + By default, the SELinux boolean logging_syslogd_use_tty is enabled. +If this setting is disabled, it should be enabled as it allows syslog +the ability to read/write to terminal. + +To enable the logging_syslogd_use_tty SELinux boolean, run the following command: +$ sudo setsebool -P logging_syslogd_use_tty on + - name: Enable the logging_syslogd_use_tty SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234571,24 +234713,7 @@ fi - no_reboot_needed - sebool_logging_syslogd_use_tty - - - - - - - - - - Enable the login_console_enabled SELinux Boolean - By default, the SELinux boolean login_console_enabled is enabled. -If this setting is disabled, it should be enabled as it allows login from -/dev/console to a console session. - -To enable the login_console_enabled SELinux boolean, run the following command: -$ sudo setsebool -P login_console_enabled on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234598,9 +234723,9 @@ fi if selinuxenabled; then - var_login_console_enabled='' + var_logging_syslogd_use_tty='' - setsebool -P login_console_enabled $var_login_console_enabled + setsebool -P logging_syslogd_use_tty $var_logging_syslogd_use_tty else echo "Skipping remediation, SELinux is disabled"; @@ -234611,6 +234736,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the login_console_enabled SELinux Boolean + By default, the SELinux boolean login_console_enabled is enabled. +If this setting is disabled, it should be enabled as it allows login from +/dev/console to a console session. + +To enable the login_console_enabled SELinux boolean, run the following command: +$ sudo setsebool -P login_console_enabled on + - name: Enable the login_console_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234647,23 +234789,7 @@ fi - no_reboot_needed - sebool_login_console_enabled - - - - - - - - - - Disable the logrotate_use_nfs SELinux Boolean - By default, the SELinux boolean logrotate_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the logrotate_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P logrotate_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234673,9 +234799,9 @@ fi if selinuxenabled; then - var_logrotate_use_nfs='' + var_login_console_enabled='' - setsebool -P logrotate_use_nfs $var_logrotate_use_nfs + setsebool -P login_console_enabled $var_login_console_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -234686,6 +234812,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logrotate_use_nfs SELinux Boolean + By default, the SELinux boolean logrotate_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the logrotate_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P logrotate_use_nfs off + - name: Disable the logrotate_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234722,23 +234864,7 @@ fi - no_reboot_needed - sebool_logrotate_use_nfs - - - - - - - - - - Disable the logwatch_can_network_connect_mail SELinux Boolean - By default, the SELinux boolean logwatch_can_network_connect_mail is disabled. -If this setting is enabled, it should be disabled. - -To disable the logwatch_can_network_connect_mail SELinux boolean, run the following command: -$ sudo setsebool -P logwatch_can_network_connect_mail off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234748,9 +234874,9 @@ fi if selinuxenabled; then - var_logwatch_can_network_connect_mail='' + var_logrotate_use_nfs='' - setsebool -P logwatch_can_network_connect_mail $var_logwatch_can_network_connect_mail + setsebool -P logrotate_use_nfs $var_logrotate_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -234761,6 +234887,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the logwatch_can_network_connect_mail SELinux Boolean + By default, the SELinux boolean logwatch_can_network_connect_mail is disabled. +If this setting is enabled, it should be disabled. + +To disable the logwatch_can_network_connect_mail SELinux boolean, run the following command: +$ sudo setsebool -P logwatch_can_network_connect_mail off + - name: Disable the logwatch_can_network_connect_mail SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234797,23 +234939,7 @@ fi - no_reboot_needed - sebool_logwatch_can_network_connect_mail - - - - - - - - - - Disable the lsmd_plugin_connect_any SELinux Boolean - By default, the SELinux boolean lsmd_plugin_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the lsmd_plugin_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P lsmd_plugin_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234823,9 +234949,9 @@ fi if selinuxenabled; then - var_lsmd_plugin_connect_any='' + var_logwatch_can_network_connect_mail='' - setsebool -P lsmd_plugin_connect_any $var_lsmd_plugin_connect_any + setsebool -P logwatch_can_network_connect_mail $var_logwatch_can_network_connect_mail else echo "Skipping remediation, SELinux is disabled"; @@ -234836,6 +234962,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the lsmd_plugin_connect_any SELinux Boolean + By default, the SELinux boolean lsmd_plugin_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the lsmd_plugin_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P lsmd_plugin_connect_any off + - name: Disable the lsmd_plugin_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234872,23 +235014,7 @@ fi - no_reboot_needed - sebool_lsmd_plugin_connect_any - - - - - - - - - - Disable the mailman_use_fusefs SELinux Boolean - By default, the SELinux boolean mailman_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mailman_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P mailman_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234898,9 +235024,9 @@ fi if selinuxenabled; then - var_mailman_use_fusefs='' + var_lsmd_plugin_connect_any='' - setsebool -P mailman_use_fusefs $var_mailman_use_fusefs + setsebool -P lsmd_plugin_connect_any $var_lsmd_plugin_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -234911,6 +235037,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mailman_use_fusefs SELinux Boolean + By default, the SELinux boolean mailman_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mailman_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P mailman_use_fusefs off + - name: Disable the mailman_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -234947,23 +235089,7 @@ fi - no_reboot_needed - sebool_mailman_use_fusefs - - - - - - - - - - Disable the mcelog_client SELinux Boolean - By default, the SELinux boolean mcelog_client is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_client SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_client off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -234973,9 +235099,9 @@ fi if selinuxenabled; then - var_mcelog_client='' + var_mailman_use_fusefs='' - setsebool -P mcelog_client $var_mcelog_client + setsebool -P mailman_use_fusefs $var_mailman_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -234986,6 +235112,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_client SELinux Boolean + By default, the SELinux boolean mcelog_client is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_client SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_client off + - name: Disable the mcelog_client SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235021,23 +235163,7 @@ fi - no_reboot_needed - sebool_mcelog_client - - - - - - - - - - Enable the mcelog_exec_scripts SELinux Boolean - By default, the SELinux boolean mcelog_exec_scripts is enabled. -If this setting is disabled, it should be enabled. - -To enable the mcelog_exec_scripts SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_exec_scripts on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235047,9 +235173,9 @@ fi if selinuxenabled; then - var_mcelog_exec_scripts='' + var_mcelog_client='' - setsebool -P mcelog_exec_scripts $var_mcelog_exec_scripts + setsebool -P mcelog_client $var_mcelog_client else echo "Skipping remediation, SELinux is disabled"; @@ -235060,10 +235186,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Enable the mcelog_exec_scripts SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage + + + + + + + + + + Enable the mcelog_exec_scripts SELinux Boolean + By default, the SELinux boolean mcelog_exec_scripts is enabled. +If this setting is disabled, it should be enabled. + +To enable the mcelog_exec_scripts SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_exec_scripts on + + - name: Enable the mcelog_exec_scripts SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: @@ -235096,23 +235238,7 @@ fi - no_reboot_needed - sebool_mcelog_exec_scripts - - - - - - - - - - Disable the mcelog_foreground SELinux Boolean - By default, the SELinux boolean mcelog_foreground is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_foreground SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_foreground off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235122,9 +235248,9 @@ fi if selinuxenabled; then - var_mcelog_foreground='' + var_mcelog_exec_scripts='' - setsebool -P mcelog_foreground $var_mcelog_foreground + setsebool -P mcelog_exec_scripts $var_mcelog_exec_scripts else echo "Skipping remediation, SELinux is disabled"; @@ -235135,6 +235261,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_foreground SELinux Boolean + By default, the SELinux boolean mcelog_foreground is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_foreground SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_foreground off + - name: Disable the mcelog_foreground SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235171,23 +235313,7 @@ fi - no_reboot_needed - sebool_mcelog_foreground - - - - - - - - - - Disable the mcelog_server SELinux Boolean - By default, the SELinux boolean mcelog_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the mcelog_server SELinux boolean, run the following command: -$ sudo setsebool -P mcelog_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235197,9 +235323,9 @@ fi if selinuxenabled; then - var_mcelog_server='' + var_mcelog_foreground='' - setsebool -P mcelog_server $var_mcelog_server + setsebool -P mcelog_foreground $var_mcelog_foreground else echo "Skipping remediation, SELinux is disabled"; @@ -235210,6 +235336,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mcelog_server SELinux Boolean + By default, the SELinux boolean mcelog_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the mcelog_server SELinux boolean, run the following command: +$ sudo setsebool -P mcelog_server off + - name: Disable the mcelog_server SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235245,23 +235387,7 @@ fi - no_reboot_needed - sebool_mcelog_server - - - - - - - - - - Disable the minidlna_read_generic_user_content SELinux Boolean - By default, the SELinux boolean minidlna_read_generic_user_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the minidlna_read_generic_user_content SELinux boolean, run the following command: -$ sudo setsebool -P minidlna_read_generic_user_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235271,9 +235397,9 @@ fi if selinuxenabled; then - var_minidlna_read_generic_user_content='' + var_mcelog_server='' - setsebool -P minidlna_read_generic_user_content $var_minidlna_read_generic_user_content + setsebool -P mcelog_server $var_mcelog_server else echo "Skipping remediation, SELinux is disabled"; @@ -235284,6 +235410,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the minidlna_read_generic_user_content SELinux Boolean + By default, the SELinux boolean minidlna_read_generic_user_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the minidlna_read_generic_user_content SELinux boolean, run the following command: +$ sudo setsebool -P minidlna_read_generic_user_content off + - name: Disable the minidlna_read_generic_user_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235320,23 +235462,7 @@ fi - no_reboot_needed - sebool_minidlna_read_generic_user_content - - - - - - - - - - Disable the mmap_low_allowed SELinux Boolean - By default, the SELinux boolean mmap_low_allowed is disabled. -If this setting is enabled, it should be disabled. - -To disable the mmap_low_allowed SELinux boolean, run the following command: -$ sudo setsebool -P mmap_low_allowed off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235346,9 +235472,9 @@ fi if selinuxenabled; then - var_mmap_low_allowed='' + var_minidlna_read_generic_user_content='' - setsebool -P mmap_low_allowed $var_mmap_low_allowed + setsebool -P minidlna_read_generic_user_content $var_minidlna_read_generic_user_content else echo "Skipping remediation, SELinux is disabled"; @@ -235359,6 +235485,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mmap_low_allowed SELinux Boolean + By default, the SELinux boolean mmap_low_allowed is disabled. +If this setting is enabled, it should be disabled. + +To disable the mmap_low_allowed SELinux boolean, run the following command: +$ sudo setsebool -P mmap_low_allowed off + - name: Disable the mmap_low_allowed SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235395,23 +235537,7 @@ fi - no_reboot_needed - sebool_mmap_low_allowed - - - - - - - - - - Disable the mock_enable_homedirs SELinux Boolean - By default, the SELinux boolean mock_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mock_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P mock_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235421,9 +235547,9 @@ fi if selinuxenabled; then - var_mock_enable_homedirs='' + var_mmap_low_allowed='' - setsebool -P mock_enable_homedirs $var_mock_enable_homedirs + setsebool -P mmap_low_allowed $var_mmap_low_allowed else echo "Skipping remediation, SELinux is disabled"; @@ -235434,6 +235560,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mock_enable_homedirs SELinux Boolean + By default, the SELinux boolean mock_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mock_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P mock_enable_homedirs off + - name: Disable the mock_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235470,24 +235612,7 @@ fi - no_reboot_needed - sebool_mock_enable_homedirs - - - - - - - - - - Enable the mount_anyfile SELinux Boolean - By default, the SELinux boolean mount_anyfile is enabled. -If this setting is disabled, it should be enabled to allow any file -or directory to be mounted. - -To enable the mount_anyfile SELinux boolean, run the following command: -$ sudo setsebool -P mount_anyfile on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235497,9 +235622,9 @@ fi if selinuxenabled; then - var_mount_anyfile='' + var_mock_enable_homedirs='' - setsebool -P mount_anyfile $var_mount_anyfile + setsebool -P mock_enable_homedirs $var_mock_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -235510,6 +235635,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the mount_anyfile SELinux Boolean + By default, the SELinux boolean mount_anyfile is enabled. +If this setting is disabled, it should be enabled to allow any file +or directory to be mounted. + +To enable the mount_anyfile SELinux boolean, run the following command: +$ sudo setsebool -P mount_anyfile on + - name: Enable the mount_anyfile SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -235545,23 +235687,7 @@ fi - no_reboot_needed - sebool_mount_anyfile - - - - - - - - - - Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - By default, the SELinux boolean mozilla_plugin_bind_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_bind_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_bind_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235571,9 +235697,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_bind_unreserved_ports='' + var_mount_anyfile='' - setsebool -P mozilla_plugin_bind_unreserved_ports $var_mozilla_plugin_bind_unreserved_ports + setsebool -P mount_anyfile $var_mount_anyfile else echo "Skipping remediation, SELinux is disabled"; @@ -235584,6 +235710,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean + By default, the SELinux boolean mozilla_plugin_bind_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_bind_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_bind_unreserved_ports off + - name: Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235620,23 +235762,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_bind_unreserved_ports - - - - - - - - - - Disable the mozilla_plugin_can_network_connect SELinux Boolean - By default, the SELinux boolean mozilla_plugin_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235646,9 +235772,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_can_network_connect='' + var_mozilla_plugin_bind_unreserved_ports='' - setsebool -P mozilla_plugin_can_network_connect $var_mozilla_plugin_can_network_connect + setsebool -P mozilla_plugin_bind_unreserved_ports $var_mozilla_plugin_bind_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -235659,6 +235785,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_can_network_connect SELinux Boolean + By default, the SELinux boolean mozilla_plugin_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_can_network_connect off + - name: Disable the mozilla_plugin_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235695,23 +235837,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_can_network_connect - - - - - - - - - - Disable the mozilla_plugin_use_bluejeans SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_bluejeans is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_bluejeans SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_bluejeans off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235721,9 +235847,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_bluejeans='' + var_mozilla_plugin_can_network_connect='' - setsebool -P mozilla_plugin_use_bluejeans $var_mozilla_plugin_use_bluejeans + setsebool -P mozilla_plugin_can_network_connect $var_mozilla_plugin_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -235734,6 +235860,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_bluejeans SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_bluejeans is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_bluejeans SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_bluejeans off + - name: Disable the mozilla_plugin_use_bluejeans SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235770,23 +235912,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_bluejeans - - - - - - - - - - Disable the mozilla_plugin_use_gps SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_gps is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_gps SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_gps off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235796,9 +235922,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_gps='' + var_mozilla_plugin_use_bluejeans='' - setsebool -P mozilla_plugin_use_gps $var_mozilla_plugin_use_gps + setsebool -P mozilla_plugin_use_bluejeans $var_mozilla_plugin_use_bluejeans else echo "Skipping remediation, SELinux is disabled"; @@ -235809,6 +235935,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_gps SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_gps is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_gps SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_gps off + - name: Disable the mozilla_plugin_use_gps SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235845,23 +235987,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_gps - - - - - - - - - - Disable the mozilla_plugin_use_spice SELinux Boolean - By default, the SELinux boolean mozilla_plugin_use_spice is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_plugin_use_spice SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_plugin_use_spice off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235871,9 +235997,9 @@ fi if selinuxenabled; then - var_mozilla_plugin_use_spice='' + var_mozilla_plugin_use_gps='' - setsebool -P mozilla_plugin_use_spice $var_mozilla_plugin_use_spice + setsebool -P mozilla_plugin_use_gps $var_mozilla_plugin_use_gps else echo "Skipping remediation, SELinux is disabled"; @@ -235884,6 +236010,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_plugin_use_spice SELinux Boolean + By default, the SELinux boolean mozilla_plugin_use_spice is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_plugin_use_spice SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_plugin_use_spice off + - name: Disable the mozilla_plugin_use_spice SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235920,23 +236062,7 @@ fi - no_reboot_needed - sebool_mozilla_plugin_use_spice - - - - - - - - - - Disable the mozilla_read_content SELinux Boolean - By default, the SELinux boolean mozilla_read_content is disabled. -If this setting is enabled, it should be disabled. - -To disable the mozilla_read_content SELinux boolean, run the following command: -$ sudo setsebool -P mozilla_read_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -235946,9 +236072,9 @@ fi if selinuxenabled; then - var_mozilla_read_content='' + var_mozilla_plugin_use_spice='' - setsebool -P mozilla_read_content $var_mozilla_read_content + setsebool -P mozilla_plugin_use_spice $var_mozilla_plugin_use_spice else echo "Skipping remediation, SELinux is disabled"; @@ -235959,6 +236085,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mozilla_read_content SELinux Boolean + By default, the SELinux boolean mozilla_read_content is disabled. +If this setting is enabled, it should be disabled. + +To disable the mozilla_read_content SELinux boolean, run the following command: +$ sudo setsebool -P mozilla_read_content off + - name: Disable the mozilla_read_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -235995,23 +236137,7 @@ fi - no_reboot_needed - sebool_mozilla_read_content - - - - - - - - - - Disable the mpd_enable_homedirs SELinux Boolean - By default, the SELinux boolean mpd_enable_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236021,9 +236147,9 @@ fi if selinuxenabled; then - var_mpd_enable_homedirs='' + var_mozilla_read_content='' - setsebool -P mpd_enable_homedirs $var_mpd_enable_homedirs + setsebool -P mozilla_read_content $var_mozilla_read_content else echo "Skipping remediation, SELinux is disabled"; @@ -236034,6 +236160,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_enable_homedirs SELinux Boolean + By default, the SELinux boolean mpd_enable_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_enable_homedirs off + - name: Disable the mpd_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236070,23 +236212,7 @@ fi - no_reboot_needed - sebool_mpd_enable_homedirs - - - - - - - - - - Disable the mpd_use_cifs SELinux Boolean - By default, the SELinux boolean mpd_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236096,9 +236222,9 @@ fi if selinuxenabled; then - var_mpd_use_cifs='' + var_mpd_enable_homedirs='' - setsebool -P mpd_use_cifs $var_mpd_use_cifs + setsebool -P mpd_enable_homedirs $var_mpd_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -236109,6 +236235,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_use_cifs SELinux Boolean + By default, the SELinux boolean mpd_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_use_cifs off + - name: Disable the mpd_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236144,23 +236286,7 @@ fi - no_reboot_needed - sebool_mpd_use_cifs - - - - - - - - - - Disable the mpd_use_nfs SELinux Boolean - By default, the SELinux boolean mpd_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the mpd_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P mpd_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236170,9 +236296,9 @@ fi if selinuxenabled; then - var_mpd_use_nfs='' + var_mpd_use_cifs='' - setsebool -P mpd_use_nfs $var_mpd_use_nfs + setsebool -P mpd_use_cifs $var_mpd_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -236183,6 +236309,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mpd_use_nfs SELinux Boolean + By default, the SELinux boolean mpd_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the mpd_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P mpd_use_nfs off + - name: Disable the mpd_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236218,23 +236360,7 @@ fi - no_reboot_needed - sebool_mpd_use_nfs - - - - - - - - - - Disable the mplayer_execstack SELinux Boolean - By default, the SELinux boolean mplayer_execstack is disabled. -If this setting is enabled, it should be disabled. - -To disable the mplayer_execstack SELinux boolean, run the following command: -$ sudo setsebool -P mplayer_execstack off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236244,9 +236370,9 @@ fi if selinuxenabled; then - var_mplayer_execstack='' + var_mpd_use_nfs='' - setsebool -P mplayer_execstack $var_mplayer_execstack + setsebool -P mpd_use_nfs $var_mpd_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -236257,6 +236383,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mplayer_execstack SELinux Boolean + By default, the SELinux boolean mplayer_execstack is disabled. +If this setting is enabled, it should be disabled. + +To disable the mplayer_execstack SELinux boolean, run the following command: +$ sudo setsebool -P mplayer_execstack off + - name: Disable the mplayer_execstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236293,23 +236435,7 @@ fi - no_reboot_needed - sebool_mplayer_execstack - - - - - - - - - - Disable the mysql_connect_any SELinux Boolean - By default, the SELinux boolean mysql_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the mysql_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P mysql_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236319,9 +236445,9 @@ fi if selinuxenabled; then - var_mysql_connect_any='' + var_mplayer_execstack='' - setsebool -P mysql_connect_any $var_mysql_connect_any + setsebool -P mplayer_execstack $var_mplayer_execstack else echo "Skipping remediation, SELinux is disabled"; @@ -236332,6 +236458,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the mysql_connect_any SELinux Boolean + By default, the SELinux boolean mysql_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the mysql_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P mysql_connect_any off + - name: Disable the mysql_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236368,23 +236510,7 @@ fi - no_reboot_needed - sebool_mysql_connect_any - - - - - - - - - - Disable the nagios_run_pnp4nagios SELinux Boolean - By default, the SELinux boolean nagios_run_pnp4nagios is disabled. -If this setting is enabled, it should be disabled. - -To disable the nagios_run_pnp4nagios SELinux boolean, run the following command: -$ sudo setsebool -P nagios_run_pnp4nagios off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236394,9 +236520,9 @@ fi if selinuxenabled; then - var_nagios_run_pnp4nagios='' + var_mysql_connect_any='' - setsebool -P nagios_run_pnp4nagios $var_nagios_run_pnp4nagios + setsebool -P mysql_connect_any $var_mysql_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -236407,6 +236533,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nagios_run_pnp4nagios SELinux Boolean + By default, the SELinux boolean nagios_run_pnp4nagios is disabled. +If this setting is enabled, it should be disabled. + +To disable the nagios_run_pnp4nagios SELinux boolean, run the following command: +$ sudo setsebool -P nagios_run_pnp4nagios off + - name: Disable the nagios_run_pnp4nagios SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236443,23 +236585,7 @@ fi - no_reboot_needed - sebool_nagios_run_pnp4nagios - - - - - - - - - - Disable the nagios_run_sudo SELinux Boolean - By default, the SELinux boolean nagios_run_sudo is disabled. -If this setting is enabled, it should be disabled. - -To disable the nagios_run_sudo SELinux boolean, run the following command: -$ sudo setsebool -P nagios_run_sudo off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236469,9 +236595,9 @@ fi if selinuxenabled; then - var_nagios_run_sudo='' + var_nagios_run_pnp4nagios='' - setsebool -P nagios_run_sudo $var_nagios_run_sudo + setsebool -P nagios_run_pnp4nagios $var_nagios_run_pnp4nagios else echo "Skipping remediation, SELinux is disabled"; @@ -236482,6 +236608,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nagios_run_sudo SELinux Boolean + By default, the SELinux boolean nagios_run_sudo is disabled. +If this setting is enabled, it should be disabled. + +To disable the nagios_run_sudo SELinux boolean, run the following command: +$ sudo setsebool -P nagios_run_sudo off + - name: Disable the nagios_run_sudo SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236517,23 +236659,7 @@ fi - no_reboot_needed - sebool_nagios_run_sudo - - - - - - - - - - Disable the named_tcp_bind_http_port SELinux Boolean - By default, the SELinux boolean named_tcp_bind_http_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the named_tcp_bind_http_port SELinux boolean, run the following command: -$ sudo setsebool -P named_tcp_bind_http_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236543,9 +236669,9 @@ fi if selinuxenabled; then - var_named_tcp_bind_http_port='' + var_nagios_run_sudo='' - setsebool -P named_tcp_bind_http_port $var_named_tcp_bind_http_port + setsebool -P nagios_run_sudo $var_nagios_run_sudo else echo "Skipping remediation, SELinux is disabled"; @@ -236556,6 +236682,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the named_tcp_bind_http_port SELinux Boolean + By default, the SELinux boolean named_tcp_bind_http_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the named_tcp_bind_http_port SELinux boolean, run the following command: +$ sudo setsebool -P named_tcp_bind_http_port off + - name: Disable the named_tcp_bind_http_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236592,23 +236734,7 @@ fi - no_reboot_needed - sebool_named_tcp_bind_http_port - - - - - - - - - - Disable the named_write_master_zones SELinux Boolean - By default, the SELinux boolean named_write_master_zones is disabled. -If this setting is enabled, it should be disabled. - -To disable the named_write_master_zones SELinux boolean, run the following command: -$ sudo setsebool -P named_write_master_zones off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236618,9 +236744,9 @@ fi if selinuxenabled; then - var_named_write_master_zones='' + var_named_tcp_bind_http_port='' - setsebool -P named_write_master_zones $var_named_write_master_zones + setsebool -P named_tcp_bind_http_port $var_named_tcp_bind_http_port else echo "Skipping remediation, SELinux is disabled"; @@ -236631,6 +236757,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the named_write_master_zones SELinux Boolean + By default, the SELinux boolean named_write_master_zones is disabled. +If this setting is enabled, it should be disabled. + +To disable the named_write_master_zones SELinux boolean, run the following command: +$ sudo setsebool -P named_write_master_zones off + - name: Disable the named_write_master_zones SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236667,23 +236809,7 @@ fi - no_reboot_needed - sebool_named_write_master_zones - - - - - - - - - - Disable the neutron_can_network SELinux Boolean - By default, the SELinux boolean neutron_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the neutron_can_network SELinux boolean, run the following command: -$ sudo setsebool -P neutron_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236693,9 +236819,9 @@ fi if selinuxenabled; then - var_neutron_can_network='' + var_named_write_master_zones='' - setsebool -P neutron_can_network $var_neutron_can_network + setsebool -P named_write_master_zones $var_named_write_master_zones else echo "Skipping remediation, SELinux is disabled"; @@ -236706,6 +236832,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the neutron_can_network SELinux Boolean + By default, the SELinux boolean neutron_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the neutron_can_network SELinux boolean, run the following command: +$ sudo setsebool -P neutron_can_network off + - name: Disable the neutron_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236742,24 +236884,7 @@ fi - no_reboot_needed - sebool_neutron_can_network - - - - - - - - - - Enable the nfs_export_all_ro SELinux Boolean - By default, the SELinux boolean nfs_export_all_ro is enabled. -If this setting is disabled, it should be enabled as it allows NFS to -export read-only mounts. - -To enable the nfs_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P nfs_export_all_ro on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236769,9 +236894,9 @@ fi if selinuxenabled; then - var_nfs_export_all_ro='' + var_neutron_can_network='' - setsebool -P nfs_export_all_ro $var_nfs_export_all_ro + setsebool -P neutron_can_network $var_neutron_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -236782,6 +236907,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nfs_export_all_ro SELinux Boolean + By default, the SELinux boolean nfs_export_all_ro is enabled. +If this setting is disabled, it should be enabled as it allows NFS to +export read-only mounts. + +To enable the nfs_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P nfs_export_all_ro on + - name: Enable the nfs_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236818,24 +236960,7 @@ fi - no_reboot_needed - sebool_nfs_export_all_ro - - - - - - - - - - Enable the nfs_export_all_rw SELinux Boolean - By default, the SELinux boolean nfs_export_all_rw is enabled. -If this setting is disabled, it should be enabled as it allows NFS to -export read/write mounts. - -To enable the nfs_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P nfs_export_all_rw on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236845,9 +236970,9 @@ fi if selinuxenabled; then - var_nfs_export_all_rw='' + var_nfs_export_all_ro='' - setsebool -P nfs_export_all_rw $var_nfs_export_all_rw + setsebool -P nfs_export_all_ro $var_nfs_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -236858,6 +236983,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nfs_export_all_rw SELinux Boolean + By default, the SELinux boolean nfs_export_all_rw is enabled. +If this setting is disabled, it should be enabled as it allows NFS to +export read/write mounts. + +To enable the nfs_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P nfs_export_all_rw on + - name: Enable the nfs_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -236894,23 +237036,7 @@ fi - no_reboot_needed - sebool_nfs_export_all_rw - - - - - - - - - - Disable the nfsd_anon_write SELinux Boolean - By default, the SELinux boolean nfsd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the nfsd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P nfsd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236920,9 +237046,9 @@ fi if selinuxenabled; then - var_nfsd_anon_write='' + var_nfs_export_all_rw='' - setsebool -P nfsd_anon_write $var_nfsd_anon_write + setsebool -P nfs_export_all_rw $var_nfs_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -236933,6 +237059,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nfsd_anon_write SELinux Boolean + By default, the SELinux boolean nfsd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the nfsd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P nfsd_anon_write off + - name: Disable the nfsd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -236968,23 +237110,7 @@ fi - no_reboot_needed - sebool_nfsd_anon_write - - - - - - - - - - Disable the nis_enabled SELinux Boolean - By default, the SELinux boolean nis_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the nis_enabled SELinux boolean, run the following command: -$ sudo setsebool -P nis_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -236994,9 +237120,9 @@ fi if selinuxenabled; then - var_nis_enabled='' + var_nfsd_anon_write='' - setsebool -P nis_enabled $var_nis_enabled + setsebool -P nfsd_anon_write $var_nfsd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -237007,6 +237133,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the nis_enabled SELinux Boolean + By default, the SELinux boolean nis_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the nis_enabled SELinux boolean, run the following command: +$ sudo setsebool -P nis_enabled off + - name: Disable the nis_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237042,24 +237184,7 @@ fi - no_reboot_needed - sebool_nis_enabled - - - - - - - - - - Enable the nscd_use_shm SELinux Boolean - By default, the SELinux boolean nscd_use_shm is enabled. -If this setting is disabled, it should be enabled to allow nscd -to use shared memory. - -To enable the nscd_use_shm SELinux boolean, run the following command: -$ sudo setsebool -P nscd_use_shm on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237069,9 +237194,9 @@ fi if selinuxenabled; then - var_nscd_use_shm='' + var_nis_enabled='' - setsebool -P nscd_use_shm $var_nscd_use_shm + setsebool -P nis_enabled $var_nis_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -237082,6 +237207,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the nscd_use_shm SELinux Boolean + By default, the SELinux boolean nscd_use_shm is enabled. +If this setting is disabled, it should be enabled to allow nscd +to use shared memory. + +To enable the nscd_use_shm SELinux boolean, run the following command: +$ sudo setsebool -P nscd_use_shm on + - name: Enable the nscd_use_shm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237117,23 +237259,7 @@ fi - no_reboot_needed - sebool_nscd_use_shm - - - - - - - - - - Disable the openshift_use_nfs SELinux Boolean - By default, the SELinux boolean openshift_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the openshift_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P openshift_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237143,9 +237269,9 @@ fi if selinuxenabled; then - var_openshift_use_nfs='' + var_nscd_use_shm='' - setsebool -P openshift_use_nfs $var_openshift_use_nfs + setsebool -P nscd_use_shm $var_nscd_use_shm else echo "Skipping remediation, SELinux is disabled"; @@ -237156,6 +237282,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openshift_use_nfs SELinux Boolean + By default, the SELinux boolean openshift_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the openshift_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P openshift_use_nfs off + - name: Disable the openshift_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237192,23 +237334,7 @@ fi - no_reboot_needed - sebool_openshift_use_nfs - - - - - - - - - - Disable the openvpn_can_network_connect SELinux Boolean - By default, the SELinux boolean openvpn_can_network_connect is enabled. -This setting should be disabled. - -To disable the openvpn_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237218,9 +237344,9 @@ fi if selinuxenabled; then - var_openvpn_can_network_connect='' + var_openshift_use_nfs='' - setsebool -P openvpn_can_network_connect $var_openvpn_can_network_connect + setsebool -P openshift_use_nfs $var_openshift_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -237231,6 +237357,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_can_network_connect SELinux Boolean + By default, the SELinux boolean openvpn_can_network_connect is enabled. +This setting should be disabled. + +To disable the openvpn_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_can_network_connect off + - name: Disable the openvpn_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237267,23 +237409,7 @@ fi - no_reboot_needed - sebool_openvpn_can_network_connect - - - - - - - - - - Disable the openvpn_enable_homedirs SELinux Boolean - By default, the SELinux boolean openvpn_enable_homedirs is enabled. -This setting should be disabled. - -To disable the openvpn_enable_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_enable_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237293,9 +237419,9 @@ fi if selinuxenabled; then - var_openvpn_enable_homedirs='' + var_openvpn_can_network_connect='' - setsebool -P openvpn_enable_homedirs $var_openvpn_enable_homedirs + setsebool -P openvpn_can_network_connect $var_openvpn_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -237306,6 +237432,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_enable_homedirs SELinux Boolean + By default, the SELinux boolean openvpn_enable_homedirs is enabled. +This setting should be disabled. + +To disable the openvpn_enable_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_enable_homedirs off + - name: Disable the openvpn_enable_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237342,23 +237484,7 @@ fi - no_reboot_needed - sebool_openvpn_enable_homedirs - - - - - - - - - - Disable the openvpn_run_unconfined SELinux Boolean - By default, the SELinux boolean openvpn_run_unconfined is disabled. -If this setting is enabled, it should be disabled. - -To disable the openvpn_run_unconfined SELinux boolean, run the following command: -$ sudo setsebool -P openvpn_run_unconfined off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237368,9 +237494,9 @@ fi if selinuxenabled; then - var_openvpn_run_unconfined='' + var_openvpn_enable_homedirs='' - setsebool -P openvpn_run_unconfined $var_openvpn_run_unconfined + setsebool -P openvpn_enable_homedirs $var_openvpn_enable_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -237381,6 +237507,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the openvpn_run_unconfined SELinux Boolean + By default, the SELinux boolean openvpn_run_unconfined is disabled. +If this setting is enabled, it should be disabled. + +To disable the openvpn_run_unconfined SELinux boolean, run the following command: +$ sudo setsebool -P openvpn_run_unconfined off + - name: Disable the openvpn_run_unconfined SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237417,23 +237559,7 @@ fi - no_reboot_needed - sebool_openvpn_run_unconfined - - - - - - - - - - Disable the pcp_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean pcp_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the pcp_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P pcp_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237443,9 +237569,9 @@ fi if selinuxenabled; then - var_pcp_bind_all_unreserved_ports='' + var_openvpn_run_unconfined='' - setsebool -P pcp_bind_all_unreserved_ports $var_pcp_bind_all_unreserved_ports + setsebool -P openvpn_run_unconfined $var_openvpn_run_unconfined else echo "Skipping remediation, SELinux is disabled"; @@ -237456,6 +237582,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pcp_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean pcp_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the pcp_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P pcp_bind_all_unreserved_ports off + - name: Disable the pcp_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237492,23 +237634,7 @@ fi - no_reboot_needed - sebool_pcp_bind_all_unreserved_ports - - - - - - - - - - Disable the pcp_read_generic_logs SELinux Boolean - By default, the SELinux boolean pcp_read_generic_logs is disabled. -If this setting is enabled, it should be disabled. - -To disable the pcp_read_generic_logs SELinux boolean, run the following command: -$ sudo setsebool -P pcp_read_generic_logs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237518,9 +237644,9 @@ fi if selinuxenabled; then - var_pcp_read_generic_logs='' + var_pcp_bind_all_unreserved_ports='' - setsebool -P pcp_read_generic_logs $var_pcp_read_generic_logs + setsebool -P pcp_bind_all_unreserved_ports $var_pcp_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -237531,6 +237657,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pcp_read_generic_logs SELinux Boolean + By default, the SELinux boolean pcp_read_generic_logs is disabled. +If this setting is enabled, it should be disabled. + +To disable the pcp_read_generic_logs SELinux boolean, run the following command: +$ sudo setsebool -P pcp_read_generic_logs off + - name: Disable the pcp_read_generic_logs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237567,23 +237709,7 @@ fi - no_reboot_needed - sebool_pcp_read_generic_logs - - - - - - - - - - Disable the piranha_lvs_can_network_connect SELinux Boolean - By default, the SELinux boolean piranha_lvs_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the piranha_lvs_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P piranha_lvs_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237593,9 +237719,9 @@ fi if selinuxenabled; then - var_piranha_lvs_can_network_connect='' + var_pcp_read_generic_logs='' - setsebool -P piranha_lvs_can_network_connect $var_piranha_lvs_can_network_connect + setsebool -P pcp_read_generic_logs $var_pcp_read_generic_logs else echo "Skipping remediation, SELinux is disabled"; @@ -237606,6 +237732,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the piranha_lvs_can_network_connect SELinux Boolean + By default, the SELinux boolean piranha_lvs_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the piranha_lvs_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P piranha_lvs_can_network_connect off + - name: Disable the piranha_lvs_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237642,23 +237784,7 @@ fi - no_reboot_needed - sebool_piranha_lvs_can_network_connect - - - - - - - - - - Disable the polipo_connect_all_unreserved SELinux Boolean - By default, the SELinux boolean polipo_connect_all_unreserved is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_connect_all_unreserved SELinux boolean, run the following command: -$ sudo setsebool -P polipo_connect_all_unreserved off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237668,9 +237794,9 @@ fi if selinuxenabled; then - var_polipo_connect_all_unreserved='' + var_piranha_lvs_can_network_connect='' - setsebool -P polipo_connect_all_unreserved $var_polipo_connect_all_unreserved + setsebool -P piranha_lvs_can_network_connect $var_piranha_lvs_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -237681,6 +237807,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_connect_all_unreserved SELinux Boolean + By default, the SELinux boolean polipo_connect_all_unreserved is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_connect_all_unreserved SELinux boolean, run the following command: +$ sudo setsebool -P polipo_connect_all_unreserved off + - name: Disable the polipo_connect_all_unreserved SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237717,23 +237859,7 @@ fi - no_reboot_needed - sebool_polipo_connect_all_unreserved - - - - - - - - - - Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean polipo_session_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_session_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P polipo_session_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237743,9 +237869,9 @@ fi if selinuxenabled; then - var_polipo_session_bind_all_unreserved_ports='' + var_polipo_connect_all_unreserved='' - setsebool -P polipo_session_bind_all_unreserved_ports $var_polipo_session_bind_all_unreserved_ports + setsebool -P polipo_connect_all_unreserved $var_polipo_connect_all_unreserved else echo "Skipping remediation, SELinux is disabled"; @@ -237756,6 +237882,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean polipo_session_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_session_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P polipo_session_bind_all_unreserved_ports off + - name: Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237792,23 +237934,7 @@ fi - no_reboot_needed - sebool_polipo_session_bind_all_unreserved_ports - - - - - - - - - - Disable the polipo_session_users SELinux Boolean - By default, the SELinux boolean polipo_session_users is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_session_users SELinux boolean, run the following command: -$ sudo setsebool -P polipo_session_users off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237818,9 +237944,9 @@ fi if selinuxenabled; then - var_polipo_session_users='' + var_polipo_session_bind_all_unreserved_ports='' - setsebool -P polipo_session_users $var_polipo_session_users + setsebool -P polipo_session_bind_all_unreserved_ports $var_polipo_session_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -237831,6 +237957,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_session_users SELinux Boolean + By default, the SELinux boolean polipo_session_users is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_session_users SELinux boolean, run the following command: +$ sudo setsebool -P polipo_session_users off + - name: Disable the polipo_session_users SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -237867,23 +238009,7 @@ fi - no_reboot_needed - sebool_polipo_session_users - - - - - - - - - - Disable the polipo_use_cifs SELinux Boolean - By default, the SELinux boolean polipo_use_cifs is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_use_cifs SELinux boolean, run the following command: -$ sudo setsebool -P polipo_use_cifs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237893,9 +238019,9 @@ fi if selinuxenabled; then - var_polipo_use_cifs='' + var_polipo_session_users='' - setsebool -P polipo_use_cifs $var_polipo_use_cifs + setsebool -P polipo_session_users $var_polipo_session_users else echo "Skipping remediation, SELinux is disabled"; @@ -237906,6 +238032,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_use_cifs SELinux Boolean + By default, the SELinux boolean polipo_use_cifs is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_use_cifs SELinux boolean, run the following command: +$ sudo setsebool -P polipo_use_cifs off + - name: Disable the polipo_use_cifs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -237941,23 +238083,7 @@ fi - no_reboot_needed - sebool_polipo_use_cifs - - - - - - - - - - Disable the polipo_use_nfs SELinux Boolean - By default, the SELinux boolean polipo_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the polipo_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P polipo_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -237967,9 +238093,9 @@ fi if selinuxenabled; then - var_polipo_use_nfs='' + var_polipo_use_cifs='' - setsebool -P polipo_use_nfs $var_polipo_use_nfs + setsebool -P polipo_use_cifs $var_polipo_use_cifs else echo "Skipping remediation, SELinux is disabled"; @@ -237980,6 +238106,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the polipo_use_nfs SELinux Boolean + By default, the SELinux boolean polipo_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the polipo_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P polipo_use_nfs off + - name: Disable the polipo_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238015,25 +238157,7 @@ fi - no_reboot_needed - sebool_polipo_use_nfs - - - - - - - - - - Configure the polyinstantiation_enabled SELinux Boolean - By default, the SELinux boolean polyinstantiation_enabled is disabled. -This setting should be configured to . - -To set the polyinstantiation_enabled SELinux boolean, run the following command: -$ sudo setsebool -P polyinstantiation_enabled - BP28(R39) - - CCE-84230-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238043,9 +238167,9 @@ fi if selinuxenabled; then - var_polyinstantiation_enabled='' + var_polipo_use_nfs='' - setsebool -P polyinstantiation_enabled $var_polyinstantiation_enabled + setsebool -P polipo_use_nfs $var_polipo_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -238056,6 +238180,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the polyinstantiation_enabled SELinux Boolean + By default, the SELinux boolean polyinstantiation_enabled is disabled. +This setting should be configured to . + +To set the polyinstantiation_enabled SELinux boolean, run the following command: +$ sudo setsebool -P polyinstantiation_enabled + BP28(R39) + + CCE-84230-2 - name: Configure the polyinstantiation_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238094,24 +238236,7 @@ fi - no_reboot_needed - sebool_polyinstantiation_enabled - - - - - - - - - - Enable the postfix_local_write_mail_spool SELinux Boolean - By default, the SELinux boolean postfix_local_write_mail_spool is enabled. -If this setting is disabled, it should be enabled as it allows Postfix to write -to the mail spool directories. - -To enable the postfix_local_write_mail_spool SELinux boolean, run the following command: -$ sudo setsebool -P postfix_local_write_mail_spool on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238121,9 +238246,9 @@ fi if selinuxenabled; then - var_postfix_local_write_mail_spool='' + var_polyinstantiation_enabled='' - setsebool -P postfix_local_write_mail_spool $var_postfix_local_write_mail_spool + setsebool -P polyinstantiation_enabled $var_polyinstantiation_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -238134,6 +238259,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postfix_local_write_mail_spool SELinux Boolean + By default, the SELinux boolean postfix_local_write_mail_spool is enabled. +If this setting is disabled, it should be enabled as it allows Postfix to write +to the mail spool directories. + +To enable the postfix_local_write_mail_spool SELinux boolean, run the following command: +$ sudo setsebool -P postfix_local_write_mail_spool on + - name: Enable the postfix_local_write_mail_spool SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238170,23 +238312,7 @@ fi - no_reboot_needed - sebool_postfix_local_write_mail_spool - - - - - - - - - - Disable the postgresql_can_rsync SELinux Boolean - By default, the SELinux boolean postgresql_can_rsync is disabled. -If this setting is enabled, it should be disabled. - -To disable the postgresql_can_rsync SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_can_rsync off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238196,9 +238322,9 @@ fi if selinuxenabled; then - var_postgresql_can_rsync='' + var_postfix_local_write_mail_spool='' - setsebool -P postgresql_can_rsync $var_postgresql_can_rsync + setsebool -P postfix_local_write_mail_spool $var_postfix_local_write_mail_spool else echo "Skipping remediation, SELinux is disabled"; @@ -238209,6 +238335,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the postgresql_can_rsync SELinux Boolean + By default, the SELinux boolean postgresql_can_rsync is disabled. +If this setting is enabled, it should be disabled. + +To disable the postgresql_can_rsync SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_can_rsync off + - name: Disable the postgresql_can_rsync SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238245,23 +238387,7 @@ fi - no_reboot_needed - sebool_postgresql_can_rsync - - - - - - - - - - Disable the postgresql_selinux_transmit_client_label SELinux Boolean - By default, the SELinux boolean postgresql_selinux_transmit_client_label is disabled. -If this setting is enabled, it should be disabled. - -To disable the postgresql_selinux_transmit_client_label SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_transmit_client_label off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238271,9 +238397,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_transmit_client_label='' + var_postgresql_can_rsync='' - setsebool -P postgresql_selinux_transmit_client_label $var_postgresql_selinux_transmit_client_label + setsebool -P postgresql_can_rsync $var_postgresql_can_rsync else echo "Skipping remediation, SELinux is disabled"; @@ -238284,6 +238410,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the postgresql_selinux_transmit_client_label SELinux Boolean + By default, the SELinux boolean postgresql_selinux_transmit_client_label is disabled. +If this setting is enabled, it should be disabled. + +To disable the postgresql_selinux_transmit_client_label SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_transmit_client_label off + - name: Disable the postgresql_selinux_transmit_client_label SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238320,24 +238462,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_transmit_client_label - - - - - - - - - - Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - By default, the SELinux boolean postgresql_selinux_unconfined_dbadm is enabled. -If this setting is disabled, it should be enabled as it allows Database Administrators to -execute Data Manipulation Language (DML) statements. - -To enable the postgresql_selinux_unconfined_dbadm SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_unconfined_dbadm on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238347,9 +238472,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_unconfined_dbadm='' + var_postgresql_selinux_transmit_client_label='' - setsebool -P postgresql_selinux_unconfined_dbadm $var_postgresql_selinux_unconfined_dbadm + setsebool -P postgresql_selinux_transmit_client_label $var_postgresql_selinux_transmit_client_label else echo "Skipping remediation, SELinux is disabled"; @@ -238360,6 +238485,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean + By default, the SELinux boolean postgresql_selinux_unconfined_dbadm is enabled. +If this setting is disabled, it should be enabled as it allows Database Administrators to +execute Data Manipulation Language (DML) statements. + +To enable the postgresql_selinux_unconfined_dbadm SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_unconfined_dbadm on + - name: Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238396,24 +238538,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_unconfined_dbadm - - - - - - - - - - Enable the postgresql_selinux_users_ddl SELinux Boolean - By default, the SELinux boolean postgresql_selinux_users_ddl is enabled. -If this setting is disabled, it should be enabled as it allows Database Administrators to -execute Data Definition Language (DDL) statements. - -To enable the postgresql_selinux_users_ddl SELinux boolean, run the following command: -$ sudo setsebool -P postgresql_selinux_users_ddl on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238423,9 +238548,9 @@ fi if selinuxenabled; then - var_postgresql_selinux_users_ddl='' + var_postgresql_selinux_unconfined_dbadm='' - setsebool -P postgresql_selinux_users_ddl $var_postgresql_selinux_users_ddl + setsebool -P postgresql_selinux_unconfined_dbadm $var_postgresql_selinux_unconfined_dbadm else echo "Skipping remediation, SELinux is disabled"; @@ -238436,6 +238561,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the postgresql_selinux_users_ddl SELinux Boolean + By default, the SELinux boolean postgresql_selinux_users_ddl is enabled. +If this setting is disabled, it should be enabled as it allows Database Administrators to +execute Data Definition Language (DDL) statements. + +To enable the postgresql_selinux_users_ddl SELinux boolean, run the following command: +$ sudo setsebool -P postgresql_selinux_users_ddl on + - name: Enable the postgresql_selinux_users_ddl SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238472,23 +238614,7 @@ fi - no_reboot_needed - sebool_postgresql_selinux_users_ddl - - - - - - - - - - Disable the pppd_can_insmod SELinux Boolean - By default, the SELinux boolean pppd_can_insmod is disabled. -If this setting is enabled, it should be disabled. - -To disable the pppd_can_insmod SELinux boolean, run the following command: -$ sudo setsebool -P pppd_can_insmod off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238498,9 +238624,9 @@ fi if selinuxenabled; then - var_pppd_can_insmod='' + var_postgresql_selinux_users_ddl='' - setsebool -P pppd_can_insmod $var_pppd_can_insmod + setsebool -P postgresql_selinux_users_ddl $var_postgresql_selinux_users_ddl else echo "Skipping remediation, SELinux is disabled"; @@ -238511,6 +238637,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pppd_can_insmod SELinux Boolean + By default, the SELinux boolean pppd_can_insmod is disabled. +If this setting is enabled, it should be disabled. + +To disable the pppd_can_insmod SELinux boolean, run the following command: +$ sudo setsebool -P pppd_can_insmod off + - name: Disable the pppd_can_insmod SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238546,23 +238688,7 @@ fi - no_reboot_needed - sebool_pppd_can_insmod - - - - - - - - - - Disable the pppd_for_user SELinux Boolean - By default, the SELinux boolean pppd_for_user is disabled. -If this setting is enabled, it should be disabled. - -To disable the pppd_for_user SELinux boolean, run the following command: -$ sudo setsebool -P pppd_for_user off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238572,9 +238698,9 @@ fi if selinuxenabled; then - var_pppd_for_user='' + var_pppd_can_insmod='' - setsebool -P pppd_for_user $var_pppd_for_user + setsebool -P pppd_can_insmod $var_pppd_can_insmod else echo "Skipping remediation, SELinux is disabled"; @@ -238585,6 +238711,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the pppd_for_user SELinux Boolean + By default, the SELinux boolean pppd_for_user is disabled. +If this setting is enabled, it should be disabled. + +To disable the pppd_for_user SELinux boolean, run the following command: +$ sudo setsebool -P pppd_for_user off + - name: Disable the pppd_for_user SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -238620,23 +238762,7 @@ fi - no_reboot_needed - sebool_pppd_for_user - - - - - - - - - - Disable the privoxy_connect_any SELinux Boolean - By default, the SELinux boolean privoxy_connect_any is enabled. -This setting should be disabled. - -To disable the privoxy_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P privoxy_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238646,9 +238772,9 @@ fi if selinuxenabled; then - var_privoxy_connect_any='' + var_pppd_for_user='' - setsebool -P privoxy_connect_any $var_privoxy_connect_any + setsebool -P pppd_for_user $var_pppd_for_user else echo "Skipping remediation, SELinux is disabled"; @@ -238659,6 +238785,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the privoxy_connect_any SELinux Boolean + By default, the SELinux boolean privoxy_connect_any is enabled. +This setting should be disabled. + +To disable the privoxy_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P privoxy_connect_any off + - name: Disable the privoxy_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238695,23 +238837,7 @@ fi - no_reboot_needed - sebool_privoxy_connect_any - - - - - - - - - - Disable the prosody_bind_http_port SELinux Boolean - By default, the SELinux boolean prosody_bind_http_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the prosody_bind_http_port SELinux boolean, run the following command: -$ sudo setsebool -P prosody_bind_http_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238721,9 +238847,9 @@ fi if selinuxenabled; then - var_prosody_bind_http_port='' + var_privoxy_connect_any='' - setsebool -P prosody_bind_http_port $var_prosody_bind_http_port + setsebool -P privoxy_connect_any $var_privoxy_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -238734,6 +238860,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the prosody_bind_http_port SELinux Boolean + By default, the SELinux boolean prosody_bind_http_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the prosody_bind_http_port SELinux boolean, run the following command: +$ sudo setsebool -P prosody_bind_http_port off + - name: Disable the prosody_bind_http_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238770,23 +238912,7 @@ fi - no_reboot_needed - sebool_prosody_bind_http_port - - - - - - - - - - Disable the puppetagent_manage_all_files SELinux Boolean - By default, the SELinux boolean puppetagent_manage_all_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the puppetagent_manage_all_files SELinux boolean, run the following command: -$ sudo setsebool -P puppetagent_manage_all_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238796,9 +238922,9 @@ fi if selinuxenabled; then - var_puppetagent_manage_all_files='' + var_prosody_bind_http_port='' - setsebool -P puppetagent_manage_all_files $var_puppetagent_manage_all_files + setsebool -P prosody_bind_http_port $var_prosody_bind_http_port else echo "Skipping remediation, SELinux is disabled"; @@ -238809,6 +238935,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the puppetagent_manage_all_files SELinux Boolean + By default, the SELinux boolean puppetagent_manage_all_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the puppetagent_manage_all_files SELinux boolean, run the following command: +$ sudo setsebool -P puppetagent_manage_all_files off + - name: Disable the puppetagent_manage_all_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238845,23 +238987,7 @@ fi - no_reboot_needed - sebool_puppetagent_manage_all_files - - - - - - - - - - Disable the puppetmaster_use_db SELinux Boolean - By default, the SELinux boolean puppetmaster_use_db is disabled. -If this setting is enabled, it should be disabled. - -To disable the puppetmaster_use_db SELinux boolean, run the following command: -$ sudo setsebool -P puppetmaster_use_db off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238871,9 +238997,9 @@ fi if selinuxenabled; then - var_puppetmaster_use_db='' + var_puppetagent_manage_all_files='' - setsebool -P puppetmaster_use_db $var_puppetmaster_use_db + setsebool -P puppetagent_manage_all_files $var_puppetagent_manage_all_files else echo "Skipping remediation, SELinux is disabled"; @@ -238884,6 +239010,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the puppetmaster_use_db SELinux Boolean + By default, the SELinux boolean puppetmaster_use_db is disabled. +If this setting is enabled, it should be disabled. + +To disable the puppetmaster_use_db SELinux boolean, run the following command: +$ sudo setsebool -P puppetmaster_use_db off + - name: Disable the puppetmaster_use_db SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238920,23 +239062,7 @@ fi - no_reboot_needed - sebool_puppetmaster_use_db - - - - - - - - - - Disable the racoon_read_shadow SELinux Boolean - By default, the SELinux boolean racoon_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the racoon_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P racoon_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -238946,9 +239072,9 @@ fi if selinuxenabled; then - var_racoon_read_shadow='' + var_puppetmaster_use_db='' - setsebool -P racoon_read_shadow $var_racoon_read_shadow + setsebool -P puppetmaster_use_db $var_puppetmaster_use_db else echo "Skipping remediation, SELinux is disabled"; @@ -238959,6 +239085,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the racoon_read_shadow SELinux Boolean + By default, the SELinux boolean racoon_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the racoon_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P racoon_read_shadow off + - name: Disable the racoon_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -238995,23 +239137,7 @@ fi - no_reboot_needed - sebool_racoon_read_shadow - - - - - - - - - - Disable the rsync_anon_write SELinux Boolean - By default, the SELinux boolean rsync_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P rsync_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239021,9 +239147,9 @@ fi if selinuxenabled; then - var_rsync_anon_write='' + var_racoon_read_shadow='' - setsebool -P rsync_anon_write $var_rsync_anon_write + setsebool -P racoon_read_shadow $var_racoon_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -239034,18 +239160,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the rsync_anon_write SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed + + + + + + + + + + Disable the rsync_anon_write SELinux Boolean + By default, the SELinux boolean rsync_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P rsync_anon_write off + + - name: Disable the rsync_anon_write SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed - sebool_rsync_anon_write - name: XCCDF Value var_rsync_anon_write # promote to variable set_fact: @@ -239070,23 +239212,7 @@ fi - no_reboot_needed - sebool_rsync_anon_write - - - - - - - - - - Disable the rsync_client SELinux Boolean - By default, the SELinux boolean rsync_client is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_client SELinux boolean, run the following command: -$ sudo setsebool -P rsync_client off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239096,9 +239222,9 @@ fi if selinuxenabled; then - var_rsync_client='' + var_rsync_anon_write='' - setsebool -P rsync_client $var_rsync_client + setsebool -P rsync_anon_write $var_rsync_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -239109,6 +239235,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_client SELinux Boolean + By default, the SELinux boolean rsync_client is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_client SELinux boolean, run the following command: +$ sudo setsebool -P rsync_client off + - name: Disable the rsync_client SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -239144,23 +239286,7 @@ fi - no_reboot_needed - sebool_rsync_client - - - - - - - - - - Disable the rsync_export_all_ro SELinux Boolean - By default, the SELinux boolean rsync_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P rsync_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239170,9 +239296,9 @@ fi if selinuxenabled; then - var_rsync_export_all_ro='' + var_rsync_client='' - setsebool -P rsync_export_all_ro $var_rsync_export_all_ro + setsebool -P rsync_client $var_rsync_client else echo "Skipping remediation, SELinux is disabled"; @@ -239183,6 +239309,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_export_all_ro SELinux Boolean + By default, the SELinux boolean rsync_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P rsync_export_all_ro off + - name: Disable the rsync_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239219,23 +239361,7 @@ fi - no_reboot_needed - sebool_rsync_export_all_ro - - - - - - - - - - Disable the rsync_full_access SELinux Boolean - By default, the SELinux boolean rsync_full_access is disabled. -If this setting is enabled, it should be disabled. - -To disable the rsync_full_access SELinux boolean, run the following command: -$ sudo setsebool -P rsync_full_access off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239245,9 +239371,9 @@ fi if selinuxenabled; then - var_rsync_full_access='' + var_rsync_export_all_ro='' - setsebool -P rsync_full_access $var_rsync_full_access + setsebool -P rsync_export_all_ro $var_rsync_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -239258,6 +239384,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the rsync_full_access SELinux Boolean + By default, the SELinux boolean rsync_full_access is disabled. +If this setting is enabled, it should be disabled. + +To disable the rsync_full_access SELinux boolean, run the following command: +$ sudo setsebool -P rsync_full_access off + - name: Disable the rsync_full_access SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239294,23 +239436,7 @@ fi - no_reboot_needed - sebool_rsync_full_access - - - - - - - - - - Disable the samba_create_home_dirs SELinux Boolean - By default, the SELinux boolean samba_create_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_create_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P samba_create_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239320,9 +239446,9 @@ fi if selinuxenabled; then - var_samba_create_home_dirs='' + var_rsync_full_access='' - setsebool -P samba_create_home_dirs $var_samba_create_home_dirs + setsebool -P rsync_full_access $var_rsync_full_access else echo "Skipping remediation, SELinux is disabled"; @@ -239333,6 +239459,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_create_home_dirs SELinux Boolean + By default, the SELinux boolean samba_create_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_create_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P samba_create_home_dirs off + - name: Disable the samba_create_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239369,23 +239511,7 @@ fi - no_reboot_needed - sebool_samba_create_home_dirs - - - - - - - - - - Disable the samba_domain_controller SELinux Boolean - By default, the SELinux boolean samba_domain_controller is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_domain_controller SELinux boolean, run the following command: -$ sudo setsebool -P samba_domain_controller off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239395,9 +239521,9 @@ fi if selinuxenabled; then - var_samba_domain_controller='' + var_samba_create_home_dirs='' - setsebool -P samba_domain_controller $var_samba_domain_controller + setsebool -P samba_create_home_dirs $var_samba_create_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -239408,6 +239534,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_domain_controller SELinux Boolean + By default, the SELinux boolean samba_domain_controller is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_domain_controller SELinux boolean, run the following command: +$ sudo setsebool -P samba_domain_controller off + - name: Disable the samba_domain_controller SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239444,23 +239586,7 @@ fi - no_reboot_needed - sebool_samba_domain_controller - - - - - - - - - - Disable the samba_enable_home_dirs SELinux Boolean - By default, the SELinux boolean samba_enable_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_enable_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P samba_enable_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239470,9 +239596,9 @@ fi if selinuxenabled; then - var_samba_enable_home_dirs='' + var_samba_domain_controller='' - setsebool -P samba_enable_home_dirs $var_samba_enable_home_dirs + setsebool -P samba_domain_controller $var_samba_domain_controller else echo "Skipping remediation, SELinux is disabled"; @@ -239483,6 +239609,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_enable_home_dirs SELinux Boolean + By default, the SELinux boolean samba_enable_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_enable_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P samba_enable_home_dirs off + - name: Disable the samba_enable_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239519,23 +239661,7 @@ fi - no_reboot_needed - sebool_samba_enable_home_dirs - - - - - - - - - - Disable the samba_export_all_ro SELinux Boolean - By default, the SELinux boolean samba_export_all_ro is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_export_all_ro SELinux boolean, run the following command: -$ sudo setsebool -P samba_export_all_ro off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239545,9 +239671,9 @@ fi if selinuxenabled; then - var_samba_export_all_ro='' + var_samba_enable_home_dirs='' - setsebool -P samba_export_all_ro $var_samba_export_all_ro + setsebool -P samba_enable_home_dirs $var_samba_enable_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -239558,6 +239684,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_export_all_ro SELinux Boolean + By default, the SELinux boolean samba_export_all_ro is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_export_all_ro SELinux boolean, run the following command: +$ sudo setsebool -P samba_export_all_ro off + - name: Disable the samba_export_all_ro SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239594,23 +239736,7 @@ fi - no_reboot_needed - sebool_samba_export_all_ro - - - - - - - - - - Disable the samba_export_all_rw SELinux Boolean - By default, the SELinux boolean samba_export_all_rw is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_export_all_rw SELinux boolean, run the following command: -$ sudo setsebool -P samba_export_all_rw off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239620,9 +239746,9 @@ fi if selinuxenabled; then - var_samba_export_all_rw='' + var_samba_export_all_ro='' - setsebool -P samba_export_all_rw $var_samba_export_all_rw + setsebool -P samba_export_all_ro $var_samba_export_all_ro else echo "Skipping remediation, SELinux is disabled"; @@ -239633,6 +239759,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_export_all_rw SELinux Boolean + By default, the SELinux boolean samba_export_all_rw is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_export_all_rw SELinux boolean, run the following command: +$ sudo setsebool -P samba_export_all_rw off + - name: Disable the samba_export_all_rw SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239669,23 +239811,7 @@ fi - no_reboot_needed - sebool_samba_export_all_rw - - - - - - - - - - Disable the samba_load_libgfapi SELinux Boolean - By default, the SELinux boolean samba_load_libgfapi is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_load_libgfapi SELinux boolean, run the following command: -$ sudo setsebool -P samba_load_libgfapi off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239695,9 +239821,9 @@ fi if selinuxenabled; then - var_samba_load_libgfapi='' + var_samba_export_all_rw='' - setsebool -P samba_load_libgfapi $var_samba_load_libgfapi + setsebool -P samba_export_all_rw $var_samba_export_all_rw else echo "Skipping remediation, SELinux is disabled"; @@ -239708,6 +239834,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_load_libgfapi SELinux Boolean + By default, the SELinux boolean samba_load_libgfapi is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_load_libgfapi SELinux boolean, run the following command: +$ sudo setsebool -P samba_load_libgfapi off + - name: Disable the samba_load_libgfapi SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239744,23 +239886,7 @@ fi - no_reboot_needed - sebool_samba_load_libgfapi - - - - - - - - - - Disable the samba_portmapper SELinux Boolean - By default, the SELinux boolean samba_portmapper is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_portmapper SELinux boolean, run the following command: -$ sudo setsebool -P samba_portmapper off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239770,9 +239896,9 @@ fi if selinuxenabled; then - var_samba_portmapper='' + var_samba_load_libgfapi='' - setsebool -P samba_portmapper $var_samba_portmapper + setsebool -P samba_load_libgfapi $var_samba_load_libgfapi else echo "Skipping remediation, SELinux is disabled"; @@ -239783,6 +239909,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_portmapper SELinux Boolean + By default, the SELinux boolean samba_portmapper is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_portmapper SELinux boolean, run the following command: +$ sudo setsebool -P samba_portmapper off + - name: Disable the samba_portmapper SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239819,23 +239961,7 @@ fi - no_reboot_needed - sebool_samba_portmapper - - - - - - - - - - Disable the samba_run_unconfined SELinux Boolean - By default, the SELinux boolean samba_run_unconfined is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_run_unconfined SELinux boolean, run the following command: -$ sudo setsebool -P samba_run_unconfined off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239845,9 +239971,9 @@ fi if selinuxenabled; then - var_samba_run_unconfined='' + var_samba_portmapper='' - setsebool -P samba_run_unconfined $var_samba_run_unconfined + setsebool -P samba_portmapper $var_samba_portmapper else echo "Skipping remediation, SELinux is disabled"; @@ -239858,6 +239984,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_run_unconfined SELinux Boolean + By default, the SELinux boolean samba_run_unconfined is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_run_unconfined SELinux boolean, run the following command: +$ sudo setsebool -P samba_run_unconfined off + - name: Disable the samba_run_unconfined SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239894,23 +240036,7 @@ fi - no_reboot_needed - sebool_samba_run_unconfined - - - - - - - - - - Disable the samba_share_fusefs SELinux Boolean - By default, the SELinux boolean samba_share_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_share_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P samba_share_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239920,9 +240046,9 @@ fi if selinuxenabled; then - var_samba_share_fusefs='' + var_samba_run_unconfined='' - setsebool -P samba_share_fusefs $var_samba_share_fusefs + setsebool -P samba_run_unconfined $var_samba_run_unconfined else echo "Skipping remediation, SELinux is disabled"; @@ -239933,6 +240059,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_share_fusefs SELinux Boolean + By default, the SELinux boolean samba_share_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_share_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P samba_share_fusefs off + - name: Disable the samba_share_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -239969,23 +240111,7 @@ fi - no_reboot_needed - sebool_samba_share_fusefs - - - - - - - - - - Disable the samba_share_nfs SELinux Boolean - By default, the SELinux boolean samba_share_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the samba_share_nfs SELinux boolean, run the following command: -$ sudo setsebool -P samba_share_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -239995,9 +240121,9 @@ fi if selinuxenabled; then - var_samba_share_nfs='' + var_samba_share_fusefs='' - setsebool -P samba_share_nfs $var_samba_share_nfs + setsebool -P samba_share_fusefs $var_samba_share_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -240008,6 +240134,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the samba_share_nfs SELinux Boolean + By default, the SELinux boolean samba_share_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the samba_share_nfs SELinux boolean, run the following command: +$ sudo setsebool -P samba_share_nfs off + - name: Disable the samba_share_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240043,23 +240185,7 @@ fi - no_reboot_needed - sebool_samba_share_nfs - - - - - - - - - - Disable the sanlock_use_fusefs SELinux Boolean - By default, the SELinux boolean sanlock_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240069,9 +240195,9 @@ fi if selinuxenabled; then - var_sanlock_use_fusefs='' + var_samba_share_nfs='' - setsebool -P sanlock_use_fusefs $var_sanlock_use_fusefs + setsebool -P samba_share_nfs $var_samba_share_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -240082,6 +240208,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_fusefs SELinux Boolean + By default, the SELinux boolean sanlock_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_fusefs off + - name: Disable the sanlock_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240118,23 +240260,7 @@ fi - no_reboot_needed - sebool_sanlock_use_fusefs - - - - - - - - - - Disable the sanlock_use_nfs SELinux Boolean - By default, the SELinux boolean sanlock_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240144,9 +240270,9 @@ fi if selinuxenabled; then - var_sanlock_use_nfs='' + var_sanlock_use_fusefs='' - setsebool -P sanlock_use_nfs $var_sanlock_use_nfs + setsebool -P sanlock_use_fusefs $var_sanlock_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -240157,6 +240283,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_nfs SELinux Boolean + By default, the SELinux boolean sanlock_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_nfs off + - name: Disable the sanlock_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240192,23 +240334,7 @@ fi - no_reboot_needed - sebool_sanlock_use_nfs - - - - - - - - - - Disable the sanlock_use_samba SELinux Boolean - By default, the SELinux boolean sanlock_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the sanlock_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P sanlock_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240218,9 +240344,9 @@ fi if selinuxenabled; then - var_sanlock_use_samba='' + var_sanlock_use_nfs='' - setsebool -P sanlock_use_samba $var_sanlock_use_samba + setsebool -P sanlock_use_nfs $var_sanlock_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -240231,6 +240357,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sanlock_use_samba SELinux Boolean + By default, the SELinux boolean sanlock_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the sanlock_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P sanlock_use_samba off + - name: Disable the sanlock_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240267,23 +240409,7 @@ fi - no_reboot_needed - sebool_sanlock_use_samba - - - - - - - - - - Disable the saslauthd_read_shadow SELinux Boolean - By default, the SELinux boolean saslauthd_read_shadow is disabled. -If this setting is enabled, it should be disabled. - -To disable the saslauthd_read_shadow SELinux boolean, run the following command: -$ sudo setsebool -P saslauthd_read_shadow off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240293,9 +240419,9 @@ fi if selinuxenabled; then - var_saslauthd_read_shadow='' + var_sanlock_use_samba='' - setsebool -P saslauthd_read_shadow $var_saslauthd_read_shadow + setsebool -P sanlock_use_samba $var_sanlock_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -240306,6 +240432,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the saslauthd_read_shadow SELinux Boolean + By default, the SELinux boolean saslauthd_read_shadow is disabled. +If this setting is enabled, it should be disabled. + +To disable the saslauthd_read_shadow SELinux boolean, run the following command: +$ sudo setsebool -P saslauthd_read_shadow off + - name: Disable the saslauthd_read_shadow SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240342,23 +240484,7 @@ fi - no_reboot_needed - sebool_saslauthd_read_shadow - - - - - - - - - - Enable the secadm_exec_content SELinux Boolean - By default, the SELinux boolean secadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the secadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P secadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240368,9 +240494,9 @@ fi if selinuxenabled; then - var_secadm_exec_content='' + var_saslauthd_read_shadow='' - setsebool -P secadm_exec_content $var_secadm_exec_content + setsebool -P saslauthd_read_shadow $var_saslauthd_read_shadow else echo "Skipping remediation, SELinux is disabled"; @@ -240381,6 +240507,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the secadm_exec_content SELinux Boolean + By default, the SELinux boolean secadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the secadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P secadm_exec_content on + - name: Enable the secadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240417,23 +240559,7 @@ fi - no_reboot_needed - sebool_secadm_exec_content - - - - - - - - - - Disable the secure_mode SELinux Boolean - By default, the SELinux boolean secure_mode is disabled. -If this setting is enabled, it should be disabled. - -To disable the secure_mode SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240443,9 +240569,9 @@ fi if selinuxenabled; then - var_secure_mode='' + var_secadm_exec_content='' - setsebool -P secure_mode $var_secure_mode + setsebool -P secadm_exec_content $var_secadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -240456,6 +240582,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the secure_mode SELinux Boolean + By default, the SELinux boolean secure_mode is disabled. +If this setting is enabled, it should be disabled. + +To disable the secure_mode SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode off + - name: Disable the secure_mode SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -240491,25 +240633,7 @@ fi - no_reboot_needed - sebool_secure_mode - - - - - - - - - - Configure the secure_mode_insmod SELinux Boolean - By default, the SELinux boolean secure_mode_insmod is disabled. -This setting should be configured to . - -To set the secure_mode_insmod SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode_insmod - BP28(R67) - - CCE-83310-3 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240519,9 +240643,9 @@ fi if selinuxenabled; then - var_secure_mode_insmod='' + var_secure_mode='' - setsebool -P secure_mode_insmod $var_secure_mode_insmod + setsebool -P secure_mode $var_secure_mode else echo "Skipping remediation, SELinux is disabled"; @@ -240532,6 +240656,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the secure_mode_insmod SELinux Boolean + By default, the SELinux boolean secure_mode_insmod is disabled. +This setting should be configured to . + +To set the secure_mode_insmod SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode_insmod + BP28(R67) + + CCE-83310-3 - name: Configure the secure_mode_insmod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240570,23 +240712,7 @@ fi - no_reboot_needed - sebool_secure_mode_insmod - - - - - - - - - - Disable the secure_mode_policyload SELinux Boolean - By default, the SELinux boolean secure_mode_policyload is disabled. -If this setting is enabled, it should be disabled. - -To disable the secure_mode_policyload SELinux boolean, run the following command: -$ sudo setsebool -P secure_mode_policyload off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240596,9 +240722,9 @@ fi if selinuxenabled; then - var_secure_mode_policyload='' + var_secure_mode_insmod='' - setsebool -P secure_mode_policyload $var_secure_mode_policyload + setsebool -P secure_mode_insmod $var_secure_mode_insmod else echo "Skipping remediation, SELinux is disabled"; @@ -240609,6 +240735,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the secure_mode_policyload SELinux Boolean + By default, the SELinux boolean secure_mode_policyload is disabled. +If this setting is enabled, it should be disabled. + +To disable the secure_mode_policyload SELinux boolean, run the following command: +$ sudo setsebool -P secure_mode_policyload off + - name: Disable the secure_mode_policyload SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240645,24 +240787,7 @@ fi - no_reboot_needed - sebool_secure_mode_policyload - - - - - - - - - - Configure the selinuxuser_direct_dri_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_direct_dri_enabled is enabled. -If XWindows is not installed or used on the system, this setting should be disabled. -Otherwise, enable it. - -To disable the selinuxuser_direct_dri_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_direct_dri_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -240672,9 +240797,9 @@ fi if selinuxenabled; then - var_selinuxuser_direct_dri_enabled='' + var_secure_mode_policyload='' - setsebool -P selinuxuser_direct_dri_enabled $var_selinuxuser_direct_dri_enabled + setsebool -P secure_mode_policyload $var_secure_mode_policyload else echo "Skipping remediation, SELinux is disabled"; @@ -240685,6 +240810,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure the selinuxuser_direct_dri_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_direct_dri_enabled is enabled. +If XWindows is not installed or used on the system, this setting should be disabled. +Otherwise, enable it. + +To disable the selinuxuser_direct_dri_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_direct_dri_enabled off + - name: Configure the selinuxuser_direct_dri_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240720,6 +240862,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_direct_dri_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_direct_dri_enabled='' + + setsebool -P selinuxuser_direct_dri_enabled $var_selinuxuser_direct_dri_enabled + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240747,29 +240912,6 @@ To disable the selinuxuser_execheap SELinux boolean, run 164.312(e) Disabling code execution from the heap blocks buffer overflow attacks. CCE-80949-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execheap='' - - setsebool -P selinuxuser_execheap $var_selinuxuser_execheap - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the selinuxuser_execheap SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240807,6 +240949,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_execheap + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_execheap='' + + setsebool -P selinuxuser_execheap $var_selinuxuser_execheap + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240832,29 +240997,6 @@ To enable the selinuxuser_execmod SELinux boolean, run th 164.312(e) CCE-80950-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execmod='' - - setsebool -P selinuxuser_execmod $var_selinuxuser_execmod - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable the selinuxuser_execmod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240892,6 +241034,29 @@ fi - medium_severity - no_reboot_needed - sebool_selinuxuser_execmod + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_selinuxuser_execmod='' + + setsebool -P selinuxuser_execmod $var_selinuxuser_execmod + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -240919,29 +241084,6 @@ To disable the selinuxuser_execstack SELinux boolean, run 164.312(e) Disabling code execution from the stack blocks buffer overflow attacks. CCE-80951-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_selinuxuser_execstack='' - - setsebool -P selinuxuser_execstack $var_selinuxuser_execstack - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the selinuxuser_execstack SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -240980,24 +241122,8 @@ fi - no_reboot_needed - sebool_selinuxuser_execstack - - - - - - - - - - Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_mysql_connect_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_mysql_connect_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_mysql_connect_enabled off - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then yum install -y "python3-libsemanage" @@ -241006,9 +241132,9 @@ fi if selinuxenabled; then - var_selinuxuser_mysql_connect_enabled='' + var_selinuxuser_execstack='' - setsebool -P selinuxuser_mysql_connect_enabled $var_selinuxuser_mysql_connect_enabled + setsebool -P selinuxuser_execstack $var_selinuxuser_execstack else echo "Skipping remediation, SELinux is disabled"; @@ -241019,6 +241145,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_mysql_connect_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_mysql_connect_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_mysql_connect_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_mysql_connect_enabled off + - name: Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241055,24 +241197,7 @@ fi - no_reboot_needed - sebool_selinuxuser_mysql_connect_enabled - - - - - - - - - - Enable the selinuxuser_ping SELinux Boolean - By default, the SELinux boolean selinuxuser_ping is enabled. -If this setting is disabled, it should be enabled as it allows confined users -to use ping and traceroute which is helpful for network troubleshooting. - -To enable the selinuxuser_ping SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_ping on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241082,9 +241207,9 @@ fi if selinuxenabled; then - var_selinuxuser_ping='' + var_selinuxuser_mysql_connect_enabled='' - setsebool -P selinuxuser_ping $var_selinuxuser_ping + setsebool -P selinuxuser_mysql_connect_enabled $var_selinuxuser_mysql_connect_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -241095,6 +241220,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the selinuxuser_ping SELinux Boolean + By default, the SELinux boolean selinuxuser_ping is enabled. +If this setting is disabled, it should be enabled as it allows confined users +to use ping and traceroute which is helpful for network troubleshooting. + +To enable the selinuxuser_ping SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_ping on + - name: Enable the selinuxuser_ping SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241130,23 +241272,7 @@ fi - no_reboot_needed - sebool_selinuxuser_ping - - - - - - - - - - Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - By default, the SELinux boolean selinuxuser_postgresql_connect_enabled is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_postgresql_connect_enabled SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_postgresql_connect_enabled off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241156,9 +241282,9 @@ fi if selinuxenabled; then - var_selinuxuser_postgresql_connect_enabled='' + var_selinuxuser_ping='' - setsebool -P selinuxuser_postgresql_connect_enabled $var_selinuxuser_postgresql_connect_enabled + setsebool -P selinuxuser_ping $var_selinuxuser_ping else echo "Skipping remediation, SELinux is disabled"; @@ -241169,6 +241295,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean + By default, the SELinux boolean selinuxuser_postgresql_connect_enabled is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_postgresql_connect_enabled SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_postgresql_connect_enabled off + - name: Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241205,24 +241347,7 @@ fi - no_reboot_needed - sebool_selinuxuser_postgresql_connect_enabled - - - - - - - - - - Disable the selinuxuser_rw_noexattrfile SELinux Boolean - By default, the SELinux boolean selinuxuser_rw_noexattrfile is enabled. -This setting should be disabled as users should not be able to read/write files -on filesystems that do not have extended attributes e.g. FAT, CDROM, FLOPPY, etc. - -To disable the selinuxuser_rw_noexattrfile SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_rw_noexattrfile off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241232,9 +241357,9 @@ fi if selinuxenabled; then - var_selinuxuser_rw_noexattrfile='' + var_selinuxuser_postgresql_connect_enabled='' - setsebool -P selinuxuser_rw_noexattrfile $var_selinuxuser_rw_noexattrfile + setsebool -P selinuxuser_postgresql_connect_enabled $var_selinuxuser_postgresql_connect_enabled else echo "Skipping remediation, SELinux is disabled"; @@ -241245,6 +241370,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_rw_noexattrfile SELinux Boolean + By default, the SELinux boolean selinuxuser_rw_noexattrfile is enabled. +This setting should be disabled as users should not be able to read/write files +on filesystems that do not have extended attributes e.g. FAT, CDROM, FLOPPY, etc. + +To disable the selinuxuser_rw_noexattrfile SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_rw_noexattrfile off + - name: Disable the selinuxuser_rw_noexattrfile SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241281,23 +241423,7 @@ fi - no_reboot_needed - sebool_selinuxuser_rw_noexattrfile - - - - - - - - - - Disable the selinuxuser_share_music SELinux Boolean - By default, the SELinux boolean selinuxuser_share_music is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_share_music SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_share_music off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241307,9 +241433,9 @@ fi if selinuxenabled; then - var_selinuxuser_share_music='' + var_selinuxuser_rw_noexattrfile='' - setsebool -P selinuxuser_share_music $var_selinuxuser_share_music + setsebool -P selinuxuser_rw_noexattrfile $var_selinuxuser_rw_noexattrfile else echo "Skipping remediation, SELinux is disabled"; @@ -241320,6 +241446,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_share_music SELinux Boolean + By default, the SELinux boolean selinuxuser_share_music is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_share_music SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_share_music off + - name: Disable the selinuxuser_share_music SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241356,23 +241498,7 @@ fi - no_reboot_needed - sebool_selinuxuser_share_music - - - - - - - - - - Disable the selinuxuser_tcp_server SELinux Boolean - By default, the SELinux boolean selinuxuser_tcp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_tcp_server SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_tcp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241382,9 +241508,9 @@ fi if selinuxenabled; then - var_selinuxuser_tcp_server='' + var_selinuxuser_share_music='' - setsebool -P selinuxuser_tcp_server $var_selinuxuser_tcp_server + setsebool -P selinuxuser_share_music $var_selinuxuser_share_music else echo "Skipping remediation, SELinux is disabled"; @@ -241395,6 +241521,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_tcp_server SELinux Boolean + By default, the SELinux boolean selinuxuser_tcp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_tcp_server SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_tcp_server off + - name: Disable the selinuxuser_tcp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241431,23 +241573,7 @@ fi - no_reboot_needed - sebool_selinuxuser_tcp_server - - - - - - - - - - Disable the selinuxuser_udp_server SELinux Boolean - By default, the SELinux boolean selinuxuser_udp_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_udp_server SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_udp_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241457,9 +241583,9 @@ fi if selinuxenabled; then - var_selinuxuser_udp_server='' + var_selinuxuser_tcp_server='' - setsebool -P selinuxuser_udp_server $var_selinuxuser_udp_server + setsebool -P selinuxuser_tcp_server $var_selinuxuser_tcp_server else echo "Skipping remediation, SELinux is disabled"; @@ -241470,6 +241596,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_udp_server SELinux Boolean + By default, the SELinux boolean selinuxuser_udp_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_udp_server SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_udp_server off + - name: Disable the selinuxuser_udp_server SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241506,23 +241648,7 @@ fi - no_reboot_needed - sebool_selinuxuser_udp_server - - - - - - - - - - Disable the selinuxuser_use_ssh_chroot SELinux Boolean - By default, the SELinux boolean selinuxuser_use_ssh_chroot is disabled. -If this setting is enabled, it should be disabled. - -To disable the selinuxuser_use_ssh_chroot SELinux boolean, run the following command: -$ sudo setsebool -P selinuxuser_use_ssh_chroot off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241532,9 +241658,9 @@ fi if selinuxenabled; then - var_selinuxuser_use_ssh_chroot='' + var_selinuxuser_udp_server='' - setsebool -P selinuxuser_use_ssh_chroot $var_selinuxuser_use_ssh_chroot + setsebool -P selinuxuser_udp_server $var_selinuxuser_udp_server else echo "Skipping remediation, SELinux is disabled"; @@ -241545,6 +241671,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the selinuxuser_use_ssh_chroot SELinux Boolean + By default, the SELinux boolean selinuxuser_use_ssh_chroot is disabled. +If this setting is enabled, it should be disabled. + +To disable the selinuxuser_use_ssh_chroot SELinux boolean, run the following command: +$ sudo setsebool -P selinuxuser_use_ssh_chroot off + - name: Disable the selinuxuser_use_ssh_chroot SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241581,23 +241723,7 @@ fi - no_reboot_needed - sebool_selinuxuser_use_ssh_chroot - - - - - - - - - - Disable the sge_domain_can_network_connect SELinux Boolean - By default, the SELinux boolean sge_domain_can_network_connect is disabled. -If this setting is enabled, it should be disabled. - -To disable the sge_domain_can_network_connect SELinux boolean, run the following command: -$ sudo setsebool -P sge_domain_can_network_connect off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241607,9 +241733,9 @@ fi if selinuxenabled; then - var_sge_domain_can_network_connect='' + var_selinuxuser_use_ssh_chroot='' - setsebool -P sge_domain_can_network_connect $var_sge_domain_can_network_connect + setsebool -P selinuxuser_use_ssh_chroot $var_selinuxuser_use_ssh_chroot else echo "Skipping remediation, SELinux is disabled"; @@ -241620,6 +241746,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sge_domain_can_network_connect SELinux Boolean + By default, the SELinux boolean sge_domain_can_network_connect is disabled. +If this setting is enabled, it should be disabled. + +To disable the sge_domain_can_network_connect SELinux boolean, run the following command: +$ sudo setsebool -P sge_domain_can_network_connect off + - name: Disable the sge_domain_can_network_connect SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241656,23 +241798,7 @@ fi - no_reboot_needed - sebool_sge_domain_can_network_connect - - - - - - - - - - Disable the sge_use_nfs SELinux Boolean - By default, the SELinux boolean sge_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the sge_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P sge_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241682,9 +241808,9 @@ fi if selinuxenabled; then - var_sge_use_nfs='' + var_sge_domain_can_network_connect='' - setsebool -P sge_use_nfs $var_sge_use_nfs + setsebool -P sge_domain_can_network_connect $var_sge_domain_can_network_connect else echo "Skipping remediation, SELinux is disabled"; @@ -241695,6 +241821,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the sge_use_nfs SELinux Boolean + By default, the SELinux boolean sge_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the sge_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P sge_use_nfs off + - name: Disable the sge_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241730,23 +241872,7 @@ fi - no_reboot_needed - sebool_sge_use_nfs - - - - - - - - - - Disable the smartmon_3ware SELinux Boolean - By default, the SELinux boolean smartmon_3ware is disabled. -If this setting is enabled, it should be disabled. - -To disable the smartmon_3ware SELinux boolean, run the following command: -$ sudo setsebool -P smartmon_3ware off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241756,9 +241882,9 @@ fi if selinuxenabled; then - var_smartmon_3ware='' + var_sge_use_nfs='' - setsebool -P smartmon_3ware $var_smartmon_3ware + setsebool -P sge_use_nfs $var_sge_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -241769,6 +241895,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the smartmon_3ware SELinux Boolean + By default, the SELinux boolean smartmon_3ware is disabled. +If this setting is enabled, it should be disabled. + +To disable the smartmon_3ware SELinux boolean, run the following command: +$ sudo setsebool -P smartmon_3ware off + - name: Disable the smartmon_3ware SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241804,23 +241946,7 @@ fi - no_reboot_needed - sebool_smartmon_3ware - - - - - - - - - - Disable the smbd_anon_write SELinux Boolean - By default, the SELinux boolean smbd_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the smbd_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P smbd_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241830,9 +241956,9 @@ fi if selinuxenabled; then - var_smbd_anon_write='' + var_smartmon_3ware='' - setsebool -P smbd_anon_write $var_smbd_anon_write + setsebool -P smartmon_3ware $var_smartmon_3ware else echo "Skipping remediation, SELinux is disabled"; @@ -241843,6 +241969,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the smbd_anon_write SELinux Boolean + By default, the SELinux boolean smbd_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the smbd_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P smbd_anon_write off + - name: Disable the smbd_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -241878,23 +242020,7 @@ fi - no_reboot_needed - sebool_smbd_anon_write - - - - - - - - - - Disable the spamassassin_can_network SELinux Boolean - By default, the SELinux boolean spamassassin_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the spamassassin_can_network SELinux boolean, run the following command: -$ sudo setsebool -P spamassassin_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241904,9 +242030,9 @@ fi if selinuxenabled; then - var_spamassassin_can_network='' + var_smbd_anon_write='' - setsebool -P spamassassin_can_network $var_spamassassin_can_network + setsebool -P smbd_anon_write $var_smbd_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -241917,6 +242043,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the spamassassin_can_network SELinux Boolean + By default, the SELinux boolean spamassassin_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the spamassassin_can_network SELinux boolean, run the following command: +$ sudo setsebool -P spamassassin_can_network off + - name: Disable the spamassassin_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -241953,23 +242095,7 @@ fi - no_reboot_needed - sebool_spamassassin_can_network - - - - - - - - - - Enable the spamd_enable_home_dirs SELinux Boolean - By default, the SELinux boolean spamd_enable_home_dirs is enabled. -If this setting is disabled, it should be enabled. - -To enable the spamd_enable_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P spamd_enable_home_dirs on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -241979,9 +242105,9 @@ fi if selinuxenabled; then - var_spamd_enable_home_dirs='' + var_spamassassin_can_network='' - setsebool -P spamd_enable_home_dirs $var_spamd_enable_home_dirs + setsebool -P spamassassin_can_network $var_spamassassin_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -241992,6 +242118,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the spamd_enable_home_dirs SELinux Boolean + By default, the SELinux boolean spamd_enable_home_dirs is enabled. +If this setting is disabled, it should be enabled. + +To enable the spamd_enable_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P spamd_enable_home_dirs on + - name: Enable the spamd_enable_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242028,24 +242170,7 @@ fi - no_reboot_needed - sebool_spamd_enable_home_dirs - - - - - - - - - - Disable the squid_connect_any SELinux Boolean - By default, the SELinux boolean squid_connect_any is enabled. -This setting should be disabled as squid should only connect on specified -ports. - -To disable the squid_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P squid_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242055,9 +242180,9 @@ fi if selinuxenabled; then - var_squid_connect_any='' + var_spamd_enable_home_dirs='' - setsebool -P squid_connect_any $var_squid_connect_any + setsebool -P spamd_enable_home_dirs $var_spamd_enable_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -242068,6 +242193,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the squid_connect_any SELinux Boolean + By default, the SELinux boolean squid_connect_any is enabled. +This setting should be disabled as squid should only connect on specified +ports. + +To disable the squid_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P squid_connect_any off + - name: Disable the squid_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242104,23 +242246,7 @@ fi - no_reboot_needed - sebool_squid_connect_any - - - - - - - - - - Disable the squid_use_tproxy SELinux Boolean - By default, the SELinux boolean squid_use_tproxy is disabled. -If this setting is enabled, it should be disabled. - -To disable the squid_use_tproxy SELinux boolean, run the following command: -$ sudo setsebool -P squid_use_tproxy off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242130,9 +242256,9 @@ fi if selinuxenabled; then - var_squid_use_tproxy='' + var_squid_connect_any='' - setsebool -P squid_use_tproxy $var_squid_use_tproxy + setsebool -P squid_connect_any $var_squid_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -242143,6 +242269,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the squid_use_tproxy SELinux Boolean + By default, the SELinux boolean squid_use_tproxy is disabled. +If this setting is enabled, it should be disabled. + +To disable the squid_use_tproxy SELinux boolean, run the following command: +$ sudo setsebool -P squid_use_tproxy off + - name: Disable the squid_use_tproxy SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242179,23 +242321,7 @@ fi - no_reboot_needed - sebool_squid_use_tproxy - - - - - - - - - - Disable the ssh_chroot_rw_homedirs SELinux Boolean - By default, the SELinux boolean ssh_chroot_rw_homedirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the ssh_chroot_rw_homedirs SELinux boolean, run the following command: -$ sudo setsebool -P ssh_chroot_rw_homedirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242205,9 +242331,9 @@ fi if selinuxenabled; then - var_ssh_chroot_rw_homedirs='' + var_squid_use_tproxy='' - setsebool -P ssh_chroot_rw_homedirs $var_ssh_chroot_rw_homedirs + setsebool -P squid_use_tproxy $var_squid_use_tproxy else echo "Skipping remediation, SELinux is disabled"; @@ -242218,6 +242344,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ssh_chroot_rw_homedirs SELinux Boolean + By default, the SELinux boolean ssh_chroot_rw_homedirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the ssh_chroot_rw_homedirs SELinux boolean, run the following command: +$ sudo setsebool -P ssh_chroot_rw_homedirs off + - name: Disable the ssh_chroot_rw_homedirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242254,23 +242396,7 @@ fi - no_reboot_needed - sebool_ssh_chroot_rw_homedirs - - - - - - - - - - Disable the ssh_keysign SELinux Boolean - By default, the SELinux boolean ssh_keysign is disabled. -If this setting is enabled, it should be disabled. - -To disable the ssh_keysign SELinux boolean, run the following command: -$ sudo setsebool -P ssh_keysign off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242280,9 +242406,9 @@ fi if selinuxenabled; then - var_ssh_keysign='' + var_ssh_chroot_rw_homedirs='' - setsebool -P ssh_keysign $var_ssh_keysign + setsebool -P ssh_chroot_rw_homedirs $var_ssh_chroot_rw_homedirs else echo "Skipping remediation, SELinux is disabled"; @@ -242293,6 +242419,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the ssh_keysign SELinux Boolean + By default, the SELinux boolean ssh_keysign is disabled. +If this setting is enabled, it should be disabled. + +To disable the ssh_keysign SELinux boolean, run the following command: +$ sudo setsebool -P ssh_keysign off + - name: Disable the ssh_keysign SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242327,6 +242469,29 @@ fi - medium_severity - no_reboot_needed - sebool_ssh_keysign + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_ssh_keysign='' + + setsebool -P ssh_keysign $var_ssh_keysign + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -242358,29 +242523,6 @@ authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users. CCE-83311-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "python3-libsemanage" ; then - yum install -y "python3-libsemanage" -fi - - -if selinuxenabled; then - - var_ssh_sysadm_login='' - - setsebool -P ssh_sysadm_login $var_ssh_sysadm_login - -else - echo "Skipping remediation, SELinux is disabled"; - false -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable the ssh_sysadm_login SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242419,23 +242561,7 @@ fi - no_reboot_needed - sebool_ssh_sysadm_login - - - - - - - - - - Enable the staff_exec_content SELinux Boolean - By default, the SELinux boolean staff_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the staff_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P staff_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242445,9 +242571,9 @@ fi if selinuxenabled; then - var_staff_exec_content='' + var_ssh_sysadm_login='' - setsebool -P staff_exec_content $var_staff_exec_content + setsebool -P ssh_sysadm_login $var_ssh_sysadm_login else echo "Skipping remediation, SELinux is disabled"; @@ -242458,6 +242584,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the staff_exec_content SELinux Boolean + By default, the SELinux boolean staff_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the staff_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P staff_exec_content on + - name: Enable the staff_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242494,23 +242636,7 @@ fi - no_reboot_needed - sebool_staff_exec_content - - - - - - - - - - Disable the staff_use_svirt SELinux Boolean - By default, the SELinux boolean staff_use_svirt is disabled. -If this setting is enabled, it should be disabled. - -To disable the staff_use_svirt SELinux boolean, run the following command: -$ sudo setsebool -P staff_use_svirt off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242520,9 +242646,9 @@ fi if selinuxenabled; then - var_staff_use_svirt='' + var_staff_exec_content='' - setsebool -P staff_use_svirt $var_staff_use_svirt + setsebool -P staff_exec_content $var_staff_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -242533,6 +242659,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the staff_use_svirt SELinux Boolean + By default, the SELinux boolean staff_use_svirt is disabled. +If this setting is enabled, it should be disabled. + +To disable the staff_use_svirt SELinux boolean, run the following command: +$ sudo setsebool -P staff_use_svirt off + - name: Disable the staff_use_svirt SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242568,23 +242710,7 @@ fi - no_reboot_needed - sebool_staff_use_svirt - - - - - - - - - - Disable the swift_can_network SELinux Boolean - By default, the SELinux boolean swift_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the swift_can_network SELinux boolean, run the following command: -$ sudo setsebool -P swift_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242594,9 +242720,9 @@ fi if selinuxenabled; then - var_swift_can_network='' + var_staff_use_svirt='' - setsebool -P swift_can_network $var_swift_can_network + setsebool -P staff_use_svirt $var_staff_use_svirt else echo "Skipping remediation, SELinux is disabled"; @@ -242607,6 +242733,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the swift_can_network SELinux Boolean + By default, the SELinux boolean swift_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the swift_can_network SELinux boolean, run the following command: +$ sudo setsebool -P swift_can_network off + - name: Disable the swift_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242643,23 +242785,7 @@ fi - no_reboot_needed - sebool_swift_can_network - - - - - - - - - - Enable the sysadm_exec_content SELinux Boolean - By default, the SELinux boolean sysadm_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the sysadm_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P sysadm_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242669,9 +242795,9 @@ fi if selinuxenabled; then - var_sysadm_exec_content='' + var_swift_can_network='' - setsebool -P sysadm_exec_content $var_sysadm_exec_content + setsebool -P swift_can_network $var_swift_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -242682,6 +242808,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the sysadm_exec_content SELinux Boolean + By default, the SELinux boolean sysadm_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the sysadm_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P sysadm_exec_content on + - name: Enable the sysadm_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242718,23 +242860,7 @@ fi - no_reboot_needed - sebool_sysadm_exec_content - - - - - - - - - - Disable the telepathy_connect_all_ports SELinux Boolean - By default, the SELinux boolean telepathy_connect_all_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the telepathy_connect_all_ports SELinux boolean, run the following command: -$ sudo setsebool -P telepathy_connect_all_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242744,9 +242870,9 @@ fi if selinuxenabled; then - var_telepathy_connect_all_ports='' + var_sysadm_exec_content='' - setsebool -P telepathy_connect_all_ports $var_telepathy_connect_all_ports + setsebool -P sysadm_exec_content $var_sysadm_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -242757,6 +242883,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the telepathy_connect_all_ports SELinux Boolean + By default, the SELinux boolean telepathy_connect_all_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the telepathy_connect_all_ports SELinux boolean, run the following command: +$ sudo setsebool -P telepathy_connect_all_ports off + - name: Disable the telepathy_connect_all_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242793,24 +242935,7 @@ fi - no_reboot_needed - sebool_telepathy_connect_all_ports - - - - - - - - - - Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - By default, the SELinux boolean telepathy_tcp_connect_generic_network_ports is enabled. -This setting should be disabled as telepathy should not connect to any generic network -ports. - -To disable the telepathy_tcp_connect_generic_network_ports SELinux boolean, run the following command: -$ sudo setsebool -P telepathy_tcp_connect_generic_network_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242820,9 +242945,9 @@ fi if selinuxenabled; then - var_telepathy_tcp_connect_generic_network_ports='' + var_telepathy_connect_all_ports='' - setsebool -P telepathy_tcp_connect_generic_network_ports $var_telepathy_tcp_connect_generic_network_ports + setsebool -P telepathy_connect_all_ports $var_telepathy_connect_all_ports else echo "Skipping remediation, SELinux is disabled"; @@ -242833,6 +242958,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean + By default, the SELinux boolean telepathy_tcp_connect_generic_network_ports is enabled. +This setting should be disabled as telepathy should not connect to any generic network +ports. + +To disable the telepathy_tcp_connect_generic_network_ports SELinux boolean, run the following command: +$ sudo setsebool -P telepathy_tcp_connect_generic_network_ports off + - name: Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -242869,23 +243011,7 @@ fi - no_reboot_needed - sebool_telepathy_tcp_connect_generic_network_ports - - - - - - - - - - Disable the tftp_anon_write SELinux Boolean - By default, the SELinux boolean tftp_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the tftp_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P tftp_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242895,9 +243021,9 @@ fi if selinuxenabled; then - var_tftp_anon_write='' + var_telepathy_tcp_connect_generic_network_ports='' - setsebool -P tftp_anon_write $var_tftp_anon_write + setsebool -P telepathy_tcp_connect_generic_network_ports $var_telepathy_tcp_connect_generic_network_ports else echo "Skipping remediation, SELinux is disabled"; @@ -242908,6 +243034,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tftp_anon_write SELinux Boolean + By default, the SELinux boolean tftp_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the tftp_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P tftp_anon_write off + - name: Disable the tftp_anon_write SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -242943,23 +243085,7 @@ fi - no_reboot_needed - sebool_tftp_anon_write - - - - - - - - - - Disable the tftp_home_dir SELinux Boolean - By default, the SELinux boolean tftp_home_dir is disabled. -If this setting is enabled, it should be disabled. - -To disable the tftp_home_dir SELinux boolean, run the following command: -$ sudo setsebool -P tftp_home_dir off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -242969,9 +243095,9 @@ fi if selinuxenabled; then - var_tftp_home_dir='' + var_tftp_anon_write='' - setsebool -P tftp_home_dir $var_tftp_home_dir + setsebool -P tftp_anon_write $var_tftp_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -242982,18 +243108,34 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the tftp_home_dir SELinux Boolean - Ensure python3-libsemanage Installed - package: - name: python3-libsemanage - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - sebool_tftp_home_dir + + + + + + + + + + Disable the tftp_home_dir SELinux Boolean + By default, the SELinux boolean tftp_home_dir is disabled. +If this setting is enabled, it should be disabled. + +To disable the tftp_home_dir SELinux boolean, run the following command: +$ sudo setsebool -P tftp_home_dir off + + - name: Disable the tftp_home_dir SELinux Boolean - Ensure python3-libsemanage Installed + package: + name: python3-libsemanage + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - sebool_tftp_home_dir - name: XCCDF Value var_tftp_home_dir # promote to variable set_fact: var_tftp_home_dir: !!str @@ -243017,23 +243159,7 @@ fi - no_reboot_needed - sebool_tftp_home_dir - - - - - - - - - - Disable the tmpreaper_use_nfs SELinux Boolean - By default, the SELinux boolean tmpreaper_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the tmpreaper_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P tmpreaper_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243043,9 +243169,9 @@ fi if selinuxenabled; then - var_tmpreaper_use_nfs='' + var_tftp_home_dir='' - setsebool -P tmpreaper_use_nfs $var_tmpreaper_use_nfs + setsebool -P tftp_home_dir $var_tftp_home_dir else echo "Skipping remediation, SELinux is disabled"; @@ -243056,6 +243182,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tmpreaper_use_nfs SELinux Boolean + By default, the SELinux boolean tmpreaper_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the tmpreaper_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P tmpreaper_use_nfs off + - name: Disable the tmpreaper_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243092,23 +243234,7 @@ fi - no_reboot_needed - sebool_tmpreaper_use_nfs - - - - - - - - - - Disable the tmpreaper_use_samba SELinux Boolean - By default, the SELinux boolean tmpreaper_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the tmpreaper_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P tmpreaper_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243118,9 +243244,9 @@ fi if selinuxenabled; then - var_tmpreaper_use_samba='' + var_tmpreaper_use_nfs='' - setsebool -P tmpreaper_use_samba $var_tmpreaper_use_samba + setsebool -P tmpreaper_use_nfs $var_tmpreaper_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -243131,6 +243257,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tmpreaper_use_samba SELinux Boolean + By default, the SELinux boolean tmpreaper_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the tmpreaper_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P tmpreaper_use_samba off + - name: Disable the tmpreaper_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243167,23 +243309,7 @@ fi - no_reboot_needed - sebool_tmpreaper_use_samba - - - - - - - - - - Disable the tor_bind_all_unreserved_ports SELinux Boolean - By default, the SELinux boolean tor_bind_all_unreserved_ports is disabled. -If this setting is enabled, it should be disabled. - -To disable the tor_bind_all_unreserved_ports SELinux boolean, run the following command: -$ sudo setsebool -P tor_bind_all_unreserved_ports off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243193,9 +243319,9 @@ fi if selinuxenabled; then - var_tor_bind_all_unreserved_ports='' + var_tmpreaper_use_samba='' - setsebool -P tor_bind_all_unreserved_ports $var_tor_bind_all_unreserved_ports + setsebool -P tmpreaper_use_samba $var_tmpreaper_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -243206,6 +243332,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tor_bind_all_unreserved_ports SELinux Boolean + By default, the SELinux boolean tor_bind_all_unreserved_ports is disabled. +If this setting is enabled, it should be disabled. + +To disable the tor_bind_all_unreserved_ports SELinux boolean, run the following command: +$ sudo setsebool -P tor_bind_all_unreserved_ports off + - name: Disable the tor_bind_all_unreserved_ports SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243242,23 +243384,7 @@ fi - no_reboot_needed - sebool_tor_bind_all_unreserved_ports - - - - - - - - - - Disable the tor_can_network_relay SELinux Boolean - By default, the SELinux boolean tor_can_network_relay is disabled. -If this setting is enabled, it should be disabled. - -To disable the tor_can_network_relay SELinux boolean, run the following command: -$ sudo setsebool -P tor_can_network_relay off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243268,9 +243394,9 @@ fi if selinuxenabled; then - var_tor_can_network_relay='' + var_tor_bind_all_unreserved_ports='' - setsebool -P tor_can_network_relay $var_tor_can_network_relay + setsebool -P tor_bind_all_unreserved_ports $var_tor_bind_all_unreserved_ports else echo "Skipping remediation, SELinux is disabled"; @@ -243281,6 +243407,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the tor_can_network_relay SELinux Boolean + By default, the SELinux boolean tor_can_network_relay is disabled. +If this setting is enabled, it should be disabled. + +To disable the tor_can_network_relay SELinux boolean, run the following command: +$ sudo setsebool -P tor_can_network_relay off + - name: Disable the tor_can_network_relay SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243317,23 +243459,7 @@ fi - no_reboot_needed - sebool_tor_can_network_relay - - - - - - - - - - Enable the unconfined_chrome_sandbox_transition SELinux Boolean - By default, the SELinux boolean unconfined_chrome_sandbox_transition is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_chrome_sandbox_transition SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_chrome_sandbox_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243343,9 +243469,9 @@ fi if selinuxenabled; then - var_unconfined_chrome_sandbox_transition='' + var_tor_can_network_relay='' - setsebool -P unconfined_chrome_sandbox_transition $var_unconfined_chrome_sandbox_transition + setsebool -P tor_can_network_relay $var_tor_can_network_relay else echo "Skipping remediation, SELinux is disabled"; @@ -243356,6 +243482,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_chrome_sandbox_transition SELinux Boolean + By default, the SELinux boolean unconfined_chrome_sandbox_transition is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_chrome_sandbox_transition SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_chrome_sandbox_transition on + - name: Enable the unconfined_chrome_sandbox_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243392,23 +243534,7 @@ fi - no_reboot_needed - sebool_unconfined_chrome_sandbox_transition - - - - - - - - - - Enable the unconfined_login SELinux Boolean - By default, the SELinux boolean unconfined_login is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_login SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_login on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243418,9 +243544,9 @@ fi if selinuxenabled; then - var_unconfined_login='' + var_unconfined_chrome_sandbox_transition='' - setsebool -P unconfined_login $var_unconfined_login + setsebool -P unconfined_chrome_sandbox_transition $var_unconfined_chrome_sandbox_transition else echo "Skipping remediation, SELinux is disabled"; @@ -243431,6 +243557,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_login SELinux Boolean + By default, the SELinux boolean unconfined_login is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_login SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_login on + - name: Enable the unconfined_login SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -243466,23 +243608,7 @@ fi - no_reboot_needed - sebool_unconfined_login - - - - - - - - - - Enable the unconfined_mozilla_plugin_transition SELinux Boolean - By default, the SELinux boolean unconfined_mozilla_plugin_transition is enabled. -If this setting is disabled, it should be enabled. - -To enable the unconfined_mozilla_plugin_transition SELinux boolean, run the following command: -$ sudo setsebool -P unconfined_mozilla_plugin_transition on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243492,9 +243618,9 @@ fi if selinuxenabled; then - var_unconfined_mozilla_plugin_transition='' + var_unconfined_login='' - setsebool -P unconfined_mozilla_plugin_transition $var_unconfined_mozilla_plugin_transition + setsebool -P unconfined_login $var_unconfined_login else echo "Skipping remediation, SELinux is disabled"; @@ -243505,6 +243631,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the unconfined_mozilla_plugin_transition SELinux Boolean + By default, the SELinux boolean unconfined_mozilla_plugin_transition is enabled. +If this setting is disabled, it should be enabled. + +To enable the unconfined_mozilla_plugin_transition SELinux boolean, run the following command: +$ sudo setsebool -P unconfined_mozilla_plugin_transition on + - name: Enable the unconfined_mozilla_plugin_transition SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243541,23 +243683,7 @@ fi - no_reboot_needed - sebool_unconfined_mozilla_plugin_transition - - - - - - - - - - Disable the unprivuser_use_svirt SELinux Boolean - By default, the SELinux boolean unprivuser_use_svirt is disabled. -If this setting is enabled, it should be disabled. - -To disable the unprivuser_use_svirt SELinux boolean, run the following command: -$ sudo setsebool -P unprivuser_use_svirt off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243567,9 +243693,9 @@ fi if selinuxenabled; then - var_unprivuser_use_svirt='' + var_unconfined_mozilla_plugin_transition='' - setsebool -P unprivuser_use_svirt $var_unprivuser_use_svirt + setsebool -P unconfined_mozilla_plugin_transition $var_unconfined_mozilla_plugin_transition else echo "Skipping remediation, SELinux is disabled"; @@ -243580,6 +243706,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the unprivuser_use_svirt SELinux Boolean + By default, the SELinux boolean unprivuser_use_svirt is disabled. +If this setting is enabled, it should be disabled. + +To disable the unprivuser_use_svirt SELinux boolean, run the following command: +$ sudo setsebool -P unprivuser_use_svirt off + - name: Disable the unprivuser_use_svirt SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243616,23 +243758,7 @@ fi - no_reboot_needed - sebool_unprivuser_use_svirt - - - - - - - - - - Disable the use_ecryptfs_home_dirs SELinux Boolean - By default, the SELinux boolean use_ecryptfs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_ecryptfs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_ecryptfs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243642,9 +243768,9 @@ fi if selinuxenabled; then - var_use_ecryptfs_home_dirs='' + var_unprivuser_use_svirt='' - setsebool -P use_ecryptfs_home_dirs $var_use_ecryptfs_home_dirs + setsebool -P unprivuser_use_svirt $var_unprivuser_use_svirt else echo "Skipping remediation, SELinux is disabled"; @@ -243655,6 +243781,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_ecryptfs_home_dirs SELinux Boolean + By default, the SELinux boolean use_ecryptfs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_ecryptfs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_ecryptfs_home_dirs off + - name: Disable the use_ecryptfs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243691,23 +243833,7 @@ fi - no_reboot_needed - sebool_use_ecryptfs_home_dirs - - - - - - - - - - Disable the use_fusefs_home_dirs SELinux Boolean - By default, the SELinux boolean use_fusefs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_fusefs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_fusefs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243717,9 +243843,9 @@ fi if selinuxenabled; then - var_use_fusefs_home_dirs='' + var_use_ecryptfs_home_dirs='' - setsebool -P use_fusefs_home_dirs $var_use_fusefs_home_dirs + setsebool -P use_ecryptfs_home_dirs $var_use_ecryptfs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243730,6 +243856,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_fusefs_home_dirs SELinux Boolean + By default, the SELinux boolean use_fusefs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_fusefs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_fusefs_home_dirs off + - name: Disable the use_fusefs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243766,23 +243908,7 @@ fi - no_reboot_needed - sebool_use_fusefs_home_dirs - - - - - - - - - - Disable the use_lpd_server SELinux Boolean - By default, the SELinux boolean use_lpd_server is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_lpd_server SELinux boolean, run the following command: -$ sudo setsebool -P use_lpd_server off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243792,9 +243918,9 @@ fi if selinuxenabled; then - var_use_lpd_server='' + var_use_fusefs_home_dirs='' - setsebool -P use_lpd_server $var_use_lpd_server + setsebool -P use_fusefs_home_dirs $var_use_fusefs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243805,6 +243931,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_lpd_server SELinux Boolean + By default, the SELinux boolean use_lpd_server is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_lpd_server SELinux boolean, run the following command: +$ sudo setsebool -P use_lpd_server off + - name: Disable the use_lpd_server SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -243840,23 +243982,7 @@ fi - no_reboot_needed - sebool_use_lpd_server - - - - - - - - - - Disable the use_nfs_home_dirs SELinux Boolean - By default, the SELinux boolean use_nfs_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_nfs_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_nfs_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243866,9 +243992,9 @@ fi if selinuxenabled; then - var_use_nfs_home_dirs='' + var_use_lpd_server='' - setsebool -P use_nfs_home_dirs $var_use_nfs_home_dirs + setsebool -P use_lpd_server $var_use_lpd_server else echo "Skipping remediation, SELinux is disabled"; @@ -243879,6 +244005,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_nfs_home_dirs SELinux Boolean + By default, the SELinux boolean use_nfs_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_nfs_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_nfs_home_dirs off + - name: Disable the use_nfs_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243915,23 +244057,7 @@ fi - no_reboot_needed - sebool_use_nfs_home_dirs - - - - - - - - - - Disable the use_samba_home_dirs SELinux Boolean - By default, the SELinux boolean use_samba_home_dirs is disabled. -If this setting is enabled, it should be disabled. - -To disable the use_samba_home_dirs SELinux boolean, run the following command: -$ sudo setsebool -P use_samba_home_dirs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -243941,9 +244067,9 @@ fi if selinuxenabled; then - var_use_samba_home_dirs='' + var_use_nfs_home_dirs='' - setsebool -P use_samba_home_dirs $var_use_samba_home_dirs + setsebool -P use_nfs_home_dirs $var_use_nfs_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -243954,6 +244080,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the use_samba_home_dirs SELinux Boolean + By default, the SELinux boolean use_samba_home_dirs is disabled. +If this setting is enabled, it should be disabled. + +To disable the use_samba_home_dirs SELinux boolean, run the following command: +$ sudo setsebool -P use_samba_home_dirs off + - name: Disable the use_samba_home_dirs SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -243990,23 +244132,7 @@ fi - no_reboot_needed - sebool_use_samba_home_dirs - - - - - - - - - - Enable the user_exec_content SELinux Boolean - By default, the SELinux boolean user_exec_content is enabled. -If this setting is disabled, it should be enabled. - -To enable the user_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P user_exec_content on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244016,9 +244142,9 @@ fi if selinuxenabled; then - var_user_exec_content='' + var_use_samba_home_dirs='' - setsebool -P user_exec_content $var_user_exec_content + setsebool -P use_samba_home_dirs $var_use_samba_home_dirs else echo "Skipping remediation, SELinux is disabled"; @@ -244029,6 +244155,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the user_exec_content SELinux Boolean + By default, the SELinux boolean user_exec_content is enabled. +If this setting is disabled, it should be enabled. + +To enable the user_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P user_exec_content on + - name: Enable the user_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244065,23 +244207,7 @@ fi - no_reboot_needed - sebool_user_exec_content - - - - - - - - - - Disable the varnishd_connect_any SELinux Boolean - By default, the SELinux boolean varnishd_connect_any is disabled. -If this setting is enabled, it should be disabled. - -To disable the varnishd_connect_any SELinux boolean, run the following command: -$ sudo setsebool -P varnishd_connect_any off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244091,9 +244217,9 @@ fi if selinuxenabled; then - var_varnishd_connect_any='' + var_user_exec_content='' - setsebool -P varnishd_connect_any $var_varnishd_connect_any + setsebool -P user_exec_content $var_user_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -244104,6 +244230,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the varnishd_connect_any SELinux Boolean + By default, the SELinux boolean varnishd_connect_any is disabled. +If this setting is enabled, it should be disabled. + +To disable the varnishd_connect_any SELinux boolean, run the following command: +$ sudo setsebool -P varnishd_connect_any off + - name: Disable the varnishd_connect_any SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244140,23 +244282,7 @@ fi - no_reboot_needed - sebool_varnishd_connect_any - - - - - - - - - - Disable the virt_read_qemu_ga_data SELinux Boolean - By default, the SELinux boolean virt_read_qemu_ga_data is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_read_qemu_ga_data SELinux boolean, run the following command: -$ sudo setsebool -P virt_read_qemu_ga_data off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244166,9 +244292,9 @@ fi if selinuxenabled; then - var_virt_read_qemu_ga_data='' + var_varnishd_connect_any='' - setsebool -P virt_read_qemu_ga_data $var_virt_read_qemu_ga_data + setsebool -P varnishd_connect_any $var_varnishd_connect_any else echo "Skipping remediation, SELinux is disabled"; @@ -244179,6 +244305,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_read_qemu_ga_data SELinux Boolean + By default, the SELinux boolean virt_read_qemu_ga_data is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_read_qemu_ga_data SELinux boolean, run the following command: +$ sudo setsebool -P virt_read_qemu_ga_data off + - name: Disable the virt_read_qemu_ga_data SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244215,23 +244357,7 @@ fi - no_reboot_needed - sebool_virt_read_qemu_ga_data - - - - - - - - - - Disable the virt_rw_qemu_ga_data SELinux Boolean - By default, the SELinux boolean virt_rw_qemu_ga_data is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_rw_qemu_ga_data SELinux boolean, run the following command: -$ sudo setsebool -P virt_rw_qemu_ga_data off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244241,9 +244367,9 @@ fi if selinuxenabled; then - var_virt_rw_qemu_ga_data='' + var_virt_read_qemu_ga_data='' - setsebool -P virt_rw_qemu_ga_data $var_virt_rw_qemu_ga_data + setsebool -P virt_read_qemu_ga_data $var_virt_read_qemu_ga_data else echo "Skipping remediation, SELinux is disabled"; @@ -244254,6 +244380,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_rw_qemu_ga_data SELinux Boolean + By default, the SELinux boolean virt_rw_qemu_ga_data is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_rw_qemu_ga_data SELinux boolean, run the following command: +$ sudo setsebool -P virt_rw_qemu_ga_data off + - name: Disable the virt_rw_qemu_ga_data SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244290,23 +244432,7 @@ fi - no_reboot_needed - sebool_virt_rw_qemu_ga_data - - - - - - - - - - Disable the virt_sandbox_use_all_caps SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_all_caps is enabled. -This setting is disabled as containers should not run with privileges. - -To disable the virt_sandbox_use_all_caps SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_all_caps off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244316,9 +244442,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_all_caps='' + var_virt_rw_qemu_ga_data='' - setsebool -P virt_sandbox_use_all_caps $var_virt_sandbox_use_all_caps + setsebool -P virt_rw_qemu_ga_data $var_virt_rw_qemu_ga_data else echo "Skipping remediation, SELinux is disabled"; @@ -244329,6 +244455,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_all_caps SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_all_caps is enabled. +This setting is disabled as containers should not run with privileges. + +To disable the virt_sandbox_use_all_caps SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_all_caps off + - name: Disable the virt_sandbox_use_all_caps SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244365,24 +244507,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_all_caps - - - - - - - - - - Enable the virt_sandbox_use_audit SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_audit is enabled. -If this setting is disabled, it should be enabled to allow sandboxed containers -to send audit messages. - -To enable the virt_sandbox_use_audit SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_audit on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244392,9 +244517,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_audit='' + var_virt_sandbox_use_all_caps='' - setsebool -P virt_sandbox_use_audit $var_virt_sandbox_use_audit + setsebool -P virt_sandbox_use_all_caps $var_virt_sandbox_use_all_caps else echo "Skipping remediation, SELinux is disabled"; @@ -244405,6 +244530,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the virt_sandbox_use_audit SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_audit is enabled. +If this setting is disabled, it should be enabled to allow sandboxed containers +to send audit messages. + +To enable the virt_sandbox_use_audit SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_audit on + - name: Enable the virt_sandbox_use_audit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244441,23 +244583,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_audit - - - - - - - - - - Disable the virt_sandbox_use_mknod SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_mknod is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_mknod SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_mknod off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244467,9 +244593,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_mknod='' + var_virt_sandbox_use_audit='' - setsebool -P virt_sandbox_use_mknod $var_virt_sandbox_use_mknod + setsebool -P virt_sandbox_use_audit $var_virt_sandbox_use_audit else echo "Skipping remediation, SELinux is disabled"; @@ -244480,6 +244606,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_mknod SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_mknod is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_mknod SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_mknod off + - name: Disable the virt_sandbox_use_mknod SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244516,23 +244658,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_mknod - - - - - - - - - - Disable the virt_sandbox_use_netlink SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_netlink is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_netlink SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_netlink off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244542,9 +244668,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_netlink='' + var_virt_sandbox_use_mknod='' - setsebool -P virt_sandbox_use_netlink $var_virt_sandbox_use_netlink + setsebool -P virt_sandbox_use_mknod $var_virt_sandbox_use_mknod else echo "Skipping remediation, SELinux is disabled"; @@ -244555,6 +244681,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_netlink SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_netlink is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_netlink SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_netlink off + - name: Disable the virt_sandbox_use_netlink SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244591,23 +244733,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_netlink - - - - - - - - - - Disable the virt_sandbox_use_sys_admin SELinux Boolean - By default, the SELinux boolean virt_sandbox_use_sys_admin is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_sandbox_use_sys_admin SELinux boolean, run the following command: -$ sudo setsebool -P virt_sandbox_use_sys_admin off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244617,9 +244743,9 @@ fi if selinuxenabled; then - var_virt_sandbox_use_sys_admin='' + var_virt_sandbox_use_netlink='' - setsebool -P virt_sandbox_use_sys_admin $var_virt_sandbox_use_sys_admin + setsebool -P virt_sandbox_use_netlink $var_virt_sandbox_use_netlink else echo "Skipping remediation, SELinux is disabled"; @@ -244630,6 +244756,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_sandbox_use_sys_admin SELinux Boolean + By default, the SELinux boolean virt_sandbox_use_sys_admin is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_sandbox_use_sys_admin SELinux boolean, run the following command: +$ sudo setsebool -P virt_sandbox_use_sys_admin off + - name: Disable the virt_sandbox_use_sys_admin SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244666,23 +244808,7 @@ fi - no_reboot_needed - sebool_virt_sandbox_use_sys_admin - - - - - - - - - - Disable the virt_transition_userdomain SELinux Boolean - By default, the SELinux boolean virt_transition_userdomain is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_transition_userdomain SELinux boolean, run the following command: -$ sudo setsebool -P virt_transition_userdomain off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244692,9 +244818,9 @@ fi if selinuxenabled; then - var_virt_transition_userdomain='' + var_virt_sandbox_use_sys_admin='' - setsebool -P virt_transition_userdomain $var_virt_transition_userdomain + setsebool -P virt_sandbox_use_sys_admin $var_virt_sandbox_use_sys_admin else echo "Skipping remediation, SELinux is disabled"; @@ -244705,6 +244831,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_transition_userdomain SELinux Boolean + By default, the SELinux boolean virt_transition_userdomain is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_transition_userdomain SELinux boolean, run the following command: +$ sudo setsebool -P virt_transition_userdomain off + - name: Disable the virt_transition_userdomain SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244741,23 +244883,7 @@ fi - no_reboot_needed - sebool_virt_transition_userdomain - - - - - - - - - - Disable the virt_use_comm SELinux Boolean - By default, the SELinux boolean virt_use_comm is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_comm SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_comm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244767,9 +244893,9 @@ fi if selinuxenabled; then - var_virt_use_comm='' + var_virt_transition_userdomain='' - setsebool -P virt_use_comm $var_virt_use_comm + setsebool -P virt_transition_userdomain $var_virt_transition_userdomain else echo "Skipping remediation, SELinux is disabled"; @@ -244780,6 +244906,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_comm SELinux Boolean + By default, the SELinux boolean virt_use_comm is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_comm SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_comm off + - name: Disable the virt_use_comm SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -244815,25 +244957,7 @@ fi - no_reboot_needed - sebool_virt_use_comm - - - - - - - - - - Disable the virt_use_execmem SELinux Boolean - By default, the SELinux boolean virt_use_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_execmem SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_execmem off - BP28(R67) - - CCE-83312-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244843,9 +244967,9 @@ fi if selinuxenabled; then - var_virt_use_execmem='' + var_virt_use_comm='' - setsebool -P virt_use_execmem $var_virt_use_execmem + setsebool -P virt_use_comm $var_virt_use_comm else echo "Skipping remediation, SELinux is disabled"; @@ -244856,6 +244980,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_execmem SELinux Boolean + By default, the SELinux boolean virt_use_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_execmem SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_execmem off + BP28(R67) + + CCE-83312-9 - name: Disable the virt_use_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -244894,23 +245036,7 @@ fi - no_reboot_needed - sebool_virt_use_execmem - - - - - - - - - - Disable the virt_use_fusefs SELinux Boolean - By default, the SELinux boolean virt_use_fusefs is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_fusefs SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_fusefs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244920,9 +245046,9 @@ fi if selinuxenabled; then - var_virt_use_fusefs='' + var_virt_use_execmem='' - setsebool -P virt_use_fusefs $var_virt_use_fusefs + setsebool -P virt_use_execmem $var_virt_use_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -244933,6 +245059,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_fusefs SELinux Boolean + By default, the SELinux boolean virt_use_fusefs is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_fusefs SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_fusefs off + - name: Disable the virt_use_fusefs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -244968,23 +245110,7 @@ fi - no_reboot_needed - sebool_virt_use_fusefs - - - - - - - - - - Disable the virt_use_nfs SELinux Boolean - By default, the SELinux boolean virt_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -244994,9 +245120,9 @@ fi if selinuxenabled; then - var_virt_use_nfs='' + var_virt_use_fusefs='' - setsebool -P virt_use_nfs $var_virt_use_nfs + setsebool -P virt_use_fusefs $var_virt_use_fusefs else echo "Skipping remediation, SELinux is disabled"; @@ -245007,6 +245133,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_nfs SELinux Boolean + By default, the SELinux boolean virt_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_nfs off + - name: Disable the virt_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245042,23 +245184,7 @@ fi - no_reboot_needed - sebool_virt_use_nfs - - - - - - - - - - Disable the virt_use_rawip SELinux Boolean - By default, the SELinux boolean virt_use_rawip is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_rawip SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_rawip off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245068,9 +245194,9 @@ fi if selinuxenabled; then - var_virt_use_rawip='' + var_virt_use_nfs='' - setsebool -P virt_use_rawip $var_virt_use_rawip + setsebool -P virt_use_nfs $var_virt_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -245081,6 +245207,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_rawip SELinux Boolean + By default, the SELinux boolean virt_use_rawip is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_rawip SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_rawip off + - name: Disable the virt_use_rawip SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245116,23 +245258,7 @@ fi - no_reboot_needed - sebool_virt_use_rawip - - - - - - - - - - Disable the virt_use_samba SELinux Boolean - By default, the SELinux boolean virt_use_samba is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_samba SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_samba off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245142,9 +245268,9 @@ fi if selinuxenabled; then - var_virt_use_samba='' + var_virt_use_rawip='' - setsebool -P virt_use_samba $var_virt_use_samba + setsebool -P virt_use_rawip $var_virt_use_rawip else echo "Skipping remediation, SELinux is disabled"; @@ -245155,6 +245281,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_samba SELinux Boolean + By default, the SELinux boolean virt_use_samba is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_samba SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_samba off + - name: Disable the virt_use_samba SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245190,23 +245332,7 @@ fi - no_reboot_needed - sebool_virt_use_samba - - - - - - - - - - Disable the virt_use_sanlock SELinux Boolean - By default, the SELinux boolean virt_use_sanlock is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_sanlock SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_sanlock off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245216,9 +245342,9 @@ fi if selinuxenabled; then - var_virt_use_sanlock='' + var_virt_use_samba='' - setsebool -P virt_use_sanlock $var_virt_use_sanlock + setsebool -P virt_use_samba $var_virt_use_samba else echo "Skipping remediation, SELinux is disabled"; @@ -245229,6 +245355,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_sanlock SELinux Boolean + By default, the SELinux boolean virt_use_sanlock is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_sanlock SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_sanlock off + - name: Disable the virt_use_sanlock SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245265,23 +245407,7 @@ fi - no_reboot_needed - sebool_virt_use_sanlock - - - - - - - - - - Disable the virt_use_usb SELinux Boolean - By default, the SELinux boolean virt_use_usb is enabled. -This setting should be disabled. - -To disable the virt_use_usb SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_usb off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245291,9 +245417,9 @@ fi if selinuxenabled; then - var_virt_use_usb='' + var_virt_use_sanlock='' - setsebool -P virt_use_usb $var_virt_use_usb + setsebool -P virt_use_sanlock $var_virt_use_sanlock else echo "Skipping remediation, SELinux is disabled"; @@ -245304,6 +245430,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_usb SELinux Boolean + By default, the SELinux boolean virt_use_usb is enabled. +This setting should be disabled. + +To disable the virt_use_usb SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_usb off + - name: Disable the virt_use_usb SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245339,23 +245481,7 @@ fi - no_reboot_needed - sebool_virt_use_usb - - - - - - - - - - Disable the virt_use_xserver SELinux Boolean - By default, the SELinux boolean virt_use_xserver is disabled. -If this setting is enabled, it should be disabled. - -To disable the virt_use_xserver SELinux boolean, run the following command: -$ sudo setsebool -P virt_use_xserver off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245365,9 +245491,9 @@ fi if selinuxenabled; then - var_virt_use_xserver='' + var_virt_use_usb='' - setsebool -P virt_use_xserver $var_virt_use_xserver + setsebool -P virt_use_usb $var_virt_use_usb else echo "Skipping remediation, SELinux is disabled"; @@ -245378,6 +245504,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the virt_use_xserver SELinux Boolean + By default, the SELinux boolean virt_use_xserver is disabled. +If this setting is enabled, it should be disabled. + +To disable the virt_use_xserver SELinux boolean, run the following command: +$ sudo setsebool -P virt_use_xserver off + - name: Disable the virt_use_xserver SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245414,23 +245556,7 @@ fi - no_reboot_needed - sebool_virt_use_xserver - - - - - - - - - - Disable the webadm_manage_user_files SELinux Boolean - By default, the SELinux boolean webadm_manage_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the webadm_manage_user_files SELinux boolean, run the following command: -$ sudo setsebool -P webadm_manage_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245440,9 +245566,9 @@ fi if selinuxenabled; then - var_webadm_manage_user_files='' + var_virt_use_xserver='' - setsebool -P webadm_manage_user_files $var_webadm_manage_user_files + setsebool -P virt_use_xserver $var_virt_use_xserver else echo "Skipping remediation, SELinux is disabled"; @@ -245453,6 +245579,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the webadm_manage_user_files SELinux Boolean + By default, the SELinux boolean webadm_manage_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the webadm_manage_user_files SELinux boolean, run the following command: +$ sudo setsebool -P webadm_manage_user_files off + - name: Disable the webadm_manage_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245489,23 +245631,7 @@ fi - no_reboot_needed - sebool_webadm_manage_user_files - - - - - - - - - - Disable the webadm_read_user_files SELinux Boolean - By default, the SELinux boolean webadm_read_user_files is disabled. -If this setting is enabled, it should be disabled. - -To disable the webadm_read_user_files SELinux boolean, run the following command: -$ sudo setsebool -P webadm_read_user_files off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245515,9 +245641,9 @@ fi if selinuxenabled; then - var_webadm_read_user_files='' + var_webadm_manage_user_files='' - setsebool -P webadm_read_user_files $var_webadm_read_user_files + setsebool -P webadm_manage_user_files $var_webadm_manage_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -245528,6 +245654,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the webadm_read_user_files SELinux Boolean + By default, the SELinux boolean webadm_read_user_files is disabled. +If this setting is enabled, it should be disabled. + +To disable the webadm_read_user_files SELinux boolean, run the following command: +$ sudo setsebool -P webadm_read_user_files off + - name: Disable the webadm_read_user_files SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245564,23 +245706,7 @@ fi - no_reboot_needed - sebool_webadm_read_user_files - - - - - - - - - - Disable the wine_mmap_zero_ignore SELinux Boolean - By default, the SELinux boolean wine_mmap_zero_ignore is disabled. -If this setting is enabled, it should be disabled. - -To disable the wine_mmap_zero_ignore SELinux boolean, run the following command: -$ sudo setsebool -P wine_mmap_zero_ignore off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245590,9 +245716,9 @@ fi if selinuxenabled; then - var_wine_mmap_zero_ignore='' + var_webadm_read_user_files='' - setsebool -P wine_mmap_zero_ignore $var_wine_mmap_zero_ignore + setsebool -P webadm_read_user_files $var_webadm_read_user_files else echo "Skipping remediation, SELinux is disabled"; @@ -245603,6 +245729,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the wine_mmap_zero_ignore SELinux Boolean + By default, the SELinux boolean wine_mmap_zero_ignore is disabled. +If this setting is enabled, it should be disabled. + +To disable the wine_mmap_zero_ignore SELinux boolean, run the following command: +$ sudo setsebool -P wine_mmap_zero_ignore off + - name: Disable the wine_mmap_zero_ignore SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245639,23 +245781,7 @@ fi - no_reboot_needed - sebool_wine_mmap_zero_ignore - - - - - - - - - - Disable the xdm_bind_vnc_tcp_port SELinux Boolean - By default, the SELinux boolean xdm_bind_vnc_tcp_port is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_bind_vnc_tcp_port SELinux boolean, run the following command: -$ sudo setsebool -P xdm_bind_vnc_tcp_port off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245665,9 +245791,9 @@ fi if selinuxenabled; then - var_xdm_bind_vnc_tcp_port='' + var_wine_mmap_zero_ignore='' - setsebool -P xdm_bind_vnc_tcp_port $var_xdm_bind_vnc_tcp_port + setsebool -P wine_mmap_zero_ignore $var_wine_mmap_zero_ignore else echo "Skipping remediation, SELinux is disabled"; @@ -245678,6 +245804,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_bind_vnc_tcp_port SELinux Boolean + By default, the SELinux boolean xdm_bind_vnc_tcp_port is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_bind_vnc_tcp_port SELinux boolean, run the following command: +$ sudo setsebool -P xdm_bind_vnc_tcp_port off + - name: Disable the xdm_bind_vnc_tcp_port SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245714,23 +245856,7 @@ fi - no_reboot_needed - sebool_xdm_bind_vnc_tcp_port - - - - - - - - - - Disable the xdm_exec_bootloader SELinux Boolean - By default, the SELinux boolean xdm_exec_bootloader is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_exec_bootloader SELinux boolean, run the following command: -$ sudo setsebool -P xdm_exec_bootloader off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245740,9 +245866,9 @@ fi if selinuxenabled; then - var_xdm_exec_bootloader='' + var_xdm_bind_vnc_tcp_port='' - setsebool -P xdm_exec_bootloader $var_xdm_exec_bootloader + setsebool -P xdm_bind_vnc_tcp_port $var_xdm_bind_vnc_tcp_port else echo "Skipping remediation, SELinux is disabled"; @@ -245753,6 +245879,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_exec_bootloader SELinux Boolean + By default, the SELinux boolean xdm_exec_bootloader is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_exec_bootloader SELinux boolean, run the following command: +$ sudo setsebool -P xdm_exec_bootloader off + - name: Disable the xdm_exec_bootloader SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245789,23 +245931,7 @@ fi - no_reboot_needed - sebool_xdm_exec_bootloader - - - - - - - - - - Disable the xdm_sysadm_login SELinux Boolean - By default, the SELinux boolean xdm_sysadm_login is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_sysadm_login SELinux boolean, run the following command: -$ sudo setsebool -P xdm_sysadm_login off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245815,9 +245941,9 @@ fi if selinuxenabled; then - var_xdm_sysadm_login='' + var_xdm_exec_bootloader='' - setsebool -P xdm_sysadm_login $var_xdm_sysadm_login + setsebool -P xdm_exec_bootloader $var_xdm_exec_bootloader else echo "Skipping remediation, SELinux is disabled"; @@ -245828,6 +245954,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_sysadm_login SELinux Boolean + By default, the SELinux boolean xdm_sysadm_login is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_sysadm_login SELinux boolean, run the following command: +$ sudo setsebool -P xdm_sysadm_login off + - name: Disable the xdm_sysadm_login SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -245864,23 +246006,7 @@ fi - no_reboot_needed - sebool_xdm_sysadm_login - - - - - - - - - - Disable the xdm_write_home SELinux Boolean - By default, the SELinux boolean xdm_write_home is disabled. -If this setting is enabled, it should be disabled. - -To disable the xdm_write_home SELinux boolean, run the following command: -$ sudo setsebool -P xdm_write_home off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245890,9 +246016,9 @@ fi if selinuxenabled; then - var_xdm_write_home='' + var_xdm_sysadm_login='' - setsebool -P xdm_write_home $var_xdm_write_home + setsebool -P xdm_sysadm_login $var_xdm_sysadm_login else echo "Skipping remediation, SELinux is disabled"; @@ -245903,6 +246029,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xdm_write_home SELinux Boolean + By default, the SELinux boolean xdm_write_home is disabled. +If this setting is enabled, it should be disabled. + +To disable the xdm_write_home SELinux boolean, run the following command: +$ sudo setsebool -P xdm_write_home off + - name: Disable the xdm_write_home SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -245938,23 +246080,7 @@ fi - no_reboot_needed - sebool_xdm_write_home - - - - - - - - - - Disable the xen_use_nfs SELinux Boolean - By default, the SELinux boolean xen_use_nfs is disabled. -If this setting is enabled, it should be disabled. - -To disable the xen_use_nfs SELinux boolean, run the following command: -$ sudo setsebool -P xen_use_nfs off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -245964,9 +246090,9 @@ fi if selinuxenabled; then - var_xen_use_nfs='' + var_xdm_write_home='' - setsebool -P xen_use_nfs $var_xen_use_nfs + setsebool -P xdm_write_home $var_xdm_write_home else echo "Skipping remediation, SELinux is disabled"; @@ -245977,6 +246103,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xen_use_nfs SELinux Boolean + By default, the SELinux boolean xen_use_nfs is disabled. +If this setting is enabled, it should be disabled. + +To disable the xen_use_nfs SELinux boolean, run the following command: +$ sudo setsebool -P xen_use_nfs off + - name: Disable the xen_use_nfs SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246012,23 +246154,7 @@ fi - no_reboot_needed - sebool_xen_use_nfs - - - - - - - - - - Enable the xend_run_blktap SELinux Boolean - By default, the SELinux boolean xend_run_blktap is enabled. -If this setting is disabled, it should be enabled. - -To enable the xend_run_blktap SELinux boolean, run the following command: -$ sudo setsebool -P xend_run_blktap on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246038,9 +246164,9 @@ fi if selinuxenabled; then - var_xend_run_blktap='' + var_xen_use_nfs='' - setsebool -P xend_run_blktap $var_xend_run_blktap + setsebool -P xen_use_nfs $var_xen_use_nfs else echo "Skipping remediation, SELinux is disabled"; @@ -246051,6 +246177,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the xend_run_blktap SELinux Boolean + By default, the SELinux boolean xend_run_blktap is enabled. +If this setting is disabled, it should be enabled. + +To enable the xend_run_blktap SELinux boolean, run the following command: +$ sudo setsebool -P xend_run_blktap on + - name: Enable the xend_run_blktap SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246086,23 +246228,7 @@ fi - no_reboot_needed - sebool_xend_run_blktap - - - - - - - - - - Enable the xend_run_qemu SELinux Boolean - By default, the SELinux boolean xend_run_qemu is enabled. -If this setting is disabled, it should be enabled. - -To enable the xend_run_qemu SELinux boolean, run the following command: -$ sudo setsebool -P xend_run_qemu on - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246112,9 +246238,9 @@ fi if selinuxenabled; then - var_xend_run_qemu='' + var_xend_run_blktap='' - setsebool -P xend_run_qemu $var_xend_run_qemu + setsebool -P xend_run_blktap $var_xend_run_blktap else echo "Skipping remediation, SELinux is disabled"; @@ -246125,6 +246251,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Enable the xend_run_qemu SELinux Boolean + By default, the SELinux boolean xend_run_qemu is enabled. +If this setting is disabled, it should be enabled. + +To enable the xend_run_qemu SELinux boolean, run the following command: +$ sudo setsebool -P xend_run_qemu on + - name: Enable the xend_run_qemu SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246160,24 +246302,7 @@ fi - no_reboot_needed - sebool_xend_run_qemu - - - - - - - - - - Disable the xguest_connect_network SELinux Boolean - By default, the SELinux boolean xguest_connect_network is enabled. -This setting should be disabled as guest users should not be able to configure -NetworkManager. - -To disable the xguest_connect_network SELinux boolean, run the following command: -$ sudo setsebool -P xguest_connect_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246187,9 +246312,9 @@ fi if selinuxenabled; then - var_xguest_connect_network='' + var_xend_run_qemu='' - setsebool -P xguest_connect_network $var_xguest_connect_network + setsebool -P xend_run_qemu $var_xend_run_qemu else echo "Skipping remediation, SELinux is disabled"; @@ -246200,6 +246325,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_connect_network SELinux Boolean + By default, the SELinux boolean xguest_connect_network is enabled. +This setting should be disabled as guest users should not be able to configure +NetworkManager. + +To disable the xguest_connect_network SELinux boolean, run the following command: +$ sudo setsebool -P xguest_connect_network off + - name: Disable the xguest_connect_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246236,24 +246378,7 @@ fi - no_reboot_needed - sebool_xguest_connect_network - - - - - - - - - - Disable the xguest_exec_content SELinux Boolean - By default, the SELinux boolean xguest_exec_content is enabled. -This setting should be disabled as guest users should not be able to run -executables. - -To disable the xguest_exec_content SELinux boolean, run the following command: -$ sudo setsebool -P xguest_exec_content off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246263,9 +246388,9 @@ fi if selinuxenabled; then - var_xguest_exec_content='' + var_xguest_connect_network='' - setsebool -P xguest_exec_content $var_xguest_exec_content + setsebool -P xguest_connect_network $var_xguest_connect_network else echo "Skipping remediation, SELinux is disabled"; @@ -246276,6 +246401,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_exec_content SELinux Boolean + By default, the SELinux boolean xguest_exec_content is enabled. +This setting should be disabled as guest users should not be able to run +executables. + +To disable the xguest_exec_content SELinux boolean, run the following command: +$ sudo setsebool -P xguest_exec_content off + - name: Disable the xguest_exec_content SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246312,24 +246454,7 @@ fi - no_reboot_needed - sebool_xguest_exec_content - - - - - - - - - - Disable the xguest_mount_media SELinux Boolean - By default, the SELinux boolean xguest_mount_media is enabled. -This setting should be disabled as guest users should not be able to mount -any media. - -To disable the xguest_mount_media SELinux boolean, run the following command: -$ sudo setsebool -P xguest_mount_media off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246339,9 +246464,9 @@ fi if selinuxenabled; then - var_xguest_mount_media='' + var_xguest_exec_content='' - setsebool -P xguest_mount_media $var_xguest_mount_media + setsebool -P xguest_exec_content $var_xguest_exec_content else echo "Skipping remediation, SELinux is disabled"; @@ -246352,6 +246477,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_mount_media SELinux Boolean + By default, the SELinux boolean xguest_mount_media is enabled. +This setting should be disabled as guest users should not be able to mount +any media. + +To disable the xguest_mount_media SELinux boolean, run the following command: +$ sudo setsebool -P xguest_mount_media off + - name: Disable the xguest_mount_media SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246388,24 +246530,7 @@ fi - no_reboot_needed - sebool_xguest_mount_media - - - - - - - - - - Disable the xguest_use_bluetooth SELinux Boolean - By default, the SELinux boolean xguest_use_bluetooth is enabled. -This setting should be disabled as guests users should not be able to access -or use bluetooth. - -To disable the xguest_use_bluetooth SELinux boolean, run the following command: -$ sudo setsebool -P xguest_use_bluetooth off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246415,9 +246540,9 @@ fi if selinuxenabled; then - var_xguest_use_bluetooth='' + var_xguest_mount_media='' - setsebool -P xguest_use_bluetooth $var_xguest_use_bluetooth + setsebool -P xguest_mount_media $var_xguest_mount_media else echo "Skipping remediation, SELinux is disabled"; @@ -246428,6 +246553,23 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xguest_use_bluetooth SELinux Boolean + By default, the SELinux boolean xguest_use_bluetooth is enabled. +This setting should be disabled as guests users should not be able to access +or use bluetooth. + +To disable the xguest_use_bluetooth SELinux boolean, run the following command: +$ sudo setsebool -P xguest_use_bluetooth off + - name: Disable the xguest_use_bluetooth SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246464,23 +246606,7 @@ fi - no_reboot_needed - sebool_xguest_use_bluetooth - - - - - - - - - - Disable the xserver_clients_write_xshm SELinux Boolean - By default, the SELinux boolean xserver_clients_write_xshm is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_clients_write_xshm SELinux boolean, run the following command: -$ sudo setsebool -P xserver_clients_write_xshm off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246490,9 +246616,9 @@ fi if selinuxenabled; then - var_xserver_clients_write_xshm='' + var_xguest_use_bluetooth='' - setsebool -P xserver_clients_write_xshm $var_xserver_clients_write_xshm + setsebool -P xguest_use_bluetooth $var_xguest_use_bluetooth else echo "Skipping remediation, SELinux is disabled"; @@ -246503,6 +246629,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_clients_write_xshm SELinux Boolean + By default, the SELinux boolean xserver_clients_write_xshm is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_clients_write_xshm SELinux boolean, run the following command: +$ sudo setsebool -P xserver_clients_write_xshm off + - name: Disable the xserver_clients_write_xshm SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246539,25 +246681,7 @@ fi - no_reboot_needed - sebool_xserver_clients_write_xshm - - - - - - - - - - Disable the xserver_execmem SELinux Boolean - By default, the SELinux boolean xserver_execmem is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_execmem SELinux boolean, run the following command: -$ sudo setsebool -P xserver_execmem off - BP28(R67) - - CCE-83313-7 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246567,9 +246691,9 @@ fi if selinuxenabled; then - var_xserver_execmem='' + var_xserver_clients_write_xshm='' - setsebool -P xserver_execmem $var_xserver_execmem + setsebool -P xserver_clients_write_xshm $var_xserver_clients_write_xshm else echo "Skipping remediation, SELinux is disabled"; @@ -246580,6 +246704,24 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_execmem SELinux Boolean + By default, the SELinux boolean xserver_execmem is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_execmem SELinux boolean, run the following command: +$ sudo setsebool -P xserver_execmem off + BP28(R67) + + CCE-83313-7 - name: Disable the xserver_execmem SELinux Boolean - Ensure python3-libsemanage Installed package: name: python3-libsemanage @@ -246617,23 +246759,7 @@ fi - no_reboot_needed - sebool_xserver_execmem - - - - - - - - - - Disable the xserver_object_manager SELinux Boolean - By default, the SELinux boolean xserver_object_manager is disabled. -If this setting is enabled, it should be disabled. - -To disable the xserver_object_manager SELinux boolean, run the following command: -$ sudo setsebool -P xserver_object_manager off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246643,9 +246769,9 @@ fi if selinuxenabled; then - var_xserver_object_manager='' + var_xserver_execmem='' - setsebool -P xserver_object_manager $var_xserver_object_manager + setsebool -P xserver_execmem $var_xserver_execmem else echo "Skipping remediation, SELinux is disabled"; @@ -246656,6 +246782,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the xserver_object_manager SELinux Boolean + By default, the SELinux boolean xserver_object_manager is disabled. +If this setting is enabled, it should be disabled. + +To disable the xserver_object_manager SELinux boolean, run the following command: +$ sudo setsebool -P xserver_object_manager off + - name: Disable the xserver_object_manager SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246692,23 +246834,7 @@ fi - no_reboot_needed - sebool_xserver_object_manager - - - - - - - - - - Disable the zabbix_can_network SELinux Boolean - By default, the SELinux boolean zabbix_can_network is disabled. -If this setting is enabled, it should be disabled. - -To disable the zabbix_can_network SELinux boolean, run the following command: -$ sudo setsebool -P zabbix_can_network off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246718,9 +246844,9 @@ fi if selinuxenabled; then - var_zabbix_can_network='' + var_xserver_object_manager='' - setsebool -P zabbix_can_network $var_zabbix_can_network + setsebool -P xserver_object_manager $var_xserver_object_manager else echo "Skipping remediation, SELinux is disabled"; @@ -246731,6 +246857,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zabbix_can_network SELinux Boolean + By default, the SELinux boolean zabbix_can_network is disabled. +If this setting is enabled, it should be disabled. + +To disable the zabbix_can_network SELinux boolean, run the following command: +$ sudo setsebool -P zabbix_can_network off + - name: Disable the zabbix_can_network SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246767,23 +246909,7 @@ fi - no_reboot_needed - sebool_zabbix_can_network - - - - - - - - - - Disable the zarafa_setrlimit SELinux Boolean - By default, the SELinux boolean zarafa_setrlimit is disabled. -If this setting is enabled, it should be disabled. - -To disable the zarafa_setrlimit SELinux boolean, run the following command: -$ sudo setsebool -P zarafa_setrlimit off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246793,9 +246919,9 @@ fi if selinuxenabled; then - var_zarafa_setrlimit='' + var_zabbix_can_network='' - setsebool -P zarafa_setrlimit $var_zarafa_setrlimit + setsebool -P zabbix_can_network $var_zabbix_can_network else echo "Skipping remediation, SELinux is disabled"; @@ -246806,6 +246932,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zarafa_setrlimit SELinux Boolean + By default, the SELinux boolean zarafa_setrlimit is disabled. +If this setting is enabled, it should be disabled. + +To disable the zarafa_setrlimit SELinux boolean, run the following command: +$ sudo setsebool -P zarafa_setrlimit off + - name: Disable the zarafa_setrlimit SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246842,23 +246984,7 @@ fi - no_reboot_needed - sebool_zarafa_setrlimit - - - - - - - - - - Disable the zebra_write_config SELinux Boolean - By default, the SELinux boolean zebra_write_config is disabled. -If this setting is enabled, it should be disabled. - -To disable the zebra_write_config SELinux boolean, run the following command: -$ sudo setsebool -P zebra_write_config off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246868,9 +246994,9 @@ fi if selinuxenabled; then - var_zebra_write_config='' + var_zarafa_setrlimit='' - setsebool -P zebra_write_config $var_zebra_write_config + setsebool -P zarafa_setrlimit $var_zarafa_setrlimit else echo "Skipping remediation, SELinux is disabled"; @@ -246881,6 +247007,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zebra_write_config SELinux Boolean + By default, the SELinux boolean zebra_write_config is disabled. +If this setting is enabled, it should be disabled. + +To disable the zebra_write_config SELinux boolean, run the following command: +$ sudo setsebool -P zebra_write_config off + - name: Disable the zebra_write_config SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -246917,23 +247059,7 @@ fi - no_reboot_needed - sebool_zebra_write_config - - - - - - - - - - Disable the zoneminder_anon_write SELinux Boolean - By default, the SELinux boolean zoneminder_anon_write is disabled. -If this setting is enabled, it should be disabled. - -To disable the zoneminder_anon_write SELinux boolean, run the following command: -$ sudo setsebool -P zoneminder_anon_write off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -246943,9 +247069,9 @@ fi if selinuxenabled; then - var_zoneminder_anon_write='' + var_zebra_write_config='' - setsebool -P zoneminder_anon_write $var_zoneminder_anon_write + setsebool -P zebra_write_config $var_zebra_write_config else echo "Skipping remediation, SELinux is disabled"; @@ -246956,10 +247082,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable the zoneminder_anon_write SELinux Boolean - Ensure python3-libsemanage - Installed - package: - name: python3-libsemanage + + + + + + + + + + Disable the zoneminder_anon_write SELinux Boolean + By default, the SELinux boolean zoneminder_anon_write is disabled. +If this setting is enabled, it should be disabled. + +To disable the zoneminder_anon_write SELinux boolean, run the following command: +$ sudo setsebool -P zoneminder_anon_write off + + - name: Disable the zoneminder_anon_write SELinux Boolean - Ensure python3-libsemanage + Installed + package: + name: python3-libsemanage state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: @@ -246992,23 +247134,7 @@ fi - no_reboot_needed - sebool_zoneminder_anon_write - - - - - - - - - - Disable the zoneminder_run_sudo SELinux Boolean - By default, the SELinux boolean zoneminder_run_sudo is disabled. -If this setting is enabled, it should be disabled. - -To disable the zoneminder_run_sudo SELinux boolean, run the following command: -$ sudo setsebool -P zoneminder_run_sudo off - - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if ! rpm -q --quiet "python3-libsemanage" ; then @@ -247018,9 +247144,9 @@ fi if selinuxenabled; then - var_zoneminder_run_sudo='' + var_zoneminder_anon_write='' - setsebool -P zoneminder_run_sudo $var_zoneminder_run_sudo + setsebool -P zoneminder_anon_write $var_zoneminder_anon_write else echo "Skipping remediation, SELinux is disabled"; @@ -247031,6 +247157,22 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable the zoneminder_run_sudo SELinux Boolean + By default, the SELinux boolean zoneminder_run_sudo is disabled. +If this setting is enabled, it should be disabled. + +To disable the zoneminder_run_sudo SELinux boolean, run the following command: +$ sudo setsebool -P zoneminder_run_sudo off + - name: Disable the zoneminder_run_sudo SELinux Boolean - Ensure python3-libsemanage Installed package: @@ -247066,6 +247208,29 @@ fi - medium_severity - no_reboot_needed - sebool_zoneminder_run_sudo + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "python3-libsemanage" ; then + yum install -y "python3-libsemanage" +fi + + +if selinuxenabled; then + + var_zoneminder_run_sudo='' + + setsebool -P zoneminder_run_sudo $var_zoneminder_run_sudo + +else + echo "Skipping remediation, SELinux is disabled"; + false +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -247594,8 +247759,21 @@ the avahi-autoipd and avahi packages can be uninstalled. system functionality. It is recommended to remove this package to reduce the potential attack surface. CCE-86515-4 - -package --remove=avahi-autoipd + - name: Ensure avahi-autoipd is removed + package: + name: avahi-autoipd + state: absent + tags: + - CCE-86515-4 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_avahi-autoipd_removed include remove_avahi-autoipd @@ -247604,6 +247782,9 @@ class remove_avahi-autoipd { ensure => 'purged', } } + + +package --remove=avahi-autoipd # CAUTION: This remediation script will remove avahi-autoipd @@ -247617,22 +247798,6 @@ if rpm -q --quiet "avahi-autoipd" ; then yum remove -y "avahi-autoipd" fi - - - name: Ensure avahi-autoipd is removed - package: - name: avahi-autoipd - state: absent - tags: - - CCE-86515-4 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_avahi-autoipd_removed @@ -247719,8 +247884,21 @@ the avahi-autoipd and avahi packages can be uninstalled. system functionality. It is recommended to remove this package to reduce the potential attack surface. CCE-86512-1 - -package --remove=avahi + - name: Ensure avahi is removed + package: + name: avahi + state: absent + tags: + - CCE-86512-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_avahi_removed include remove_avahi @@ -247729,6 +247907,9 @@ class remove_avahi { ensure => 'purged', } } + + +package --remove=avahi # CAUTION: This remediation script will remove avahi @@ -247742,22 +247923,6 @@ if rpm -q --quiet "avahi" ; then yum remove -y "avahi" fi - - - name: Ensure avahi is removed - package: - name: avahi - state: absent - tags: - - CCE-86512-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_avahi_removed @@ -247847,55 +248012,6 @@ is convenient but is only appropriate if the local network can be trusted. CCE-82188-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: avahi-daemon.service - enabled: false - mask: true - - name: avahi-daemon.socket - enabled: false - mask: true - - include disable_avahi-daemon - -class disable_avahi-daemon { - service {'avahi-daemon': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q avahi ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'avahi-daemon.service' -"$SYSTEMCTL_EXEC" disable 'avahi-daemon.service' -"$SYSTEMCTL_EXEC" mask 'avahi-daemon.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files avahi-daemon.socket; then - "$SYSTEMCTL_EXEC" stop 'avahi-daemon.socket' - "$SYSTEMCTL_EXEC" mask 'avahi-daemon.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'avahi-daemon.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["avahi-daemon"] - - name: Gather the package facts package_facts: manager: auto @@ -247987,6 +248103,55 @@ disabled = ["avahi-daemon"] - medium_severity - no_reboot_needed - service_avahi-daemon_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: avahi-daemon.service + enabled: false + mask: true + - name: avahi-daemon.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["avahi-daemon"] + + include disable_avahi-daemon + +class disable_avahi-daemon { + service {'avahi-daemon': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q avahi ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'avahi-daemon.service' +"$SYSTEMCTL_EXEC" disable 'avahi-daemon.service' +"$SYSTEMCTL_EXEC" mask 'avahi-daemon.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files avahi-daemon.socket; then + "$SYSTEMCTL_EXEC" stop 'avahi-daemon.socket' + "$SYSTEMCTL_EXEC" mask 'avahi-daemon.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'avahi-daemon.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248136,27 +248301,6 @@ view into some user activities. However, it should be noted that the auditing system and its audit records provide more authoritative and comprehensive records. CCE-82404-5 - -package --add=psacct - - include install_psacct - -class install_psacct { - package { 'psacct': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "psacct" ; then - yum install -y "psacct" -fi - - -[[packages]] -name = "psacct" -version = "*" - - name: Ensure psacct is installed package: name: psacct @@ -248171,6 +248315,27 @@ version = "*" - low_severity - no_reboot_needed - package_psacct_installed + + +[[packages]] +name = "psacct" +version = "*" + + include install_psacct + +class install_psacct { + package { 'psacct': + ensure => 'installed', + } +} + + +package --add=psacct + + +if ! rpm -q --quiet "psacct" ; then + yum install -y "psacct" +fi @@ -248197,8 +248362,19 @@ $ sudo yum erase abrt vulnerabilities in software executing on the system, as well as sensitive information from within a process's address space or registers. CCE-80948-3 - -package --remove=abrt + - name: Ensure abrt is removed + package: + name: abrt + state: absent + tags: + - CCE-80948-3 + - DISA-STIG-RHEL-08-040001 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_abrt_removed include remove_abrt @@ -248207,6 +248383,9 @@ class remove_abrt { ensure => 'purged', } } + + +package --remove=abrt # CAUTION: This remediation script will remove abrt @@ -248220,20 +248399,6 @@ if rpm -q --quiet "abrt" ; then yum remove -y "abrt" fi - - - name: Ensure abrt is removed - package: - name: abrt - state: absent - tags: - - CCE-80948-3 - - DISA-STIG-RHEL-08-040001 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_abrt_removed @@ -248374,31 +248539,6 @@ system and its audit records provide more authoritative and comprehensive records. CCE-82401-1 - include enable_psacct - -class enable_psacct { - service {'psacct': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'psacct.service' -"$SYSTEMCTL_EXEC" start 'psacct.service' -"$SYSTEMCTL_EXEC" enable 'psacct.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["psacct"] - - name: Enable service psacct block: @@ -248425,6 +248565,31 @@ enabled = ["psacct"] - low_severity - no_reboot_needed - service_psacct_enabled + + +[customizations.services] +enabled = ["psacct"] + + include enable_psacct + +class enable_psacct { + service {'psacct': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'psacct.service' +"$SYSTEMCTL_EXEC" start 'psacct.service' +"$SYSTEMCTL_EXEC" enable 'psacct.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248537,55 +248702,6 @@ vulnerabilities in software executing on the system, as well as sensitive information from within a process's address space or registers. CCE-80870-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: abrtd.service - enabled: false - mask: true - - name: abrtd.socket - enabled: false - mask: true - - include disable_abrtd - -class disable_abrtd { - service {'abrtd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'abrtd.service' -"$SYSTEMCTL_EXEC" disable 'abrtd.service' -"$SYSTEMCTL_EXEC" mask 'abrtd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files abrtd.socket; then - "$SYSTEMCTL_EXEC" stop 'abrtd.socket' - "$SYSTEMCTL_EXEC" mask 'abrtd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'abrtd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["abrtd"] - - name: Block Disable service abrtd block: @@ -248652,6 +248768,55 @@ disabled = ["abrtd"] - medium_severity - no_reboot_needed - service_abrtd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: abrtd.service + enabled: false + mask: true + - name: abrtd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["abrtd"] + + include disable_abrtd + +class disable_abrtd { + service {'abrtd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'abrtd.service' +"$SYSTEMCTL_EXEC" disable 'abrtd.service' +"$SYSTEMCTL_EXEC" mask 'abrtd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files abrtd.socket; then + "$SYSTEMCTL_EXEC" stop 'abrtd.socket' + "$SYSTEMCTL_EXEC" mask 'abrtd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'abrtd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248741,55 +248906,6 @@ accidental or trivially achievable denial of service situations and disabling it is appropriate. CCE-82407-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: acpid.service - enabled: false - mask: true - - name: acpid.socket - enabled: false - mask: true - - include disable_acpid - -class disable_acpid { - service {'acpid': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'acpid.service' -"$SYSTEMCTL_EXEC" disable 'acpid.service' -"$SYSTEMCTL_EXEC" mask 'acpid.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files acpid.socket; then - "$SYSTEMCTL_EXEC" stop 'acpid.socket' - "$SYSTEMCTL_EXEC" mask 'acpid.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'acpid.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["acpid"] - - name: Block Disable service acpid block: @@ -248859,6 +248975,55 @@ disabled = ["acpid"] - medium_severity - no_reboot_needed - service_acpid_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: acpid.service + enabled: false + mask: true + - name: acpid.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["acpid"] + + include disable_acpid + +class disable_acpid { + service {'acpid': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'acpid.service' +"$SYSTEMCTL_EXEC" disable 'acpid.service' +"$SYSTEMCTL_EXEC" mask 'acpid.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files acpid.socket; then + "$SYSTEMCTL_EXEC" stop 'acpid.socket' + "$SYSTEMCTL_EXEC" mask 'acpid.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'acpid.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -248948,55 +249113,6 @@ fulfilling some roles a PKI infrastructure, but its functionality is not necessa for many other use cases. CCE-82452-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: certmonger.service - enabled: false - mask: true - - name: certmonger.socket - enabled: false - mask: true - - include disable_certmonger - -class disable_certmonger { - service {'certmonger': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'certmonger.service' -"$SYSTEMCTL_EXEC" disable 'certmonger.service' -"$SYSTEMCTL_EXEC" mask 'certmonger.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files certmonger.socket; then - "$SYSTEMCTL_EXEC" stop 'certmonger.socket' - "$SYSTEMCTL_EXEC" mask 'certmonger.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'certmonger.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["certmonger"] - - name: Block Disable service certmonger block: @@ -249067,23 +249183,7 @@ disabled = ["certmonger"] - no_reboot_needed - service_certmonger_disabled - - - - - - - - - Disable Cockpit Management Server - The Cockpit Management Server (cockpit) provides a web based -login and management framework. - -The cockpit service can be disabled with the following command: -$ sudo systemctl mask --now cockpit.service - Cockpit provides a form of remote login. - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -249091,47 +249191,63 @@ spec: version: 3.1.0 systemd: units: - - name: cockpit.service + - name: certmonger.service enabled: false mask: true - - name: cockpit.socket + - name: certmonger.socket enabled: false mask: true - include disable_cockpit + +[customizations.services] +disabled = ["certmonger"] + + include disable_certmonger -class disable_cockpit { - service {'cockpit': +class disable_certmonger { + service {'certmonger': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cockpit.service' -"$SYSTEMCTL_EXEC" disable 'cockpit.service' -"$SYSTEMCTL_EXEC" mask 'cockpit.service' +"$SYSTEMCTL_EXEC" stop 'certmonger.service' +"$SYSTEMCTL_EXEC" disable 'certmonger.service' +"$SYSTEMCTL_EXEC" mask 'certmonger.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cockpit.socket; then - "$SYSTEMCTL_EXEC" stop 'cockpit.socket' - "$SYSTEMCTL_EXEC" mask 'cockpit.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files certmonger.socket; then + "$SYSTEMCTL_EXEC" stop 'certmonger.socket' + "$SYSTEMCTL_EXEC" mask 'certmonger.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cockpit.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'certmonger.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["cockpit"] - + + + + + + + + + Disable Cockpit Management Server + The Cockpit Management Server (cockpit) provides a web based +login and management framework. + +The cockpit service can be disabled with the following command: +$ sudo systemctl mask --now cockpit.service + Cockpit provides a form of remote login. + - name: Block Disable service cockpit block: @@ -249189,6 +249305,55 @@ disabled = ["cockpit"] - medium_severity - no_reboot_needed - service_cockpit_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cockpit.service + enabled: false + mask: true + - name: cockpit.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cockpit"] + + include disable_cockpit + +class disable_cockpit { + service {'cockpit': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cockpit.service' +"$SYSTEMCTL_EXEC" disable 'cockpit.service' +"$SYSTEMCTL_EXEC" mask 'cockpit.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cockpit.socket; then + "$SYSTEMCTL_EXEC" stop 'cockpit.socket' + "$SYSTEMCTL_EXEC" mask 'cockpit.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cockpit.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249277,55 +249442,6 @@ but may also apply to server or desktop environments where conserving power is highly desirable or necessary. CCE-82382-3 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: cpupower.service - enabled: false - mask: true - - name: cpupower.socket - enabled: false - mask: true - - include disable_cpupower - -class disable_cpupower { - service {'cpupower': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cpupower.service' -"$SYSTEMCTL_EXEC" disable 'cpupower.service' -"$SYSTEMCTL_EXEC" mask 'cpupower.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cpupower.socket; then - "$SYSTEMCTL_EXEC" stop 'cpupower.socket' - "$SYSTEMCTL_EXEC" mask 'cpupower.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cpupower.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["cpupower"] - - name: Block Disable service cpupower block: @@ -249395,6 +249511,55 @@ disabled = ["cpupower"] - low_severity - no_reboot_needed - service_cpupower_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cpupower.service + enabled: false + mask: true + - name: cpupower.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cpupower"] + + include disable_cpupower + +class disable_cpupower { + service {'cpupower': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cpupower.service' +"$SYSTEMCTL_EXEC" disable 'cpupower.service' +"$SYSTEMCTL_EXEC" mask 'cpupower.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cpupower.socket; then + "$SYSTEMCTL_EXEC" stop 'cpupower.socket' + "$SYSTEMCTL_EXEC" mask 'cpupower.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cpupower.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249522,58 +249687,6 @@ on the target file system partition. Unless the system is used for kernel development or testing, there is little need to run the kdump service. CCE-80878-2 - -kdump --disable - - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: kdump.service - enabled: false - mask: true - - name: kdump.socket - enabled: false - mask: true - - include disable_kdump - -class disable_kdump { - service {'kdump': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'kdump.service' -"$SYSTEMCTL_EXEC" disable 'kdump.service' -"$SYSTEMCTL_EXEC" mask 'kdump.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files kdump.socket; then - "$SYSTEMCTL_EXEC" stop 'kdump.socket' - "$SYSTEMCTL_EXEC" mask 'kdump.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'kdump.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["kdump"] - - name: Block Disable service kdump block: @@ -249646,6 +249759,58 @@ disabled = ["kdump"] - medium_severity - no_reboot_needed - service_kdump_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: kdump.service + enabled: false + mask: true + - name: kdump.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["kdump"] + + include disable_kdump + +class disable_kdump { + service {'kdump': + enable => false, + ensure => 'stopped', + } +} + + +kdump --disable + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'kdump.service' +"$SYSTEMCTL_EXEC" disable 'kdump.service' +"$SYSTEMCTL_EXEC" mask 'kdump.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files kdump.socket; then + "$SYSTEMCTL_EXEC" stop 'kdump.socket' + "$SYSTEMCTL_EXEC" mask 'kdump.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'kdump.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249732,55 +249897,6 @@ The mdmonitor service can be disabled with the following there is no need to run this service. CCE-82386-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: mdmonitor.service - enabled: false - mask: true - - name: mdmonitor.socket - enabled: false - mask: true - - include disable_mdmonitor - -class disable_mdmonitor { - service {'mdmonitor': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'mdmonitor.service' -"$SYSTEMCTL_EXEC" disable 'mdmonitor.service' -"$SYSTEMCTL_EXEC" mask 'mdmonitor.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files mdmonitor.socket; then - "$SYSTEMCTL_EXEC" stop 'mdmonitor.socket' - "$SYSTEMCTL_EXEC" mask 'mdmonitor.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'mdmonitor.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["mdmonitor"] - - name: Block Disable service mdmonitor block: @@ -249850,6 +249966,55 @@ disabled = ["mdmonitor"] - low_severity - no_reboot_needed - service_mdmonitor_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: mdmonitor.service + enabled: false + mask: true + - name: mdmonitor.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["mdmonitor"] + + include disable_mdmonitor + +class disable_mdmonitor { + service {'mdmonitor': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'mdmonitor.service' +"$SYSTEMCTL_EXEC" disable 'mdmonitor.service' +"$SYSTEMCTL_EXEC" mask 'mdmonitor.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files mdmonitor.socket; then + "$SYSTEMCTL_EXEC" stop 'mdmonitor.socket' + "$SYSTEMCTL_EXEC" mask 'mdmonitor.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'mdmonitor.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -249962,55 +250127,6 @@ The netconsole service can be disabled with the following kernel panics, which is not common. CCE-82455-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: netconsole.service - enabled: false - mask: true - - name: netconsole.socket - enabled: false - mask: true - - include disable_netconsole - -class disable_netconsole { - service {'netconsole': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'netconsole.service' -"$SYSTEMCTL_EXEC" disable 'netconsole.service' -"$SYSTEMCTL_EXEC" mask 'netconsole.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files netconsole.socket; then - "$SYSTEMCTL_EXEC" stop 'netconsole.socket' - "$SYSTEMCTL_EXEC" mask 'netconsole.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'netconsole.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["netconsole"] - - name: Block Disable service netconsole block: @@ -250080,6 +250196,55 @@ disabled = ["netconsole"] - low_severity - no_reboot_needed - service_netconsole_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: netconsole.service + enabled: false + mask: true + - name: netconsole.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["netconsole"] + + include disable_netconsole + +class disable_netconsole { + service {'netconsole': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'netconsole.service' +"$SYSTEMCTL_EXEC" disable 'netconsole.service' +"$SYSTEMCTL_EXEC" mask 'netconsole.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files netconsole.socket; then + "$SYSTEMCTL_EXEC" stop 'netconsole.socket' + "$SYSTEMCTL_EXEC" mask 'netconsole.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'netconsole.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250195,55 +250360,6 @@ reboots. In any event, the functionality of the ntpdate service is now available in the ntpd program and should be considered deprecated. CCE-80879-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: ntpdate.service - enabled: false - mask: true - - name: ntpdate.socket - enabled: false - mask: true - - include disable_ntpdate - -class disable_ntpdate { - service {'ntpdate': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ntpdate.service' -"$SYSTEMCTL_EXEC" disable 'ntpdate.service' -"$SYSTEMCTL_EXEC" mask 'ntpdate.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ntpdate.socket; then - "$SYSTEMCTL_EXEC" stop 'ntpdate.socket' - "$SYSTEMCTL_EXEC" mask 'ntpdate.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ntpdate.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["ntpdate"] - - name: Block Disable service ntpdate block: @@ -250313,6 +250429,55 @@ disabled = ["ntpdate"] - low_severity - no_reboot_needed - service_ntpdate_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: ntpdate.service + enabled: false + mask: true + - name: ntpdate.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["ntpdate"] + + include disable_ntpdate + +class disable_ntpdate { + service {'ntpdate': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'ntpdate.service' +"$SYSTEMCTL_EXEC" disable 'ntpdate.service' +"$SYSTEMCTL_EXEC" mask 'ntpdate.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files ntpdate.socket; then + "$SYSTEMCTL_EXEC" stop 'ntpdate.socket' + "$SYSTEMCTL_EXEC" mask 'ntpdate.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'ntpdate.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250404,55 +250569,6 @@ tasks by privileged programs, on behalf of unprivileged ones, has traditionally been a source of privilege escalation security issues. CCE-80880-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: oddjobd.service - enabled: false - mask: true - - name: oddjobd.socket - enabled: false - mask: true - - include disable_oddjobd - -class disable_oddjobd { - service {'oddjobd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'oddjobd.service' -"$SYSTEMCTL_EXEC" disable 'oddjobd.service' -"$SYSTEMCTL_EXEC" mask 'oddjobd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files oddjobd.socket; then - "$SYSTEMCTL_EXEC" stop 'oddjobd.socket' - "$SYSTEMCTL_EXEC" mask 'oddjobd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'oddjobd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["oddjobd"] - - name: Block Disable service oddjobd block: @@ -250522,6 +250638,55 @@ disabled = ["oddjobd"] - medium_severity - no_reboot_needed - service_oddjobd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: oddjobd.service + enabled: false + mask: true + - name: oddjobd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["oddjobd"] + + include disable_oddjobd + +class disable_oddjobd { + service {'oddjobd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'oddjobd.service' +"$SYSTEMCTL_EXEC" disable 'oddjobd.service' +"$SYSTEMCTL_EXEC" mask 'oddjobd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files oddjobd.socket; then + "$SYSTEMCTL_EXEC" stop 'oddjobd.socket' + "$SYSTEMCTL_EXEC" mask 'oddjobd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'oddjobd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250633,55 +250798,6 @@ preventing conflicting usage of ports in the reserved port range, but it can be disabled if not needed. CCE-82390-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: portreserve.service - enabled: false - mask: true - - name: portreserve.socket - enabled: false - mask: true - - include disable_portreserve - -class disable_portreserve { - service {'portreserve': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'portreserve.service' -"$SYSTEMCTL_EXEC" disable 'portreserve.service' -"$SYSTEMCTL_EXEC" mask 'portreserve.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files portreserve.socket; then - "$SYSTEMCTL_EXEC" stop 'portreserve.socket' - "$SYSTEMCTL_EXEC" mask 'portreserve.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'portreserve.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["portreserve"] - - name: Block Disable service portreserve block: @@ -250751,6 +250867,55 @@ disabled = ["portreserve"] - low_severity - no_reboot_needed - service_portreserve_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: portreserve.service + enabled: false + mask: true + - name: portreserve.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["portreserve"] + + include disable_portreserve + +class disable_portreserve { + service {'portreserve': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'portreserve.service' +"$SYSTEMCTL_EXEC" disable 'portreserve.service' +"$SYSTEMCTL_EXEC" mask 'portreserve.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files portreserve.socket; then + "$SYSTEMCTL_EXEC" stop 'portreserve.socket' + "$SYSTEMCTL_EXEC" mask 'portreserve.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'portreserve.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -250866,55 +251031,6 @@ the system is not intended to receive AMQP traffic, then the qpidd CCE-80882-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: qpidd.service - enabled: false - mask: true - - name: qpidd.socket - enabled: false - mask: true - - include disable_qpidd - -class disable_qpidd { - service {'qpidd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'qpidd.service' -"$SYSTEMCTL_EXEC" disable 'qpidd.service' -"$SYSTEMCTL_EXEC" mask 'qpidd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files qpidd.socket; then - "$SYSTEMCTL_EXEC" stop 'qpidd.socket' - "$SYSTEMCTL_EXEC" mask 'qpidd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'qpidd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["qpidd"] - - name: Block Disable service qpidd block: @@ -250984,6 +251100,55 @@ disabled = ["qpidd"] - low_severity - no_reboot_needed - service_qpidd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: qpidd.service + enabled: false + mask: true + - name: qpidd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["qpidd"] + + include disable_qpidd + +class disable_qpidd { + service {'qpidd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'qpidd.service' +"$SYSTEMCTL_EXEC" disable 'qpidd.service' +"$SYSTEMCTL_EXEC" mask 'qpidd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files qpidd.socket; then + "$SYSTEMCTL_EXEC" stop 'qpidd.socket' + "$SYSTEMCTL_EXEC" mask 'qpidd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'qpidd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251076,55 +251241,6 @@ disk quota violation is not desired then there is no need to run this service. CCE-82406-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: quota_nld.service - enabled: false - mask: true - - name: quota_nld.socket - enabled: false - mask: true - - include disable_quota_nld - -class disable_quota_nld { - service {'quota_nld': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'quota_nld.service' -"$SYSTEMCTL_EXEC" disable 'quota_nld.service' -"$SYSTEMCTL_EXEC" mask 'quota_nld.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files quota_nld.socket; then - "$SYSTEMCTL_EXEC" stop 'quota_nld.socket' - "$SYSTEMCTL_EXEC" mask 'quota_nld.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'quota_nld.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["quota_nld"] - - name: Block Disable service quota_nld block: @@ -251194,6 +251310,55 @@ disabled = ["quota_nld"] - low_severity - no_reboot_needed - service_quota_nld_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: quota_nld.service + enabled: false + mask: true + - name: quota_nld.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["quota_nld"] + + include disable_quota_nld + +class disable_quota_nld { + service {'quota_nld': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'quota_nld.service' +"$SYSTEMCTL_EXEC" disable 'quota_nld.service' +"$SYSTEMCTL_EXEC" mask 'quota_nld.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files quota_nld.socket; then + "$SYSTEMCTL_EXEC" stop 'quota_nld.socket' + "$SYSTEMCTL_EXEC" mask 'quota_nld.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'quota_nld.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251350,55 +251515,6 @@ some special-purpose systems often use DHCP (instead of IRDP) to retrieve dynamic network configuration information. CCE-80883-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rdisc.service - enabled: false - mask: true - - name: rdisc.socket - enabled: false - mask: true - - include disable_rdisc - -class disable_rdisc { - service {'rdisc': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rdisc.service' -"$SYSTEMCTL_EXEC" disable 'rdisc.service' -"$SYSTEMCTL_EXEC" mask 'rdisc.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rdisc.socket; then - "$SYSTEMCTL_EXEC" stop 'rdisc.socket' - "$SYSTEMCTL_EXEC" mask 'rdisc.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rdisc.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rdisc"] - - name: Block Disable service rdisc block: @@ -251471,6 +251587,55 @@ disabled = ["rdisc"] - medium_severity - no_reboot_needed - service_rdisc_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rdisc.service + enabled: false + mask: true + - name: rdisc.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rdisc"] + + include disable_rdisc + +class disable_rdisc { + service {'rdisc': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rdisc.service' +"$SYSTEMCTL_EXEC" disable 'rdisc.service' +"$SYSTEMCTL_EXEC" mask 'rdisc.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rdisc.socket; then + "$SYSTEMCTL_EXEC" stop 'rdisc.socket' + "$SYSTEMCTL_EXEC" mask 'rdisc.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rdisc.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251586,55 +251751,6 @@ desirable for some environments. However, if the system is being managed by RHN RHN Satellite Server the rhnsd daemon can remain on. CCE-82405-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rhnsd.service - enabled: false - mask: true - - name: rhnsd.socket - enabled: false - mask: true - - include disable_rhnsd - -class disable_rhnsd { - service {'rhnsd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rhnsd.service' -"$SYSTEMCTL_EXEC" disable 'rhnsd.service' -"$SYSTEMCTL_EXEC" mask 'rhnsd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rhnsd.socket; then - "$SYSTEMCTL_EXEC" stop 'rhnsd.socket' - "$SYSTEMCTL_EXEC" mask 'rhnsd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rhnsd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rhnsd"] - - name: Block Disable service rhnsd block: @@ -251704,6 +251820,55 @@ disabled = ["rhnsd"] - low_severity - no_reboot_needed - service_rhnsd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rhnsd.service + enabled: false + mask: true + - name: rhnsd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rhnsd"] + + include disable_rhnsd + +class disable_rhnsd { + service {'rhnsd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rhnsd.service' +"$SYSTEMCTL_EXEC" disable 'rhnsd.service' +"$SYSTEMCTL_EXEC" mask 'rhnsd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rhnsd.socket; then + "$SYSTEMCTL_EXEC" stop 'rhnsd.socket' + "$SYSTEMCTL_EXEC" mask 'rhnsd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rhnsd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -251794,55 +251959,6 @@ expected to require remote changes to their subscription status, it is unnecessary and can be disabled. CCE-82387-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rhsmcertd.service - enabled: false - mask: true - - name: rhsmcertd.socket - enabled: false - mask: true - - include disable_rhsmcertd - -class disable_rhsmcertd { - service {'rhsmcertd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rhsmcertd.service' -"$SYSTEMCTL_EXEC" disable 'rhsmcertd.service' -"$SYSTEMCTL_EXEC" mask 'rhsmcertd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rhsmcertd.socket; then - "$SYSTEMCTL_EXEC" stop 'rhsmcertd.socket' - "$SYSTEMCTL_EXEC" mask 'rhsmcertd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rhsmcertd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rhsmcertd"] - - name: Block Disable service rhsmcertd block: @@ -251912,6 +252028,55 @@ disabled = ["rhsmcertd"] - low_severity - no_reboot_needed - service_rhsmcertd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rhsmcertd.service + enabled: false + mask: true + - name: rhsmcertd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rhsmcertd"] + + include disable_rhsmcertd + +class disable_rhsmcertd { + service {'rhsmcertd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rhsmcertd.service' +"$SYSTEMCTL_EXEC" disable 'rhsmcertd.service' +"$SYSTEMCTL_EXEC" mask 'rhsmcertd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rhsmcertd.socket; then + "$SYSTEMCTL_EXEC" stop 'rhsmcertd.socket' + "$SYSTEMCTL_EXEC" mask 'rhsmcertd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rhsmcertd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252026,55 +252191,6 @@ use Kerberos and LDAP. For others, however, in which only local files may be consulted, it is not necessary and should be disabled. CCE-82389-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: saslauthd.service - enabled: false - mask: true - - name: saslauthd.socket - enabled: false - mask: true - - include disable_saslauthd - -class disable_saslauthd { - service {'saslauthd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'saslauthd.service' -"$SYSTEMCTL_EXEC" disable 'saslauthd.service' -"$SYSTEMCTL_EXEC" mask 'saslauthd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files saslauthd.socket; then - "$SYSTEMCTL_EXEC" stop 'saslauthd.socket' - "$SYSTEMCTL_EXEC" mask 'saslauthd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'saslauthd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["saslauthd"] - - name: Block Disable service saslauthd block: @@ -252144,6 +252260,55 @@ disabled = ["saslauthd"] - low_severity - no_reboot_needed - service_saslauthd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: saslauthd.service + enabled: false + mask: true + - name: saslauthd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["saslauthd"] + + include disable_saslauthd + +class disable_saslauthd { + service {'saslauthd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'saslauthd.service' +"$SYSTEMCTL_EXEC" disable 'saslauthd.service' +"$SYSTEMCTL_EXEC" mask 'saslauthd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files saslauthd.socket; then + "$SYSTEMCTL_EXEC" stop 'saslauthd.socket' + "$SYSTEMCTL_EXEC" mask 'saslauthd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'saslauthd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252234,55 +252399,6 @@ insight into system operation, through the lens of providing only essential syst this service should be disabled. CCE-82388-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: sysstat.service - enabled: false - mask: true - - name: sysstat.socket - enabled: false - mask: true - - include disable_sysstat - -class disable_sysstat { - service {'sysstat': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'sysstat.service' -"$SYSTEMCTL_EXEC" disable 'sysstat.service' -"$SYSTEMCTL_EXEC" mask 'sysstat.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files sysstat.socket; then - "$SYSTEMCTL_EXEC" stop 'sysstat.socket' - "$SYSTEMCTL_EXEC" mask 'sysstat.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'sysstat.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["sysstat"] - - name: Block Disable service sysstat block: @@ -252352,6 +252468,55 @@ disabled = ["sysstat"] - low_severity - no_reboot_needed - service_sysstat_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: sysstat.service + enabled: false + mask: true + - name: sysstat.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["sysstat"] + + include disable_sysstat + +class disable_sysstat { + service {'sysstat': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'sysstat.service' +"$SYSTEMCTL_EXEC" disable 'sysstat.service' +"$SYSTEMCTL_EXEC" mask 'sysstat.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files sysstat.socket; then + "$SYSTEMCTL_EXEC" stop 'sysstat.socket' + "$SYSTEMCTL_EXEC" mask 'sysstat.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'sysstat.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252445,8 +252610,24 @@ configured defensively. PR.IP-1 PR.PT-3 The cron service allow periodic job execution, needed for almost all administrative tasks and services (software update, log rotating, etc.). Access to cron service should be restricted to administrative accounts only. - -package --add=cron + - name: Ensure cron is installed + package: + name: cron + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_cron_installed + + +[[packages]] +name = "cron" +version = "*" include install_cron @@ -252455,6 +252636,9 @@ class install_cron { ensure => 'installed', } } + + +package --add=cron # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -252466,25 +252650,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "cron" -version = "*" - - - name: Ensure cron is installed - package: - name: cron - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_cron_installed @@ -252575,31 +252740,6 @@ The cron service can be enabled with the following comman 2.2.6 Due to its usage for maintenance and security-supporting tasks, enabling the cron daemon is essential. - include enable_cron - -class enable_cron { - service {'cron': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'cron.service' -"$SYSTEMCTL_EXEC" start 'cron.service' -"$SYSTEMCTL_EXEC" enable 'cron.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["cron"] - - name: Enable service cron block: @@ -252625,6 +252765,31 @@ enabled = ["cron"] - medium_severity - no_reboot_needed - service_cron_enabled + + +[customizations.services] +enabled = ["cron"] + + include enable_cron + +class enable_cron { + service {'cron': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'cron.service' +"$SYSTEMCTL_EXEC" start 'cron.service' +"$SYSTEMCTL_EXEC" enable 'cron.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252712,35 +252877,10 @@ The crond service can be enabled with the following comma CM-6(a) PR.IP-1 PR.PT-3 - 5.1.1 + 4.1.1.1 Due to its usage for maintenance and security-supporting tasks, enabling the cron daemon is essential. CCE-80875-8 - include enable_crond - -class enable_crond { - service {'crond': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'crond.service' -"$SYSTEMCTL_EXEC" start 'crond.service' -"$SYSTEMCTL_EXEC" enable 'crond.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["crond"] - - name: Enable service crond block: @@ -252766,6 +252906,31 @@ enabled = ["crond"] - medium_severity - no_reboot_needed - service_crond_enabled + + +[customizations.services] +enabled = ["crond"] + + include enable_crond + +class enable_crond { + service {'crond': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'crond.service' +"$SYSTEMCTL_EXEC" start 'crond.service' +"$SYSTEMCTL_EXEC" enable 'crond.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -252858,55 +253023,6 @@ accountability. Furthermore, the need to schedule tasks with atbatch is not common. CCE-80871-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: atd.service - enabled: false - mask: true - - name: atd.socket - enabled: false - mask: true - - include disable_atd - -class disable_atd { - service {'atd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'atd.service' -"$SYSTEMCTL_EXEC" disable 'atd.service' -"$SYSTEMCTL_EXEC" mask 'atd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files atd.socket; then - "$SYSTEMCTL_EXEC" stop 'atd.socket' - "$SYSTEMCTL_EXEC" mask 'atd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'atd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["atd"] - - name: Block Disable service atd block: @@ -252976,6 +253092,55 @@ disabled = ["atd"] - medium_severity - no_reboot_needed - service_atd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: atd.service + enabled: false + mask: true + - name: atd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["atd"] + + include disable_atd + +class disable_atd { + service {'atd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'atd.service' +"$SYSTEMCTL_EXEC" disable 'atd.service' +"$SYSTEMCTL_EXEC" mask 'atd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files atd.socket; then + "$SYSTEMCTL_EXEC" stop 'atd.socket' + "$SYSTEMCTL_EXEC" mask 'atd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'atd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253116,20 +253281,11 @@ To properly set the group owner of /etc/cron.d, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82268-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.d/ file: path: /etc/cron.d/ @@ -253147,6 +253303,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253204,20 +253369,11 @@ To properly set the group owner of /etc/cron.daily, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82234-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.daily/ file: path: /etc/cron.daily/ @@ -253235,6 +253391,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253292,20 +253457,11 @@ To properly set the group owner of /etc/cron.hourly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82227-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.hourly/ file: path: /etc/cron.hourly/ @@ -253323,6 +253479,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253380,20 +253545,11 @@ To properly set the group owner of /etc/cron.monthly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82256-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.monthly/ file: path: /etc/cron.monthly/ @@ -253411,6 +253567,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253468,20 +253633,11 @@ To properly set the group owner of /etc/cron.weekly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82244-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure group owner on /etc/cron.weekly/ file: path: /etc/cron.weekly/ @@ -253499,6 +253655,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253556,20 +253721,11 @@ To properly set the group owner of /etc/crontab, run the PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82223-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -253605,6 +253761,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253662,20 +253827,11 @@ To properly set the owner of /etc/cron.d, run the command PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82272-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.d/ file: path: /etc/cron.d/ @@ -253693,6 +253849,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253750,20 +253915,11 @@ To properly set the owner of /etc/cron.daily, run the com PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82237-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.daily/ file: path: /etc/cron.daily/ @@ -253781,6 +253937,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253838,20 +254003,11 @@ To properly set the owner of /etc/cron.hourly, run the co PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82209-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.hourly/ file: path: /etc/cron.hourly/ @@ -253869,6 +254025,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -253926,20 +254091,11 @@ To properly set the owner of /etc/cron.monthly, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82260-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.monthly/ file: path: /etc/cron.monthly/ @@ -253957,6 +254113,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254014,20 +254179,11 @@ To properly set the owner of /etc/cron.weekly, run the co PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82247-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure owner on directory /etc/cron.weekly/ file: path: /etc/cron.weekly/ @@ -254045,6 +254201,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -type d -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254102,20 +254267,11 @@ To properly set the owner of /etc/crontab, run the comman PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct user to prevent unauthorized changes. CCE-82224-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -254151,6 +254307,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254208,20 +254373,11 @@ To properly set the permissions of /etc/cron.d, run the c PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.7 + 4.1.1.7 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82277-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.d/ file(s) command: 'find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' register: files_found @@ -254260,6 +254416,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.d/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254317,20 +254482,11 @@ To properly set the permissions of /etc/cron.daily, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.4 + 4.1.1.4 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82240-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.daily/ file(s) command: 'find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' register: files_found @@ -254369,6 +254525,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.daily/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254426,20 +254591,11 @@ To properly set the permissions of /etc/cron.hourly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.3 + 4.1.1.3 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82230-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.hourly/ file(s) command: 'find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254479,6 +254635,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.hourly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254536,20 +254701,11 @@ To properly set the permissions of /etc/cron.monthly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.6 + 4.1.1.6 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82263-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.monthly/ file(s) command: 'find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254589,6 +254745,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.monthly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254646,20 +254811,11 @@ To properly set the permissions of /etc/cron.weekly, run PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.5 + 4.1.1.5 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82253-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/cron.weekly/ file(s) command: 'find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d ' @@ -254699,6 +254855,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/cron.weekly/ -maxdepth 1 -perm /u+s,g+xwrs,o+xwrt -type d -exec chmod u-s,g-xwrs,o-xwrt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254756,20 +254921,11 @@ To properly set the permissions of /etc/crontab, run the PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.2 + 4.1.1.2 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should have the correct access rights to prevent unauthorized changes. CCE-82206-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/crontab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/crontab stat: path: /etc/crontab @@ -254805,6 +254961,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/crontab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254836,21 +255001,10 @@ the at command to create at jobs. The file /etc/at.deny should not exist. Use /etc/at.allow instead. 2.2.6 - 5.1.9 + 4.1.2.1 Access to at should be restricted. It is easier to manage an allow list than a deny list. CCE-86945-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [[ -f /etc/at.deny ]]; then - rm /etc/at.deny - fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Remove /etc/at.deny file: path: /etc/at.deny @@ -254865,6 +255019,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [[ -f /etc/at.deny ]]; then + rm /etc/at.deny + fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254877,23 +255042,12 @@ fi Ensure that /etc/cron.allow exists The file /etc/cron.allow should exist and should be used instead of /etc/cron.deny. - 5.1.8 + 4.1.1.8 Access to crontab should be restricted. It is easier to manage an allow list than a deny list. Therefore, /etc/cron.allow needs to be created and used instead of /etc/cron.deny. Regardless of the existence of any of these files, the root administrative user is always allowed to setup a crontab. CCE-86184-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -touch /etc/cron.allow - chown 0 /etc/cron.allow - chmod 0600 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Add empty /etc/cron.allow file: path: /etc/cron.allow @@ -254909,6 +255063,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +touch /etc/cron.allow + chown 0 /etc/cron.allow + chmod 0600 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254922,21 +255087,10 @@ fi The file /etc/cron.deny should not exist. Use /etc/cron.allow instead. 2.2.6 - 5.1.8 + 4.1.1.8 Access to cron should be restricted. It is easier to manage an allow list than a deny list. CCE-86849-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [[ -f /etc/cron.deny ]]; then - rm /etc/cron.deny - fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Remove /etc/cron.deny file: path: /etc/cron.deny @@ -254951,6 +255105,17 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [[ -f /etc/cron.deny ]]; then + rm /etc/cron.deny + fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -254966,19 +255131,10 @@ fi To properly set the group owner of /etc/at.allow, run the command: $ sudo chgrp root /etc/at.allow 2.2.6 - 5.1.9 + 4.1.2.1 If the owner of the at.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-87102-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/at.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/at.allow stat: path: /etc/at.allow @@ -255010,6 +255166,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/at.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255069,19 +255234,10 @@ To properly set the group owner of /etc/cron.allow, run t PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the owner of the cron.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86829-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255117,6 +255273,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255175,19 +255340,10 @@ To properly set the owner of /etc/cron.allow, run the com PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the owner of the cron.allow file is not set to root, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86843-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255221,6 +255377,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255238,19 +255403,10 @@ or more restrictive. To properly set the permissions of /etc/at.allow, run the command: $ sudo chmod 0600 /etc/at.allow 2.2.6 - 5.1.9 + 4.1.2.1 If the permissions of the at.allow file are not set to 0600 or more restrictive, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86903-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/at.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/at.allow stat: path: /etc/at.allow @@ -255282,6 +255438,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/at.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255300,19 +255465,10 @@ To properly set the permissions of /etc/cron.allow, run t $ sudo chmod 0600 /etc/cron.allow 2.2.6 SRG-OS-000480-GPOS-00227 - 5.1.8 + 4.1.1.8 If the permissions of the cron.allow file are not set to 0600 or more restrictive, the possibility exists for an unauthorized user to view or edit sensitive information. CCE-86876-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/cron.allow - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/cron.allow stat: path: /etc/cron.allow @@ -255344,6 +255500,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/cron.allow + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -255455,8 +255620,20 @@ confidentiality in network exchange, usage as uncontrolled communication channel telnet allows clear text communications, and does not protect any data transmission between client and server. Any confidential data can be listened and no integrity checking is made. - -package --remove=inetutils-telnetd + - name: Ensure inetutils-telnetd is removed + package: + name: inetutils-telnetd + state: absent + tags: + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_inetutils-telnetd_removed include remove_inetutils-telnetd @@ -255465,6 +255642,9 @@ class remove_inetutils-telnetd { ensure => 'purged', } } + + +package --remove=inetutils-telnetd # CAUTION: This remediation script will remove inetutils-telnetd @@ -255478,21 +255658,6 @@ if rpm -q --quiet "inetutils-telnetd" ; then yum remove -y "inetutils-telnetd" fi - - - name: Ensure inetutils-telnetd is removed - package: - name: inetutils-telnetd - state: absent - tags: - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_inetutils-telnetd_removed @@ -255503,8 +255668,17 @@ fi The support for Yellowpages should not be installed unless it is required. NIS is the historical SUN service for central account management, more and more replaced by LDAP. NIS does not support efficiently security constraints, ACL, etc. and should not be used. - -package --remove=nis + - name: Ensure nis is removed + package: + name: nis + state: absent + tags: + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_nis_removed include remove_nis @@ -255513,6 +255687,9 @@ class remove_nis { ensure => 'purged', } } + + +package --remove=nis # CAUTION: This remediation script will remove nis @@ -255526,18 +255703,6 @@ if rpm -q --quiet "nis" ; then yum remove -y "nis" fi - - - name: Ensure nis is removed - package: - name: nis - state: absent - tags: - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_nis_removed @@ -255547,8 +255712,17 @@ fi Uninstall the ntpdate package ntpdate is a historical ntp synchronization client for unixes. It sould be uninstalled. ntpdate is an old not security-compliant ntp client. It should be replaced by modern ntp clients such as ntpd, able to use cryptographic mechanisms integrated in NTP. - -package --remove=ntpdate + - name: Ensure ntpdate is removed + package: + name: ntpdate + state: absent + tags: + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_ntpdate_removed include remove_ntpdate @@ -255557,6 +255731,9 @@ class remove_ntpdate { ensure => 'purged', } } + + +package --remove=ntpdate # CAUTION: This remediation script will remove ntpdate @@ -255570,18 +255747,6 @@ if rpm -q --quiet "ntpdate" ; then yum remove -y "ntpdate" fi - - - name: Ensure ntpdate is removed - package: - name: ntpdate - state: absent - tags: - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_ntpdate_removed @@ -255683,8 +255848,20 @@ fi PR.PT-4 telnet, even with ssl support, should not be installed. When remote shell is required, up-to-date ssh daemon can be used. - -package --remove=telnetd-ssl + - name: Ensure telnetd-ssl is removed + package: + name: telnetd-ssl + state: absent + tags: + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnetd-ssl_removed include remove_telnetd-ssl @@ -255693,6 +255870,9 @@ class remove_telnetd-ssl { ensure => 'purged', } } + + +package --remove=telnetd-ssl # CAUTION: This remediation script will remove telnetd-ssl @@ -255706,21 +255886,6 @@ if rpm -q --quiet "telnetd-ssl" ; then yum remove -y "telnetd-ssl" fi - - - name: Ensure telnetd-ssl is removed - package: - name: telnetd-ssl - state: absent - tags: - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnetd-ssl_removed @@ -255825,8 +255990,21 @@ fi any data transmission between client and server. Any confidential data can be listened and no integrity checking is made.' CCE-83302-0 - -package --remove=telnetd + - name: Ensure telnetd is removed + package: + name: telnetd + state: absent + tags: + - CCE-83302-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnetd_removed include remove_telnetd @@ -255835,6 +256013,9 @@ class remove_telnetd { ensure => 'purged', } } + + +package --remove=telnetd # CAUTION: This remediation script will remove telnetd @@ -255848,22 +256029,6 @@ if rpm -q --quiet "telnetd" ; then yum remove -y "telnetd" fi - - - name: Ensure telnetd is removed - package: - name: telnetd - state: absent - tags: - - CCE-83302-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnetd_removed @@ -256539,8 +256704,22 @@ $ sudo yum erase dhcp-server Removing the DHCP server ensures that it cannot be easily or accidentally reactivated and disrupt network operation. CCE-83385-5 - -package --remove=dhcp-server + - name: Ensure dhcp-server is removed + package: + name: dhcp-server + state: absent + tags: + - CCE-83385-5 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_dhcp_removed include remove_dhcp-server @@ -256549,6 +256728,9 @@ class remove_dhcp-server { ensure => 'purged', } } + + +package --remove=dhcp-server # CAUTION: This remediation script will remove dhcp-server @@ -256562,23 +256744,6 @@ if rpm -q --quiet "dhcp-server" ; then yum remove -y "dhcp-server" fi - - - name: Ensure dhcp-server is removed - package: - name: dhcp-server - state: absent - tags: - - CCE-83385-5 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_dhcp_removed @@ -256668,6 +256833,76 @@ to clients, interfering with the operation of a legitimate site DHCP server if there is one. CCE-82864-0 + - name: Block Disable service dhcpd + block: + + - name: Disable service dhcpd + block: + + - name: Disable service dhcpd + systemd: + name: dhcpd.service + enabled: 'no' + state: stopped + masked: 'yes' + rescue: + + - name: Intentionally ignored previous 'Disable service dhcpd' failure, service + was already disabled + meta: noop + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + +- name: Unit Socket Exists - dhcpd.socket + command: systemctl -q list-unit-files dhcpd.socket + register: socket_file_exists + changed_when: false + failed_when: socket_file_exists.rc not in [0, 1] + check_mode: false + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + +- name: Disable socket dhcpd + systemd: + name: dhcpd.socket + enabled: 'no' + state: stopped + masked: 'yes' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - socket_file_exists.stdout_lines is search("dhcpd.socket",multiline=True) + tags: + - CCE-82864-0 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_dhcpd_disabled + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -256682,6 +256917,10 @@ spec: - name: dhcpd.socket enabled: false mask: true + + +[customizations.services] +disabled = ["dhcpd"] include disable_dhcpd @@ -256712,80 +256951,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -disabled = ["dhcpd"] - - - name: Block Disable service dhcpd - block: - - - name: Disable service dhcpd - block: - - - name: Disable service dhcpd - systemd: - name: dhcpd.service - enabled: 'no' - state: stopped - masked: 'yes' - rescue: - - - name: Intentionally ignored previous 'Disable service dhcpd' failure, service - was already disabled - meta: noop - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled - -- name: Unit Socket Exists - dhcpd.socket - command: systemctl -q list-unit-files dhcpd.socket - register: socket_file_exists - changed_when: false - failed_when: socket_file_exists.rc not in [0, 1] - check_mode: false - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled - -- name: Disable socket dhcpd - systemd: - name: dhcpd.socket - enabled: 'no' - state: stopped - masked: 'yes' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - socket_file_exists.stdout_lines is search("dhcpd.socket",multiline=True) - tags: - - CCE-82864-0 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_dhcpd_disabled @@ -256888,8 +257053,21 @@ $ sudo yum erase bind If there is no need to make DNS server software available, removing it provides a safeguard against its activation. CCE-82408-6 - -package --remove=bind + - name: Ensure bind is removed + package: + name: bind + state: absent + tags: + - CCE-82408-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_bind_removed include remove_bind @@ -256898,6 +257076,9 @@ class remove_bind { ensure => 'purged', } } + + +package --remove=bind # CAUTION: This remediation script will remove bind @@ -256911,22 +257092,6 @@ if rpm -q --quiet "bind" ; then yum remove -y "bind" fi - - - name: Ensure bind is removed - package: - name: bind - state: absent - tags: - - CCE-82408-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_bind_removed @@ -257013,55 +257178,6 @@ The named service can be disabled with the following comm implementation flaws and should be disabled if possible. CCE-82409-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: named.service - enabled: false - mask: true - - name: named.socket - enabled: false - mask: true - - include disable_named - -class disable_named { - service {'named': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'named.service' -"$SYSTEMCTL_EXEC" disable 'named.service' -"$SYSTEMCTL_EXEC" mask 'named.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files named.socket; then - "$SYSTEMCTL_EXEC" stop 'named.socket' - "$SYSTEMCTL_EXEC" mask 'named.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'named.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["named"] - - name: Block Disable service named block: @@ -257131,6 +257247,55 @@ disabled = ["named"] - medium_severity - no_reboot_needed - service_named_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: named.service + enabled: false + mask: true + - name: named.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["named"] + + include disable_named + +class disable_named { + service {'named': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'named.service' +"$SYSTEMCTL_EXEC" disable 'named.service' +"$SYSTEMCTL_EXEC" mask 'named.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files named.socket; then + "$SYSTEMCTL_EXEC" stop 'named.socket' + "$SYSTEMCTL_EXEC" mask 'named.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'named.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257432,8 +257597,27 @@ $ sudo yum install fapolicyd fapolicyd (File Access Policy Daemon) implements application whitelisting to decide file access rights. CCE-82191-8 - -package --add=fapolicyd + - name: Ensure fapolicyd is installed + package: + name: fapolicyd + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82191-8 + - DISA-STIG-RHEL-08-040135 + - NIST-800-53-CM-6(a) + - NIST-800-53-SI-4(22) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_fapolicyd_installed + + +[[packages]] +name = "fapolicyd" +version = "*" include install_fapolicyd @@ -257442,6 +257626,9 @@ class install_fapolicyd { ensure => 'installed', } } + + +package --add=fapolicyd # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -257453,28 +257640,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "fapolicyd" -version = "*" - - - name: Ensure fapolicyd is installed - package: - name: fapolicyd - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82191-8 - - DISA-STIG-RHEL-08-040135 - - NIST-800-53-CM-6(a) - - NIST-800-53-SI-4(22) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_fapolicyd_installed @@ -257502,31 +257667,6 @@ The fapolicyd service can be enabled with the following c The fapolicyd service (File Access Policy Daemon) implements application whitelisting to decide file access rights. CCE-82249-4 - include enable_fapolicyd - -class enable_fapolicyd { - service {'fapolicyd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'fapolicyd.service' -"$SYSTEMCTL_EXEC" start 'fapolicyd.service' -"$SYSTEMCTL_EXEC" enable 'fapolicyd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["fapolicyd"] - - name: Enable service fapolicyd block: @@ -257554,6 +257694,31 @@ enabled = ["fapolicyd"] - medium_severity - no_reboot_needed - service_fapolicyd_enabled + + +[customizations.services] +enabled = ["fapolicyd"] + + include enable_fapolicyd + +class enable_fapolicyd { + service {'fapolicyd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'fapolicyd.service' +"$SYSTEMCTL_EXEC" start 'fapolicyd.service' +"$SYSTEMCTL_EXEC" enable 'fapolicyd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257581,38 +257746,6 @@ Proceed with caution with enforcing the use of this daemon. Improper configuration may render the system non-functional. The "fapolicyd" API is not namespace aware and can cause issues when launching or running containers. CCE-86478-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -cat > /etc/fapolicyd/rules.d/99-deny-everything.rules << EOF -# Red Hat KCS 7003854 (https://access.redhat.com/solutions/7003854) -deny perm=any all : all -EOF - -chmod 644 /etc/fapolicyd/rules.d/99-deny-everything.rules -chgrp fapolicyd /etc/fapolicyd/rules.d/99-deny-everything.rules - -if [ -e "/etc/fapolicyd/fapolicyd.conf" ] ; then - - LC_ALL=C sed -i "/^\s*permissive\s*=\s*/Id" "/etc/fapolicyd/fapolicyd.conf" -else - touch "/etc/fapolicyd/fapolicyd.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/fapolicyd/fapolicyd.conf" - -cp "/etc/fapolicyd/fapolicyd.conf" "/etc/fapolicyd/fapolicyd.conf.bak" -# Insert at the end of the file -printf '%s\n' "permissive = 0" >> "/etc/fapolicyd/fapolicyd.conf" -# Clean up after ourselves. -rm "/etc/fapolicyd/fapolicyd.conf.bak" - -systemctl restart fapolicyd - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. - Ensure a Final Rule Denying Everything @@ -257683,6 +257816,38 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +cat > /etc/fapolicyd/rules.d/99-deny-everything.rules << EOF +# Red Hat KCS 7003854 (https://access.redhat.com/solutions/7003854) +deny perm=any all : all +EOF + +chmod 644 /etc/fapolicyd/rules.d/99-deny-everything.rules +chgrp fapolicyd /etc/fapolicyd/rules.d/99-deny-everything.rules + +if [ -e "/etc/fapolicyd/fapolicyd.conf" ] ; then + + LC_ALL=C sed -i "/^\s*permissive\s*=\s*/Id" "/etc/fapolicyd/fapolicyd.conf" +else + touch "/etc/fapolicyd/fapolicyd.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/fapolicyd/fapolicyd.conf" + +cp "/etc/fapolicyd/fapolicyd.conf" "/etc/fapolicyd/fapolicyd.conf.bak" +# Insert at the end of the file +printf '%s\n' "permissive = 0" >> "/etc/fapolicyd/fapolicyd.conf" +# Clean up after ourselves. +rm "/etc/fapolicyd/fapolicyd.conf.bak" + +systemctl restart fapolicyd + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -257733,8 +257898,19 @@ is recommended SFTP be used if file transfer is required. Unless there is a need to run the system as a FTP server (for example, to allow anonymous downloads), it is recommended that the package be removed to reduce the potential attack surface. CCE-90745-1 - -package --remove=ftp + - name: Ensure ftp is removed + package: + name: ftp + state: absent + tags: + - CCE-90745-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_ftp_removed include remove_ftp @@ -257743,6 +257919,9 @@ class remove_ftp { ensure => 'purged', } } + + +package --remove=ftp # CAUTION: This remediation script will remove ftp @@ -257756,20 +257935,6 @@ if rpm -q --quiet "ftp" ; then yum remove -y "ftp" fi - - - name: Ensure ftp is removed - package: - name: ftp - state: absent - tags: - - CCE-90745-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_ftp_removed @@ -257868,8 +258033,26 @@ possible. Removing the vsftpd package decreases the risk of its accidental activation. CCE-82414-4 - -package --remove=vsftpd + - name: Ensure vsftpd is removed + package: + name: vsftpd + state: absent + tags: + - CCE-82414-4 + - DISA-STIG-RHEL-08-040360 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7 + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-CM-7.1(ii) + - NIST-800-53-IA-5(1)(c) + - NIST-800-53-IA-5(1).1(v) + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_vsftpd_removed include remove_vsftpd @@ -257878,6 +258061,9 @@ class remove_vsftpd { ensure => 'purged', } } + + +package --remove=vsftpd # CAUTION: This remediation script will remove vsftpd @@ -257891,27 +258077,6 @@ if rpm -q --quiet "vsftpd" ; then yum remove -y "vsftpd" fi - - - name: Ensure vsftpd is removed - package: - name: vsftpd - state: absent - tags: - - CCE-82414-4 - - DISA-STIG-RHEL-08-040360 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7 - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-CM-7.1(ii) - - NIST-800-53-IA-5(1)(c) - - NIST-800-53-IA-5(1).1(v) - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_vsftpd_removed @@ -258000,55 +258165,6 @@ Furthermore, the FTP protocol is unencrypted and creates a risk of compromising sensitive information. CCE-82413-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: vsftpd.service - enabled: false - mask: true - - name: vsftpd.socket - enabled: false - mask: true - - include disable_vsftpd - -class disable_vsftpd { - service {'vsftpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'vsftpd.service' -"$SYSTEMCTL_EXEC" disable 'vsftpd.service' -"$SYSTEMCTL_EXEC" mask 'vsftpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files vsftpd.socket; then - "$SYSTEMCTL_EXEC" stop 'vsftpd.socket' - "$SYSTEMCTL_EXEC" mask 'vsftpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'vsftpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["vsftpd"] - - name: Block Disable service vsftpd block: @@ -258118,6 +258234,55 @@ disabled = ["vsftpd"] - medium_severity - no_reboot_needed - service_vsftpd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: vsftpd.service + enabled: false + mask: true + - name: vsftpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["vsftpd"] + + include disable_vsftpd + +class disable_vsftpd { + service {'vsftpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'vsftpd.service' +"$SYSTEMCTL_EXEC" disable 'vsftpd.service' +"$SYSTEMCTL_EXEC" mask 'vsftpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files vsftpd.socket; then + "$SYSTEMCTL_EXEC" stop 'vsftpd.socket' + "$SYSTEMCTL_EXEC" mask 'vsftpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'vsftpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -258412,27 +258577,6 @@ $ sudo yum install vsftpd Red Hat Enterprise Linux to distributing vsftpd. For security and for consistency with future Red Hat releases, the use of vsftpd is recommended. CCE-82411-0 - -package --add=vsftpd - - include install_vsftpd - -class install_vsftpd { - package { 'vsftpd': - ensure => 'installed', - } -} - - -if ! rpm -q --quiet "vsftpd" ; then - yum install -y "vsftpd" -fi - - -[[packages]] -name = "vsftpd" -version = "*" - - name: Ensure vsftpd is installed package: name: vsftpd @@ -258446,6 +258590,27 @@ version = "*" - low_severity - no_reboot_needed - package_vsftpd_installed + + +[[packages]] +name = "vsftpd" +version = "*" + + include install_vsftpd + +class install_vsftpd { + package { 'vsftpd': + ensure => 'installed', + } +} + + +package --add=vsftpd + + +if ! rpm -q --quiet "vsftpd" ; then + yum install -y "vsftpd" +fi @@ -258547,8 +258712,21 @@ $ sudo yum erase httpd If there is no need to make the web server software available, removing it provides a safeguard against its activation. CCE-85970-2 - -package --remove=httpd + - name: Ensure httpd is removed + package: + name: httpd + state: absent + tags: + - CCE-85970-2 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_httpd_removed + - unknown_severity include remove_httpd @@ -258557,6 +258735,9 @@ class remove_httpd { ensure => 'purged', } } + + +package --remove=httpd # CAUTION: This remediation script will remove httpd @@ -258570,22 +258751,6 @@ if rpm -q --quiet "httpd" ; then yum remove -y "httpd" fi - - - name: Ensure httpd is removed - package: - name: httpd - state: absent - tags: - - CCE-85970-2 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_httpd_removed - - unknown_severity @@ -258671,55 +258836,6 @@ The httpd service can be disabled with the following comm of attack, and should be disabled if not needed. CCE-82761-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: httpd.service - enabled: false - mask: true - - name: httpd.socket - enabled: false - mask: true - - include disable_httpd - -class disable_httpd { - service {'httpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'httpd.service' -"$SYSTEMCTL_EXEC" disable 'httpd.service' -"$SYSTEMCTL_EXEC" mask 'httpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files httpd.socket; then - "$SYSTEMCTL_EXEC" stop 'httpd.socket' - "$SYSTEMCTL_EXEC" mask 'httpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'httpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["httpd"] - - name: Block Disable service httpd block: @@ -258789,6 +258905,55 @@ disabled = ["httpd"] - no_reboot_needed - service_httpd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: httpd.service + enabled: false + mask: true + - name: httpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["httpd"] + + include disable_httpd + +class disable_httpd { + service {'httpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'httpd.service' +"$SYSTEMCTL_EXEC" disable 'httpd.service' +"$SYSTEMCTL_EXEC" mask 'httpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files httpd.socket; then + "$SYSTEMCTL_EXEC" stop 'httpd.socket' + "$SYSTEMCTL_EXEC" mask 'httpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'httpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -258874,8 +259039,21 @@ $ sudo yum erase nginx If there is no need to make the web server software available, removing it provides a safeguard against its activation. CCE-88034-4 - -package --remove=nginx + - name: Ensure nginx is removed + package: + name: nginx + state: absent + tags: + - CCE-88034-4 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_nginx_removed + - unknown_severity include remove_nginx @@ -258884,6 +259062,9 @@ class remove_nginx { ensure => 'purged', } } + + +package --remove=nginx # CAUTION: This remediation script will remove nginx @@ -258897,22 +259078,6 @@ if rpm -q --quiet "nginx" ; then yum remove -y "nginx" fi - - - name: Ensure nginx is removed - package: - name: nginx - state: absent - tags: - - CCE-88034-4 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_nginx_removed - - unknown_severity @@ -259439,13 +259604,6 @@ these files. PR.PT-3 Access to the web server's configuration files may allow an unauthorized user or attacker to access information about the web server or to alter the server's configuration files. - - - - - -find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/httpd/conf.d/ file(s) command: find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*$" @@ -259483,6 +259641,13 @@ find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex - low_disruption - no_reboot_needed - unknown_severity + + + + + + +find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -259564,13 +259729,6 @@ find -H /etc/httpd/conf.d/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex PR.PT-3 Access to the web server's configuration files may allow an unauthorized user or attacker to access information about the web server or to alter the server's configuration files. - - - - - -find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; - - name: Find /etc/httpd/conf/ file(s) command: find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex "^.*$" @@ -259608,6 +259766,13 @@ find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^ - low_disruption - no_reboot_needed - unknown_severity + + + + + + +find -H /etc/httpd/conf/ -maxdepth 1 -perm /u+xs,g+xws,o+xwrt -type f -regex '^.*$' -exec chmod u-xs,g-xws,o-xwrt {} \; @@ -260714,8 +260879,18 @@ $ sudo yum erase cyrus-imapd If there is no need to make the cyrus-imapd software available, removing it provides a safeguard against its activation. CCE-88119-3 - -package --remove=cyrus-imapd + - name: Ensure cyrus-imapd is removed + package: + name: cyrus-imapd + state: absent + tags: + - CCE-88119-3 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_cyrus-imapd_removed + - unknown_severity include remove_cyrus-imapd @@ -260724,6 +260899,9 @@ class remove_cyrus-imapd { ensure => 'purged', } } + + +package --remove=cyrus-imapd # CAUTION: This remediation script will remove cyrus-imapd @@ -260737,19 +260915,6 @@ if rpm -q --quiet "cyrus-imapd" ; then yum remove -y "cyrus-imapd" fi - - - name: Ensure cyrus-imapd is removed - package: - name: cyrus-imapd - state: absent - tags: - - CCE-88119-3 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_cyrus-imapd_removed - - unknown_severity @@ -260773,8 +260938,18 @@ $ sudo yum erase dovecot If there is no need to make the Dovecot software available, removing it provides a safeguard against its activation. CCE-85976-9 - -package --remove=dovecot + - name: Ensure dovecot is removed + package: + name: dovecot + state: absent + tags: + - CCE-85976-9 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_dovecot_removed + - unknown_severity include remove_dovecot @@ -260783,6 +260958,9 @@ class remove_dovecot { ensure => 'purged', } } + + +package --remove=dovecot # CAUTION: This remediation script will remove dovecot @@ -260796,19 +260974,6 @@ if rpm -q --quiet "dovecot" ; then yum remove -y "dovecot" fi - - - name: Ensure dovecot is removed - package: - name: dovecot - state: absent - tags: - - CCE-85976-9 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_dovecot_removed - - unknown_severity @@ -260827,55 +260992,6 @@ The dovecot service can be disabled with the following co avenue of attack, and should be disabled if not needed. CCE-82760-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: dovecot.service - enabled: false - mask: true - - name: dovecot.socket - enabled: false - mask: true - - include disable_dovecot - -class disable_dovecot { - service {'dovecot': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'dovecot.service' -"$SYSTEMCTL_EXEC" disable 'dovecot.service' -"$SYSTEMCTL_EXEC" mask 'dovecot.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files dovecot.socket; then - "$SYSTEMCTL_EXEC" stop 'dovecot.socket' - "$SYSTEMCTL_EXEC" mask 'dovecot.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'dovecot.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["dovecot"] - - name: Block Disable service dovecot block: @@ -260936,6 +261052,55 @@ disabled = ["dovecot"] - no_reboot_needed - service_dovecot_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: dovecot.service + enabled: false + mask: true + - name: dovecot.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["dovecot"] + + include disable_dovecot + +class disable_dovecot { + service {'dovecot': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'dovecot.service' +"$SYSTEMCTL_EXEC" disable 'dovecot.service' +"$SYSTEMCTL_EXEC" mask 'dovecot.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files dovecot.socket; then + "$SYSTEMCTL_EXEC" stop 'dovecot.socket' + "$SYSTEMCTL_EXEC" mask 'dovecot.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'dovecot.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -260976,8 +261141,22 @@ surface of the system. While this software is clearly essential on an KDC server, it is not necessary on typical desktop or workstation systems. CCE-85887-8 - -package --remove=krb5-server + - name: Ensure krb5-server is removed + package: + name: krb5-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-85887-8 + - DISA-STIG-RHEL-08-010163 + - NIST-800-53-IA-7 + - NIST-800-53-IA-7.1 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_krb5-server_removed include remove_krb5-server @@ -260986,6 +261165,9 @@ class remove_krb5-server { ensure => 'purged', } } + + +package --remove=krb5-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -261005,23 +261187,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure krb5-server is removed - package: - name: krb5-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85887-8 - - DISA-STIG-RHEL-08-010163 - - NIST-800-53-IA-7 - - NIST-800-53-IA-7.1 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_krb5-server_removed @@ -261047,15 +261212,6 @@ remove the Kerberos keytab files, especially The key derivation function (KDF) in Kerberos is not FIPS compatible. CCE-82175-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -rm -f /etc/*.keytab - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find keytab files find: paths: /etc/ @@ -261087,6 +261243,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +rm -f /etc/*.keytab + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -261183,8 +261348,21 @@ intended for use as an LDAP Server it should be removed. surface of the system. While this software is clearly essential on an LDAP server, it is not necessary on typical desktop or workstation systems. CCE-82728-7 - -package --remove=389-ds-base + - name: Ensure 389-ds-base is removed + package: + name: 389-ds-base + state: absent + tags: + - CCE-82728-7 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_389-ds-base_removed include remove_389-ds-base @@ -261193,6 +261371,9 @@ class remove_389-ds-base { ensure => 'purged', } } + + +package --remove=389-ds-base # CAUTION: This remediation script will remove 389-ds-base @@ -261206,22 +261387,6 @@ if rpm -q --quiet "389-ds-base" ; then yum remove -y "389-ds-base" fi - - - name: Ensure 389-ds-base is removed - package: - name: 389-ds-base - state: absent - tags: - - CCE-82728-7 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_389-ds-base_removed @@ -261255,8 +261420,18 @@ $ sudo yum erase openldap-clients 2.3.2 If the system does not need to act as an LDAP client, it is recommended that the software is removed to reduce the potential attack surface. CCE-82885-5 - -package --remove=openldap-clients + - name: Ensure openldap-clients is removed + package: + name: openldap-clients + state: absent + tags: + - CCE-82885-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_openldap-clients_removed include remove_openldap-clients @@ -261265,6 +261440,9 @@ class remove_openldap-clients { ensure => 'purged', } } + + +package --remove=openldap-clients # CAUTION: This remediation script will remove openldap-clients @@ -261278,19 +261456,6 @@ if rpm -q --quiet "openldap-clients" ; then yum remove -y "openldap-clients" fi - - - name: Ensure openldap-clients is removed - package: - name: openldap-clients - state: absent - tags: - - CCE-82885-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_openldap-clients_removed @@ -261757,8 +261922,21 @@ intended for use as an LDAP Server it should be removed. surface of the system. While this software is clearly essential on an LDAP server, it is not necessary on typical desktop or workstation systems. CCE-82415-1 - -package --remove=openldap-servers + - name: Ensure openldap-servers is removed + package: + name: openldap-servers + state: absent + tags: + - CCE-82415-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_openldap-servers_removed include remove_openldap-servers @@ -261767,6 +261945,9 @@ class remove_openldap-servers { ensure => 'purged', } } + + +package --remove=openldap-servers # CAUTION: This remediation script will remove openldap-servers @@ -261780,22 +261961,6 @@ if rpm -q --quiet "openldap-servers" ; then yum remove -y "openldap-servers" fi - - - name: Ensure openldap-servers is removed - package: - name: openldap-servers - state: absent - tags: - - CCE-82415-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_openldap-servers_removed @@ -261811,55 +261976,6 @@ fi disabled to reduce the potential attack surface. CCE-87262-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: slapd.service - enabled: false - mask: true - - name: slapd.socket - enabled: false - mask: true - - include disable_slapd - -class disable_slapd { - service {'slapd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'slapd.service' -"$SYSTEMCTL_EXEC" disable 'slapd.service' -"$SYSTEMCTL_EXEC" mask 'slapd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files slapd.socket; then - "$SYSTEMCTL_EXEC" stop 'slapd.socket' - "$SYSTEMCTL_EXEC" mask 'slapd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'slapd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["slapd"] - - name: Block Disable service slapd block: @@ -261920,6 +262036,55 @@ disabled = ["slapd"] - medium_severity - no_reboot_needed - service_slapd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: slapd.service + enabled: false + mask: true + - name: slapd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["slapd"] + + include disable_slapd + +class disable_slapd { + service {'slapd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'slapd.service' +"$SYSTEMCTL_EXEC" disable 'slapd.service' +"$SYSTEMCTL_EXEC" mask 'slapd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files slapd.socket; then + "$SYSTEMCTL_EXEC" stop 'slapd.socket' + "$SYSTEMCTL_EXEC" mask 'slapd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'slapd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -261995,8 +262160,26 @@ $ sudo yum install mailx Emails can be used to notify designated personnel about important system events such as failures or warnings. CCE-87036-0 - -package --add=mailx + - name: Ensure mailx is installed + package: + name: mailx + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-87036-0 + - DISA-STIG-RHEL-08-010358 + - NIST-800-53-CM-3(5) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_mailx_installed + + +[[packages]] +name = "mailx" +version = "*" include install_mailx @@ -262005,6 +262188,9 @@ class install_mailx { ensure => 'installed', } } + + +package --add=mailx # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262016,27 +262202,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "mailx" -version = "*" - - - name: Ensure mailx is installed - package: - name: mailx - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-87036-0 - - DISA-STIG-RHEL-08-010358 - - NIST-800-53-CM-3(5) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_mailx_installed @@ -262057,8 +262222,25 @@ $ sudo yum install postfix Emails can be used to notify designated personnel about important system events such as failures or warnings. CCE-85983-5 - -package --add=postfix + - name: Ensure postfix is installed + package: + name: postfix + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-85983-5 + - DISA-STIG-RHEL-08-030030 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_postfix_installed + + +[[packages]] +name = "postfix" +version = "*" include install_postfix @@ -262067,6 +262249,9 @@ class install_postfix { ensure => 'installed', } } + + +package --add=postfix # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262078,26 +262263,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "postfix" -version = "*" - - - name: Ensure postfix is installed - package: - name: postfix - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-85983-5 - - DISA-STIG-RHEL-08-030030 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_postfix_installed @@ -262190,8 +262355,23 @@ $ sudo yum erase sendmail its design prevents it from being effectively contained by SELinux. Postfix should be used instead. CCE-81039-0 - -package --remove=sendmail + - name: Ensure sendmail is removed + package: + name: sendmail + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-81039-0 + - DISA-STIG-RHEL-08-040002 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_sendmail_removed include remove_sendmail @@ -262200,6 +262380,9 @@ class remove_sendmail { ensure => 'purged', } } + + +package --remove=sendmail # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -262219,24 +262402,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure sendmail is removed - package: - name: sendmail - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-81039-0 - - DISA-STIG-RHEL-08-040002 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_sendmail_removed @@ -262256,31 +262421,6 @@ The postfix service can be enabled with the following com $ sudo systemctl enable postfix.service Local mail delivery is essential to some system maintenance and notification tasks. - include enable_postfix - -class enable_postfix { - service {'postfix': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'postfix.service' -"$SYSTEMCTL_EXEC" start 'postfix.service' -"$SYSTEMCTL_EXEC" enable 'postfix.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["postfix"] - - name: Enable service postfix block: @@ -262304,6 +262444,31 @@ enabled = ["postfix"] - no_reboot_needed - service_postfix_enabled - unknown_severity + + +[customizations.services] +enabled = ["postfix"] + + include enable_postfix + +class enable_postfix { + service {'postfix': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'postfix.service' +"$SYSTEMCTL_EXEC" start 'postfix.service' +"$SYSTEMCTL_EXEC" enable 'postfix.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262372,42 +262537,6 @@ $ sudo newaliases notify system administrators of active or impending issues. These messages must be forwarded to at least one monitored email address. CCE-82381-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_postfix_root_mail_alias='' - - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^root") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s: %s" "$stripped_key" "$var_postfix_root_mail_alias" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^root\\>" "/etc/aliases"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^root\\>.*/$escaped_formatted_output/gi" "/etc/aliases" -else - if [[ -s "/etc/aliases" ]] && [[ -n "$(tail -c 1 -- "/etc/aliases" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/aliases" - fi - cce="CCE-82381-5" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/aliases" >> "/etc/aliases" - printf '%s\n' "$formatted_output" >> "/etc/aliases" -fi - -if [ -f /usr/bin/newaliases ]; then - newaliases -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_postfix_root_mail_alias # promote to variable set_fact: var_postfix_root_mail_alias: !!str @@ -262462,6 +262591,42 @@ fi - medium_severity - no_reboot_needed - postfix_client_configure_mail_alias + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_postfix_root_mail_alias='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^root") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s: %s" "$stripped_key" "$var_postfix_root_mail_alias" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^root\\>" "/etc/aliases"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^root\\>.*/$escaped_formatted_output/gi" "/etc/aliases" +else + if [[ -s "/etc/aliases" ]] && [[ -n "$(tail -c 1 -- "/etc/aliases" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/aliases" + fi + cce="CCE-82381-5" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/aliases" >> "/etc/aliases" + printf '%s\n' "$formatted_output" >> "/etc/aliases" +fi + +if [ -f /usr/bin/newaliases ]; then + newaliases +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262492,32 +262657,6 @@ affected. Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. CCE-89063-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/aliases" ] ; then - - LC_ALL=C sed -i "/^\s*postmaster\s*:\s*/Id" "/etc/aliases" -else - touch "/etc/aliases" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/aliases" - -cp "/etc/aliases" "/etc/aliases.bak" -# Insert at the end of the file -printf '%s\n' "postmaster: root" >> "/etc/aliases" -# Clean up after ourselves. -rm "/etc/aliases.bak" - -if [ -f /usr/bin/newaliases ]; then - newaliases -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Configure System to Forward All Mail From Postmaster to The Root Account block: @@ -262593,6 +262732,32 @@ fi - medium_severity - no_reboot_needed - postfix_client_configure_mail_alias_postmaster + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/aliases" ] ; then + + LC_ALL=C sed -i "/^\s*postmaster\s*:\s*/Id" "/etc/aliases" +else + touch "/etc/aliases" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/aliases" + +cp "/etc/aliases" "/etc/aliases.bak" +# Insert at the end of the file +printf '%s\n' "postmaster: root" >> "/etc/aliases" +# Clean up after ourselves. +rm "/etc/aliases.bak" + +if [ -f /usr/bin/newaliases ]; then + newaliases +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262696,33 +262861,6 @@ may help prevent spam or viruses from being delivered. and not from the network, which protects it from network attack. CCE-82174-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q postfix; }; then - -var_postfix_inet_interfaces='' - - -if [ -e "/etc/postfix/main.cf" ] ; then - - LC_ALL=C sed -i "/^\s*inet_interfaces\s\+=\s\+/Id" "/etc/postfix/main.cf" -else - touch "/etc/postfix/main.cf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/postfix/main.cf" - -cp "/etc/postfix/main.cf" "/etc/postfix/main.cf.bak" -# Insert at the end of the file -printf '%s\n' "inet_interfaces=$var_postfix_inet_interfaces" >> "/etc/postfix/main.cf" -# Clean up after ourselves. -rm "/etc/postfix/main.cf.bak" - -systemctl restart postfix - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_postfix_inet_interfaces # promote to variable set_fact: var_postfix_inet_interfaces: !!str @@ -262772,6 +262910,33 @@ fi - no_reboot_needed - postfix_network_listening_disabled - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q postfix; }; then + +var_postfix_inet_interfaces='' + + +if [ -e "/etc/postfix/main.cf" ] ; then + + LC_ALL=C sed -i "/^\s*inet_interfaces\s\+=\s\+/Id" "/etc/postfix/main.cf" +else + touch "/etc/postfix/main.cf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/postfix/main.cf" + +cp "/etc/postfix/main.cf" "/etc/postfix/main.cf.bak" +# Insert at the end of the file +printf '%s\n' "inet_interfaces=$var_postfix_inet_interfaces" >> "/etc/postfix/main.cf" +# Clean up after ourselves. +rm "/etc/postfix/main.cf.bak" + +systemctl restart postfix + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -262913,19 +263078,6 @@ to the local network with the following command: host as a mail relay for the purpose of sending spam or other unauthorized activity. CCE-84054-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q postfix; then - -if ! grep -q ^smtpd_client_restrictions /etc/postfix/main.cf; then - echo "smtpd_client_restrictions = permit_mynetworks,reject" >> /etc/postfix/main.cf -else - sed -i "s/^smtpd_client_restrictions.*/smtpd_client_restrictions = permit_mynetworks,reject/g" /etc/postfix/main.cf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -262979,6 +263131,19 @@ fi - no_reboot_needed - postfix_prevent_unrestricted_relay - restrict_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q postfix; then + +if ! grep -q ^smtpd_client_restrictions /etc/postfix/main.cf; then + echo "smtpd_client_restrictions = permit_mynetworks,reject" >> /etc/postfix/main.cf +else + sed -i "s/^smtpd_client_restrictions.*/smtpd_client_restrictions = permit_mynetworks,reject/g" /etc/postfix/main.cf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -263077,8 +263242,18 @@ daemon on a remote host for information about the Network File System (NFS) serv remote host. For example, showmount can display the clients which are mounted on that host. CCE-82932-5 - -package --remove=nfs-utils + - name: Ensure nfs-utils is removed + package: + name: nfs-utils + state: absent + tags: + - CCE-82932-5 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_nfs-utils_removed include remove_nfs-utils @@ -263087,6 +263262,9 @@ class remove_nfs-utils { ensure => 'purged', } } + + +package --remove=nfs-utils # CAUTION: This remediation script will remove nfs-utils @@ -263100,19 +263278,6 @@ if rpm -q --quiet "nfs-utils" ; then yum remove -y "nfs-utils" fi - - - name: Ensure nfs-utils is removed - package: - name: nfs-utils - state: absent - tags: - - CCE-82932-5 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_nfs-utils_removed @@ -263147,6 +263312,64 @@ and against flaws in the netfs script itself. The netfs service can be disabled with the following command: $ sudo systemctl mask --now netfs.service + - name: Block Disable service netfs + block: + + - name: Disable service netfs + block: + + - name: Disable service netfs + systemd: + name: netfs.service + enabled: 'no' + state: stopped + masked: 'yes' + rescue: + + - name: Intentionally ignored previous 'Disable service netfs' failure, service + was already disabled + meta: noop + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + +- name: Unit Socket Exists - netfs.socket + command: systemctl -q list-unit-files netfs.socket + register: socket_file_exists + changed_when: false + failed_when: socket_file_exists.rc not in [0, 1] + check_mode: false + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + +- name: Disable socket netfs + systemd: + name: netfs.socket + enabled: 'no' + state: stopped + masked: 'yes' + when: + - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + - socket_file_exists.stdout_lines is search("netfs.socket",multiline=True) + tags: + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - service_netfs_disabled + - unknown_severity + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: @@ -263161,6 +263384,10 @@ spec: - name: netfs.socket enabled: false mask: true + + +[customizations.services] +disabled = ["netfs"] include disable_netfs @@ -263191,68 +263418,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -disabled = ["netfs"] - - - name: Block Disable service netfs - block: - - - name: Disable service netfs - block: - - - name: Disable service netfs - systemd: - name: netfs.service - enabled: 'no' - state: stopped - masked: 'yes' - rescue: - - - name: Intentionally ignored previous 'Disable service netfs' failure, service - was already disabled - meta: noop - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity - -- name: Unit Socket Exists - netfs.socket - command: systemctl -q list-unit-files netfs.socket - register: socket_file_exists - changed_when: false - failed_when: socket_file_exists.rc not in [0, 1] - check_mode: false - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity - -- name: Disable socket netfs - systemd: - name: netfs.socket - enabled: 'no' - state: stopped - masked: 'yes' - when: - - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - - socket_file_exists.stdout_lines is search("netfs.socket",multiline=True) - tags: - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - service_netfs_disabled - - unknown_severity @@ -263282,8 +263447,19 @@ $ sudo yum erase rpcbind If the system does not require rpc based services, it is recommended that rpcbind be disabled to reduce the attack surface. CCE-86645-9 - -package --remove=rpcbind + - name: Ensure rpcbind is removed + package: + name: rpcbind + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86645-9 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_rpcbind_removed include remove_rpcbind @@ -263292,6 +263468,9 @@ class remove_rpcbind { ensure => 'purged', } } + + +package --remove=rpcbind # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -263311,20 +263490,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure rpcbind is removed - package: - name: rpcbind - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-86645-9 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_rpcbind_removed @@ -263343,55 +263508,6 @@ this service should be disabled. The nfslock service can be disabled with the following command: $ sudo systemctl mask --now nfslock.service - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nfslock.service - enabled: false - mask: true - - name: nfslock.socket - enabled: false - mask: true - - include disable_nfslock - -class disable_nfslock { - service {'nfslock': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nfslock.service' -"$SYSTEMCTL_EXEC" disable 'nfslock.service' -"$SYSTEMCTL_EXEC" mask 'nfslock.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nfslock.socket; then - "$SYSTEMCTL_EXEC" stop 'nfslock.socket' - "$SYSTEMCTL_EXEC" mask 'nfslock.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nfslock.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nfslock"] - - name: Block Disable service nfslock block: @@ -263450,27 +263566,7 @@ disabled = ["nfslock"] - service_nfslock_disabled - unknown_severity - - - - - - Disable rpcbind Service - The rpcbind utility maps RPC services to the ports on which they listen. -RPC processes notify rpcbind when they start, registering the ports they -are listening on and the RPC program numbers they expect to serve. The -rpcbind service redirects the client to the proper port number so it can -communicate with the requested service. If the system does not require RPC -(such as for NFS servers) then this service should be disabled. - -The rpcbind service can be disabled with the following command: -$ sudo systemctl mask --now rpcbind.service - 2.2.4 - 2.2.12 - If the system does not require rpc based services, it is recommended that -rpcbind be disabled to reduce the attack surface. - CCE-82858-2 - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263478,47 +263574,67 @@ spec: version: 3.1.0 systemd: units: - - name: rpcbind.service + - name: nfslock.service enabled: false mask: true - - name: rpcbind.socket + - name: nfslock.socket enabled: false mask: true - include disable_rpcbind + +[customizations.services] +disabled = ["nfslock"] + + include disable_nfslock -class disable_rpcbind { - service {'rpcbind': +class disable_nfslock { + service {'nfslock': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcbind.service' -"$SYSTEMCTL_EXEC" disable 'rpcbind.service' -"$SYSTEMCTL_EXEC" mask 'rpcbind.service' +"$SYSTEMCTL_EXEC" stop 'nfslock.service' +"$SYSTEMCTL_EXEC" disable 'nfslock.service' +"$SYSTEMCTL_EXEC" mask 'nfslock.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcbind.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcbind.socket' - "$SYSTEMCTL_EXEC" mask 'rpcbind.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files nfslock.socket; then + "$SYSTEMCTL_EXEC" stop 'nfslock.socket' + "$SYSTEMCTL_EXEC" mask 'nfslock.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcbind.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'nfslock.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcbind"] - + + + + + + Disable rpcbind Service + The rpcbind utility maps RPC services to the ports on which they listen. +RPC processes notify rpcbind when they start, registering the ports they +are listening on and the RPC program numbers they expect to serve. The +rpcbind service redirects the client to the proper port number so it can +communicate with the requested service. If the system does not require RPC +(such as for NFS servers) then this service should be disabled. + +The rpcbind service can be disabled with the following command: +$ sudo systemctl mask --now rpcbind.service + 2.2.4 + 2.2.12 + If the system does not require rpc based services, it is recommended that +rpcbind be disabled to reduce the attack surface. + CCE-82858-2 - name: Block Disable service rpcbind block: @@ -263583,21 +263699,7 @@ disabled = ["rpcbind"] - no_reboot_needed - service_rpcbind_disabled - - - - - - Disable Secure RPC Client Service (rpcgssd) - The rpcgssd service manages RPCSEC GSS contexts required to secure protocols -that use RPC (most often Kerberos and NFS). The rpcgssd service is the -client-side of RPCSEC GSS. If the system does not require secure RPC then this -service should be disabled. - -The rpcgssd service can be disabled with the following command: -$ sudo systemctl mask --now rpcgssd.service - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263605,47 +263707,61 @@ spec: version: 3.1.0 systemd: units: - - name: rpcgssd.service + - name: rpcbind.service enabled: false mask: true - - name: rpcgssd.socket + - name: rpcbind.socket enabled: false mask: true - include disable_rpcgssd + +[customizations.services] +disabled = ["rpcbind"] + + include disable_rpcbind -class disable_rpcgssd { - service {'rpcgssd': +class disable_rpcbind { + service {'rpcbind': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcgssd.service' -"$SYSTEMCTL_EXEC" disable 'rpcgssd.service' -"$SYSTEMCTL_EXEC" mask 'rpcgssd.service' +"$SYSTEMCTL_EXEC" stop 'rpcbind.service' +"$SYSTEMCTL_EXEC" disable 'rpcbind.service' +"$SYSTEMCTL_EXEC" mask 'rpcbind.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcgssd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcgssd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcgssd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcbind.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcbind.socket' + "$SYSTEMCTL_EXEC" mask 'rpcbind.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcgssd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'rpcbind.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcgssd"] - + + + + + + Disable Secure RPC Client Service (rpcgssd) + The rpcgssd service manages RPCSEC GSS contexts required to secure protocols +that use RPC (most often Kerberos and NFS). The rpcgssd service is the +client-side of RPCSEC GSS. If the system does not require secure RPC then this +service should be disabled. + +The rpcgssd service can be disabled with the following command: +$ sudo systemctl mask --now rpcgssd.service + - name: Block Disable service rpcgssd block: @@ -263704,20 +263820,7 @@ disabled = ["rpcgssd"] - service_rpcgssd_disabled - unknown_severity - - - - - - Disable RPC ID Mapping Service (rpcidmapd) - The rpcidmapd service is used to map user names and groups to UID -and GID numbers on NFSv4 mounts. If NFS is not in use on the local system then -this service should be disabled. - -The rpcidmapd service can be disabled with the following command: -$ sudo systemctl mask --now rpcidmapd.service - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -263725,47 +263828,60 @@ spec: version: 3.1.0 systemd: units: - - name: rpcidmapd.service + - name: rpcgssd.service enabled: false mask: true - - name: rpcidmapd.socket + - name: rpcgssd.socket enabled: false mask: true - include disable_rpcidmapd + +[customizations.services] +disabled = ["rpcgssd"] + + include disable_rpcgssd -class disable_rpcidmapd { - service {'rpcidmapd': +class disable_rpcgssd { + service {'rpcgssd': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcidmapd.service' -"$SYSTEMCTL_EXEC" disable 'rpcidmapd.service' -"$SYSTEMCTL_EXEC" mask 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" stop 'rpcgssd.service' +"$SYSTEMCTL_EXEC" disable 'rpcgssd.service' +"$SYSTEMCTL_EXEC" mask 'rpcgssd.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcidmapd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcidmapd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcidmapd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcgssd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcgssd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcgssd.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcidmapd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'rpcgssd.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcidmapd"] - + + + + + + Disable RPC ID Mapping Service (rpcidmapd) + The rpcidmapd service is used to map user names and groups to UID +and GID numbers on NFSv4 mounts. If NFS is not in use on the local system then +this service should be disabled. + +The rpcidmapd service can be disabled with the following command: +$ sudo systemctl mask --now rpcidmapd.service + - name: Block Disable service rpcidmapd block: @@ -263823,6 +263939,55 @@ disabled = ["rpcidmapd"] - no_reboot_needed - service_rpcidmapd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rpcidmapd.service + enabled: false + mask: true + - name: rpcidmapd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rpcidmapd"] + + include disable_rpcidmapd + +class disable_rpcidmapd { + service {'rpcidmapd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" disable 'rpcidmapd.service' +"$SYSTEMCTL_EXEC" mask 'rpcidmapd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcidmapd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcidmapd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcidmapd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rpcidmapd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264001,55 +264166,6 @@ The nfs-server service can be disabled with the following Unnecessary services should be disabled to decrease the attack surface of the system. CCE-82762-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: nfs-server.service - enabled: false - mask: true - - name: nfs-server.socket - enabled: false - mask: true - - include disable_nfs-server - -class disable_nfs-server { - service {'nfs-server': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'nfs-server.service' -"$SYSTEMCTL_EXEC" disable 'nfs-server.service' -"$SYSTEMCTL_EXEC" mask 'nfs-server.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files nfs-server.socket; then - "$SYSTEMCTL_EXEC" stop 'nfs-server.socket' - "$SYSTEMCTL_EXEC" mask 'nfs-server.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'nfs-server.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["nfs-server"] - - name: Block Disable service nfs-server block: @@ -264120,25 +264236,7 @@ disabled = ["nfs-server"] - service_nfs_disabled - unknown_severity - - - - - - - - - Disable Secure RPC Server Service (rpcsvcgssd) - The rpcsvcgssd service manages RPCSEC GSS contexts required to -secure protocols that use RPC (most often Kerberos and NFS). The rpcsvcgssd -service is the server-side of RPCSEC GSS. If the system does not require secure -RPC then this service should be disabled. - -The rpcsvcgssd service can be disabled with the following command: -$ sudo systemctl mask --now rpcsvcgssd.service - Unnecessary services should be disabled to decrease the attack surface of the system. - - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -264146,47 +264244,65 @@ spec: version: 3.1.0 systemd: units: - - name: rpcsvcgssd.service + - name: nfs-server.service enabled: false mask: true - - name: rpcsvcgssd.socket + - name: nfs-server.socket enabled: false mask: true - include disable_rpcsvcgssd + +[customizations.services] +disabled = ["nfs-server"] + + include disable_nfs-server -class disable_rpcsvcgssd { - service {'rpcsvcgssd': +class disable_nfs-server { + service {'nfs-server': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.service' -"$SYSTEMCTL_EXEC" disable 'rpcsvcgssd.service' -"$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" stop 'nfs-server.service' +"$SYSTEMCTL_EXEC" disable 'nfs-server.service' +"$SYSTEMCTL_EXEC" mask 'nfs-server.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rpcsvcgssd.socket; then - "$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.socket' - "$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files nfs-server.socket; then + "$SYSTEMCTL_EXEC" stop 'nfs-server.socket' + "$SYSTEMCTL_EXEC" mask 'nfs-server.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rpcsvcgssd.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'nfs-server.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["rpcsvcgssd"] - + + + + + + + + + Disable Secure RPC Server Service (rpcsvcgssd) + The rpcsvcgssd service manages RPCSEC GSS contexts required to +secure protocols that use RPC (most often Kerberos and NFS). The rpcsvcgssd +service is the server-side of RPCSEC GSS. If the system does not require secure +RPC then this service should be disabled. + +The rpcsvcgssd service can be disabled with the following command: +$ sudo systemctl mask --now rpcsvcgssd.service + Unnecessary services should be disabled to decrease the attack surface of the system. + - name: Block Disable service rpcsvcgssd block: @@ -264244,6 +264360,55 @@ disabled = ["rpcsvcgssd"] - no_reboot_needed - service_rpcsvcgssd_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rpcsvcgssd.service + enabled: false + mask: true + - name: rpcsvcgssd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rpcsvcgssd"] + + include disable_rpcsvcgssd + +class disable_rpcsvcgssd { + service {'rpcsvcgssd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" disable 'rpcsvcgssd.service' +"$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rpcsvcgssd.socket; then + "$SYSTEMCTL_EXEC" stop 'rpcsvcgssd.socket' + "$SYSTEMCTL_EXEC" mask 'rpcsvcgssd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rpcsvcgssd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264345,40 +264510,6 @@ any NFS mounts. requests from the remote user. The userid and groupid could mistakenly or maliciously be set incorrectly. The AUTH_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|sec=krb5:krb5i:krb5p)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}sec=krb5:krb5i:krb5p 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "sec=krb5:krb5i:krb5p"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,sec=krb5:krb5i:krb5p|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have sec=krb5:krb5i:krb5p command: findmnt --fstab --types nfs,nfs4 -O nosec=krb5:krb5i:krb5p -n -P register: points_register @@ -264426,6 +264557,40 @@ fi - medium_severity - mount_option_krb_sec_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|sec=krb5:krb5i:krb5p)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}sec=krb5:krb5i:krb5p 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "sec=krb5:krb5i:krb5p"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,sec=krb5:krb5i:krb5p|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264522,40 +264687,6 @@ any NFS mounts. Legitimate device files should only exist in the /dev directory. NFS mounts should not present device files to users. CCE-84052-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have nodev command: findmnt --fstab --types nfs,nfs4 -O nonodev -n -P register: points_register @@ -264597,6 +264728,40 @@ fi - medium_severity - mount_option_nodev_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nodev)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nodev 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nodev"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nodev|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264662,40 +264827,6 @@ for mounting any file system not containing approved binary files as they may be files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access. CCE-84050-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have noexec command: findmnt --fstab --types nfs,nfs4 -O nonoexec -n -P register: points_register @@ -264741,6 +264872,40 @@ fi - medium_severity - mount_option_noexec_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|noexec)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}noexec 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "noexec"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,noexec|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -264803,40 +264968,6 @@ any NFS mounts. NFS mounts should not present suid binaries to users. Only vendor-supplied suid executables should be installed to their default location on the local filesystem. CCE-84053-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -vfstype_points=() -readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') - -for vfstype_point in "${vfstype_points[@]}" -do - mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" - - # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab - if ! grep -q "$mount_point_match_regexp" /etc/fstab; then - # runtime opts without some automatic kernel/userspace-added defaults - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ - | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") - [ "$previous_mount_opts" ] && previous_mount_opts+="," - # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in - # fstab as "block". The next variable is to satisfy shellcheck SC2050. - fs_type="nfs4" - if [ "$fs_type" == "iso9660" ] ; then - previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") - fi - echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab - # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it - elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then - previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') - sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Get nfs and nfs4 mount points, that don't have nosuid command: findmnt --fstab --types nfs,nfs4 -O nonosuid -n -P register: points_register @@ -264880,6 +265011,40 @@ fi - medium_severity - mount_option_nosuid_remote_filesystems - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +vfstype_points=() +readarray -t vfstype_points < <(grep -E "[[:space:]]nfs[4]?[[:space:]]" /etc/fstab | awk '{print $2}') + +for vfstype_point in "${vfstype_points[@]}" +do + mount_point_match_regexp="$(printf "^[[:space:]]*[^#].*[[:space:]]%s[[:space:]]" ${vfstype_point//\\/\\\\})" + + # If the mount point is not in /etc/fstab, get previous mount options from /etc/mtab + if ! grep -q "$mount_point_match_regexp" /etc/fstab; then + # runtime opts without some automatic kernel/userspace-added defaults + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/mtab | head -1 | awk '{print $4}' \ + | sed -E "s/(rw|defaults|seclabel|nosuid)(,|$)//g;s/,$//") + [ "$previous_mount_opts" ] && previous_mount_opts+="," + # In iso9660 filesystems mtab could describe a "blocksize" value, this should be reflected in + # fstab as "block". The next variable is to satisfy shellcheck SC2050. + fs_type="nfs4" + if [ "$fs_type" == "iso9660" ] ; then + previous_mount_opts=$(sed 's/blocksize=/block=/' <<< "$previous_mount_opts") + fi + echo " ${vfstype_point//\\/\\\\} nfs4 defaults,${previous_mount_opts}nosuid 0 0" >> /etc/fstab + # If the mount_opt option is not already in the mount point's /etc/fstab entry, add it + elif ! grep "$mount_point_match_regexp" /etc/fstab | grep -q "nosuid"; then + previous_mount_opts=$(grep "$mount_point_match_regexp" /etc/fstab | awk '{print $4}') + sed -i "s|\(${mount_point_match_regexp}.*${previous_mount_opts}\)|\1,nosuid|" /etc/fstab + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265078,21 +265243,6 @@ requests from the remote user. The userid and groupid could mistakenly or malici incorrectly. The AUTH_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request. CCE-80924-4 - -nfs_exports=() -readarray -t nfs_exports < <(grep -E "^/.*[[:space:]]+ .*\(.*\)[[:space:]]*$" /etc/exports | awk '{print $2}') - -for nfs_export in "${nfs_exports[@]}" -do - correct_export="" - if [ "$(grep -c "sec=" <<<"$nfs_export")" -eq 0 ]; then - correct_export="$(echo $nfs_export|sed -e 's/).*$/,sec=krb5\:krb5i\:krb5p)/')" - else - correct_export="$(echo $nfs_export|sed -e 's/sec=[^\,\)]*/sec=krb5\:krb5i\:krb5p/')" - fi - sed -i "s|$nfs_export|$correct_export|g" /etc/exports -done - - name: Drop any security clause for every export replace: path: /etc/exports @@ -265134,6 +265284,21 @@ done - medium_severity - no_reboot_needed - use_kerberos_security_all_exports + + +nfs_exports=() +readarray -t nfs_exports < <(grep -E "^/.*[[:space:]]+ .*\(.*\)[[:space:]]*$" /etc/exports | awk '{print $2}') + +for nfs_export in "${nfs_exports[@]}" +do + correct_export="" + if [ "$(grep -c "sec=" <<<"$nfs_export")" -eq 0 ]; then + correct_export="$(echo $nfs_export|sed -e 's/).*$/,sec=krb5\:krb5i\:krb5p)/')" + else + correct_export="$(echo $nfs_export|sed -e 's/sec=[^\,\)]*/sec=krb5\:krb5i\:krb5p/')" + fi + sed -i "s|$nfs_export|$correct_export|g" /etc/exports +done @@ -265300,8 +265465,26 @@ Kerberos and also ensures log files have consistent time records across the ente which aids in forensic investigations. CCE-82874-9 - -package --add=chrony + - name: Ensure chrony is installed + package: + name: chrony + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82874-9 + - PCI-DSS-Req-10.4 + - PCI-DSSv4-10.6.1 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_chrony_installed + + +[[packages]] +name = "chrony" +version = "*" include install_chrony @@ -265310,6 +265493,9 @@ class install_chrony { ensure => 'installed', } } + + +package --add=chrony # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -265321,27 +265507,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "chrony" -version = "*" - - - name: Ensure chrony is installed - package: - name: chrony - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82874-9 - - PCI-DSS-Req-10.4 - - PCI-DSSv4-10.6.1 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_chrony_installed @@ -265387,8 +265552,25 @@ version = "*" PR.PT-1 Req-10.4 Time synchronization (using NTP) is required by almost all network and administrative tasks (syslog, cryptographic based services (authentication, etc.), etc.). Ntpd is regulary maintained and updated, supporting security features such as RFC 5906. - -package --add=ntp + - name: Ensure ntp is installed + package: + name: ntp + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - NIST-800-53-CM-6(a) + - PCI-DSS-Req-10.4 + - enable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_ntp_installed + + +[[packages]] +name = "ntp" +version = "*" include install_ntp @@ -265397,6 +265579,9 @@ class install_ntp { ensure => 'installed', } } + + +package --add=ntp # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -265408,26 +265593,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "ntp" -version = "*" - - - name: Ensure ntp is installed - package: - name: ntp - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - NIST-800-53-CM-6(a) - - PCI-DSS-Req-10.4 - - enable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_ntp_installed @@ -265455,31 +265620,6 @@ This recommendation only applies if chrony is in use on the system. CCE-82875-6 - include enable_chronyd - -class enable_chronyd { - service {'chronyd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'chronyd.service' -"$SYSTEMCTL_EXEC" start 'chronyd.service' -"$SYSTEMCTL_EXEC" enable 'chronyd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["chronyd"] - - name: Gather the package facts package_facts: manager: auto @@ -265518,6 +265658,31 @@ enabled = ["chronyd"] - medium_severity - no_reboot_needed - service_chronyd_enabled + + +[customizations.services] +enabled = ["chronyd"] + + include enable_chronyd + +class enable_chronyd { + service {'chronyd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'chronyd.service' +"$SYSTEMCTL_EXEC" start 'chronyd.service' +"$SYSTEMCTL_EXEC" enable 'chronyd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265603,47 +265768,6 @@ The chronyd and ntpd NTP daemons o functionality of ntpdate, which is now deprecated. CCE-80874-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if rpm --quiet -q "chrony" ; then - if ! /usr/sbin/pidof ntpd ; then - /usr/bin/systemctl enable "chronyd" - /usr/bin/systemctl start "chronyd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "chronyd"; then - /usr/bin/systemctl reset-failed "chronyd" - fi - fi -elif rpm --quiet -q "ntp" ; then - /usr/bin/systemctl enable "ntpd" - /usr/bin/systemctl start "ntpd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "ntpd"; then - /usr/bin/systemctl reset-failed "ntpd" - fi -else - if ! rpm -q --quiet "chrony" ; then - yum install -y "chrony" - fi - /usr/bin/systemctl enable "chronyd" - /usr/bin/systemctl start "chronyd" - # The service may not be running because it has been started and failed, - # so let's reset the state so OVAL checks pass. - # Service should be 'inactive', not 'failed' after reboot though. - if /usr/bin/systemctl --failed | grep -q "chronyd"; then - /usr/bin/systemctl reset-failed "chronyd" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -265728,6 +265852,47 @@ fi - medium_severity - no_reboot_needed - service_chronyd_or_ntpd_enabled + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if rpm --quiet -q "chrony" ; then + if ! /usr/sbin/pidof ntpd ; then + /usr/bin/systemctl enable "chronyd" + /usr/bin/systemctl start "chronyd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "chronyd"; then + /usr/bin/systemctl reset-failed "chronyd" + fi + fi +elif rpm --quiet -q "ntp" ; then + /usr/bin/systemctl enable "ntpd" + /usr/bin/systemctl start "ntpd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "ntpd"; then + /usr/bin/systemctl reset-failed "ntpd" + fi +else + if ! rpm -q --quiet "chrony" ; then + yum install -y "chrony" + fi + /usr/bin/systemctl enable "chronyd" + /usr/bin/systemctl start "chronyd" + # The service may not be running because it has been started and failed, + # so let's reset the state so OVAL checks pass. + # Service should be 'inactive', not 'failed' after reboot though. + if /usr/bin/systemctl --failed | grep -q "chronyd"; then + /usr/bin/systemctl reset-failed "chronyd" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265787,31 +265952,6 @@ logs and auditing possible security breaches. The NTP daemon offers all of the functionality of ntpdate, which is now deprecated. - include enable_ntp - -class enable_ntp { - service {'ntp': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ntp.service' -"$SYSTEMCTL_EXEC" start 'ntp.service' -"$SYSTEMCTL_EXEC" enable 'ntp.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ntp"] - - name: Gather the package facts package_facts: manager: auto @@ -265856,6 +265996,31 @@ enabled = ["ntp"] - low_disruption - no_reboot_needed - service_ntp_enabled + + +[customizations.services] +enabled = ["ntp"] + + include enable_ntp + +class enable_ntp { + service {'ntp': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ntp.service' +"$SYSTEMCTL_EXEC" start 'ntp.service' +"$SYSTEMCTL_EXEC" enable 'ntp.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -265914,31 +266079,6 @@ The NTP daemon offers all of the functionality of ntpdate deprecated. CCE-86486-8 - include enable_ntpd - -class enable_ntpd { - service {'ntpd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'ntpd.service' -"$SYSTEMCTL_EXEC" start 'ntpd.service' -"$SYSTEMCTL_EXEC" enable 'ntpd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["ntpd"] - - name: Gather the package facts package_facts: manager: auto @@ -265985,6 +266125,31 @@ enabled = ["ntpd"] - medium_severity - no_reboot_needed - service_ntpd_enabled + + +[customizations.services] +enabled = ["ntpd"] + + include enable_ntpd + +class enable_ntpd { + service {'ntpd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q ntp; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'ntpd.service' +"$SYSTEMCTL_EXEC" start 'ntpd.service' +"$SYSTEMCTL_EXEC" enable 'ntpd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266011,6 +266176,47 @@ Operating systems are capable of providing a wide variety of functions and servi To support the requirements and principles of least functionality, the operating system must support the organizational requirements, providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues. CCE-82988-7 + - name: Disable chrony daemon from acting as server + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/chrony.conf + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/chrony.conf + lineinfile: + path: /etc/chrony.conf + create: true + regexp: ^\s*port\s+ + line: port 0 + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82988-7 + - DISA-STIG-RHEL-08-030741 + - NIST-800-53-AU-12(1) + - NIST-800-53-AU-8(1) + - chronyd_client_only + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - restrict_strategy + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -266065,14 +266271,37 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: Disable chrony daemon from acting as server + + + + + + + + + Disable network management of chrony daemon + The cmdport option in /etc/chrony.conf can be set to +0 to stop chrony daemon from listening on the UDP port 323 +for management connections made by chronyc. + CCI-000381 + CM-7(1) + FMT_SMF_EXT.1 + SRG-OS-000096-GPOS-00050 + SRG-OS-000095-GPOS-00049 + RHEL-08-030742 + SV-230486r928593_rule + Minimizing the exposure of the server functionality of the chrony +daemon diminishes the attack surface. + + CCE-82840-0 + - name: Disable network management of chrony daemon block: - name: Check for duplicate values lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ + regexp: ^\s*cmdport\s+ state: absent check_mode: true changed_when: false @@ -266082,7 +266311,7 @@ fi lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ + regexp: ^\s*cmdport\s+ state: absent when: dupes.found is defined and dupes.found > 1 @@ -266090,45 +266319,21 @@ fi lineinfile: path: /etc/chrony.conf create: true - regexp: ^\s*port\s+ - line: port 0 + regexp: ^\s*cmdport\s+ + line: cmdport 0 state: present when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-82988-7 - - DISA-STIG-RHEL-08-030741 - - NIST-800-53-AU-12(1) - - NIST-800-53-AU-8(1) - - chronyd_client_only + - CCE-82840-0 + - DISA-STIG-RHEL-08-030742 + - NIST-800-53-CM-7(1) + - chronyd_no_chronyc_network - low_complexity - low_disruption - low_severity - no_reboot_needed - restrict_strategy - - - - - - - - - Disable network management of chrony daemon - The cmdport option in /etc/chrony.conf can be set to -0 to stop chrony daemon from listening on the UDP port 323 -for management connections made by chronyc. - CCI-000381 - CM-7(1) - FMT_SMF_EXT.1 - SRG-OS-000096-GPOS-00050 - SRG-OS-000095-GPOS-00049 - RHEL-08-030742 - SV-230486r928593_rule - Minimizing the exposure of the server functionality of the chrony -daemon diminishes the attack surface. - - CCE-82840-0 --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -266182,46 +266387,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable network management of chrony daemon - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/chrony.conf - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/chrony.conf - lineinfile: - path: /etc/chrony.conf - create: true - regexp: ^\s*cmdport\s+ - line: cmdport 0 - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82840-0 - - DISA-STIG-RHEL-08-030742 - - NIST-800-53-CM-7(1) - - chronyd_no_chronyc_network - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - restrict_strategy @@ -266286,70 +266451,6 @@ Synchronizing internal information system clocks provides uniformity of time sta Organizations should consider endpoints that may not have regular access to the authoritative time server (e.g., mobile, teleworking, and tactical endpoints). CCE-84059-5 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} - mode: 420 - overwrite: true - path: /etc/chrony.conf - - contents: - source: data:, - mode: 420 - overwrite: true - path: /etc/chrony.d/.mco-keep - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} - mode: 420 - overwrite: true - path: /etc/chrony.d/ntp-server.conf - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( rpm --quiet -q chrony || rpm --quiet -q ntp ); }; then - -var_time_service_set_maxpoll='' - - - - -pof="/usr/sbin/pidof" - - -CONFIG_FILES="/etc/ntp.conf" -$pof ntpd || { - CHRONY_NAME=/etc/chrony.conf - CHRONY_PATH=${CHRONY_NAME%%.*} - CONFIG_FILES=$(find ${CHRONY_PATH}.* -type f -name '*.conf') -} - -# get list of ntp files - -for config_file in $CONFIG_FILES; do - # Set maxpoll values to var_time_service_set_maxpoll - sed -i "s/^\(\(server\|pool\|peer\).*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \3/" "$config_file" -done - - - - -for config_file in $CONFIG_FILES; do - # Add maxpoll to server, pool or peer entries without maxpoll - grep "^\(server\|pool\|peer\)" "$config_file" | grep -v maxpoll | while read -r line ; do - sed -i "s/$line/& maxpoll $var_time_service_set_maxpoll/" "$config_file" - done -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -266542,6 +266643,70 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} + mode: 420 + overwrite: true + path: /etc/chrony.conf + - contents: + source: data:, + mode: 420 + overwrite: true + path: /etc/chrony.d/.mco-keep + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} + mode: 420 + overwrite: true + path: /etc/chrony.d/ntp-server.conf + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { ( rpm --quiet -q chrony || rpm --quiet -q ntp ); }; then + +var_time_service_set_maxpoll='' + + + + +pof="/usr/sbin/pidof" + + +CONFIG_FILES="/etc/ntp.conf" +$pof ntpd || { + CHRONY_NAME=/etc/chrony.conf + CHRONY_PATH=${CHRONY_NAME%%.*} + CONFIG_FILES=$(find ${CHRONY_PATH}.* -type f -name '*.conf') +} + +# get list of ntp files + +for config_file in $CONFIG_FILES; do + # Set maxpoll values to var_time_service_set_maxpoll + sed -i "s/^\(\(server\|pool\|peer\).*maxpoll\) [0-9][0-9]*\(.*\)$/\1 $var_time_service_set_maxpoll \3/" "$config_file" +done + + + + +for config_file in $CONFIG_FILES; do + # Add maxpoll to server, pool or peer entries without maxpoll + grep "^\(server\|pool\|peer\)" "$config_file" | grep -v maxpoll | while read -r line ; do + sed -i "s/$line/& maxpoll $var_time_service_set_maxpoll/" "$config_file" + done +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266614,54 +266779,6 @@ unavailable. This is typical for a system acting as an NTP server for other systems. CCE-80764-4 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} - mode: 420 - overwrite: true - path: /etc/chrony.conf - - contents: - source: data:, - mode: 420 - overwrite: true - path: /etc/chrony.d/.mco-keep - - contents: - source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} - mode: 420 - overwrite: true - path: /etc/chrony.d/ntp-server.conf - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_multiple_time_servers='' - - -config_file="/etc/ntp.conf" -/usr/sbin/pidof ntpd || config_file="/etc/chrony.conf" - -if ! [ "$(grep -c '^server' "$config_file")" -gt 1 ] ; then - if ! grep -q '#[[:space:]]*server' "$config_file" ; then - for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do - printf '\nserver %s' "$server" >> "$config_file" - done - else - sed -i 's/#[ \t]*server/server/g' "$config_file" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_multiple_time_servers # promote to variable set_fact: var_multiple_time_servers: !!str @@ -266755,6 +266872,54 @@ fi - low_disruption - medium_severity - no_reboot_needed + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,{{ %23%20Allow%20for%20extra%20configuration%20files.%20This%20is%20useful%0A%23%20for%20admins%20specifying%20their%20own%20NTP%20servers%0Ainclude%20/etc/chrony.d/%2A.conf%0A%0A%23%20Set%20chronyd%20as%20client-only.%0Aport%200%0A%0A%23%20Disable%20chronyc%20from%20the%20network%0Acmdport%200%0A%0A%23%20Record%20the%20rate%20at%20which%20the%20system%20clock%20gains/losses%20time.%0Adriftfile%20/var/lib/chrony/drift%0A%0A%23%20Allow%20the%20system%20clock%20to%20be%20stepped%20in%20the%20first%20three%20updates%0A%23%20if%20its%20offset%20is%20larger%20than%201%20second.%0Amakestep%201.0%203%0A%0A%23%20Enable%20kernel%20synchronization%20of%20the%20real-time%20clock%20%28RTC%29.%0Artcsync%0A%0A%23%20Enable%20hardware%20timestamping%20on%20all%20interfaces%20that%20support%20it.%0A%23hwtimestamp%20%2A%0A%0A%23%20Increase%20the%20minimum%20number%20of%20selectable%20sources%20required%20to%20adjust%0A%23%20the%20system%20clock.%0A%23minsources%202%0A%0A%23%20Allow%20NTP%20client%20access%20from%20local%20network.%0A%23allow%20192.168.0.0/16%0A%0A%23%20Serve%20time%20even%20if%20not%20synchronized%20to%20a%20time%20source.%0A%23local%20stratum%2010%0A%0A%23%20Require%20authentication%20%28nts%20or%20key%20option%29%20for%20all%20NTP%20sources.%0A%23authselectmode%20require%0A%0A%23%20Specify%20file%20containing%20keys%20for%20NTP%20authentication.%0Akeyfile%20/etc/chrony.keys%0A%0A%23%20Insert/delete%20leap%20seconds%20by%20slewing%20instead%20of%20stepping.%0A%23leapsecmode%20slew%0A%0A%23%20Get%20TAI-UTC%20offset%20and%20leap%20seconds%20from%20the%20system%20tz%20database.%0Aleapsectz%20right/UTC%0A%0A%23%20Specify%20directory%20for%20log%20files.%0Alogdir%20/var/log/chrony%0A%0A%23%20Select%20which%20information%20is%20logged.%0A%23log%20measurements%20statistics%20tracking }} + mode: 420 + overwrite: true + path: /etc/chrony.conf + - contents: + source: data:, + mode: 420 + overwrite: true + path: /etc/chrony.d/.mco-keep + - contents: + source: data:,{{ %23%0A%23%20This%20file%20controls%20the%20configuration%20of%20the%20ntp%20server%0A%23%20%7B%7B.var_multiple_time_servers%7D%7D%20we%20have%20to%20put%20variable%20array%20name%20here%20for%20mutilines%20remediation%0A%7B%7B%24var_time_service_set_maxpoll%3A%3D.var_time_service_set_maxpoll%7D%7D%0A%7B%7Brange%20%24element%3A%3D.var_multiple_time_servers%7CtoArrayByComma%7D%7Dserver%20%7B%7B%24element%7D%7D%20minpoll%204%20maxpoll%20%7B%7B%24var_time_service_set_maxpoll%7D%7D%0A%7B%7Bend%7D%7D }} + mode: 420 + overwrite: true + path: /etc/chrony.d/ntp-server.conf + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_multiple_time_servers='' + + +config_file="/etc/ntp.conf" +/usr/sbin/pidof ntpd || config_file="/etc/chrony.conf" + +if ! [ "$(grep -c '^server' "$config_file")" -gt 1 ] ; then + if ! grep -q '#[[:space:]]*server' "$config_file" ; then + for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do + printf '\nserver %s' "$server" >> "$config_file" + done + else + sed -i 's/#[ \t]*server/server/g' "$config_file" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -266899,27 +267064,6 @@ This recommendation only applies if chrony is in use on the system. CCE-82879-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then - # trying to solve cases where the parameter after OPTIONS - #may or may not be enclosed in quotes - sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1\2/' /etc/sysconfig/chronyd -fi - -if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then - # trying to solve cases where the parameter after OPTIONS - #may or may not be enclosed in quotes - sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1 -u chrony\2/' /etc/sysconfig/chronyd -else - echo 'OPTIONS="-u chrony"' >> /etc/sysconfig/chronyd -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -266970,6 +267114,27 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then + # trying to solve cases where the parameter after OPTIONS + #may or may not be enclosed in quotes + sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1\2/' /etc/sysconfig/chronyd +fi + +if grep -q 'OPTIONS=.*' /etc/sysconfig/chronyd; then + # trying to solve cases where the parameter after OPTIONS + #may or may not be enclosed in quotes + sed -i -E -e 's/\s*-u\s*\w+\s*/ /' -e 's/^([\s]*OPTIONS=["]?[^"]*)("?)/\1 -u chrony\2/' /etc/sysconfig/chronyd +else + echo 'OPTIONS="-u chrony"' >> /etc/sysconfig/chronyd +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267023,28 +267188,6 @@ Multiple servers may be configured. synchronization is working properly. CCE-82873-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then - -var_multiple_time_servers='' - - -config_file="/etc/chrony.conf" - -if ! grep -q '^[[:space:]]*\(server\|pool\)[[:space:]]\+[[:graph:]]\+' "$config_file" ; then - if ! grep -q '#[[:space:]]*server' "$config_file" ; then - for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do - printf '\nserver %s' "$server" >> "$config_file" - done - else - sed -i 's/#[ \t]*server/server/g' "$config_file" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -267111,6 +267254,28 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q chrony; }; then + +var_multiple_time_servers='' + + +config_file="/etc/chrony.conf" + +if ! grep -q '^[[:space:]]*\(server\|pool\)[[:space:]]\+[[:graph:]]\+' "$config_file" ; then + if ! grep -q '#[[:space:]]*server' "$config_file" ; then + for server in $(echo "$var_multiple_time_servers" | tr ',' '\n') ; do + printf '\nserver %s' "$server" >> "$config_file" + done + else + sed -i 's/#[ \t]*server/server/g' "$config_file" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267253,8 +267418,18 @@ $ sudo yum erase rsync-daemon The rsyncd service presents a security risk as it uses unencrypted protocols for communication. CCE-86335-7 - -package --remove=rsync-daemon + - name: Ensure rsync-daemon is removed + package: + name: rsync-daemon + state: absent + tags: + - CCE-86335-7 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_rsync_removed include remove_rsync-daemon @@ -267263,6 +267438,9 @@ class remove_rsync-daemon { ensure => 'purged', } } + + +package --remove=rsync-daemon # CAUTION: This remediation script will remove rsync-daemon @@ -267276,19 +267454,6 @@ if rpm -q --quiet "rsync-daemon" ; then yum remove -y "rsync-daemon" fi - - - name: Ensure rsync-daemon is removed - package: - name: rsync-daemon - state: absent - tags: - - CCE-86335-7 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_rsync_removed @@ -267308,55 +267473,6 @@ The rsyncd service can be disabled with the following com communication. CCE-83335-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rsyncd.service - enabled: false - mask: true - - name: rsyncd.socket - enabled: false - mask: true - - include disable_rsyncd - -class disable_rsyncd { - service {'rsyncd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rsyncd.service' -"$SYSTEMCTL_EXEC" disable 'rsyncd.service' -"$SYSTEMCTL_EXEC" mask 'rsyncd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rsyncd.socket; then - "$SYSTEMCTL_EXEC" stop 'rsyncd.socket' - "$SYSTEMCTL_EXEC" mask 'rsyncd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rsyncd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rsyncd"] - - name: Block Disable service rsyncd block: @@ -267420,6 +267536,55 @@ disabled = ["rsyncd"] - medium_severity - no_reboot_needed - service_rsyncd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rsyncd.service + enabled: false + mask: true + - name: rsyncd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rsyncd"] + + include disable_rsyncd + +class disable_rsyncd { + service {'rsyncd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rsyncd.service' +"$SYSTEMCTL_EXEC" disable 'rsyncd.service' +"$SYSTEMCTL_EXEC" mask 'rsyncd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rsyncd.socket; then + "$SYSTEMCTL_EXEC" stop 'rsyncd.socket' + "$SYSTEMCTL_EXEC" mask 'rsyncd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rsyncd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267544,8 +267709,23 @@ $ sudo yum erase xinetd Removing the xinetd package decreases the risk of the xinetd service's accidental (or intentional) activation. CCE-80850-1 - -package --remove=xinetd + - name: Ensure xinetd is removed + package: + name: xinetd + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80850-1 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_xinetd_removed include remove_xinetd @@ -267554,6 +267734,9 @@ class remove_xinetd { ensure => 'purged', } } + + +package --remove=xinetd # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -267573,24 +267756,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure xinetd is removed - package: - name: xinetd - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80850-1 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_xinetd_removed @@ -267709,55 +267874,6 @@ it ensures that these uncommon services are not running, and also prevents attacks against xinetd itself. CCE-80888-1 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: xinetd.service - enabled: false - mask: true - - name: xinetd.socket - enabled: false - mask: true - - include disable_xinetd - -class disable_xinetd { - service {'xinetd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'xinetd.service' -"$SYSTEMCTL_EXEC" disable 'xinetd.service' -"$SYSTEMCTL_EXEC" mask 'xinetd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files xinetd.socket; then - "$SYSTEMCTL_EXEC" stop 'xinetd.socket' - "$SYSTEMCTL_EXEC" mask 'xinetd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'xinetd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["xinetd"] - - name: Block Disable service xinetd block: @@ -267830,6 +267946,55 @@ disabled = ["xinetd"] - medium_severity - no_reboot_needed - service_xinetd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: xinetd.service + enabled: false + mask: true + - name: xinetd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["xinetd"] + + include disable_xinetd + +class disable_xinetd { + service {'xinetd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'xinetd.service' +"$SYSTEMCTL_EXEC" disable 'xinetd.service' +"$SYSTEMCTL_EXEC" mask 'xinetd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files xinetd.socket; then + "$SYSTEMCTL_EXEC" stop 'xinetd.socket' + "$SYSTEMCTL_EXEC" mask 'xinetd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'xinetd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -267868,8 +268033,19 @@ NIS maps. NIS generally has been replaced by such protocols as Lightweight Directory Access Protocol (LDAP). It is recommended that the service be removed. CCE-82181-9 - -package --remove=ypbind + - name: Ensure ypbind is removed + package: + name: ypbind + state: absent + tags: + - CCE-82181-9 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_ypbind_removed + - unknown_severity include remove_ypbind @@ -267878,6 +268054,9 @@ class remove_ypbind { ensure => 'purged', } } + + +package --remove=ypbind # CAUTION: This remediation script will remove ypbind @@ -267891,20 +268070,6 @@ if rpm -q --quiet "ypbind" ; then yum remove -y "ypbind" fi - - - name: Ensure ypbind is removed - package: - name: ypbind - state: absent - tags: - - CCE-82181-9 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_ypbind_removed - - unknown_severity @@ -268028,8 +268193,24 @@ remote session. Removing the ypserv package decreases the risk of the accidental (or intentional) activation of NIS or NIS+ services. CCE-82432-6 - -package --remove=ypserv + - name: Ensure ypserv is removed + package: + name: ypserv + state: absent + tags: + - CCE-82432-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-IA-5(1)(c) + - PCI-DSS-Req-2.2.2 + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_ypserv_removed include remove_ypserv @@ -268038,6 +268219,9 @@ class remove_ypserv { ensure => 'purged', } } + + +package --remove=ypserv # CAUTION: This remediation script will remove ypserv @@ -268051,25 +268235,6 @@ if rpm -q --quiet "ypserv" ; then yum remove -y "ypserv" fi - - - name: Ensure ypserv is removed - package: - name: ypserv - state: absent - tags: - - CCE-82432-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-IA-5(1)(c) - - PCI-DSS-Req-2.2.2 - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_ypserv_removed @@ -268188,55 +268353,6 @@ as a client in a NIS or NIS+ domain. This service should be disabled unless in use. CCE-82433-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: ypbind.service - enabled: false - mask: true - - name: ypbind.socket - enabled: false - mask: true - - include disable_ypbind - -class disable_ypbind { - service {'ypbind': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ypbind.service' -"$SYSTEMCTL_EXEC" disable 'ypbind.service' -"$SYSTEMCTL_EXEC" mask 'ypbind.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ypbind.socket; then - "$SYSTEMCTL_EXEC" stop 'ypbind.socket' - "$SYSTEMCTL_EXEC" mask 'ypbind.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ypbind.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["ypbind"] - - name: Block Disable service ypbind block: @@ -268310,27 +268426,7 @@ disabled = ["ypbind"] - no_reboot_needed - service_ypbind_disabled - - - - - - - - - Disable ypserv Service - The ypserv service, which allows the system to act as a client in -a NIS or NIS+ domain, should be disabled. - -The ypserv service can be disabled with the following command: -$ sudo systemctl mask --now ypserv.service - 2.2.10 - Disabling the ypserv service ensures the system is not acting -as a client in a NIS or NIS+ domain. This service should be disabled -unless in use. - - CCE-86121-1 - apiVersion: machineconfiguration.openshift.io/v1 + apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig spec: config: @@ -268338,47 +268434,67 @@ spec: version: 3.1.0 systemd: units: - - name: ypserv.service + - name: ypbind.service enabled: false mask: true - - name: ypserv.socket + - name: ypbind.socket enabled: false mask: true - include disable_ypserv + +[customizations.services] +disabled = ["ypbind"] + + include disable_ypbind -class disable_ypserv { - service {'ypserv': +class disable_ypbind { + service {'ypbind': enable => false, ensure => 'stopped', } } - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'ypserv.service' -"$SYSTEMCTL_EXEC" disable 'ypserv.service' -"$SYSTEMCTL_EXEC" mask 'ypserv.service' +"$SYSTEMCTL_EXEC" stop 'ypbind.service' +"$SYSTEMCTL_EXEC" disable 'ypbind.service' +"$SYSTEMCTL_EXEC" mask 'ypbind.service' # Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files ypserv.socket; then - "$SYSTEMCTL_EXEC" stop 'ypserv.socket' - "$SYSTEMCTL_EXEC" mask 'ypserv.socket' +if "$SYSTEMCTL_EXEC" -q list-unit-files ypbind.socket; then + "$SYSTEMCTL_EXEC" stop 'ypbind.socket' + "$SYSTEMCTL_EXEC" mask 'ypbind.socket' fi # The service may not be running because it has been started and failed, # so let's reset the state so OVAL checks pass. # Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'ypserv.service' || true +"$SYSTEMCTL_EXEC" reset-failed 'ypbind.service' || true else >&2 echo 'Remediation is not applicable, nothing was done' fi - -[customizations.services] -disabled = ["ypserv"] - + + + + + + + + + Disable ypserv Service + The ypserv service, which allows the system to act as a client in +a NIS or NIS+ domain, should be disabled. + +The ypserv service can be disabled with the following command: +$ sudo systemctl mask --now ypserv.service + 2.2.10 + Disabling the ypserv service ensures the system is not acting +as a client in a NIS or NIS+ domain. This service should be disabled +unless in use. + + CCE-86121-1 - name: Block Disable service ypserv block: @@ -268439,6 +268555,55 @@ disabled = ["ypserv"] - medium_severity - no_reboot_needed - service_ypserv_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: ypserv.service + enabled: false + mask: true + - name: ypserv.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["ypserv"] + + include disable_ypserv + +class disable_ypserv { + service {'ypserv': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'ypserv.service' +"$SYSTEMCTL_EXEC" disable 'ypserv.service' +"$SYSTEMCTL_EXEC" mask 'ypserv.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files ypserv.socket; then + "$SYSTEMCTL_EXEC" stop 'ypserv.socket' + "$SYSTEMCTL_EXEC" mask 'ypserv.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'ypserv.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -268569,8 +268734,24 @@ could be compromised. The rsh-server package provides sev network services. Removing it decreases the risk of those services' accidental (or intentional) activation. CCE-82184-3 - -package --remove=rsh-server + - name: Ensure rsh-server is removed + package: + name: rsh-server + state: absent + tags: + - CCE-82184-3 + - DISA-STIG-RHEL-08-040010 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - NIST-800-53-IA-5(1)(c) + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_rsh-server_removed include remove_rsh-server @@ -268579,6 +268760,9 @@ class remove_rsh-server { ensure => 'purged', } } + + +package --remove=rsh-server # CAUTION: This remediation script will remove rsh-server @@ -268592,25 +268776,6 @@ if rpm -q --quiet "rsh-server" ; then yum remove -y "rsh-server" fi - - - name: Ensure rsh-server is removed - package: - name: rsh-server - state: absent - tags: - - CCE-82184-3 - - DISA-STIG-RHEL-08-040010 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - NIST-800-53-IA-5(1)(c) - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_rsh-server_removed @@ -268650,8 +268815,20 @@ their credentials. Note that removing the rsh package rem the clients for rsh,rcp, and rlogin. CCE-82183-5 - -package --remove=rsh + - name: Ensure rsh is removed + package: + name: rsh + state: absent + tags: + - CCE-82183-5 + - NIST-800-171-3.1.13 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_rsh_removed + - unknown_severity include remove_rsh @@ -268660,6 +268837,9 @@ class remove_rsh { ensure => 'purged', } } + + +package --remove=rsh # CAUTION: This remediation script will remove rsh @@ -268673,21 +268853,6 @@ if rpm -q --quiet "rsh" ; then yum remove -y "rsh" fi - - - name: Ensure rsh is removed - package: - name: rsh - state: absent - tags: - - CCE-82183-5 - - NIST-800-171-3.1.13 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_rsh_removed - - unknown_severity @@ -268811,55 +268976,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-80884-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rexec.service - enabled: false - mask: true - - name: rexec.socket - enabled: false - mask: true - - include disable_rexec - -class disable_rexec { - service {'rexec': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rexec.service' -"$SYSTEMCTL_EXEC" disable 'rexec.service' -"$SYSTEMCTL_EXEC" mask 'rexec.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rexec.socket; then - "$SYSTEMCTL_EXEC" stop 'rexec.socket' - "$SYSTEMCTL_EXEC" mask 'rexec.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rexec.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rexec"] - - name: Block Disable service rexec block: @@ -268938,6 +269054,55 @@ disabled = ["rexec"] - low_disruption - no_reboot_needed - service_rexec_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rexec.service + enabled: false + mask: true + - name: rexec.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rexec"] + + include disable_rexec + +class disable_rexec { + service {'rexec': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rexec.service' +"$SYSTEMCTL_EXEC" disable 'rexec.service' +"$SYSTEMCTL_EXEC" mask 'rexec.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rexec.socket; then + "$SYSTEMCTL_EXEC" stop 'rexec.socket' + "$SYSTEMCTL_EXEC" mask 'rexec.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rexec.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269083,55 +269248,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-80885-7 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rlogin.service - enabled: false - mask: true - - name: rlogin.socket - enabled: false - mask: true - - include disable_rlogin - -class disable_rlogin { - service {'rlogin': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rlogin.service' -"$SYSTEMCTL_EXEC" disable 'rlogin.service' -"$SYSTEMCTL_EXEC" mask 'rlogin.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rlogin.socket; then - "$SYSTEMCTL_EXEC" stop 'rlogin.socket' - "$SYSTEMCTL_EXEC" mask 'rlogin.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rlogin.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rlogin"] - - name: Block Disable service rlogin block: @@ -269210,6 +269326,55 @@ disabled = ["rlogin"] - low_disruption - no_reboot_needed - service_rlogin_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rlogin.service + enabled: false + mask: true + - name: rlogin.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rlogin"] + + include disable_rlogin + +class disable_rlogin { + service {'rlogin': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rlogin.service' +"$SYSTEMCTL_EXEC" disable 'rlogin.service' +"$SYSTEMCTL_EXEC" mask 'rlogin.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rlogin.socket; then + "$SYSTEMCTL_EXEC" stop 'rlogin.socket' + "$SYSTEMCTL_EXEC" mask 'rlogin.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rlogin.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269356,55 +269521,6 @@ all other information transmitted during the session, can be stolen by eavesdroppers on the network. CCE-82431-8 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: rsh.service - enabled: false - mask: true - - name: rsh.socket - enabled: false - mask: true - - include disable_rsh - -class disable_rsh { - service {'rsh': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'rsh.service' -"$SYSTEMCTL_EXEC" disable 'rsh.service' -"$SYSTEMCTL_EXEC" mask 'rsh.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files rsh.socket; then - "$SYSTEMCTL_EXEC" stop 'rsh.socket' - "$SYSTEMCTL_EXEC" mask 'rsh.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'rsh.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["rsh"] - - name: Block Disable service rsh block: @@ -269483,6 +269599,55 @@ disabled = ["rsh"] - low_disruption - no_reboot_needed - service_rsh_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: rsh.service + enabled: false + mask: true + - name: rsh.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["rsh"] + + include disable_rsh + +class disable_rsh { + service {'rsh': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'rsh.service' +"$SYSTEMCTL_EXEC" disable 'rsh.service' +"$SYSTEMCTL_EXEC" mask 'rsh.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files rsh.socket; then + "$SYSTEMCTL_EXEC" stop 'rsh.socket' + "$SYSTEMCTL_EXEC" mask 'rsh.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'rsh.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269505,16 +269670,6 @@ Host-based authentication is not sufficient for preventing unauthorized access t as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication. CCE-84055-3 - -# Identify local mounts -MOUNT_LIST=$(df --local | awk '{ print $6 }') - -# Find file on each listed mount point -for cur_mount in ${MOUNT_LIST} -do - find ${cur_mount} -xdev -type f -name "shosts.equiv" -exec rm -f {} \; -done - - name: Remove Host-Based Authentication Files - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -269683,6 +269838,16 @@ done - no_host_based_files - no_reboot_needed - restrict_strategy + + +# Identify local mounts +MOUNT_LIST=$(df --local | awk '{ print $6 }') + +# Find file on each listed mount point +for cur_mount in ${MOUNT_LIST} +do + find ${cur_mount} -xdev -type f -name "shosts.equiv" -exec rm -f {} \; +done @@ -269803,17 +269968,6 @@ through PAM. Trust files are convenient, but when used in conjunction with the R-services, they can allow unauthenticated access to a system. CCE-80842-8 - # Remediation is applicable only in certain platforms -if rpm --quiet -q rsh-server; then - -find /root -xdev -type f -name ".rhosts" -exec rm -f {} \; -find /home -maxdepth 2 -xdev -type f -name ".rhosts" -exec rm -f {} \; -rm -f /etc/hosts.equiv - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -269889,6 +270043,17 @@ fi - no_reboot_needed - no_rsh_trust_files - restrict_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q rsh-server; then + +find /root -xdev -type f -name ".rhosts" -exec rm -f {} \; +find /home -maxdepth 2 -xdev -type f -name ".rhosts" -exec rm -f {} \; +rm -f /etc/hosts.equiv + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -269914,16 +270079,6 @@ sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication. CCE-84056-1 - -# Identify local mounts -MOUNT_LIST=$(df --local | awk '{ print $6 }') - -# Find file on each listed mount point -for cur_mount in ${MOUNT_LIST} -do - find ${cur_mount} -xdev -type f -name ".shosts" -exec rm -f {} \; -done - - name: Remove User Host-Based Authentication Files - Define Excluded (Non-Local) File Systems and Paths ansible.builtin.set_fact: @@ -270092,6 +270247,16 @@ done - no_reboot_needed - no_user_host_based_files - restrict_strategy + + +# Identify local mounts +MOUNT_LIST=$(df --local | awk '{ print $6 }') + +# Find file on each listed mount point +for cur_mount in ${MOUNT_LIST} +do + find ${cur_mount} -xdev -type f -name ".shosts" -exec rm -f {} \; +done @@ -270121,8 +270286,19 @@ across systems through a terminal session. for communications. Removing the talk-server package decreases the risk of the accidental (or intentional) activation of talk services. CCE-82180-1 - -package --remove=talk-server + - name: Ensure talk-server is removed + package: + name: talk-server + state: absent + tags: + - CCE-82180-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_talk-server_removed include remove_talk-server @@ -270131,6 +270307,9 @@ class remove_talk-server { ensure => 'purged', } } + + +package --remove=talk-server # CAUTION: This remediation script will remove talk-server @@ -270144,20 +270323,6 @@ if rpm -q --quiet "talk-server" ; then yum remove -y "talk-server" fi - - - name: Ensure talk-server is removed - package: - name: talk-server - state: absent - tags: - - CCE-82180-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_talk-server_removed @@ -270188,8 +270353,19 @@ $ sudo yum erase talk for communications. Removing the talk package decreases the risk of the accidental (or intentional) activation of talk client program. CCE-80848-5 - -package --remove=talk + - name: Ensure talk is removed + package: + name: talk + state: absent + tags: + - CCE-80848-5 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_talk_removed include remove_talk @@ -270198,6 +270374,9 @@ class remove_talk { ensure => 'purged', } } + + +package --remove=talk # CAUTION: This remediation script will remove talk @@ -270211,20 +270390,6 @@ if rpm -q --quiet "talk" ; then yum remove -y "talk" fi - - - name: Ensure talk is removed - package: - name: talk - state: absent - tags: - - CCE-80848-5 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_talk_removed @@ -270363,8 +270528,24 @@ privileged user password could be compromised. Removing the telnet-server package decreases the risk of the telnet service's accidental (or intentional) activation. CCE-82182-7 - -package --remove=telnet-server + - name: Ensure telnet-server is removed + package: + name: telnet-server + state: absent + tags: + - CCE-82182-7 + - DISA-STIG-RHEL-08-040000 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSS-Req-2.2.2 + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_telnet-server_removed include remove_telnet-server @@ -270373,6 +270554,9 @@ class remove_telnet-server { ensure => 'purged', } } + + +package --remove=telnet-server # CAUTION: This remediation script will remove telnet-server @@ -270386,25 +270570,6 @@ if rpm -q --quiet "telnet-server" ; then yum remove -y "telnet-server" fi - - - name: Ensure telnet-server is removed - package: - name: telnet-server - state: absent - tags: - - CCE-82182-7 - - DISA-STIG-RHEL-08-040000 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSS-Req-2.2.2 - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_telnet-server_removed @@ -270438,8 +270603,20 @@ of an unencrypted transmission medium could allow an unauthorized user to steal credentials. The ssh package provides an encrypted session and stronger security and is included in Red Hat Enterprise Linux 8. CCE-80849-3 - -package --remove=telnet + - name: Ensure telnet is removed + package: + name: telnet + state: absent + tags: + - CCE-80849-3 + - NIST-800-171-3.1.13 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_telnet_removed include remove_telnet @@ -270448,6 +270625,9 @@ class remove_telnet { ensure => 'purged', } } + + +package --remove=telnet # CAUTION: This remediation script will remove telnet @@ -270461,21 +270641,6 @@ if rpm -q --quiet "telnet" ; then yum remove -y "telnet" fi - - - name: Ensure telnet is removed - package: - name: telnet - state: absent - tags: - - CCE-80849-3 - - NIST-800-171-3.1.13 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_telnet_removed @@ -270621,55 +270786,6 @@ can be stolen by eavesdroppers on the network. The telnet protocol is also subje man-in-the-middle attacks. CCE-80887-3 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: telnet.service - enabled: false - mask: true - - name: telnet.socket - enabled: false - mask: true - - include disable_telnet - -class disable_telnet { - service {'telnet': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q telnet-server ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'telnet.service' -"$SYSTEMCTL_EXEC" disable 'telnet.service' -"$SYSTEMCTL_EXEC" mask 'telnet.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files telnet.socket; then - "$SYSTEMCTL_EXEC" stop 'telnet.socket' - "$SYSTEMCTL_EXEC" mask 'telnet.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'telnet.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["telnet"] - - name: Gather the package facts package_facts: manager: auto @@ -270769,6 +270885,55 @@ disabled = ["telnet"] - low_disruption - no_reboot_needed - service_telnet_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: telnet.service + enabled: false + mask: true + - name: telnet.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["telnet"] + + include disable_telnet + +class disable_telnet { + service {'telnet': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q telnet-server ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'telnet.service' +"$SYSTEMCTL_EXEC" disable 'telnet.service' +"$SYSTEMCTL_EXEC" mask 'telnet.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files telnet.socket; then + "$SYSTEMCTL_EXEC" stop 'telnet.socket' + "$SYSTEMCTL_EXEC" mask 'telnet.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'telnet.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -270905,8 +271070,23 @@ configurations), its use must be documented with the Information Systems Securty Manager (ISSM), restricted to only authorized personnel, and have access control rules established. CCE-82436-7 - -package --remove=tftp-server + - name: Ensure tftp-server is removed + package: + name: tftp-server + state: absent + tags: + - CCE-82436-7 + - DISA-STIG-RHEL-08-040190 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSSv4-2.2.4 + - disable_strategy + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - package_tftp-server_removed include remove_tftp-server @@ -270915,6 +271095,9 @@ class remove_tftp-server { ensure => 'purged', } } + + +package --remove=tftp-server # CAUTION: This remediation script will remove tftp-server @@ -270928,24 +271111,6 @@ if rpm -q --quiet "tftp-server" ; then yum remove -y "tftp-server" fi - - - name: Ensure tftp-server is removed - package: - name: tftp-server - state: absent - tags: - - CCE-82436-7 - - DISA-STIG-RHEL-08-040190 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSSv4-2.2.4 - - disable_strategy - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - package_tftp-server_removed @@ -270967,8 +271132,19 @@ TFTP does not support authentication and can be easily hacked. The package for TFTP (such as a boot server). In that case, use extreme caution when configuring the services. CCE-83590-0 - -package --remove=tftp + - name: Ensure tftp is removed + package: + name: tftp + state: absent + tags: + - CCE-83590-0 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_tftp_removed include remove_tftp @@ -270977,6 +271153,9 @@ class remove_tftp { ensure => 'purged', } } + + +package --remove=tftp # CAUTION: This remediation script will remove tftp @@ -270990,20 +271169,6 @@ if rpm -q --quiet "tftp" ; then yum remove -y "tftp" fi - - - name: Ensure tftp is removed - package: - name: tftp - state: absent - tags: - - CCE-83590-0 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_tftp_removed @@ -271114,55 +271279,6 @@ The tftp service can be disabled with the following comma as a TFTP server, which does not provide encryption or authentication. CCE-82435-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: tftp.service - enabled: false - mask: true - - name: tftp.socket - enabled: false - mask: true - - include disable_tftp - -class disable_tftp { - service {'tftp': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'tftp.service' -"$SYSTEMCTL_EXEC" disable 'tftp.service' -"$SYSTEMCTL_EXEC" mask 'tftp.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files tftp.socket; then - "$SYSTEMCTL_EXEC" stop 'tftp.socket' - "$SYSTEMCTL_EXEC" mask 'tftp.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'tftp.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["tftp"] - - name: Block Disable service tftp block: @@ -271232,6 +271348,55 @@ disabled = ["tftp"] - low_disruption - no_reboot_needed - service_tftp_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: tftp.service + enabled: false + mask: true + - name: tftp.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["tftp"] + + include disable_tftp + +class disable_tftp { + service {'tftp': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'tftp.service' +"$SYSTEMCTL_EXEC" disable 'tftp.service' +"$SYSTEMCTL_EXEC" mask 'tftp.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files tftp.socket; then + "$SYSTEMCTL_EXEC" stop 'tftp.socket' + "$SYSTEMCTL_EXEC" mask 'tftp.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'tftp.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -271375,22 +271540,6 @@ given directory. Serving files from an intentionally-specified directory reduces the risk of sharing files which should remain private. CCE-82434-2 - # Remediation is applicable only in certain platforms -if rpm --quiet -q tftp-server; then - -var_tftpd_secure_directory='' - - -if grep -q 'server_args' /etc/xinetd.d/tftp; then - sed -i -E "s;^([[:blank:]]*server_args[[:blank:]]+=[[:blank:]]+.*?)(-s[[:blank:]]+[[:graph:]]+)*(.*)$;\1 -s $var_tftpd_secure_directory \3;" /etc/xinetd.d/tftp -else - echo "server_args = -s $var_tftpd_secure_directory" >> /etc/xinetd.d/tftp -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -271476,6 +271625,22 @@ fi - medium_severity - no_reboot_needed - tftpd_uses_secure_mode + + # Remediation is applicable only in certain platforms +if rpm --quiet -q tftp-server; then + +var_tftpd_secure_directory='' + + +if grep -q 'server_args' /etc/xinetd.d/tftp; then + sed -i -E "s;^([[:blank:]]*server_args[[:blank:]]+=[[:blank:]]+.*?)(-s[[:blank:]]+[[:graph:]]+)*(.*)$;\1 -s $var_tftpd_secure_directory \3;" /etc/xinetd.d/tftp +else + echo "server_args = -s $var_tftpd_secure_directory" >> /etc/xinetd.d/tftp +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -271574,8 +271739,21 @@ $ sudo yum erase cups If the system does not need to print jobs or accept print jobs from other systems, it is recommended that CUPS be removed to reduce the potential attack surface. CCE-86299-5 - -package --remove=cups + - name: Ensure cups is removed + package: + name: cups + state: absent + tags: + - CCE-86299-5 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_cups_removed + - unknown_severity include remove_cups @@ -271584,6 +271762,9 @@ class remove_cups { ensure => 'purged', } } + + +package --remove=cups # CAUTION: This remediation script will remove cups @@ -271597,22 +271778,6 @@ if rpm -q --quiet "cups" ; then yum remove -y "cups" fi - - - name: Ensure cups is removed - package: - name: cups - state: absent - tags: - - CCE-86299-5 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_cups_removed - - unknown_severity @@ -271697,55 +271862,6 @@ The cups service can be disabled with the following comma Turn off unneeded services to reduce attack surface. CCE-82861-6 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: cups.service - enabled: false - mask: true - - name: cups.socket - enabled: false - mask: true - - include disable_cups - -class disable_cups { - service {'cups': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'cups.service' -"$SYSTEMCTL_EXEC" disable 'cups.service' -"$SYSTEMCTL_EXEC" mask 'cups.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files cups.socket; then - "$SYSTEMCTL_EXEC" stop 'cups.socket' - "$SYSTEMCTL_EXEC" mask 'cups.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'cups.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["cups"] - - name: Block Disable service cups block: @@ -271815,6 +271931,55 @@ disabled = ["cups"] - no_reboot_needed - service_cups_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: cups.service + enabled: false + mask: true + - name: cups.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["cups"] + + include disable_cups + +class disable_cups { + service {'cups': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'cups.service' +"$SYSTEMCTL_EXEC" disable 'cups.service' +"$SYSTEMCTL_EXEC" mask 'cups.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files cups.socket; then + "$SYSTEMCTL_EXEC" stop 'cups.socket' + "$SYSTEMCTL_EXEC" mask 'cups.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'cups.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272029,8 +272194,18 @@ and removed. If there is no need to make the proxy server software available, removing it provides a safeguard against its activation. CCE-82189-2 - -package --remove=squid + - name: Ensure squid is removed + package: + name: squid + state: absent + tags: + - CCE-82189-2 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_squid_removed + - unknown_severity include remove_squid @@ -272039,6 +272214,9 @@ class remove_squid { ensure => 'purged', } } + + +package --remove=squid # CAUTION: This remediation script will remove squid @@ -272052,19 +272230,6 @@ if rpm -q --quiet "squid" ; then yum remove -y "squid" fi - - - name: Ensure squid is removed - package: - name: squid - state: absent - tags: - - CCE-82189-2 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_squid_removed - - unknown_severity @@ -272083,55 +272248,6 @@ The squid service can be disabled with the following comm of attack, and should be removed if not needed. CCE-82190-0 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: squid.service - enabled: false - mask: true - - name: squid.socket - enabled: false - mask: true - - include disable_squid - -class disable_squid { - service {'squid': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q squid ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'squid.service' -"$SYSTEMCTL_EXEC" disable 'squid.service' -"$SYSTEMCTL_EXEC" mask 'squid.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files squid.socket; then - "$SYSTEMCTL_EXEC" stop 'squid.socket' - "$SYSTEMCTL_EXEC" mask 'squid.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'squid.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["squid"] - - name: Gather the package facts package_facts: manager: auto @@ -272207,6 +272323,55 @@ disabled = ["squid"] - no_reboot_needed - service_squid_disabled - unknown_severity + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: squid.service + enabled: false + mask: true + - name: squid.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["squid"] + + include disable_squid + +class disable_squid { + service {'squid': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q squid ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'squid.service' +"$SYSTEMCTL_EXEC" disable 'squid.service' +"$SYSTEMCTL_EXEC" mask 'squid.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files squid.socket; then + "$SYSTEMCTL_EXEC" stop 'squid.socket' + "$SYSTEMCTL_EXEC" mask 'squid.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'squid.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272238,8 +272403,18 @@ intended for use as a RADIUS Server it should be removed. CCE-82752-7 - -package --remove=freeradius + - name: Ensure freeradius is removed + package: + name: freeradius + state: absent + tags: + - CCE-82752-7 + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_freeradius_removed include remove_freeradius @@ -272248,6 +272423,9 @@ class remove_freeradius { ensure => 'purged', } } + + +package --remove=freeradius # CAUTION: This remediation script will remove freeradius @@ -272261,19 +272439,6 @@ if rpm -q --quiet "freeradius" ; then yum remove -y "freeradius" fi - - - name: Ensure freeradius is removed - package: - name: freeradius - state: absent - tags: - - CCE-82752-7 - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_freeradius_removed @@ -272305,31 +272470,6 @@ Consequently, the rngd service can't be started in FIPS mode. CCE-82831-9 - include enable_rngd - -class enable_rngd { - service {'rngd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.3"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'rngd.service' -"$SYSTEMCTL_EXEC" start 'rngd.service' -"$SYSTEMCTL_EXEC" enable 'rngd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["rngd"] - - name: Enable service rngd block: @@ -272358,6 +272498,31 @@ enabled = ["rngd"] - low_severity - no_reboot_needed - service_rngd_enabled + + +[customizations.services] +enabled = ["rngd"] + + include enable_rngd + +class enable_rngd { + service {'rngd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.3"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'rngd.service' +"$SYSTEMCTL_EXEC" start 'rngd.service' +"$SYSTEMCTL_EXEC" enable 'rngd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272416,8 +272581,21 @@ information may be unnecessarily transmitted across the network. If there is no need to make the router software available, removing it provides a safeguard against its activation. CCE-82187-6 - -package --remove=quagga + - name: Ensure quagga is removed + package: + name: quagga + state: absent + tags: + - CCE-82187-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - low_severity + - no_reboot_needed + - package_quagga_removed include remove_quagga @@ -272426,6 +272604,9 @@ class remove_quagga { ensure => 'purged', } } + + +package --remove=quagga # CAUTION: This remediation script will remove quagga @@ -272439,22 +272620,6 @@ if rpm -q --quiet "quagga" ; then yum remove -y "quagga" fi - - - name: Ensure quagga is removed - package: - name: quagga - state: absent - tags: - - CCE-82187-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - low_severity - - no_reboot_needed - - package_quagga_removed @@ -272504,55 +272669,6 @@ required, system network information may be unnecessarily transmitted across the network. CCE-80889-9 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: zebra.service - enabled: false - mask: true - - name: zebra.socket - enabled: false - mask: true - - include disable_zebra - -class disable_zebra { - service {'zebra': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'zebra.service' -"$SYSTEMCTL_EXEC" disable 'zebra.service' -"$SYSTEMCTL_EXEC" mask 'zebra.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files zebra.socket; then - "$SYSTEMCTL_EXEC" stop 'zebra.socket' - "$SYSTEMCTL_EXEC" mask 'zebra.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'zebra.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["zebra"] - - name: Block Disable service zebra block: @@ -272622,6 +272738,55 @@ disabled = ["zebra"] - medium_severity - no_reboot_needed - service_zebra_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: zebra.service + enabled: false + mask: true + - name: zebra.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["zebra"] + + include disable_zebra + +class disable_zebra { + service {'zebra': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'zebra.service' +"$SYSTEMCTL_EXEC" disable 'zebra.service' +"$SYSTEMCTL_EXEC" mask 'zebra.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files zebra.socket; then + "$SYSTEMCTL_EXEC" stop 'zebra.socket' + "$SYSTEMCTL_EXEC" mask 'zebra.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'zebra.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -272661,8 +272826,22 @@ The samba-common package can be installed with the follow $ sudo yum install samba-common If the samba-common package is not installed, samba cannot be configured. - -package --add=samba-common + - name: Ensure samba-common is installed + package: + name: samba-common + state: present + tags: + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_samba-common_installed + + +[[packages]] +name = "samba-common" +version = "*" include install_samba-common @@ -272671,28 +272850,14 @@ class install_samba-common { ensure => 'installed', } } + + +package --add=samba-common if ! rpm -q --quiet "samba-common" ; then yum install -y "samba-common" fi - - -[[packages]] -name = "samba-common" -version = "*" - - - name: Ensure samba-common is installed - package: - name: samba-common - state: present - tags: - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_samba-common_installed @@ -272733,20 +272898,6 @@ only communicate with servers that support packet signing.Packet signing can prevent man-in-the-middle attacks which modify SMB packets in transit. - ###################################################################### -#By Luke "Brisk-OH" Brisk -#luke.brisk@boeing.com or luke.brisk@gmail.com -###################################################################### - -CLIENTSIGNING=$( grep -ic 'client signing' /etc/samba/smb.conf ) - -if [ "$CLIENTSIGNING" -eq 0 ]; then - # Add to global section - sed -i 's/\[global\]/\[global\]\n\n\tclient signing = mandatory/g' /etc/samba/smb.conf -else - sed -i 's/[[:blank:]]*client[[:blank:]]signing[[:blank:]]*=[[:blank:]]*no/ client signing = mandatory/g' /etc/samba/smb.conf -fi - - name: Check if /etc/samba/smb.conf exists stat: path: /etc/samba/smb.conf @@ -272774,6 +272925,20 @@ fi - no_reboot_needed - require_smb_client_signing - unknown_severity + + ###################################################################### +#By Luke "Brisk-OH" Brisk +#luke.brisk@boeing.com or luke.brisk@gmail.com +###################################################################### + +CLIENTSIGNING=$( grep -ic 'client signing' /etc/samba/smb.conf ) + +if [ "$CLIENTSIGNING" -eq 0 ]; then + # Add to global section + sed -i 's/\[global\]/\[global\]\n\n\tclient signing = mandatory/g' /etc/samba/smb.conf +else + sed -i 's/[[:blank:]]*client[[:blank:]]signing[[:blank:]]*=[[:blank:]]*no/ client signing = mandatory/g' /etc/samba/smb.conf +fi @@ -272859,8 +273024,18 @@ sharing functionality. If there is no need to make the Samba software available, removing it provides a safeguard against its activation. CCE-85978-5 - -package --remove=samba + - name: Ensure samba is removed + package: + name: samba + state: absent + tags: + - CCE-85978-5 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_samba_removed + - unknown_severity include remove_samba @@ -272869,6 +273044,9 @@ class remove_samba { ensure => 'purged', } } + + +package --remove=samba # CAUTION: This remediation script will remove samba @@ -272882,19 +273060,6 @@ if rpm -q --quiet "samba" ; then yum remove -y "samba" fi - - - name: Ensure samba is removed - package: - name: samba - state: absent - tags: - - CCE-85978-5 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_samba_removed - - unknown_severity @@ -272914,55 +273079,6 @@ The smb service can be disabled with the following comman should be disabled if not needed. CCE-82759-2 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: smb.service - enabled: false - mask: true - - name: smb.socket - enabled: false - mask: true - - include disable_smb - -class disable_smb { - service {'smb': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'smb.service' -"$SYSTEMCTL_EXEC" disable 'smb.service' -"$SYSTEMCTL_EXEC" mask 'smb.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files smb.socket; then - "$SYSTEMCTL_EXEC" stop 'smb.socket' - "$SYSTEMCTL_EXEC" mask 'smb.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'smb.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["smb"] - - name: Block Disable service smb block: @@ -273023,6 +273139,55 @@ disabled = ["smb"] - low_severity - no_reboot_needed - service_smb_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: smb.service + enabled: false + mask: true + - name: smb.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["smb"] + + include disable_smb + +class disable_smb { + service {'smb': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'smb.service' +"$SYSTEMCTL_EXEC" disable 'smb.service' +"$SYSTEMCTL_EXEC" mask 'smb.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files smb.socket; then + "$SYSTEMCTL_EXEC" stop 'smb.socket' + "$SYSTEMCTL_EXEC" mask 'smb.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'smb.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273059,8 +273224,19 @@ $ sudo yum erase net-snmp removing the package provides a safeguard against its activation. CCE-85980-1 - -package --remove=net-snmp + - name: Ensure net-snmp is removed + package: + name: net-snmp + state: absent + tags: + - CCE-85980-1 + - PCI-DSSv4-2.2.4 + - disable_strategy + - low_complexity + - low_disruption + - no_reboot_needed + - package_net-snmp_removed + - unknown_severity include remove_net-snmp @@ -273069,6 +273245,9 @@ class remove_net-snmp { ensure => 'purged', } } + + +package --remove=net-snmp # CAUTION: This remediation script will remove net-snmp @@ -273082,20 +273261,6 @@ if rpm -q --quiet "net-snmp" ; then yum remove -y "net-snmp" fi - - - name: Ensure net-snmp is removed - package: - name: net-snmp - state: absent - tags: - - CCE-85980-1 - - PCI-DSSv4-2.2.4 - - disable_strategy - - low_complexity - - low_disruption - - no_reboot_needed - - package_net-snmp_removed - - unknown_severity @@ -273115,55 +273280,6 @@ The snmpd service can be disabled with the following comm should be disabled if not needed. CCE-82758-4 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: snmpd.service - enabled: false - mask: true - - name: snmpd.socket - enabled: false - mask: true - - include disable_snmpd - -class disable_snmpd { - service {'snmpd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q net-snmp ); then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'snmpd.service' -"$SYSTEMCTL_EXEC" disable 'snmpd.service' -"$SYSTEMCTL_EXEC" mask 'snmpd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files snmpd.socket; then - "$SYSTEMCTL_EXEC" stop 'snmpd.socket' - "$SYSTEMCTL_EXEC" mask 'snmpd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'snmpd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["snmpd"] - - name: Gather the package facts package_facts: manager: auto @@ -273239,6 +273355,55 @@ disabled = ["snmpd"] - low_severity - no_reboot_needed - service_snmpd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: snmpd.service + enabled: false + mask: true + - name: snmpd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["snmpd"] + + include disable_snmpd + +class disable_snmpd { + service {'snmpd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q net-snmp ); then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'snmpd.service' +"$SYSTEMCTL_EXEC" disable 'snmpd.service' +"$SYSTEMCTL_EXEC" mask 'snmpd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files snmpd.socket; then + "$SYSTEMCTL_EXEC" stop 'snmpd.socket' + "$SYSTEMCTL_EXEC" mask 'snmpd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'snmpd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273356,27 +273521,6 @@ default authenticators, then anyone can gather data about the system and the net and use the information to potentially compromise the integrity of the system and network(s). - # Remediation is applicable only in certain platforms -if rpm --quiet -q net-snmp; then - -var_snmpd_ro_string='' -var_snmpd_rw_string='' - - -# remediate read-only community string -if grep -q 'public' /etc/snmp/snmpd.conf; then - sed -i "s/public/$var_snmpd_ro_string/" /etc/snmp/snmpd.conf -fi - -# remediate read-write community string -if grep -q 'private' /etc/snmp/snmpd.conf; then - sed -i "s/private/$var_snmpd_rw_string/" /etc/snmp/snmpd.conf -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -273446,6 +273590,27 @@ fi - medium_disruption - no_reboot_needed - snmpd_not_default_password + + # Remediation is applicable only in certain platforms +if rpm --quiet -q net-snmp; then + +var_snmpd_ro_string='' +var_snmpd_rw_string='' + + +# remediate read-only community string +if grep -q 'public' /etc/snmp/snmpd.conf; then + sed -i "s/public/$var_snmpd_ro_string/" /etc/snmp/snmpd.conf +fi + +# remediate read-write community string +if grep -q 'private' /etc/snmp/snmpd.conf; then + sed -i "s/private/$var_snmpd_rw_string/" /etc/snmp/snmpd.conf +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273507,6 +273672,7 @@ Its server program is called sshd and provided by the RPM aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr + -3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr @@ -273569,17 +273735,19 @@ A value of 2 indicates that OpenSSH server package is required by the policy.ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256 + -diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1 curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 - SSH Strong KEX by FIPS + SSH Strong MACs by FIPS Specify the FIPS approved MACs (Message Authentication Code) algorithms that are used for data integrity protection by the SSH server. hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 + -hmac-md5,hmac-md5-96,hmac-ripemd160,hmac-sha1-96,umac-64@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,umac-64-etm@openssh.com hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256 @@ -273618,8 +273786,24 @@ $ sudo yum install openssh-clients This package includes utilities to make encrypted connections and transfer files securely to SSH servers. CCE-82722-0 - -package --add=openssh-clients + - name: Ensure openssh-clients is installed + package: + name: openssh-clients + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-82722-0 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-clients_installed + + +[[packages]] +name = "openssh-clients" +version = "*" include install_openssh-clients @@ -273628,6 +273812,9 @@ class install_openssh-clients { ensure => 'installed', } } + + +package --add=openssh-clients # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273639,25 +273826,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssh-clients" -version = "*" - - - name: Ensure openssh-clients is installed - package: - name: openssh-clients - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-82722-0 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-clients_installed @@ -273729,8 +273897,26 @@ $ sudo yum install openssh-server integrity may be compromised because unprotected communications can be intercepted and either read or altered. CCE-83303-8 - -package --add=openssh-server + - name: Ensure openssh-server is installed + package: + name: openssh-server + state: present + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83303-8 + - DISA-STIG-RHEL-08-040159 + - NIST-800-53-CM-6(a) + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-server_installed + + +[[packages]] +name = "openssh-server" +version = "*" include install_openssh-server @@ -273739,6 +273925,9 @@ class install_openssh-server { ensure => 'installed', } } + + +package --add=openssh-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273750,27 +273939,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "openssh-server" -version = "*" - - - name: Ensure openssh-server is installed - package: - name: openssh-server - state: present - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83303-8 - - DISA-STIG-RHEL-08-040159 - - NIST-800-53-CM-6(a) - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-server_installed @@ -273788,8 +273956,18 @@ $ sudo yum erase openssh-server Without protection of the transmitted information, confidentiality, and integrity may be compromised because unprotected communications can be intercepted and either read or altered. - -package --remove=openssh-server + - name: Ensure openssh-server is removed + package: + name: openssh-server + state: absent + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_openssh-server_removed include remove_openssh-server @@ -273798,6 +273976,9 @@ class remove_openssh-server { ensure => 'purged', } } + + +package --remove=openssh-server # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -273817,19 +273998,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Ensure openssh-server is removed - package: - name: openssh-server - state: absent - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_openssh-server_removed @@ -273911,31 +274079,6 @@ mobile devices, notebook computers, printers, copiers, scanners, etc). Communica outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. CCE-82426-8 - include enable_sshd - -class enable_sshd { - service {'sshd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'sshd.service' -"$SYSTEMCTL_EXEC" start 'sshd.service' -"$SYSTEMCTL_EXEC" enable 'sshd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["sshd"] - - name: Enable service sshd block: @@ -273970,6 +274113,31 @@ enabled = ["sshd"] - medium_severity - no_reboot_needed - service_sshd_enabled + + +[customizations.services] +enabled = ["sshd"] + + include enable_sshd + +class enable_sshd { + service {'sshd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'sshd.service' +"$SYSTEMCTL_EXEC" start 'sshd.service' +"$SYSTEMCTL_EXEC" enable 'sshd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -273990,55 +274158,6 @@ remote access. SRG-APP-000185-CTR-000490 SRG-APP-000141-CTR-000315 - apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - systemd: - units: - - name: sshd.service - enabled: false - mask: true - - name: sshd.socket - enabled: false - mask: true - - include disable_sshd - -class disable_sshd { - service {'sshd': - enable => false, - ensure => 'stopped', - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" stop 'sshd.service' -"$SYSTEMCTL_EXEC" disable 'sshd.service' -"$SYSTEMCTL_EXEC" mask 'sshd.service' -# Disable socket activation if we have a unit file for it -if "$SYSTEMCTL_EXEC" -q list-unit-files sshd.socket; then - "$SYSTEMCTL_EXEC" stop 'sshd.socket' - "$SYSTEMCTL_EXEC" mask 'sshd.socket' -fi -# The service may not be running because it has been started and failed, -# so let's reset the state so OVAL checks pass. -# Service should be 'inactive', not 'failed' after reboot though. -"$SYSTEMCTL_EXEC" reset-failed 'sshd.service' || true - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -disabled = ["sshd"] - - name: Block Disable service sshd block: @@ -274102,6 +274221,55 @@ disabled = ["sshd"] - low_disruption - no_reboot_needed - service_sshd_disabled + + apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + systemd: + units: + - name: sshd.service + enabled: false + mask: true + - name: sshd.socket + enabled: false + mask: true + + +[customizations.services] +disabled = ["sshd"] + + include disable_sshd + +class disable_sshd { + service {'sshd': + enable => false, + ensure => 'stopped', + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" stop 'sshd.service' +"$SYSTEMCTL_EXEC" disable 'sshd.service' +"$SYSTEMCTL_EXEC" mask 'sshd.service' +# Disable socket activation if we have a unit file for it +if "$SYSTEMCTL_EXEC" -q list-unit-files sshd.socket; then + "$SYSTEMCTL_EXEC" stop 'sshd.socket' + "$SYSTEMCTL_EXEC" mask 'sshd.socket' +fi +# The service may not be running because it has been started and failed, +# so let's reset the state so OVAL checks pass. +# Service should be 'inactive', not 'failed' after reboot though. +"$SYSTEMCTL_EXEC" reset-failed 'sshd.service' || true + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274168,21 +274336,12 @@ To properly set the group owner of /etc/ssh/sshd_config, PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82901-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chgrp 0 /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274218,6 +274377,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chgrp 0 /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274230,18 +274398,9 @@ fi Verify Group Ownership on SSH Server Private *_key Key Files SSH server private keys, files that match the /etc/ssh/*_key glob, must be group-owned by ssh_keys group. - 5.2.2 + 4.2.2 If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-86126-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex '^.*_key$' -exec chgrp ssh_keys {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*_key$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex "^.*_key$" register: files_found @@ -274274,6 +274433,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -group ssh_keys -regex '^.*_key$' -exec chgrp ssh_keys {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274286,19 +274454,10 @@ fi Verify Group Ownership on SSH Server Public *.pub Key Files SSH server public keys, files that match the /etc/ssh/*.pub glob, must be group-owned by root group. - 5.2.3 + 4.2.3 If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-86133-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.pub$' -exec chgrp 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*\.pub$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex "^.*\.pub$" register: files_found @@ -274331,6 +274490,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -group 0 -regex '^.*\.pub$' -exec chgrp 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274397,21 +274565,12 @@ To properly set the owner of /etc/ssh/sshd_config, run th PR.AC-4 PR.DS-5 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82898-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chown 0 /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274447,6 +274606,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chown 0 /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274459,18 +274627,9 @@ fi Verify Ownership on SSH Server Private *_key Key Files SSH server private keys, files that match the /etc/ssh/*_key glob, must be owned by root user. - 5.2.2 + 4.2.2 If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-86118-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*_key$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*_key$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex "^.*_key$" register: files_found @@ -274503,6 +274662,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*_key$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274515,19 +274683,10 @@ fi Verify Ownership on SSH Server Public *.pub Key Files SSH server public keys, files that match the /etc/ssh/*.pub glob, must be owned by root user. - 5.2.3 + 4.2.3 If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-86129-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.pub$' -exec chown 0 {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) matching ^.*\.pub$ command: find -H /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex "^.*\.pub$" register: files_found @@ -274560,6 +274719,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find /etc/ssh/ -maxdepth 1 -type f ! -uid 0 -regex '^.*\.pub$' -exec chown 0 {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274627,21 +274795,12 @@ To properly set the permissions of /etc/ssh/sshd_config, PR.DS-5 2.2.6 SRG-OS-000480-GPOS-00227 - 5.2.1 + 4.2.1 Service configuration files enable or disable features of their respective services that if configured incorrectly can lead to insecure and vulnerable configurations. Therefore, service configuration files should be owned by the correct group to prevent unauthorized changes. CCE-82894-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -chmod u-xs,g-xwrs,o-xwrt /etc/ssh/sshd_config - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Test for existence /etc/ssh/sshd_config stat: path: /etc/ssh/sshd_config @@ -274679,6 +274838,15 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +chmod u-xs,g-xwrs,o-xwrt /etc/ssh/sshd_config + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274752,40 +274920,11 @@ If they are owned by the root user, but by a dedicated gr 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-010490 - 5.2.2 + 4.2.2 SV-230287r880714_rule If an unauthorized user obtains the private SSH host key file, the host could be impersonated. CCE-82424-3 - include ssh_private_key_perms - -class ssh_private_key_perms { - exec { 'sshd_priv_key': - command => "chmod 0640 /etc/ssh/*_key", - path => '/bin:/usr/bin' - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -for keyfile in /etc/ssh/*_key; do - test -f "$keyfile" || continue - if test root:root = "$(stat -c "%U:%G" "$keyfile")"; then - - chmod u-xs,g-xwrs,o-xwrt "$keyfile" - - elif test root:ssh_keys = "$(stat -c "%U:%G" "$keyfile")"; then - chmod u-xs,g-xws,o-xwrt "$keyfile" - else - echo "Key-like file '$keyfile' is owned by an unexpected user:group combination" - fi -done - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find root:root-owned keys ansible.builtin.command: find -H /etc/ssh/ -maxdepth 1 -user root -regex ".*_key$" -type f -group root -perm /u+xs,g+xwrs,o+xwrt @@ -274885,6 +275024,35 @@ fi - low_disruption - medium_severity - no_reboot_needed + + include ssh_private_key_perms + +class ssh_private_key_perms { + exec { 'sshd_priv_key': + command => "chmod 0640 /etc/ssh/*_key", + path => '/bin:/usr/bin' + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +for keyfile in /etc/ssh/*_key; do + test -f "$keyfile" || continue + if test root:root = "$(stat -c "%U:%G" "$keyfile")"; then + + chmod u-xs,g-xwrs,o-xwrt "$keyfile" + + elif test root:ssh_keys = "$(stat -c "%U:%G" "$keyfile")"; then + chmod u-xs,g-xws,o-xwrt "$keyfile" + else + echo "Key-like file '$keyfile' is owned by an unexpected user:group combination" + fi +done + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -274955,29 +275123,11 @@ fi 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-010480 - 5.2.3 + 4.2.3 SV-230286r627750_rule If a public host key file is modified by an unauthorized user, the SSH service may be compromised. CCE-82428-4 - include ssh_public_key_perms - -class ssh_public_key_perms { - exec { 'sshd_pub_key': - command => "chmod 0644 /etc/ssh/*.pub", - path => '/bin:/usr/bin' - } -} - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex '^.*\.pub$' -exec chmod u-xs,g-xws,o-xwt {} \; - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Find /etc/ssh/ file(s) command: find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex "^.*\.pub$" register: files_found @@ -275026,6 +275176,24 @@ fi - low_disruption - medium_severity - no_reboot_needed + + include ssh_public_key_perms + +class ssh_public_key_perms { + exec { 'sshd_pub_key': + command => "chmod 0644 /etc/ssh/*.pub", + path => '/bin:/usr/bin' + } +} + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +find -H /etc/ssh/ -maxdepth 1 -perm /u+xs,g+xws,o+xwt -type f -regex '^.*\.pub$' -exec chmod u-xs,g-xws,o-xwt {} \; + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275096,45 +275264,6 @@ processed before 02-rekey-limit.conf containing definitio time-based limit, effects of potential attacks against encryption keys are limited. CCE-82880-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_ssh_client_rekey_limit_size='' -var_ssh_client_rekey_limit_time='' - - -main_config="/etc/ssh/ssh_config" -include_directory="/etc/ssh/ssh_config.d" - -if grep -q '^[\s]*RekeyLimit.*$' "$main_config"; then - sed -i '/^[\s]*RekeyLimit.*/d' "$main_config" -fi - -for file in "$include_directory"/*.conf; do - if grep -q '^[\s]*RekeyLimit.*$' "$file"; then - sed -i '/^[\s]*RekeyLimit.*/d' "$file" - fi -done - -if [ -e "/etc/ssh/ssh_config.d/02-rekey-limit.conf" ] ; then - - LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/d" "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -else - touch "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/ssh_config.d/02-rekey-limit.conf" - -cp "/etc/ssh/ssh_config.d/02-rekey-limit.conf" "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" -# Insert at the end of the file -printf '%s\n' "RekeyLimit $var_ssh_client_rekey_limit_size $var_ssh_client_rekey_limit_time" >> "/etc/ssh/ssh_config.d/02-rekey-limit.conf" -# Clean up after ourselves. -rm "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_ssh_client_rekey_limit_size # promote to variable set_fact: var_ssh_client_rekey_limit_size: !!str @@ -275213,6 +275342,45 @@ fi - medium_severity - no_reboot_needed - ssh_client_rekey_limit + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_ssh_client_rekey_limit_size='' +var_ssh_client_rekey_limit_time='' + + +main_config="/etc/ssh/ssh_config" +include_directory="/etc/ssh/ssh_config.d" + +if grep -q '^[\s]*RekeyLimit.*$' "$main_config"; then + sed -i '/^[\s]*RekeyLimit.*/d' "$main_config" +fi + +for file in "$include_directory"/*.conf; do + if grep -q '^[\s]*RekeyLimit.*$' "$file"; then + sed -i '/^[\s]*RekeyLimit.*/d' "$file" + fi +done + +if [ -e "/etc/ssh/ssh_config.d/02-rekey-limit.conf" ] ; then + + LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/d" "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +else + touch "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/ssh_config.d/02-rekey-limit.conf" + +cp "/etc/ssh/ssh_config.d/02-rekey-limit.conf" "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" +# Insert at the end of the file +printf '%s\n' "RekeyLimit $var_ssh_client_rekey_limit_size $var_ssh_client_rekey_limit_time" >> "/etc/ssh/ssh_config.d/02-rekey-limit.conf" +# Clean up after ourselves. +rm "/etc/ssh/ssh_config.d/02-rekey-limit.conf.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275238,19 +275406,6 @@ Randomness is needed to generate considerably more secure data-encryption keys. in encryption algorithms, and high-quality entropy eliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-83349-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# put line into the file -echo "setenv SSH_USE_STRONG_RNG 32" > /etc/profile.d/cc-ssh-strong-rng.csh - -# remove eventual override in /etc/profile -sed -i '/^[[:space:]]*setenv[[:space:]]\+SSH_USE_STRONG_RNG.*$/d' /etc/profile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure that correct variable is exported in /etc/profile.d/cc-ssh-strong-rng.csh lineinfile: path: /etc/profile.d/cc-ssh-strong-rng.csh @@ -275282,6 +275437,19 @@ fi - medium_severity - no_reboot_needed - ssh_client_use_strong_rng_csh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# put line into the file +echo "setenv SSH_USE_STRONG_RNG 32" > /etc/profile.d/cc-ssh-strong-rng.csh + +# remove eventual override in /etc/profile +sed -i '/^[[:space:]]*setenv[[:space:]]\+SSH_USE_STRONG_RNG.*$/d' /etc/profile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275305,19 +275473,6 @@ Randomness is needed to generate considerably more secure data-encryption keys. in encryption algorithms, and high-quality entropy eliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-83346-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# put line into the file -echo "export SSH_USE_STRONG_RNG=32" > /etc/profile.d/cc-ssh-strong-rng.sh - -# remove eventual override in /etc/profile -sed -i '/^[[:space:]]*export[[:space:]]\+SSH_USE_STRONG_RNG=.*$/d' /etc/profile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Ensure that correct variable is exported in /etc/profile.d/cc-ssh-strong-rng.sh lineinfile: path: /etc/profile.d/cc-ssh-strong-rng.sh @@ -275349,6 +275504,19 @@ fi - medium_severity - no_reboot_needed - ssh_client_use_strong_rng_sh + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# put line into the file +echo "export SSH_USE_STRONG_RNG=32" > /etc/profile.d/cc-ssh-strong-rng.sh + +# remove eventual override in /etc/profile +sed -i '/^[[:space:]]*export[[:space:]]\+SSH_USE_STRONG_RNG=.*$/d' /etc/profile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275549,29 +275717,6 @@ value of 0 in is reached. CCE-83405-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveCountMax 0" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set SSH Client Alive Count Max to zero block: @@ -275619,6 +275764,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_keepalive_0 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveCountMax 0" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275749,38 +275917,12 @@ a keep alive message. SRG-OS-000163-GPOS-00072 SRG-OS-000279-GPOS-00109 RHEL-08-010200 - 5.2.20 + 4.2.7 SV-230244r917867_rule This ensures a user login will be terminated as soon as the ClientAliveInterval is reached. CCE-80907-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_set_keepalive='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveCountMax $var_sshd_set_keepalive" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_set_keepalive # promote to variable set_fact: var_sshd_set_keepalive: !!str @@ -275836,6 +275978,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_keepalive + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_keepalive='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveCountMax\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveCountMax $var_sshd_set_keepalive" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -275969,7 +276137,7 @@ configuring ClientAliveCountMax in the SSH service configuration.SRG-OS-000279-GPOS-00109 SRG-OS-000395-GPOS-00175 RHEL-08-010201 - 5.2.20 + 4.2.7 SV-244525r917886_rule Terminating an idle ssh session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session @@ -275977,32 +276145,6 @@ enabled on the console or console port that has been let unattended. CCE-80906-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.5"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then - -sshd_idle_timeout_value='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*ClientAliveInterval\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "ClientAliveInterval $sshd_idle_timeout_value" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value sshd_idle_timeout_value # promote to variable set_fact: sshd_idle_timeout_value: !!str @@ -276063,6 +276205,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_idle_timeout + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { grep -qP "^ID=[\"']?rhel[\"']?$" "/etc/os-release" && { real="$(grep -P "^VERSION_ID=[\"']?[\w.]+[\"']?$" /etc/os-release | sed "s/^VERSION_ID=[\"']\?\([^\"']\+\)[\"']\?$/\1/")"; expected="8.5"; printf "%s\n%s" "$real" "$expected" | sort -VC; }; }; then + +sshd_idle_timeout_value='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*ClientAliveInterval\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "ClientAliveInterval $sshd_idle_timeout_value" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276213,48 +276381,10 @@ following line in FIA_UAU.1 8.3.1 SRG-OS-000480-GPOS-00229 - 5.2.8 + 4.2.9 SSH trust relationships mean a compromise on one host can allow an attacker to move trivially to other hosts. CCE-80786-7 - --- -apiVersion: machineconfiguration.openshift.io/v1 -kind: MachineConfig -spec: - config: - ignition: - version: 3.1.0 - storage: - files: - - contents: - source: data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.103%202018%2F04%2F09%2020%3A41%3A22%20tj%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0ARekeyLimit%20512M%201h%0A%0A%23%20System-wide%20Crypto%20policy%3A%0A%23%20This%20system%20is%20following%20system-wide%20crypto%20policy.%20The%20changes%20to%0A%23%20Ciphers%2C%20MACs%2C%20KexAlgoritms%20and%20GSSAPIKexAlgorithsm%20will%20not%20have%20any%0A%23%20effect%20here.%20They%20will%20be%20overridden%20by%20command-line%20options%20passed%20on%0A%23%20the%20server%20start%20up.%0A%23%20To%20opt%20out%2C%20uncomment%20a%20line%20with%20redefinition%20of%20%20CRYPTO_POLICY%3D%0A%23%20variable%20in%20%20%2Fetc%2Fsysconfig%2Fsshd%20%20to%20overwrite%20the%20policy.%0A%23%20For%20more%20information%2C%20see%20manual%20page%20for%20update-crypto-policies%288%29.%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0ASyslogFacility%20AUTHPRIV%0A%23LogLevel%20INFO%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0APermitRootLogin%20no%0AStrictModes%20yes%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0APubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0AHostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0AIgnoreUserKnownHosts%20yes%0A%23%20Don%27t%20read%20the%20user%27s%20~%2F.rhosts%20and%20~%2F.shosts%20files%0AIgnoreRhosts%20yes%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0APermitEmptyPasswords%20no%0APasswordAuthentication%20no%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23ChallengeResponseAuthentication%20yes%0AChallengeResponseAuthentication%20no%0A%0A%23%20Kerberos%20options%0AKerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0AGSSAPIAuthentication%20no%0AGSSAPICleanupCredentials%20no%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20ChallengeResponseAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20ChallengeResponseAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20without-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20ChallengeResponseAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20Fedora%20and%20may%20cause%20several%0A%23%20problems.%0AUsePAM%20yes%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0AX11Forwarding%20yes%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%0A%23%20It%20is%20recommended%20to%20use%20pam_motd%20in%20%2Fetc%2Fpam.d%2Fsshd%20instead%20of%20PrintMotd%2C%0A%23%20as%20it%20is%20more%20configurable%20and%20versatile%20than%20the%20built-in%20version.%0APrintMotd%20no%0A%0APrintLastLog%20yes%0A%23TCPKeepAlive%20yes%0APermitUserEnvironment%20no%0ACompression%20no%0AClientAliveInterval%20600%0AClientAliveCountMax%200%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0ABanner%20%2Fetc%2Fissue%0A%0A%23%20Accept%20locale-related%20environment%20variables%0AAcceptEnv%20LANG%20LC_CTYPE%20LC_NUMERIC%20LC_TIME%20LC_COLLATE%20LC_MONETARY%20LC_MESSAGES%0AAcceptEnv%20LC_PAPER%20LC_NAME%20LC_ADDRESS%20LC_TELEPHONE%20LC_MEASUREMENT%0AAcceptEnv%20LC_IDENTIFICATION%20LC_ALL%20LANGUAGE%0AAcceptEnv%20XMODIFIERS%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A%0AUsePrivilegeSeparation%20sandbox - mode: 0600 - path: /etc/ssh/sshd_config - overwrite: true - - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*HostbasedAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "HostbasedAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable Host-Based Authentication block: @@ -276302,6 +276432,44 @@ fi - medium_severity - no_reboot_needed - restrict_strategy + + --- +apiVersion: machineconfiguration.openshift.io/v1 +kind: MachineConfig +spec: + config: + ignition: + version: 3.1.0 + storage: + files: + - contents: + source: data:,%23%09%24OpenBSD%3A%20sshd_config%2Cv%201.103%202018%2F04%2F09%2020%3A41%3A22%20tj%20Exp%20%24%0A%0A%23%20This%20is%20the%20sshd%20server%20system-wide%20configuration%20file.%20%20See%0A%23%20sshd_config%285%29%20for%20more%20information.%0A%0A%23%20This%20sshd%20was%20compiled%20with%20PATH%3D%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fbin%3A%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Fsbin%0A%0A%23%20The%20strategy%20used%20for%20options%20in%20the%20default%20sshd_config%20shipped%20with%0A%23%20OpenSSH%20is%20to%20specify%20options%20with%20their%20default%20value%20where%0A%23%20possible%2C%20but%20leave%20them%20commented.%20%20Uncommented%20options%20override%20the%0A%23%20default%20value.%0A%0A%23%20If%20you%20want%20to%20change%20the%20port%20on%20a%20SELinux%20system%2C%20you%20have%20to%20tell%0A%23%20SELinux%20about%20this%20change.%0A%23%20semanage%20port%20-a%20-t%20ssh_port_t%20-p%20tcp%20%23PORTNUMBER%0A%23%0A%23Port%2022%0A%23AddressFamily%20any%0A%23ListenAddress%200.0.0.0%0A%23ListenAddress%20%3A%3A%0A%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_rsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ecdsa_key%0AHostKey%20%2Fetc%2Fssh%2Fssh_host_ed25519_key%0A%0A%23%20Ciphers%20and%20keying%0ARekeyLimit%20512M%201h%0A%0A%23%20System-wide%20Crypto%20policy%3A%0A%23%20This%20system%20is%20following%20system-wide%20crypto%20policy.%20The%20changes%20to%0A%23%20Ciphers%2C%20MACs%2C%20KexAlgoritms%20and%20GSSAPIKexAlgorithsm%20will%20not%20have%20any%0A%23%20effect%20here.%20They%20will%20be%20overridden%20by%20command-line%20options%20passed%20on%0A%23%20the%20server%20start%20up.%0A%23%20To%20opt%20out%2C%20uncomment%20a%20line%20with%20redefinition%20of%20%20CRYPTO_POLICY%3D%0A%23%20variable%20in%20%20%2Fetc%2Fsysconfig%2Fsshd%20%20to%20overwrite%20the%20policy.%0A%23%20For%20more%20information%2C%20see%20manual%20page%20for%20update-crypto-policies%288%29.%0A%0A%23%20Logging%0A%23SyslogFacility%20AUTH%0ASyslogFacility%20AUTHPRIV%0A%23LogLevel%20INFO%0A%0A%23%20Authentication%3A%0A%0A%23LoginGraceTime%202m%0APermitRootLogin%20no%0AStrictModes%20yes%0A%23MaxAuthTries%206%0A%23MaxSessions%2010%0A%0APubkeyAuthentication%20yes%0A%0A%23%20The%20default%20is%20to%20check%20both%20.ssh%2Fauthorized_keys%20and%20.ssh%2Fauthorized_keys2%0A%23%20but%20this%20is%20overridden%20so%20installations%20will%20only%20check%20.ssh%2Fauthorized_keys%0AAuthorizedKeysFile%09.ssh%2Fauthorized_keys%0A%0A%23AuthorizedPrincipalsFile%20none%0A%0A%23AuthorizedKeysCommand%20none%0A%23AuthorizedKeysCommandUser%20nobody%0A%0A%23%20For%20this%20to%20work%20you%20will%20also%20need%20host%20keys%20in%20%2Fetc%2Fssh%2Fssh_known_hosts%0AHostbasedAuthentication%20no%0A%23%20Change%20to%20yes%20if%20you%20don%27t%20trust%20~%2F.ssh%2Fknown_hosts%20for%0A%23%20HostbasedAuthentication%0AIgnoreUserKnownHosts%20yes%0A%23%20Don%27t%20read%20the%20user%27s%20~%2F.rhosts%20and%20~%2F.shosts%20files%0AIgnoreRhosts%20yes%0A%0A%23%20To%20disable%20tunneled%20clear%20text%20passwords%2C%20change%20to%20no%20here%21%0A%23PasswordAuthentication%20yes%0APermitEmptyPasswords%20no%0APasswordAuthentication%20no%0A%0A%23%20Change%20to%20no%20to%20disable%20s%2Fkey%20passwords%0A%23ChallengeResponseAuthentication%20yes%0AChallengeResponseAuthentication%20no%0A%0A%23%20Kerberos%20options%0AKerberosAuthentication%20no%0A%23KerberosOrLocalPasswd%20yes%0A%23KerberosTicketCleanup%20yes%0A%23KerberosGetAFSToken%20no%0A%23KerberosUseKuserok%20yes%0A%0A%23%20GSSAPI%20options%0AGSSAPIAuthentication%20no%0AGSSAPICleanupCredentials%20no%0A%23GSSAPIStrictAcceptorCheck%20yes%0A%23GSSAPIKeyExchange%20no%0A%23GSSAPIEnablek5users%20no%0A%0A%23%20Set%20this%20to%20%27yes%27%20to%20enable%20PAM%20authentication%2C%20account%20processing%2C%0A%23%20and%20session%20processing.%20If%20this%20is%20enabled%2C%20PAM%20authentication%20will%0A%23%20be%20allowed%20through%20the%20ChallengeResponseAuthentication%20and%0A%23%20PasswordAuthentication.%20%20Depending%20on%20your%20PAM%20configuration%2C%0A%23%20PAM%20authentication%20via%20ChallengeResponseAuthentication%20may%20bypass%0A%23%20the%20setting%20of%20%22PermitRootLogin%20without-password%22.%0A%23%20If%20you%20just%20want%20the%20PAM%20account%20and%20session%20checks%20to%20run%20without%0A%23%20PAM%20authentication%2C%20then%20enable%20this%20but%20set%20PasswordAuthentication%0A%23%20and%20ChallengeResponseAuthentication%20to%20%27no%27.%0A%23%20WARNING%3A%20%27UsePAM%20no%27%20is%20not%20supported%20in%20Fedora%20and%20may%20cause%20several%0A%23%20problems.%0AUsePAM%20yes%0A%0A%23AllowAgentForwarding%20yes%0A%23AllowTcpForwarding%20yes%0A%23GatewayPorts%20no%0AX11Forwarding%20yes%0A%23X11DisplayOffset%2010%0A%23X11UseLocalhost%20yes%0A%23PermitTTY%20yes%0A%0A%23%20It%20is%20recommended%20to%20use%20pam_motd%20in%20%2Fetc%2Fpam.d%2Fsshd%20instead%20of%20PrintMotd%2C%0A%23%20as%20it%20is%20more%20configurable%20and%20versatile%20than%20the%20built-in%20version.%0APrintMotd%20no%0A%0APrintLastLog%20yes%0A%23TCPKeepAlive%20yes%0APermitUserEnvironment%20no%0ACompression%20no%0AClientAliveInterval%20600%0AClientAliveCountMax%200%0A%23UseDNS%20no%0A%23PidFile%20%2Fvar%2Frun%2Fsshd.pid%0A%23MaxStartups%2010%3A30%3A100%0A%23PermitTunnel%20no%0A%23ChrootDirectory%20none%0A%23VersionAddendum%20none%0A%0A%23%20no%20default%20banner%20path%0ABanner%20%2Fetc%2Fissue%0A%0A%23%20Accept%20locale-related%20environment%20variables%0AAcceptEnv%20LANG%20LC_CTYPE%20LC_NUMERIC%20LC_TIME%20LC_COLLATE%20LC_MONETARY%20LC_MESSAGES%0AAcceptEnv%20LC_PAPER%20LC_NAME%20LC_ADDRESS%20LC_TELEPHONE%20LC_MEASUREMENT%0AAcceptEnv%20LC_IDENTIFICATION%20LC_ALL%20LANGUAGE%0AAcceptEnv%20XMODIFIERS%0A%0A%23%20override%20default%20of%20no%20subsystems%0ASubsystem%09sftp%09%2Fusr%2Flibexec%2Fopenssh%2Fsftp-server%0A%0A%23%20Example%20of%20overriding%20settings%20on%20a%20per-user%20basis%0A%23Match%20User%20anoncvs%0A%23%09X11Forwarding%20no%0A%23%09AllowTcpForwarding%20no%0A%23%09PermitTTY%20no%0A%23%09ForceCommand%20cvs%20server%0A%0AUsePrivilegeSeparation%20sandbox + mode: 0600 + path: /etc/ssh/sshd_config + overwrite: true + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*HostbasedAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "HostbasedAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276346,54 +276514,6 @@ properly configured. will allow remote access through the SSH port. CCE-80820-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if ! rpm -q --quiet "firewalld" ; then - yum install -y "firewalld" -fi -if ! rpm -q --quiet "NetworkManager" ; then - yum install -y "NetworkManager" -fi -firewalld_sshd_zone='' - - -if systemctl is-active NetworkManager && systemctl is-active firewalld; then - # First make sure the SSH service is enabled in run-time for the proper zone. - # This is to avoid connection issues when new interfaces are addeded to this zone. - firewall-cmd --zone="$firewalld_sshd_zone" --add-service=ssh - - # This will collect all NetworkManager connections names - readarray -t nm_connections < <(nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }') - # If the connection is not yet assigned to a firewalld zone, assign it to the proper zone. - # This will not change connections which are already assigned to any firewalld zone. - for connection in "${nm_connections[@]}"; do - current_zone=$(nmcli -f connection.zone connection show "$connection" | awk '{ print $2}') - if [ $current_zone = "--" ]; then - nmcli connection modify "$connection" connection.zone $firewalld_sshd_zone - fi - done - systemctl restart NetworkManager - - # Active zones are zones with at least one interface assigned to it. - # It is possible that traffic is comming by any active interface and consequently any - # active zone. So, this make sure all active zones are permanently allowing SSH service. - readarray -t firewalld_active_zones < <(firewall-cmd --get-active-zones | grep -v interfaces) - for zone in "${firewalld_active_zones[@]}"; do - firewall-cmd --permanent --zone="$zone" --add-service=ssh - done - firewall-cmd --reload -else - echo " - firewalld and NetworkManager services are not active. Remediation aborted! - This remediation could not be applied because it depends on firewalld and NetworkManager services running. - The service is not started by this remediation in order to prevent connection issues." -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value firewalld_sshd_zone # promote to variable set_fact: firewalld_sshd_zone: !!str @@ -276553,6 +276673,54 @@ fi - low_disruption - medium_severity - no_reboot_needed + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if ! rpm -q --quiet "firewalld" ; then + yum install -y "firewalld" +fi +if ! rpm -q --quiet "NetworkManager" ; then + yum install -y "NetworkManager" +fi +firewalld_sshd_zone='' + + +if systemctl is-active NetworkManager && systemctl is-active firewalld; then + # First make sure the SSH service is enabled in run-time for the proper zone. + # This is to avoid connection issues when new interfaces are addeded to this zone. + firewall-cmd --zone="$firewalld_sshd_zone" --add-service=ssh + + # This will collect all NetworkManager connections names + readarray -t nm_connections < <(nmcli -f UUID,TYPE con | grep ethernet | awk '{ print $1 }') + # If the connection is not yet assigned to a firewalld zone, assign it to the proper zone. + # This will not change connections which are already assigned to any firewalld zone. + for connection in "${nm_connections[@]}"; do + current_zone=$(nmcli -f connection.zone connection show "$connection" | awk '{ print $2}') + if [ $current_zone = "--" ]; then + nmcli connection modify "$connection" connection.zone $firewalld_sshd_zone + fi + done + systemctl restart NetworkManager + + # Active zones are zones with at least one interface assigned to it. + # It is possible that traffic is comming by any active interface and consequently any + # active zone. So, this make sure all active zones are permanently allowing SSH service. + readarray -t firewalld_active_zones < <(firewall-cmd --get-active-zones | grep -v interfaces) + for zone in "${firewalld_active_zones[@]}"; do + firewall-cmd --permanent --zone="$zone" --add-service=ssh + done + firewall-cmd --reload +else + echo " + firewalld and NetworkManager services are not active. Remediation aborted! + This remediation could not be applied because it depends on firewalld and NetworkManager services running. + The service is not started by this remediation in order to prevent connection issues." +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276676,35 +276844,6 @@ supported is version 2, and line Protocol 2 in has many well-known vulnerability exploits. Exploits of the SSH daemon could provide immediate root access to the system. CCE-80894-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^Protocol") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "2" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^Protocol\\>" "/etc/ssh/sshd_config"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^Protocol\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" -else - if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" - fi - cce="CCE-80894-9" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" - printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow Only SSH Protocol 2 block: @@ -276753,6 +276892,35 @@ fi - no_reboot_needed - restrict_strategy - sshd_allow_only_protocol2 + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^Protocol") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "2" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^Protocol\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^Protocol\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-80894-9" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -276805,33 +276973,6 @@ a user has successfully authenticated, add or correct the following line in the vulnerabilities in the compression software could result in compromise of the system from an unauthenticated connection, potentially with root privileges. CCE-80895-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_disable_compression='' - - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Compression\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Compression $var_sshd_disable_compression" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_disable_compression # promote to variable set_fact: var_sshd_disable_compression: !!str @@ -276882,6 +277023,33 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_compression + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_disable_compression='' + + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Compression\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Compression $var_sshd_disable_compression" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277034,12 +277202,62 @@ should prevent users from being able to assign themselves empty passwords.SRG-OS-000480-GPOS-00229 SRG-OS-000480-GPOS-00227 RHEL-08-020330 - 5.2.9 + 4.2.18 SV-230380r858715_rule Configuring this setting for the SSH daemon provides additional assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80896-4 + - name: Disable SSH Access via Empty Passwords + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*PermitEmptyPasswords\s+ + line: PermitEmptyPasswords no + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80896-4 + - CJIS-5.5.6 + - DISA-STIG-RHEL-08-020330 + - NIST-800-171-3.1.1 + - NIST-800-171-3.1.5 + - NIST-800-53-AC-17(a) + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - PCI-DSS-Req-2.2.4 + - PCI-DSSv4-2.2.6 + - high_severity + - low_complexity + - low_disruption + - no_reboot_needed + - restrict_strategy + - sshd_disable_empty_passwords + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -277062,56 +277280,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable SSH Access via Empty Passwords - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*PermitEmptyPasswords\s+ - line: PermitEmptyPasswords no - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80896-4 - - CJIS-5.5.6 - - DISA-STIG-RHEL-08-020330 - - NIST-800-171-3.1.1 - - NIST-800-171-3.1.5 - - NIST-800-53-AC-17(a) - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - PCI-DSS-Req-2.2.4 - - PCI-DSSv4-2.2.6 - - high_severity - - low_complexity - - low_disruption - - no_reboot_needed - - restrict_strategy - - sshd_disable_empty_passwords @@ -277182,29 +277350,6 @@ To explicitly disable GSSAPI authentication, add or correct the following line i applications. Allowing GSSAPI authentication through SSH exposes the system's GSSAPI to remote hosts, increasing the attack surface of the system. CCE-80897-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "GSSAPIAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable GSSAPI Authentication block: @@ -277250,6 +277395,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_gssapi_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "GSSAPIAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277332,29 +277500,6 @@ is enabled through SSH, the SSH daemon provides a means of access to the system's Kerberos implementation. Configuring these settings for the SSH daemon provides additional assurance that remote logon via SSH will not use unused methods of authentication, even in the event of misconfiguration elsewhere. CCE-80898-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*KerberosAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "KerberosAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable Kerberos Authentication block: @@ -277400,6 +277545,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_kerb_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*KerberosAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "KerberosAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277423,29 +277591,6 @@ correct the following line in applications. Allowing PubkeyAuthentication authentication through SSH allows users to generate their own authentication tokens, increasing the attack surface of the system. CCE-82345-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PubkeyAuthentication no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable PubkeyAuthentication Authentication block: @@ -277485,6 +277630,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_pubkey_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PubkeyAuthentication no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277601,33 +277769,10 @@ To explicitly disable support for .rhosts files, add or correct the following li FIA_UAU.1 2.2.6 SRG-OS-000480-GPOS-00227 - 5.2.11 + 4.2.10 SSH trust relationships mean a compromise on one host can allow an attacker to move trivially to other hosts. CCE-80899-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*IgnoreRhosts\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "IgnoreRhosts yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for .rhosts Files block: @@ -277674,6 +277819,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_rhosts + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*IgnoreRhosts\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "IgnoreRhosts yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277730,35 +277898,6 @@ necessary. assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80900-4 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -# Strip any search characters in the key arg so that the key can be replaced without -# adding any search characters to the config file. -stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^RhostsRSAAuthentication") - -# shellcheck disable=SC2059 -printf -v formatted_output "%s %s" "$stripped_key" "no" - -# If the key exists, change it. Otherwise, add it to the config_file. -# We search for the key string followed by a word boundary (matched by \>), -# so if we search for 'setting', 'setting2' won't match. -if LC_ALL=C grep -q -m 1 -i -e "^RhostsRSAAuthentication\\>" "/etc/ssh/sshd_config"; then - escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") - LC_ALL=C sed -i --follow-symlinks "s/^RhostsRSAAuthentication\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" -else - if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then - LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" - fi - cce="CCE-80900-4" - printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" - printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for Rhosts RSA Authentication block: @@ -277803,6 +277942,35 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_rhosts_rsa + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^RhostsRSAAuthentication") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "no" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^RhostsRSAAuthentication\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^RhostsRSAAuthentication\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-80900-4" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -277966,7 +278134,7 @@ RHV hosts require root access to be managed by RHV Manager. SRG-APP-000148-CTR-000335 SRG-APP-000190-CTR-000500 RHEL-08-010550 - 5.2.7 + 4.2.19 SV-230296r858711_rule Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging directly on as root. @@ -277975,29 +278143,6 @@ accountability of actions performed on the system and also helps to minimize direct attack attempts on root's password. CCE-80901-2 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitRootLogin no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Root Login block: @@ -278050,6 +278195,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_root_login + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PermitRootLogin no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278077,29 +278245,6 @@ see CCE-27100-7, CCE-27445-6, CCE-80901-2, and similar. Even though the communications channel may be encrypted, an additional layer of security is gained by preventing use of a password. This also helps to minimize direct attack attempts on root's password. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitRootLogin prohibit-password" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH root Login with a Password (Insecure) block: @@ -278139,33 +278284,12 @@ fi - restrict_strategy - sshd_disable_root_password_login - - - - - - - - - - Disable SSH TCP Forwarding - The AllowTcpForwarding parameter specifies whether TCP forwarding is permitted. -To disable TCP forwarding, add or correct the following line in - - -/etc/ssh/sshd_config: - -AllowTcpForwarding no - 2.2.6 - 5.2.13 - Leaving port forwarding enabled can expose the organization to security risks and back-doors. - CCE-83301-2 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*AllowTcpForwarding\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*PermitRootLogin\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -278174,7 +278298,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "AllowTcpForwarding no" > "/etc/ssh/sshd_config" +printf '%s\n' "PermitRootLogin prohibit-password" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -278183,6 +278307,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Disable SSH TCP Forwarding + The AllowTcpForwarding parameter specifies whether TCP forwarding is permitted. +To disable TCP forwarding, add or correct the following line in + + +/etc/ssh/sshd_config: + +AllowTcpForwarding no + 2.2.6 + Leaving port forwarding enabled can expose the organization to security risks and back-doors. + CCE-83301-2 - name: Disable SSH TCP Forwarding block: @@ -278223,6 +278367,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_tcp_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*AllowTcpForwarding\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "AllowTcpForwarding no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278280,29 +278447,6 @@ To ensure this behavior is disabled, add or correct the following line in assurance that remote login via SSH will require a password, even in the event of misconfiguration elsewhere. CCE-80902-0 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*IgnoreUserKnownHosts\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "IgnoreUserKnownHosts yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Disable SSH Support for User Known Hosts block: @@ -278348,6 +278492,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_disable_user_known_hosts + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*IgnoreUserKnownHosts\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "IgnoreUserKnownHosts yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278378,7 +278545,6 @@ To explicitly disable X11 Forwarding, add or correct the following line in 2.2.6 SRG-OS-000480-GPOS-00227 RHEL-08-040340 - 5.2.12 SV-230555r858721_rule Disable X11 forwarding unless there is an operational requirement to use X11 applications directly. There is a small risk that the remote X11 servers of @@ -278386,6 +278552,49 @@ users who are logged in via SSH with X11 forwarding could be compromised by other users on the X11 server. Note that even if X11 forwarding is disabled, users can always install their own forwarders. CCE-83360-8 + - name: Disable X11 Forwarding + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*X11Forwarding\s+ + line: X11Forwarding no + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-83360-8 + - DISA-STIG-RHEL-08-040340 + - NIST-800-53-CM-6(b) + - PCI-DSSv4-2.2.6 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_disable_x11_forwarding + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -278408,49 +278617,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Disable X11 Forwarding - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*X11Forwarding\s+ - line: X11Forwarding no - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-83360-8 - - DISA-STIG-RHEL-08-040340 - - NIST-800-53-CM-6(b) - - PCI-DSSv4-2.2.6 - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sshd_disable_x11_forwarding @@ -278507,34 +278673,11 @@ To explicitly disable Environment options, add or correct the following 2.2.6 SRG-OS-000480-GPOS-00229 RHEL-08-010830 - 5.2.10 + 4.2.20 SV-230330r877377_rule SSH environment options potentially allow users to bypass access restriction in some configurations. CCE-80903-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PermitUserEnvironment\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PermitUserEnvironment no" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Do Not Allow SSH Environment Options block: @@ -278583,6 +278726,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_do_not_permit_user_env + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PermitUserEnvironment\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PermitUserEnvironment no" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278610,29 +278776,6 @@ Kerberos implementations may be subject to exploitation. For enterprises, Kerberos is often enabled and used with GSSAPI for centralized user account management which may necessitate enabling of GSSAPI functionality in SSH. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "GSSAPIAuthentication yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable GSSAPI Authentication block: @@ -278671,6 +278814,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_gssapi_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*GSSAPIAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "GSSAPIAuthentication yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278696,35 +278862,12 @@ To enable PAM authentication, add or correct the following line in CCI-000877 2.2.6 SRG-OS-000125-GPOS-00065 - 5.2.6 + 4.2.21 When UsePAM is set to yes, PAM runs through account and session types properly. This is important if you want to restrict access to services based off of IP, time or other factors of the account. Additionally, you can make sure users inherit certain environment variables on login or disallow access to the server. CCE-86721-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*UsePAM\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "UsePAM yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable PAM block: @@ -278765,6 +278908,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_pam + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*UsePAM\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "UsePAM yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278802,29 +278968,6 @@ A privileged account is defined as an information system account with authorizations of a privileged user. The DoD CAC with DoD-approved PKI is an example of multifactor authentication. - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PubkeyAuthentication yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable Public Key Authentication block: @@ -278863,6 +279006,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_pubkey_auth + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PubkeyAuthentication\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PubkeyAuthentication yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -278953,6 +279119,51 @@ To explicitly enable StrictModes in SSH, add or correct t If other users have access to modify user-specific SSH configuration files, they may be able to log into the system as another user. CCE-80904-6 + - name: Enable Use of Strict Mode Checking + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*StrictModes\s+ + line: StrictModes yes + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80904-6 + - DISA-STIG-RHEL-08-010500 + - NIST-800-171-3.1.12 + - NIST-800-53-AC-17(a) + - NIST-800-53-AC-6 + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_enable_strictmodes + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -278975,51 +279186,6 @@ rm "/etc/ssh/sshd_config.bak" else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Enable Use of Strict Mode Checking - block: - - - name: Check for duplicate values - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - state: absent - check_mode: true - changed_when: false - register: dupes - - - name: Deduplicate values from /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - state: absent - when: dupes.found is defined and dupes.found > 1 - - - name: Insert correct line to /etc/ssh/sshd_config - lineinfile: - path: /etc/ssh/sshd_config - create: true - regexp: (?i)^\s*StrictModes\s+ - line: StrictModes yes - state: present - insertbefore: BOF - validate: /usr/sbin/sshd -t -f %s - when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] - tags: - - CCE-80904-6 - - DISA-STIG-RHEL-08-010500 - - NIST-800-171-3.1.12 - - NIST-800-53-AC-17(a) - - NIST-800-53-AC-6 - - NIST-800-53-CM-6(a) - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - restrict_strategy - - sshd_enable_strictmodes @@ -279100,29 +279266,6 @@ facilitates possible legal action against attackers. Alternatively, systems whose ownership should not be obvious should ensure usage of a banner that does not provide easy attribution. CCE-80905-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Banner /etc/issue" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Warning Banner block: @@ -279170,6 +279313,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_warning_banner + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Banner /etc/issue" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279237,35 +279403,12 @@ appropriate system-wide warning banner. FTA_TAB.1 SRG-OS-000023-GPOS-00006 SRG-OS-000228-GPOS-00088 - 5.2.15 + 4.2.5 The warning message reinforces policy awareness during the logon process and facilitates possible legal action against attackers. Alternatively, systems whose ownership should not be obvious should ensure usage of a banner that does not provide easy attribution. CCE-87978-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "Banner /etc/issue.net" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Warning Banner block: @@ -279311,6 +279454,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_warning_banner_net + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*Banner\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "Banner /etc/issue.net" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279378,29 +279544,6 @@ To enable X11 Forwarding, add or correct the following line in Non-encrypted X displays allow an attacker to capture keystrokes and to execute commands remotely. CCE-82421-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*X11Forwarding\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "X11Forwarding yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable Encrypted X11 Forwarding block: @@ -279444,6 +279587,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_enable_x11_forwarding + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*X11Forwarding\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "X11Forwarding yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279561,7 +279727,7 @@ recommended that at least one of the following options be leveraged: PR.PT-3 Req-2.2.4 2.2.6 - 5.2.4 + 4.2.4 Specifying which accounts are allowed SSH access into the system reduces the possibility of unauthorized access to the system. CCE-82422-7 @@ -279624,29 +279790,6 @@ To explicitly enable LastLog in SSH, add or correct the following line in Providing users feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use. CCE-82281-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*PrintLastLog\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "PrintLastLog yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Enable SSH Print Last Log block: @@ -279689,6 +279832,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_print_last_log + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*PrintLastLog\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "PrintLastLog yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279720,35 +279886,6 @@ To decrease the default limits, add or correct the following line in time-based limit, effects of potential attacks against encryption keys are limited. CCE-82177-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_rekey_limit_size='' -var_rekey_limit_time='' - - - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "RekeyLimit $var_rekey_limit_size $var_rekey_limit_time" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_rekey_limit_size # promote to variable set_fact: var_rekey_limit_size: !!str @@ -279801,37 +279938,18 @@ fi - no_reboot_needed - sshd_rekey_limit - - - - - - - - - - - - Ensure SSH LoginGraceTime is configured - The LoginGraceTime parameter to the SSH server specifies the time allowed for successful authentication to -the SSH server. The longer the Grace period is the more open unauthenticated connections -can exist. Like other session controls in this session the Grace Period should be limited to -appropriate limits to ensure the service is available for needed access. - 2.2.6 - 5.2.19 - Setting the LoginGraceTime parameter to a low number will minimize the risk of successful -brute force attacks to the SSH server. It will also limit the number of concurrent -unauthenticated connections. - CCE-86551-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -var_sshd_set_login_grace_time='' +var_rekey_limit_size='' +var_rekey_limit_time='' + + if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*LoginGraceTime\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*RekeyLimit\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -279840,7 +279958,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "LoginGraceTime $var_sshd_set_login_grace_time" > "/etc/ssh/sshd_config" +printf '%s\n' "RekeyLimit $var_rekey_limit_size $var_rekey_limit_time" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -279849,6 +279967,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + + Ensure SSH LoginGraceTime is configured + The LoginGraceTime parameter to the SSH server specifies the time allowed for successful authentication to +the SSH server. The longer the Grace period is the more open unauthenticated connections +can exist. Like other session controls in this session the Grace Period should be limited to +appropriate limits to ensure the service is available for needed access. + 2.2.6 + 4.2.12 + Setting the LoginGraceTime parameter to a low number will minimize the risk of successful +brute force attacks to the SSH server. It will also limit the number of concurrent +unauthenticated connections. + CCE-86551-9 - name: XCCDF Value var_sshd_set_login_grace_time # promote to variable set_fact: var_sshd_set_login_grace_time: !!str @@ -279895,6 +280035,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_login_grace_time + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_login_grace_time='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LoginGraceTime\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LoginGraceTime $var_sshd_set_login_grace_time" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -279920,7 +280086,7 @@ To explicitly specify the log level in SSH, add or correct the following line in LogLevel INFO AC-17(a) CM-6(a) - 5.2.5 + 4.2.13 SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically not recommended other than strictly for debugging SSH communications since it provides so much data that it is difficult to identify important security information. INFO level is the @@ -279928,29 +280094,6 @@ basic level that only records login activity of SSH users. In many situations, s Response, it is important to determine when a particular user was active on a system. The logout record can eliminate those users who disconnected, which helps narrow the field. CCE-82282-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "LogLevel INFO" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set LogLevel to INFO block: @@ -279992,6 +280135,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_loglevel_info + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LogLevel INFO" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280019,7 +280185,7 @@ SSH, add or correct the following line in Req-2.2.4 2.2.6 SRG-OS-000032-GPOS-00013 - 5.2.5 + 4.2.13 SSH provides several logging levels with varying amounts of verbosity. DEBUG is specifically not recommended other than strictly for debugging SSH communications since it provides so much data that it is difficult to identify important security information. INFO or @@ -280028,29 +280194,6 @@ situations, such as Incident Response, it is important to determine when a parti on a system. The logout record can eliminate those users who disconnected, which helps narrow the field. CCE-82420-1 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "LogLevel VERBOSE" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Set SSH Daemon LogLevel to VERBOSE block: @@ -280095,6 +280238,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_loglevel_verbose + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*LogLevel\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "LogLevel VERBOSE" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280125,36 +280291,10 @@ to set MaxAUthTries edit /etc/ssh/sshd_config as follows: 1560 1561 2.2.6 - 5.2.16 + 4.2.15 Setting the MaxAuthTries parameter to a low number will minimize the risk of successful brute force attacks to the SSH server. CCE-83500-9 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -sshd_max_auth_tries_value='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*MaxAuthTries\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "MaxAuthTries $sshd_max_auth_tries_value" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value sshd_max_auth_tries_value # promote to variable set_fact: sshd_max_auth_tries_value: !!str @@ -280202,35 +280342,15 @@ fi - restrict_strategy - sshd_set_max_auth_tries - - - - - - - - - - - Set SSH MaxSessions limit - The MaxSessions parameter specifies the maximum number of open sessions permitted -from a given connection. To set MaxSessions edit -/etc/ssh/sshd_config as follows: MaxSessions - 2.2.6 - 5.2.18 - To protect a system from denial of service due to a large number of concurrent -sessions, use the rate limiting function of MaxSessions to protect availability -of sshd logins and prevent overwhelming the daemon. - CCE-83357-4 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then -var_sshd_max_sessions='' +sshd_max_auth_tries_value='' if [ -e "/etc/ssh/sshd_config" ] ; then - LC_ALL=C sed -i "/^\s*MaxSessions\s\+/Id" "/etc/ssh/sshd_config" + LC_ALL=C sed -i "/^\s*MaxAuthTries\s\+/Id" "/etc/ssh/sshd_config" else touch "/etc/ssh/sshd_config" fi @@ -280239,7 +280359,7 @@ sed -i -e '$a\' "/etc/ssh/sshd_config" cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" # Insert at the beginning of the file -printf '%s\n' "MaxSessions $var_sshd_max_sessions" > "/etc/ssh/sshd_config" +printf '%s\n' "MaxAuthTries $sshd_max_auth_tries_value" > "/etc/ssh/sshd_config" cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" # Clean up after ourselves. rm "/etc/ssh/sshd_config.bak" @@ -280248,6 +280368,26 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + + Set SSH MaxSessions limit + The MaxSessions parameter specifies the maximum number of open sessions permitted +from a given connection. To set MaxSessions edit +/etc/ssh/sshd_config as follows: MaxSessions + 2.2.6 + 4.2.16 + To protect a system from denial of service due to a large number of concurrent +sessions, use the rate limiting function of MaxSessions to protect availability +of sshd logins and prevent overwhelming the daemon. + CCE-83357-4 - name: XCCDF Value var_sshd_max_sessions # promote to variable set_fact: var_sshd_max_sessions: !!str @@ -280294,6 +280434,32 @@ fi - medium_severity - no_reboot_needed - sshd_set_max_sessions + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_max_sessions='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*MaxSessions\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "MaxSessions $var_sshd_max_sessions" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280316,37 +280482,11 @@ line in the CIS recommends a MaxStartups value of '10:30:60', or more restrictive where dictated by site policy. 2.2.6 - 5.2.17 + 4.2.17 To protect a system from denial of service due to a large number of pending authentication connection attempts, use the rate limiting function of MaxStartups to protect availability of sshd logins and prevent overwhelming the daemon. CCE-90718-8 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -var_sshd_set_maxstartups='' - - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*MaxStartups\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "MaxStartups $var_sshd_set_maxstartups" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: XCCDF Value var_sshd_set_maxstartups # promote to variable set_fact: var_sshd_set_maxstartups: !!str @@ -280393,6 +280533,32 @@ fi - no_reboot_needed - restrict_strategy - sshd_set_maxstartups + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +var_sshd_set_maxstartups='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*MaxStartups\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "MaxStartups $var_sshd_set_maxstartups" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -280595,6 +280761,7 @@ submits to this process. SRG-OS-000250-GPOS-00093 SRG-OS-000393-GPOS-00173 SRG-OS-000394-GPOS-00174 + 4.2.6 Unapproved mechanisms that are used for authentication to the cryptographic module are not verified and therefore cannot be relied upon to provide confidentiality or integrity, and system data may be compromised. @@ -280869,6 +281036,56 @@ SSH, add or correct the following line in the /etc/ssh/sshd_config CCE-80908-7 + - name: XCCDF Value var_sshd_priv_separation # promote to variable + set_fact: + var_sshd_priv_separation: !!str + tags: + - always + +- name: Enable Use of Privilege Separation + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*UsePrivilegeSeparation\s+ + line: UsePrivilegeSeparation {{ var_sshd_priv_separation }} + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-80908-7 + - NIST-800-171-3.1.12 + - NIST-800-53-AC-17(a) + - NIST-800-53-AC-6 + - NIST-800-53-CM-6(a) + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_use_priv_separation + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then @@ -280895,20 +281112,43 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - name: XCCDF Value var_sshd_priv_separation # promote to variable + + + + + + + + + + + Use Only Strong Key Exchange algorithms + Limit the Key Exchange to strong algorithms. +The following line in /etc/ssh/sshd_config demonstrates use +of those: +KexAlgorithms + Req-2.3 + 2.2.7 + 4.2.11 + Key exchange is any method in cryptography by which cryptographic keys are exchanged +between two parties, allowing use of a cryptographic algorithm. If the sender and receiver +wish to exchange encrypted messages, each must be equipped to encrypt messages to be +sent and decrypt messages received + CCE-86518-8 + - name: XCCDF Value sshd_strong_kex # promote to variable set_fact: - var_sshd_priv_separation: !!str + sshd_strong_kex: !!str tags: - always -- name: Enable Use of Privilege Separation +- name: Use Only Strong Key Exchange algorithms block: - name: Check for duplicate values lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ + regexp: (?i)^\s*KexAlgorithms\s+ state: absent check_mode: true changed_when: false @@ -280918,7 +281158,7 @@ fi lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ + regexp: (?i)^\s*KexAlgorithms\s+ state: absent when: dupes.found is defined and dupes.found > 1 @@ -280926,32 +281166,156 @@ fi lineinfile: path: /etc/ssh/sshd_config create: true - regexp: (?i)^\s*UsePrivilegeSeparation\s+ - line: UsePrivilegeSeparation {{ var_sshd_priv_separation }} + regexp: (?i)^\s*KexAlgorithms\s+ + line: KexAlgorithms {{ sshd_strong_kex }} state: present insertbefore: BOF validate: /usr/sbin/sshd -t -f %s when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] tags: - - CCE-80908-7 - - NIST-800-171-3.1.12 - - NIST-800-53-AC-17(a) - - NIST-800-53-AC-6 - - NIST-800-53-CM-6(a) + - CCE-86518-8 + - PCI-DSS-Req-2.3 + - PCI-DSSv4-2.2.7 - low_complexity - low_disruption - medium_severity - no_reboot_needed - restrict_strategy - - sshd_use_priv_separation + - sshd_use_strong_kex + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sshd_strong_kex='' + + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*KexAlgorithms\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "KexAlgorithms $sshd_strong_kex" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi - + - + - + + + + + Use Only Strong MACs + Limit the MACs to strong hash algorithms. +The following line in /etc/ssh/sshd_config demonstrates use +of those MACs: +MACs + 4.2.14 + MD5 and 96-bit MAC algorithms are considered weak and have been shown to increase +exploitability in SSH downgrade attacks. Weak algorithms continue to have a great deal of +attention as a weak spot that can be exploited with expanded computing power. An +attacker that breaks the algorithm could take advantage of a MiTM position to decrypt the +SSH tunnel and capture credentials and information + CCE-86504-8 + - name: XCCDF Value sshd_strong_macs # promote to variable + set_fact: + sshd_strong_macs: !!str + tags: + - always + +- name: Use Only Strong MACs + block: + + - name: Check for duplicate values + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + state: absent + check_mode: true + changed_when: false + register: dupes + + - name: Deduplicate values from /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + state: absent + when: dupes.found is defined and dupes.found > 1 + + - name: Insert correct line to /etc/ssh/sshd_config + lineinfile: + path: /etc/ssh/sshd_config + create: true + regexp: (?i)^\s*MACs\s+ + line: MACs {{ sshd_strong_macs }} + state: present + insertbefore: BOF + validate: /usr/sbin/sshd -t -f %s + when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"] + tags: + - CCE-86504-8 + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - restrict_strategy + - sshd_use_strong_macs + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +sshd_strong_macs='' + + +# Strip any search characters in the key arg so that the key can be replaced without +# adding any search characters to the config file. +stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^MACs") + +# shellcheck disable=SC2059 +printf -v formatted_output "%s %s" "$stripped_key" "$sshd_strong_macs" + +# If the key exists, change it. Otherwise, add it to the config_file. +# We search for the key string followed by a word boundary (matched by \>), +# so if we search for 'setting', 'setting2' won't match. +if LC_ALL=C grep -q -m 1 -i -e "^MACs\\>" "/etc/ssh/sshd_config"; then + escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output") + LC_ALL=C sed -i --follow-symlinks "s/^MACs\\>.*/$escaped_formatted_output/gi" "/etc/ssh/sshd_config" +else + if [[ -s "/etc/ssh/sshd_config" ]] && [[ -n "$(tail -c 1 -- "/etc/ssh/sshd_config" || true)" ]]; then + LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/ssh/sshd_config" + fi + cce="CCE-86504-8" + printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/ssh/sshd_config" >> "/etc/ssh/sshd_config" + printf '%s\n' "$formatted_output" >> "/etc/ssh/sshd_config" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi + + + + + + + + @@ -280973,37 +281337,6 @@ plaintext padding and initialization vectors in encryption algorithms, and high- entropy elliminates the possibility that the output of the random number generator used by SSH would be known to potential attackers. CCE-82462-3 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/sysconfig/sshd" ] ; then - - LC_ALL=C sed -i "/^\s*SSH_USE_STRONG_RNG\s*=\s*/d" "/etc/sysconfig/sshd" -else - touch "/etc/sysconfig/sshd" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/sysconfig/sshd" - -cp "/etc/sysconfig/sshd" "/etc/sysconfig/sshd.bak" -# Insert before the line matching the regex '^#\s*SSH_USE_STRONG_RNG'. -line_number="$(LC_ALL=C grep -n "^#\s*SSH_USE_STRONG_RNG" "/etc/sysconfig/sshd.bak" | LC_ALL=C sed 's/:.*//g')" -if [ -z "$line_number" ]; then - # There was no match of '^#\s*SSH_USE_STRONG_RNG', insert at - # the end of the file. - printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" -else - head -n "$(( line_number - 1 ))" "/etc/sysconfig/sshd.bak" > "/etc/sysconfig/sshd" - printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" - tail -n "+$(( line_number ))" "/etc/sysconfig/sshd.bak" >> "/etc/sysconfig/sshd" -fi -# Clean up after ourselves. -rm "/etc/sysconfig/sshd.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Setting unquoted shell-style assignment of 'SSH_USE_STRONG_RNG' to '32' in '/etc/sysconfig/sshd' block: @@ -281045,6 +281378,37 @@ fi - no_reboot_needed - restrict_strategy - sshd_use_strong_rng + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/sysconfig/sshd" ] ; then + + LC_ALL=C sed -i "/^\s*SSH_USE_STRONG_RNG\s*=\s*/d" "/etc/sysconfig/sshd" +else + touch "/etc/sysconfig/sshd" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/sysconfig/sshd" + +cp "/etc/sysconfig/sshd" "/etc/sysconfig/sshd.bak" +# Insert before the line matching the regex '^#\s*SSH_USE_STRONG_RNG'. +line_number="$(LC_ALL=C grep -n "^#\s*SSH_USE_STRONG_RNG" "/etc/sysconfig/sshd.bak" | LC_ALL=C sed 's/:.*//g')" +if [ -z "$line_number" ]; then + # There was no match of '^#\s*SSH_USE_STRONG_RNG', insert at + # the end of the file. + printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" +else + head -n "$(( line_number - 1 ))" "/etc/sysconfig/sshd.bak" > "/etc/sysconfig/sshd" + printf '%s\n' "SSH_USE_STRONG_RNG=32" >> "/etc/sysconfig/sshd" + tail -n "+$(( line_number ))" "/etc/sysconfig/sshd.bak" >> "/etc/sysconfig/sshd" +fi +# Clean up after ourselves. +rm "/etc/sysconfig/sshd.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281080,29 +281444,6 @@ loopback address and sets the hostname part of the DISPLAY CCE-84058-7 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -if [ -e "/etc/ssh/sshd_config" ] ; then - - LC_ALL=C sed -i "/^\s*X11UseLocalhost\s\+/Id" "/etc/ssh/sshd_config" -else - touch "/etc/ssh/sshd_config" -fi -# make sure file has newline at the end -sed -i -e '$a\' "/etc/ssh/sshd_config" - -cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" -# Insert at the beginning of the file -printf '%s\n' "X11UseLocalhost yes" > "/etc/ssh/sshd_config" -cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" -# Clean up after ourselves. -rm "/etc/ssh/sshd_config.bak" - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Prevent remote hosts from connecting to the proxy display block: @@ -281144,6 +281485,29 @@ fi - no_reboot_needed - restrict_strategy - sshd_x11_use_localhost + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +if [ -e "/etc/ssh/sshd_config" ] ; then + + LC_ALL=C sed -i "/^\s*X11UseLocalhost\s\+/Id" "/etc/ssh/sshd_config" +else + touch "/etc/ssh/sshd_config" +fi +# make sure file has newline at the end +sed -i -e '$a\' "/etc/ssh/sshd_config" + +cp "/etc/ssh/sshd_config" "/etc/ssh/sshd_config.bak" +# Insert at the beginning of the file +printf '%s\n' "X11UseLocalhost yes" > "/etc/ssh/sshd_config" +cat "/etc/ssh/sshd_config.bak" >> "/etc/ssh/sshd_config" +# Clean up after ourselves. +rm "/etc/ssh/sshd_config.bak" + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281222,33 +281586,6 @@ $ sudo yum install sssd-ipa sssd-ipa provides the IPA back end that the SSSD can utilize to fetch identity data from and authenticate against an IPA server. CCE-82994-5 - -package --add=sssd-ipa - - include install_sssd-ipa - -class install_sssd-ipa { - package { 'sssd-ipa': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -if ! rpm -q --quiet "sssd-ipa" ; then - yum install -y "sssd-ipa" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "sssd-ipa" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -281274,6 +281611,33 @@ version = "*" - medium_severity - no_reboot_needed - package_sssd-ipa_installed + + +[[packages]] +name = "sssd-ipa" +version = "*" + + include install_sssd-ipa + +class install_sssd-ipa { + package { 'sssd-ipa': + ensure => 'installed', + } +} + + +package --add=sssd-ipa + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +if ! rpm -q --quiet "sssd-ipa" ; then + yum install -y "sssd-ipa" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281339,33 +281703,6 @@ $ sudo yum install sssd PR.AC-7 CCE-82444-1 - -package --add=sssd - - include install_sssd - -class install_sssd { - package { 'sssd': - ensure => 'installed', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -if ! rpm -q --quiet "sssd" ; then - yum install -y "sssd" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[[packages]] -name = "sssd" -version = "*" - - name: Gather the package facts package_facts: manager: auto @@ -281393,6 +281730,33 @@ version = "*" - medium_severity - no_reboot_needed - package_sssd_installed + + +[[packages]] +name = "sssd" +version = "*" + + include install_sssd + +class install_sssd { + package { 'sssd': + ensure => 'installed', + } +} + + +package --add=sssd + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +if ! rpm -q --quiet "sssd" ; then + yum install -y "sssd" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281460,31 +281824,6 @@ The sssd service can be enabled with the following comman CCE-82440-9 - include enable_sssd - -class enable_sssd { - service {'sssd': - enable => true, - ensure => 'running', - } -} - - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -SYSTEMCTL_EXEC='/usr/bin/systemctl' -"$SYSTEMCTL_EXEC" unmask 'sssd.service' -"$SYSTEMCTL_EXEC" start 'sssd.service' -"$SYSTEMCTL_EXEC" enable 'sssd.service' - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - -[customizations.services] -enabled = ["sssd"] - - name: Gather the package facts package_facts: manager: auto @@ -281527,6 +281866,31 @@ enabled = ["sssd"] - medium_severity - no_reboot_needed - service_sssd_enabled + + +[customizations.services] +enabled = ["sssd"] + + include enable_sssd + +class enable_sssd { + service {'sssd': + enable => true, + ensure => 'running', + } +} + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +SYSTEMCTL_EXEC='/usr/bin/systemctl' +"$SYSTEMCTL_EXEC" unmask 'sssd.service' +"$SYSTEMCTL_EXEC" start 'sssd.service' +"$SYSTEMCTL_EXEC" enable 'sssd.service' + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281551,52 +281915,6 @@ multifactor solutions are checked via Online Certificate Status Protocol (OCSP). Ensuring that multifactor solutions certificates are checked via Online Certificate Status Protocol (OCSP) ensures the security of the system. CCE-86120-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common; then - -var_sssd_certificate_verification_digest_function='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -MAIN_CONF="/etc/sssd/conf.d/certificate_verification.conf" - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[sssd\]([^\n\[]*\n+)+?[[:space:]]*certificate_verification" "$f"; then - sed -i "s/certificate_verification[^(\n)]*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[sssd\]" "$f"; then - sed -i "/[[:space:]]*\[sssd\]/a certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[sssd]\ncertificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -281673,6 +281991,52 @@ fi - medium_severity - no_reboot_needed - sssd_certificate_verification + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common; then + +var_sssd_certificate_verification_digest_function='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +MAIN_CONF="/etc/sssd/conf.d/certificate_verification.conf" + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[sssd\]([^\n\[]*\n+)+?[[:space:]]*certificate_verification" "$f"; then + sed -i "s/certificate_verification[^(\n)]*/certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[sssd\]" "$f"; then + sed -i "/[[:space:]]*\[sssd\]/a certificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "$MAIN_CONF /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[sssd]\ncertificate_verification = ocsp_dgst = $var_sssd_certificate_verification_digest_function" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -281887,7 +282251,7 @@ include the "allow_missing_name" option, like in the following example: SRG-OS-000107-GPOS-00054 SRG-OS-000108-GPOS-00055 RHEL-08-020250 - SV-230372r627750_rule + SV-230372r942945_rule Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the @@ -281900,89 +282264,6 @@ as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. CCE-80909-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*pam_cert_auth" "$f"; then - sed -i "s/pam_cert_auth[^(\n)]*/pam_cert_auth = True/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[pam\]" "$f"; then - sed -i "/[[:space:]]*\[pam\]/a pam_cert_auth = True" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[pam]\npam_cert_auth = True" >> "$file" -fi - -umask $OLD_UMASK - - -if [ -f /usr/bin/authselect ]; then - if ! authselect check; then - echo " - authselect integrity check failed. Remediation aborted! - This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. - It is not recommended to manually edit the PAM files when authselect tool is available. - In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." - exit 1 - fi - authselect enable-feature with-smartcard - - authselect apply-changes -b -else - if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*' "/etc/pam.d/smartcard-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/smartcard-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"sufficient"' \2/' "/etc/pam.d/smartcard-auth" - else - echo 'auth '"sufficient"' pam_sss.so' >> "/etc/pam.d/smartcard-auth" - fi - fi - # Check the option - if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*\sallow_missing_name\b' "/etc/pam.d/smartcard-auth"; then - sed -i -E --follow-symlinks '/\s*auth\s+'"sufficient"'\s+pam_sss.so.*/ s/$/ allow_missing_name/' "/etc/pam.d/smartcard-auth" - fi - if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*' "/etc/pam.d/system-auth"; then - # Line matching group + control + module was not found. Check group + module. - if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then - # The control is updated only if one single line matches. - sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' \2/' "/etc/pam.d/system-auth" - else - echo 'auth '"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' pam_sss.so' >> "/etc/pam.d/system-auth" - fi - fi - # Check the option - if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*\stry_cert_auth\b' "/etc/pam.d/system-auth"; then - sed -i -E --follow-symlinks '/\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so.*/ s/$/ try_cert_auth/' "/etc/pam.d/system-auth" - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282335,6 +282616,89 @@ fi - medium_severity - no_reboot_needed - sssd_enable_smartcards + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*pam_cert_auth" "$f"; then + sed -i "s/pam_cert_auth[^(\n)]*/pam_cert_auth = True/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[pam\]" "$f"; then + sed -i "/[[:space:]]*\[pam\]/a pam_cert_auth = True" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[pam]\npam_cert_auth = True" >> "$file" +fi + +umask $OLD_UMASK + + +if [ -f /usr/bin/authselect ]; then + if ! authselect check; then + echo " + authselect integrity check failed. Remediation aborted! + This remediation could not be applied because an authselect profile was not selected or the selected profile is not intact. + It is not recommended to manually edit the PAM files when authselect tool is available. + In cases where the default authselect profile does not cover a specific demand, a custom authselect profile is recommended." + exit 1 + fi + authselect enable-feature with-smartcard + + authselect apply-changes -b +else + if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*' "/etc/pam.d/smartcard-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/smartcard-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"sufficient"' \2/' "/etc/pam.d/smartcard-auth" + else + echo 'auth '"sufficient"' pam_sss.so' >> "/etc/pam.d/smartcard-auth" + fi + fi + # Check the option + if ! grep -qP '^\s*auth\s+'"sufficient"'\s+pam_sss.so\s*.*\sallow_missing_name\b' "/etc/pam.d/smartcard-auth"; then + sed -i -E --follow-symlinks '/\s*auth\s+'"sufficient"'\s+pam_sss.so.*/ s/$/ allow_missing_name/' "/etc/pam.d/smartcard-auth" + fi + if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*' "/etc/pam.d/system-auth"; then + # Line matching group + control + module was not found. Check group + module. + if [ "$(grep -cP '^\s*auth\s+.*\s+pam_sss.so\s*' "/etc/pam.d/system-auth")" -eq 1 ]; then + # The control is updated only if one single line matches. + sed -i -E --follow-symlinks 's/^(\s*auth\s+).*(\bpam_sss.so.*)/\1'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' \2/' "/etc/pam.d/system-auth" + else + echo 'auth '"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"' pam_sss.so' >> "/etc/pam.d/system-auth" + fi + fi + # Check the option + if ! grep -qP '^\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so\s*.*\stry_cert_auth\b' "/etc/pam.d/system-auth"; then + sed -i -E --follow-symlinks '/\s*auth\s+'"\[success=done authinfo_unavail=ignore ignore=ignore default=die\]"'\s+pam_sss.so.*/ s/$/ try_cert_auth/' "/etc/pam.d/system-auth" + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282443,50 +282807,6 @@ memcache_timeout = CCE-80910-3 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_sssd_memcache_timeout='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[nss\]([^\n\[]*\n+)+?[[:space:]]*memcache_timeout" "$f"; then - sed -i "s/memcache_timeout[^(\n)]*/memcache_timeout = $var_sssd_memcache_timeout/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[nss\]" "$f"; then - sed -i "/[[:space:]]*\[nss\]/a memcache_timeout = $var_sssd_memcache_timeout" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[nss]\nmemcache_timeout = $var_sssd_memcache_timeout" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282578,6 +282898,50 @@ fi - no_reboot_needed - sssd_memcache_timeout - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_sssd_memcache_timeout='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[nss\]([^\n\[]*\n+)+?[[:space:]]*memcache_timeout" "$f"; then + sed -i "s/memcache_timeout[^(\n)]*/memcache_timeout = $var_sssd_memcache_timeout/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[nss\]" "$f"; then + sed -i "/[[:space:]]*\[nss\]/a memcache_timeout = $var_sssd_memcache_timeout" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[nss]\nmemcache_timeout = $var_sssd_memcache_timeout" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282657,52 +283021,11 @@ offline_credentials_expiration = 1 PR.AC-7 SRG-OS-000383-GPOS-00166 RHEL-08-020290 - SV-230376r854036_rule + SV-230376r942948_rule If cached authentication information is out-of-date, the validity of the authentication information may be questionable. CCE-82460-7 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*offline_credentials_expiration" "$f"; then - sed -i "s/offline_credentials_expiration[^(\n)]*/offline_credentials_expiration = 1/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[pam\]" "$f"; then - sed -i "/[[:space:]]*\[pam\]/a offline_credentials_expiration = 1" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[pam]\noffline_credentials_expiration = 1" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -282793,6 +283116,47 @@ fi - medium_severity - no_reboot_needed - sssd_offline_cred_expiration + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[pam\]([^\n\[]*\n+)+?[[:space:]]*offline_credentials_expiration" "$f"; then + sed -i "s/offline_credentials_expiration[^(\n)]*/offline_credentials_expiration = 1/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[pam\]" "$f"; then + sed -i "/[[:space:]]*\[pam\]/a offline_credentials_expiration = 1" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[pam]\noffline_credentials_expiration = 1" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -282925,50 +283289,6 @@ ssh_known_hosts_timeout = CCE-82442-5 - # Remediation is applicable only in certain platforms -if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then - -var_sssd_ssh_known_hosts_timeout='' - - -# sssd configuration files must be created with 600 permissions if they don't exist -# otherwise the sssd module fails to start -OLD_UMASK=$(umask) -umask u=rw,go= - -found=false - -# set value in all files if they contain section or key -for f in $(echo -n "/etc/sssd/sssd.conf"); do - if [ ! -e "$f" ]; then - continue - fi - - # find key in section and change value - if grep -qzosP "[[:space:]]*\[ssh\]([^\n\[]*\n+)+?[[:space:]]*ssh_known_hosts_timeout" "$f"; then - sed -i "s/ssh_known_hosts_timeout[^(\n)]*/ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout/" "$f" - found=true - - # find section and add key = value to it - elif grep -qs "[[:space:]]*\[ssh\]" "$f"; then - sed -i "/[[:space:]]*\[ssh\]/a ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" "$f" - found=true - fi -done - -# if section not in any file, append section with key = value to FIRST file in files parameter -if ! $found ; then - file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') - mkdir -p "$(dirname "$file")" - echo -e "[ssh]\nssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" >> "$file" -fi - -umask $OLD_UMASK - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283060,6 +283380,50 @@ fi - no_reboot_needed - sssd_ssh_known_hosts_timeout - unknown_strategy + + # Remediation is applicable only in certain platforms +if rpm --quiet -q sssd-common && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then + +var_sssd_ssh_known_hosts_timeout='' + + +# sssd configuration files must be created with 600 permissions if they don't exist +# otherwise the sssd module fails to start +OLD_UMASK=$(umask) +umask u=rw,go= + +found=false + +# set value in all files if they contain section or key +for f in $(echo -n "/etc/sssd/sssd.conf"); do + if [ ! -e "$f" ]; then + continue + fi + + # find key in section and change value + if grep -qzosP "[[:space:]]*\[ssh\]([^\n\[]*\n+)+?[[:space:]]*ssh_known_hosts_timeout" "$f"; then + sed -i "s/ssh_known_hosts_timeout[^(\n)]*/ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout/" "$f" + found=true + + # find section and add key = value to it + elif grep -qs "[[:space:]]*\[ssh\]" "$f"; then + sed -i "/[[:space:]]*\[ssh\]/a ssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" "$f" + found=true + fi +done + +# if section not in any file, append section with key = value to FIRST file in files parameter +if ! $found ; then + file=$(echo "/etc/sssd/sssd.conf" | cut -f1 -d ' ') + mkdir -p "$(dirname "$file")" + echo -e "[ssh]\nssh_known_hosts_timeout = $var_sssd_ssh_known_hosts_timeout" >> "$file" +fi + +umask $OLD_UMASK + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283092,6 +283456,7 @@ integrity of LDAP remote access sessions. By setting the ldap_tls_cacert option in /etc/sssd/sssd.conf to point to the path for the X.509 certificates used for peer authentication. ldap_tls_cacert /path/to/tls/ca.cert + A remediation is not provided for this rule as each system has unique requirements. CCI-001453 SC-12(3) CM-6(a) @@ -283131,40 +283496,6 @@ to verify the hash information while maintaining the confidentiality of the key used to generate the hash. CCE-82456-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then - -var_sssd_ldap_tls_ca_dir='' - - -SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_cacertdir' -AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' -DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" - -# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_tls_cacertdir in sssd.conf, if it exists, set to '$var_sssd_ldap_tls_ca_dir' -# if ldap_tls_cacertdir isn't here, add it -# if [domain/..] doesn't exist, add it here for default domain -if grep -qvzosP $AD_REGEX $SSSD_CONF; then - if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - - sed -i "s#ldap_tls_cacertdir[^(\n)]*#ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir#" $SSSD_CONF - elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" $SSSD_CONF - else - if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" >> $SSSD_CONF - else - echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 - fi - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283283,49 +283614,30 @@ fi - sssd_ldap_configure_tls_ca_dir - unknown_strategy - - - - - - - - - - Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server - Configure SSSD to demand a valid certificate from the server to -protect the integrity of LDAP remote access sessions by setting -the ldap_tls_reqcert option in /etc/sssd/sssd.conf -to demand. - CCI-001453 - SC-12(3) - CM-6(a) - SRG-OS-000250-GPOS-00093 - Without a valid certificate presented to the LDAP client backend, the identity of a -server can be forged compromising LDAP remote access sessions. - - CCE-84062-9 - # Remediation is applicable only in certain platforms + # Remediation is applicable only in certain platforms if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then +var_sssd_ldap_tls_ca_dir='' + + SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_reqcert' +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_cacertdir' AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" # Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_tls_reqcert in sssd.conf, if it exists, set to 'demand' -# if ldap_tls_reqcert isn't here, add it +# Try to find [domain/..] and ldap_tls_cacertdir in sssd.conf, if it exists, set to '$var_sssd_ldap_tls_ca_dir' +# if ldap_tls_cacertdir isn't here, add it # if [domain/..] doesn't exist, add it here for default domain if grep -qvzosP $AD_REGEX $SSSD_CONF; then if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - sed -i "s#ldap_tls_reqcert[^(\n)]*#ldap_tls_reqcert = demand#" $SSSD_CONF + sed -i "s#ldap_tls_cacertdir[^(\n)]*#ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir#" $SSSD_CONF elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_tls_reqcert = demand" $SSSD_CONF + sed -i "/$DOMAIN_REGEX/a ldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" $SSSD_CONF else if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_tls_reqcert = demand" >> $SSSD_CONF + echo -e "[domain/default]\nldap_tls_cacertdir = $var_sssd_ldap_tls_ca_dir" >> $SSSD_CONF else echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 fi @@ -283336,6 +283648,28 @@ else >&2 echo 'Remediation is not applicable, nothing was done' fi + + + + + + + + + + Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server + Configure SSSD to demand a valid certificate from the server to +protect the integrity of LDAP remote access sessions by setting +the ldap_tls_reqcert option in /etc/sssd/sssd.conf +to demand. + CCI-001453 + SC-12(3) + CM-6(a) + SRG-OS-000250-GPOS-00093 + Without a valid certificate presented to the LDAP client backend, the identity of a +server can be forged compromising LDAP remote access sessions. + + CCE-84062-9 - name: Gather the package facts package_facts: manager: auto @@ -283448,6 +283782,37 @@ fi - no_reboot_needed - sssd_ldap_configure_tls_reqcert - unknown_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then + +SSSD_CONF="/etc/sssd/sssd.conf" +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_tls_reqcert' +AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' +DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" + +# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. +# Try to find [domain/..] and ldap_tls_reqcert in sssd.conf, if it exists, set to 'demand' +# if ldap_tls_reqcert isn't here, add it +# if [domain/..] doesn't exist, add it here for default domain +if grep -qvzosP $AD_REGEX $SSSD_CONF; then + if grep -qzosP $LDAP_REGEX $SSSD_CONF; then + + sed -i "s#ldap_tls_reqcert[^(\n)]*#ldap_tls_reqcert = demand#" $SSSD_CONF + elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then + sed -i "/$DOMAIN_REGEX/a ldap_tls_reqcert = demand" $SSSD_CONF + else + if test -f "$SSSD_CONF"; then + echo -e "[domain/default]\nldap_tls_reqcert = demand" >> $SSSD_CONF + else + echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 + fi + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283565,37 +283930,6 @@ whether to use TLS or not. If not specified it will default to no. It should be set to start_tls rather than doing LDAP over SSL. CCE-82437-5 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then - -SSSD_CONF="/etc/sssd/sssd.conf" -LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_id_use_start_tls' -AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' -DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" - -# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. -# Try to find [domain/..] and ldap_id_use_start_tls in sssd.conf, if it exists, set to 'true' -# if ldap_id_use_start_tls isn't here, add it -# if [domain/..] doesn't exist, add it here for default domain -if grep -qvzosP $AD_REGEX $SSSD_CONF; then - if grep -qzosP $LDAP_REGEX $SSSD_CONF; then - - sed -i "s#ldap_id_use_start_tls[^(\n)]*#ldap_id_use_start_tls = true#" $SSSD_CONF - elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then - sed -i "/$DOMAIN_REGEX/a ldap_id_use_start_tls = true" $SSSD_CONF - else - if test -f "$SSSD_CONF"; then - echo -e "[domain/default]\nldap_id_use_start_tls = true" >> $SSSD_CONF - else - echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 - fi - fi -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -283713,6 +284047,37 @@ fi - no_reboot_needed - sssd_ldap_start_tls - unknown_strategy + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && rpm --quiet -q sssd-common; then + +SSSD_CONF="/etc/sssd/sssd.conf" +LDAP_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*ldap_id_use_start_tls' +AD_REGEX='[[:space:]]*\[domain\/[^]]*]([^(\n)]*(\n)+)+?[[:space:]]*id_provider[[:space:]]*=[[:space:]]*((?i)ad)[[:space:]]*$' +DOMAIN_REGEX="[[:space:]]*\[domain\/[^]]*]" + +# Check if id_provider is not set to ad (Active Directory) which makes start_tls not applicable, note the -v option to invert the grep. +# Try to find [domain/..] and ldap_id_use_start_tls in sssd.conf, if it exists, set to 'true' +# if ldap_id_use_start_tls isn't here, add it +# if [domain/..] doesn't exist, add it here for default domain +if grep -qvzosP $AD_REGEX $SSSD_CONF; then + if grep -qzosP $LDAP_REGEX $SSSD_CONF; then + + sed -i "s#ldap_id_use_start_tls[^(\n)]*#ldap_id_use_start_tls = true#" $SSSD_CONF + elif grep -qs $DOMAIN_REGEX $SSSD_CONF; then + sed -i "/$DOMAIN_REGEX/a ldap_id_use_start_tls = true" $SSSD_CONF + else + if test -f "$SSSD_CONF"; then + echo -e "[domain/default]\nldap_id_use_start_tls = true" >> $SSSD_CONF + else + echo "Config file '$SSSD_CONF' doesnt exist, not remediating, assuming non-applicability." >&2 + fi + fi +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -283744,8 +284109,23 @@ $ sudo yum install usbguard against rogue USB devices by implementing basic whitelisting/blacklisting capabilities based on USB device attributes. CCE-82959-8 - -package --add=usbguard + - name: Ensure usbguard is installed + package: + name: usbguard + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82959-8 + - DISA-STIG-RHEL-08-040139 + - NIST-800-53-CM-8(3) + - NIST-800-53-IA-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_usbguard_installed --- apiVersion: machineconfiguration.openshift.io/v1 @@ -283756,6 +284136,11 @@ spec: version: 3.1.0 extensions: - usbguard + + +[[packages]] +name = "usbguard" +version = "*" include install_usbguard @@ -283764,6 +284149,9 @@ class install_usbguard { ensure => 'installed', } } + + +package --add=usbguard # Remediation is applicable only in certain platforms if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then @@ -283775,29 +284163,6 @@ fi else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[[packages]] -name = "usbguard" -version = "*" - - - name: Ensure usbguard is installed - package: - name: usbguard - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82959-8 - - DISA-STIG-RHEL-08-040139 - - NIST-800-53-CM-8(3) - - NIST-800-53-IA-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_usbguard_installed @@ -283824,6 +284189,35 @@ The usbguard service can be enabled with the following co The usbguard service must be running in order to enforce the USB device authorization policy for all USB devices. CCE-82853-3 + - name: Enable service usbguard + block: + + - name: Gather the package facts + package_facts: + manager: auto + + - name: Enable service usbguard + systemd: + name: usbguard + enabled: 'yes' + state: started + masked: 'no' + when: + - '"usbguard" in ansible_facts.packages' + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82853-3 + - DISA-STIG-RHEL-08-040141 + - NIST-800-53-CM-8(3)(a) + - NIST-800-53-IA-3 + - enable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - service_usbguard_enabled + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -283838,6 +284232,10 @@ spec: units: - name: usbguard.service enabled: true + + +[customizations.services] +enabled = ["usbguard"] include enable_usbguard @@ -283859,39 +284257,6 @@ SYSTEMCTL_EXEC='/usr/bin/systemctl' else >&2 echo 'Remediation is not applicable, nothing was done' fi - - -[customizations.services] -enabled = ["usbguard"] - - - name: Enable service usbguard - block: - - - name: Gather the package facts - package_facts: - manager: auto - - - name: Enable service usbguard - systemd: - name: usbguard - enabled: 'yes' - state: started - masked: 'no' - when: - - '"usbguard" in ansible_facts.packages' - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82853-3 - - DISA-STIG-RHEL-08-040141 - - NIST-800-53-CM-8(3)(a) - - NIST-800-53-IA-3 - - enable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - service_usbguard_enabled @@ -283982,18 +284347,6 @@ to /etc/usbguard/rules.conf. Without allowing Human Interface Devices, it might not be possible to interact with the system. CCE-82274-2 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -# path of file with Usbguard rules -rulesfile="/etc/usbguard/rules.conf" - -echo "allow with-interface match-all { 03:*:* }" >> $rulesfile - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow HID devices lineinfile: path: /etc/usbguard/rules.conf @@ -284010,6 +284363,18 @@ fi - medium_severity - no_reboot_needed - usbguard_allow_hid + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +# path of file with Usbguard rules +rulesfile="/etc/usbguard/rules.conf" + +echo "allow with-interface match-all { 03:*:* }" >> $rulesfile + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284034,6 +284399,25 @@ to /etc/usbguard/rules.conf. to interact with the system. Without allowing hubs, it might not be possible to use any USB devices on the system. CCE-82368-2 + - name: Allow HID devices and hubs + lineinfile: + path: /etc/usbguard/rules.conf + create: true + line: allow with-interface match-all { 03:*:* 09:00:* } + state: present + when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", + "container"] and ansible_architecture != "s390x" ) + tags: + - CCE-82368-2 + - NIST-800-53-CM-8(3) + - NIST-800-53-IA-3 + - configure_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - usbguard_allow_hid_and_hub + --- apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig @@ -284060,25 +284444,6 @@ echo "allow with-interface match-all { 03:*:* 09:00:* }" >> /etc/usbguard/ else >&2 echo 'Remediation is not applicable, nothing was done' fi - - - name: Allow HID devices and hubs - lineinfile: - path: /etc/usbguard/rules.conf - create: true - line: allow with-interface match-all { 03:*:* 09:00:* } - state: present - when: ( ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", - "container"] and ansible_architecture != "s390x" ) - tags: - - CCE-82368-2 - - NIST-800-53-CM-8(3) - - NIST-800-53-IA-3 - - configure_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - usbguard_allow_hid_and_hub @@ -284099,15 +284464,6 @@ to /etc/usbguard/rules.conf. Without allowing hubs, it might not be possible to use any USB devices on the system. CCE-82273-4 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -echo "allow with-interface match-all { 09:00:* }" >> /etc/usbguard/rules.conf - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Allow hubs lineinfile: path: /etc/usbguard/rules.conf @@ -284124,6 +284480,15 @@ fi - medium_severity - no_reboot_needed - usbguard_allow_hub + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +echo "allow with-interface match-all { 09:00:* }" >> /etc/usbguard/rules.conf + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284149,36 +284514,6 @@ devices. The usbguard must be configured to allow connected USB devices to work properly, avoiding the system to become inaccessible. CCE-83774-0 - # Remediation is applicable only in certain platforms -if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then - -if rpm --quiet -q usbguard -then - USBGUARD_CONF=/etc/usbguard/rules.conf - if [ ! -f "$USBGUARD_CONF" ] || [ ! -s "$USBGUARD_CONF" ]; then - usbguard generate-policy > $USBGUARD_CONF - if [ ! -s "$USBGUARD_CONF" ]; then - # make sure OVAL check doesn't fail on systems where - # generate-policy doesn't find any USB devices (for - # example a system might not have a USB bus) - echo "# No USB devices found" > $USBGUARD_CONF - fi - # make sure it has correct permissions - chmod 600 $USBGUARD_CONF - - SYSTEMCTL_EXEC='/usr/bin/systemctl' - "$SYSTEMCTL_EXEC" unmask 'usbguard.service' - "$SYSTEMCTL_EXEC" restart 'usbguard.service' - "$SYSTEMCTL_EXEC" enable 'usbguard.service' - fi -else - echo "USBGuard is not installed. No remediation was applied!" -fi - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Gather the package facts package_facts: manager: auto @@ -284246,6 +284581,36 @@ fi - medium_severity - no_reboot_needed - usbguard_generate_policy + + # Remediation is applicable only in certain platforms +if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! grep -q s390x /proc/sys/kernel/osrelease ); then + +if rpm --quiet -q usbguard +then + USBGUARD_CONF=/etc/usbguard/rules.conf + if [ ! -f "$USBGUARD_CONF" ] || [ ! -s "$USBGUARD_CONF" ]; then + usbguard generate-policy > $USBGUARD_CONF + if [ ! -s "$USBGUARD_CONF" ]; then + # make sure OVAL check doesn't fail on systems where + # generate-policy doesn't find any USB devices (for + # example a system might not have a USB bus) + echo "# No USB devices found" > $USBGUARD_CONF + fi + # make sure it has correct permissions + chmod 600 $USBGUARD_CONF + + SYSTEMCTL_EXEC='/usr/bin/systemctl' + "$SYSTEMCTL_EXEC" unmask 'usbguard.service' + "$SYSTEMCTL_EXEC" restart 'usbguard.service' + "$SYSTEMCTL_EXEC" enable 'usbguard.service' + fi +else + echo "USBGuard is not installed. No remediation was applied!" +fi + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284317,8 +284682,21 @@ continuing installation. Unnecessary service packages must not be installed to decrease the attack surface of the system. X windows has a long history of security vulnerabilities and should not be installed unless approved and documented. CCE-82757-6 - -package --remove=xorg-x11-server-common + - name: Ensure xorg-x11-server-common is removed + package: + name: xorg-x11-server-common + state: absent + tags: + - CCE-82757-6 + - NIST-800-53-CM-6(a) + - NIST-800-53-CM-7(a) + - NIST-800-53-CM-7(b) + - disable_strategy + - low_complexity + - low_disruption + - medium_severity + - no_reboot_needed + - package_xorg-x11-server-common_removed include remove_xorg-x11-server-common @@ -284327,6 +284705,9 @@ class remove_xorg-x11-server-common { ensure => 'purged', } } + + +package --remove=xorg-x11-server-common # CAUTION: This remediation script will remove xorg-x11-server-common @@ -284340,22 +284721,6 @@ if rpm -q --quiet "xorg-x11-server-common" ; then yum remove -y "xorg-x11-server-common" fi - - - name: Ensure xorg-x11-server-common is removed - package: - name: xorg-x11-server-common - state: absent - tags: - - CCE-82757-6 - - NIST-800-53-CM-6(a) - - NIST-800-53-CM-7(a) - - NIST-800-53-CM-7(b) - - disable_strategy - - low_complexity - - low_disruption - - medium_severity - - no_reboot_needed - - package_xorg-x11-server-common_removed @@ -284393,6 +284758,25 @@ X11 graphic libraries are dependency of OpenStack Cinderlib storage provider. CCE-83411-9 + - name: Ensure xorg packages are removed + package: + name: + - xorg-x11-server-Xorg + - xorg-x11-server-common + - xorg-x11-server-utils + - xorg-x11-server-Xwayland + state: absent + tags: + - CCE-83411-9 + - DISA-STIG-RHEL-08-040320 + - NIST-800-53-CM-6(b) + - low_complexity + - low_disruption + - medium_severity + - reboot_required + - restrict_strategy + - xwindows_remove_packages + package --remove=xorg-x11-server-Xorg --remove=xorg-x11-server-common --remove=xorg-x11-server-utils --remove=xorg-x11-server-Xwayland @@ -284420,25 +284804,6 @@ if rpm -q --quiet "xorg-x11-server-Xwayland" ; then yum remove -y "xorg-x11-server-Xwayland" fi - - - name: Ensure xorg packages are removed - package: - name: - - xorg-x11-server-Xorg - - xorg-x11-server-common - - xorg-x11-server-utils - - xorg-x11-server-Xwayland - state: absent - tags: - - CCE-83411-9 - - DISA-STIG-RHEL-08-040320 - - NIST-800-53-CM-6(b) - - low_complexity - - low_disruption - - medium_severity - - reboot_required - - restrict_strategy - - xwindows_remove_packages @@ -284499,15 +284864,6 @@ long history of security vulnerabilities and should not be used unless approved and documented. CCE-83380-6 - # Remediation is applicable only in certain platforms -if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then - -systemctl set-default multi-user.target - -else - >&2 echo 'Remediation is not applicable, nothing was done' -fi - - name: Switch to multi-user runlevel file: src: /usr/lib/systemd/system/multi-user.target @@ -284527,6 +284883,15 @@ fi - reboot_required - restrict_strategy - xwindows_runlevel_target + + # Remediation is applicable only in certain platforms +if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then + +systemctl set-default multi-user.target + +else + >&2 echo 'Remediation is not applicable, nothing was done' +fi @@ -284658,13 +285023,13 @@ which the system will be deployed as closely as possible. - + OVALFileLinker from SCAP Security Guide ssg: [0, 1, 72], python: 3.10.12 5.11 - 2024-01-25T00:06:33 + 2024-01-26T00:06:41 @@ -285822,6 +286187,52 @@ which the system will be deployed as closely as possible. + + + Use Only Strong Key Exchange algorithms + + Red Hat Enterprise Linux 8 + + + + Limit the Key Exchange Algorithms to those which are FIPS-approved. + + + + + + + + + + + + + + + + Use Only Strong MACs + + Red Hat Enterprise Linux 8 + + + + Ensure only strong MAC algorithms are used + + + + + + + + + + + + + + + Certificate status checking in SSSD @@ -287348,6 +287759,20 @@ which the system will be deployed as closely as possible. + + + Ensure Authentication Required for Single User Mode + + Red Hat Enterprise Linux 8 + + + + Ensure root password is configured + + + + + Direct root Logins Not Allowed @@ -291259,6 +291684,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + AIDE should be configured to use the FIPS 140-2 cryptographic hashes. @@ -295965,6 +296391,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ is group owned by 0. @@ -296404,6 +296831,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ is owned by 0. @@ -296501,6 +296929,7 @@ which the system will be deployed as closely as possible. Red Hat Enterprise Linux 8 + This test makes sure that /etc/audit/, /etc/audit/rules.d/ has mode 0640. If the target file or directory has an extended ACL, then it will fail the mode check. @@ -312570,6 +312999,14 @@ which the system will be deployed as closely as possible. + + + + + + + + @@ -313273,6 +313710,9 @@ which the system will be deployed as closely as possible. + + + @@ -323240,6 +323680,22 @@ which the system will be deployed as closely as possible.^[ \t]*(?i)UsePrivilegeSeparation(?-i)[ \t]+(.+?)[ \t]*(?:$|#) 1 + + oval:ssg-var_sshd_config_kex:var:1 + + + /etc/ssh/sshd_config + ^[\s]*(?i)KexAlgorithms(?-i)[\s]+([\w,-@]+)+[\s]*(?:#.*)?$ + 1 + + + oval:ssg-var_sshd_config_strong_macs:var:1 + + + /etc/ssh/sshd_config + ^[\s]*(?i)MACs(?-i)[\s]+([\w,-@]+)+[\s]*(?:#.*)?$ + 1 + ^/etc/sssd/(sssd|conf\.d/.*)\.conf$ ^[\s]*\[sssd](?:[^\n\[]*\n+)+?[\s]*certificate_verification\s*=\s*ocsp_dgst\s*=\s*(\w+)$ @@ -323271,12 +323727,12 @@ which the system will be deployed as closely as possible.1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[pam](?:[^\n\[]*\n+)+?[\s]*offline_credentials_expiration[\s]*=[\s]*1\s*(?:#.*)?$ 1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*cache_credentials\s*=\s*(\w+)\s*(?:#.*)?$ 1 @@ -323296,12 +323752,12 @@ which the system will be deployed as closely as possible.1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[domain\/[^]]*]([^\n\[\]]*\n+)+?[\s]*ldap_tls_reqcert[ \t]*=[ \t]*((?i)demand)[ \t]*$ 1 - /etc/sssd/sssd.conf + ^\/etc\/sssd\/(sssd.conf|conf\.d\/.+\.conf)$ ^[\s]*\[domain\/[^]]*]([^\n\[\]]*\n+)+?[\s]*ldap_id_use_start_tls[ \t]*=[ \t]*((?i)true)[ \t]*$ 1 @@ -324132,6 +324588,11 @@ which the system will be deployed as closely as possible. 1 + + /etc/shadow + ^root:\$(y|[0-9].+)\$.*$ + 1 + /etc/securetty ^.*$ @@ -339631,6 +340092,12 @@ which the system will be deployed as closely as possible. + + + + + + @@ -345756,6 +346223,28 @@ which the system will be deployed as closely as possible. + + + + + + + + + + + + + + + + + + + + + + @@ -350299,7447 +350788,7460 @@ which the system will be deployed as closely as possible. - + build_shorthand.py from SCAP Security Guide ssg: 0.1.72 2.0 - 2024-01-25T00:06:33 + 2024-01-26T00:06:41 - - Disable Power Settings in GNOME3 + + Verify Permissions on cron.d - ocil:ssg-dconf_gnome_disable_power_settings_action:testaction:1 + ocil:ssg-file_permissions_cron_d_action:testaction:1 - - Disable the httpd_serve_cobbler_files SELinux Boolean + + Install dnf-automatic Package - ocil:ssg-sebool_httpd_serve_cobbler_files_action:testaction:1 + ocil:ssg-package_dnf-automatic_installed_action:testaction:1 - - Set SSH Client Alive Interval + + Configure auditing of successful permission changes - ocil:ssg-sshd_set_idle_timeout_action:testaction:1 + ocil:ssg-audit_perm_change_success_action:testaction:1 - - Enable the LDAP Client For Use in Authconfig + + Disable the mozilla_plugin_use_bluejeans SELinux Boolean - ocil:ssg-enable_ldap_client_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_bluejeans_action:testaction:1 - - Extend Audit Backlog Limit for the Audit Daemon in zIPL + + Disable the authlogin_radius SELinux Boolean - ocil:ssg-zipl_audit_backlog_limit_argument_action:testaction:1 + ocil:ssg-sebool_authlogin_radius_action:testaction:1 - - Disallow Configuration to Bypass Password Requirements for Privilege Escalation + + Verify nftables Service is Enabled - ocil:ssg-disallow_bypass_password_sudo_action:testaction:1 + ocil:ssg-service_nftables_enabled_action:testaction:1 - - Disable the puppetagent_manage_all_files SELinux Boolean + + Verify that System Executables Have Restrictive Permissions - ocil:ssg-sebool_puppetagent_manage_all_files_action:testaction:1 + ocil:ssg-file_permissions_binary_dirs_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - postqueue + + Add noexec Option to Removable Media Partitions - ocil:ssg-audit_rules_privileged_commands_postqueue_action:testaction:1 + ocil:ssg-mount_option_noexec_removable_partitions_action:testaction:1 - - Disable the httpd_verify_dns SELinux Boolean + + Configure the confidence in TPM for entropy - ocil:ssg-sebool_httpd_verify_dns_action:testaction:1 + ocil:ssg-grub2_rng_core_default_quality_argument_action:testaction:1 - - Force initialization of variables containing userspace addresses + + Disable the xguest_mount_media SELinux Boolean - ocil:ssg-kernel_config_gcc_plugin_structleak_action:testaction:1 + ocil:ssg-sebool_xguest_mount_media_action:testaction:1 - - Verify User Who Owns group File + + Install the Asset Configuration Compliance Module (ACCM) - ocil:ssg-file_owner_etc_group_action:testaction:1 + ocil:ssg-install_mcafee_hbss_accm_action:testaction:1 - - Disable the httpd_tmp_exec SELinux Boolean + + Uninstall talk Package - ocil:ssg-sebool_httpd_tmp_exec_action:testaction:1 + ocil:ssg-package_talk_removed_action:testaction:1 - - Uninstall gssproxy Package + + Disable the openvpn_run_unconfined SELinux Boolean - ocil:ssg-package_gssproxy_removed_action:testaction:1 + ocil:ssg-sebool_openvpn_run_unconfined_action:testaction:1 - - Install rng-tools Package + + Set SSH Client Alive Interval - ocil:ssg-package_rng-tools_installed_action:testaction:1 + ocil:ssg-sshd_set_idle_timeout_action:testaction:1 - - Verify Permissions on /var/log/messages File + + Enable Kernel Parameter to Ignore Bogus ICMP Error Responses on IPv4 Interfaces - ocil:ssg-file_permissions_var_log_messages_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_icmp_ignore_bogus_error_responses_action:testaction:1 - - Configure auditd Disk Full Action when Disk Space Is Full + + Enable checks on linked list manipulation - ocil:ssg-auditd_data_disk_full_action_action:testaction:1 + ocil:ssg-kernel_config_debug_list_action:testaction:1 - - Disable the domain_kernel_load_modules SELinux Boolean + + Ensure Users Cannot Change GNOME3 Screensaver Idle Activation - ocil:ssg-sebool_domain_kernel_load_modules_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_activation_locked_action:testaction:1 - - Disable the cluster_use_execmem SELinux Boolean + + Verify User Who Owns Backup passwd File - ocil:ssg-sebool_cluster_use_execmem_action:testaction:1 + ocil:ssg-file_owner_backup_etc_passwd_action:testaction:1 - - Specify module signing key to use + + Disable Kernel Image Loading - ocil:ssg-kernel_config_module_sig_key_action:testaction:1 + ocil:ssg-sysctl_kernel_kexec_load_disabled_action:testaction:1 - - Specify a Remote NTP Server + + Uninstall abrt-cli Package - ocil:ssg-chronyd_or_ntpd_specify_remote_server_action:testaction:1 + ocil:ssg-package_abrt-cli_removed_action:testaction:1 - - Restrict unprivileged access to the kernel syslog + + Disable the git_system_use_nfs SELinux Boolean - ocil:ssg-kernel_config_security_dmesg_restrict_action:testaction:1 + ocil:ssg-sebool_git_system_use_nfs_action:testaction:1 - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default + + Disable the xdm_sysadm_login SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_pinfo_action:testaction:1 + ocil:ssg-sebool_xdm_sysadm_login_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/shadow + + Record Unsuccessful Ownership Changes to Files - fchownat - ocil:ssg-no_legacy_plus_entries_etc_shadow_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchownat_action:testaction:1 - - IOMMU configuration directive + + Disallow magic SysRq key - ocil:ssg-grub2_enable_iommu_force_action:testaction:1 + ocil:ssg-sysctl_kernel_sysrq_action:testaction:1 - - Disable the rsync_export_all_ro SELinux Boolean + + Disable SSH Support for User Known Hosts - ocil:ssg-sebool_rsync_export_all_ro_action:testaction:1 + ocil:ssg-sshd_disable_user_known_hosts_action:testaction:1 - - Configure auditd admin_space_left Action on Low Disk Space + + Disable Cyrus SASL Authentication Daemon (saslauthd) - ocil:ssg-auditd_data_retention_admin_space_left_action_action:testaction:1 + ocil:ssg-service_saslauthd_disabled_action:testaction:1 - - Configure Multiple DNS Servers in /etc/resolv.conf + + Ensure Rsyslog Authenticates Off-Loaded Audit Records - ocil:ssg-network_configure_name_resolution_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdriverauthmode_action:testaction:1 - - Disable the virt_sandbox_use_netlink SELinux Boolean + + Disable the ftpd_connect_db SELinux Boolean - ocil:ssg-sebool_virt_sandbox_use_netlink_action:testaction:1 + ocil:ssg-sebool_ftpd_connect_db_action:testaction:1 - - Disable the httpd_can_network_connect_db SELinux Boolean + + Disable GDM Automatic Login - ocil:ssg-sebool_httpd_can_network_connect_db_action:testaction:1 + ocil:ssg-gnome_gdm_disable_automatic_login_action:testaction:1 - - Uninstall abrt-plugin-sosreport Package + + Disable Kernel iwlwifi Module - ocil:ssg-package_abrt-plugin-sosreport_removed_action:testaction:1 + ocil:ssg-kernel_module_iwlwifi_disabled_action:testaction:1 - - Ensure sudo passwd_timeout is appropriate - sudo passwd_timeout + + Set Password Minimum Length in login.defs - ocil:ssg-sudo_add_passwd_timeout_action:testaction:1 + ocil:ssg-accounts_password_minlen_login_defs_action:testaction:1 - - Disable SSH Root Login + + Ensure All Accounts on the System Have Unique Names - ocil:ssg-sshd_disable_root_login_action:testaction:1 + ocil:ssg-account_unique_name_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Unloading - create_module + + Configure the gluster_export_all_rw SELinux Boolean - ocil:ssg-audit_rules_kernel_module_loading_create_action:testaction:1 + ocil:ssg-sebool_gluster_export_all_rw_action:testaction:1 - - Disable CAN Support + + Enable use of Berkeley Packet Filter with seccomp - ocil:ssg-kernel_module_can_disabled_action:testaction:1 + ocil:ssg-kernel_config_seccomp_filter_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd + + Enable log_config_module For HTTPD Logging - ocil:ssg-audit_rules_etc_passwd_open_by_handle_at_action:testaction:1 + ocil:ssg-httpd_enable_log_config_action:testaction:1 - - Backup interactive scripts on the production web server are prohibited + + Verify Group Who Owns SSH Server config file - ocil:ssg-httpd_remove_backups_action:testaction:1 + ocil:ssg-file_groupowner_sshd_config_action:testaction:1 - - Disable the logwatch_can_network_connect_mail SELinux Boolean + + Add noexec Option to /var/tmp - ocil:ssg-sebool_logwatch_can_network_connect_mail_action:testaction:1 + ocil:ssg-mount_option_var_tmp_noexec_action:testaction:1 - - Install OpenSSH client software + + Disallow kernel profiling by unprivileged users - ocil:ssg-package_openssh-clients_installed_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_event_paranoid_action:testaction:1 - - Ensure SELinux is Not Disabled + + Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces - ocil:ssg-selinux_not_disabled_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_route_localnet_action:testaction:1 - - Disable the uvcvideo module + + Do not allow ACPI methods to be inserted/replaced at run time - ocil:ssg-kernel_module_uvcvideo_disabled_action:testaction:1 + ocil:ssg-kernel_config_acpi_custom_method_action:testaction:1 - - Disable rexec Service + + Configure SSSD LDAP Backend Client CA Certificate - ocil:ssg-service_rexec_disabled_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_ca_action:testaction:1 - - Enable Smartcards in SSSD + + Set PAM''s Password Hashing Algorithm - password-auth - ocil:ssg-sssd_enable_smartcards_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_passwordauth_action:testaction:1 - - Disable Kernel Parameter for Accepting Secure ICMP Redirects on all IPv4 Interfaces + + Configure auditing of unsuccessful file modifications - ocil:ssg-sysctl_net_ipv4_conf_all_secure_redirects_action:testaction:1 + ocil:ssg-audit_modify_failed_action:testaction:1 - - Assign Expiration Date to Temporary Accounts + + Verify Permissions on group File - ocil:ssg-account_temp_expire_date_action:testaction:1 + ocil:ssg-file_permissions_etc_group_action:testaction:1 - - Harden SSHD Crypto Policy + + Set Permissions on the /etc/httpd/conf/ Directory - ocil:ssg-harden_sshd_crypto_policy_action:testaction:1 + ocil:ssg-dir_perms_etc_httpd_conf_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchmodat + + Verify /boot/efi/EFI/redhat/user.cfg User Ownership - ocil:ssg-audit_rules_dac_modification_fchmodat_action:testaction:1 + ocil:ssg-file_owner_efi_user_cfg_action:testaction:1 - - Verify Permissions on /etc/cron.allow file + + Configure basic parameters of Audit system - ocil:ssg-file_permissions_cron_allow_action:testaction:1 + ocil:ssg-audit_basic_configuration_action:testaction:1 - - Disable the irssi_use_full_network SELinux Boolean + + Ensure All Accounts on the System Have Unique User IDs - ocil:ssg-sebool_irssi_use_full_network_action:testaction:1 + ocil:ssg-account_unique_id_action:testaction:1 - - Disable the httpd_run_stickshift SELinux Boolean + + Ensure All World-Writable Directories Are Group Owned by a System Account - ocil:ssg-sebool_httpd_run_stickshift_action:testaction:1 + ocil:ssg-dir_perms_world_writable_system_owned_group_action:testaction:1 - - Create Warning Banners for All FTP Users + + Install iptables Package - ocil:ssg-ftp_present_banner_action:testaction:1 + ocil:ssg-package_iptables_installed_action:testaction:1 - - Disable network management of chrony daemon + + Disable the antivirus_use_jit SELinux Boolean - ocil:ssg-chronyd_no_chronyc_network_action:testaction:1 + ocil:ssg-sebool_antivirus_use_jit_action:testaction:1 - - Verify permissions on System Login Banner + + Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config - ocil:ssg-file_permissions_etc_issue_action:testaction:1 + ocil:ssg-harden_sshd_macs_opensshserver_conf_crypto_policy_action:testaction:1 - - Configure a Sufficiently Large Partition for Audit Logs + + Disable the use_lpd_server SELinux Boolean - ocil:ssg-auditd_audispd_configure_sufficiently_large_partition_action:testaction:1 + ocil:ssg-sebool_use_lpd_server_action:testaction:1 - - Configure the root Account for Failed Password Attempts + + Install rng-tools Package - ocil:ssg-accounts_passwords_pam_faillock_deny_root_action:testaction:1 + ocil:ssg-package_rng-tools_installed_action:testaction:1 - - Disable the ssh_sysadm_login SELinux Boolean + + Enable SLUB/SLAB allocator poisoning in zIPL - ocil:ssg-sebool_ssh_sysadm_login_action:testaction:1 + ocil:ssg-zipl_slub_debug_argument_action:testaction:1 - - Disable the fcron_crond SELinux Boolean + + Explicit arguments in sudo specifications - ocil:ssg-sebool_fcron_crond_action:testaction:1 + ocil:ssg-sudoers_explicit_command_args_action:testaction:1 - - Disable graphical user interface + + Disable Portreserve (portreserve) - ocil:ssg-xwindows_remove_packages_action:testaction:1 + ocil:ssg-service_portreserve_disabled_action:testaction:1 - - Disable the tftp_home_dir SELinux Boolean + + Disable Kernel mac80211 Module - ocil:ssg-sebool_tftp_home_dir_action:testaction:1 + ocil:ssg-kernel_module_mac80211_disabled_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - lremovexattr + + Install the ntp service - ocil:ssg-audit_rules_unsuccessful_file_modification_lremovexattr_action:testaction:1 + ocil:ssg-package_ntp_installed_action:testaction:1 - - Disable Kernel Parameter for IP Forwarding on IPv4 Interfaces + + Authorize Human Interface Devices in USBGuard daemon - ocil:ssg-sysctl_net_ipv4_ip_forward_action:testaction:1 + ocil:ssg-usbguard_allow_hid_action:testaction:1 - - Set Kernel Parameter to Increase Local Port Range + + System Audit Logs Must Be Owned By Root - ocil:ssg-sysctl_net_ipv4_ip_local_port_range_action:testaction:1 + ocil:ssg-file_ownership_var_log_audit_stig_action:testaction:1 - - Enable the antivirus_can_scan_system SELinux Boolean + + Enable the selinuxuser_ping SELinux Boolean - ocil:ssg-sebool_antivirus_can_scan_system_action:testaction:1 + ocil:ssg-sebool_selinuxuser_ping_action:testaction:1 - - Add nodev Option to /var/tmp + + Ensure /tmp Located On Separate Partition - ocil:ssg-mount_option_var_tmp_nodev_action:testaction:1 + ocil:ssg-partition_for_tmp_action:testaction:1 - - Ensure the Default C Shell Umask is Set Correctly + + Ensure SELinux is Not Disabled - ocil:ssg-accounts_umask_etc_csh_cshrc_action:testaction:1 + ocil:ssg-selinux_not_disabled_action:testaction:1 - - Disable Accepting Router Advertisements on all IPv6 Interfaces by Default + + Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_trunc_write_action:testaction:1 - - Restrict Web Browser Use for Administrative Accounts + + Record Unsuccessful Access Attempts to Files - creat - ocil:ssg-no_root_webbrowsing_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_creat_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - fchownat + + Ensure sudo Ignores Commands In Current Dir - sudo ignore_dot - ocil:ssg-audit_rules_unsuccessful_file_modification_fchownat_action:testaction:1 + ocil:ssg-sudo_add_ignore_dot_action:testaction:1 - - Verify No netrc Files Exist + + Disable the httpd_use_gpg SELinux Boolean - ocil:ssg-no_netrc_files_action:testaction:1 + ocil:ssg-sebool_httpd_use_gpg_action:testaction:1 - - Install pam_pwquality Package + + Ensure No Daemons are Unconfined by SELinux - ocil:ssg-package_pam_pwquality_installed_action:testaction:1 + ocil:ssg-selinux_confinement_of_daemons_action:testaction:1 - - Kernel panic on oops + + Uninstall rsync Package - ocil:ssg-sysctl_kernel_panic_on_oops_action:testaction:1 + ocil:ssg-package_rsync_removed_action:testaction:1 - - Configure auditing of successful file modifications + + Disable SSH Support for Rhosts RSA Authentication - ocil:ssg-audit_modify_success_action:testaction:1 + ocil:ssg-sshd_disable_rhosts_rsa_action:testaction:1 - - Ensure All Groups on the System Have Unique Group Names + + Disable kernel support for MISC binaries - ocil:ssg-group_unique_name_action:testaction:1 + ocil:ssg-kernel_config_binfmt_misc_action:testaction:1 - - Verify permissions on System Login Banner for Remote Connections + + Uninstall talk-server Package - ocil:ssg-file_permissions_etc_issue_net_action:testaction:1 + ocil:ssg-package_talk-server_removed_action:testaction:1 - - Disable the LDT (local descriptor table) + + Disable All GNOME3 Thumbnailers - ocil:ssg-kernel_config_modify_ldt_syscall_action:testaction:1 + ocil:ssg-dconf_gnome_disable_thumbnailers_action:testaction:1 - - Uninstall abrt-plugin-logger Package + + Disable the virt_sandbox_use_all_caps SELinux Boolean - ocil:ssg-package_abrt-plugin-logger_removed_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_all_caps_action:testaction:1 - - Ensure zIPL bootmap is up to date + + Disable X11 Forwarding - ocil:ssg-zipl_bootmap_is_up_to_date_action:testaction:1 + ocil:ssg-sshd_disable_x11_forwarding_action:testaction:1 - - Record Successful Creation Attempts to Files - openat O_CREAT + + Disable the dhcpc_exec_iptables SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_openat_o_creat_action:testaction:1 + ocil:ssg-sebool_dhcpc_exec_iptables_action:testaction:1 - - Record Successful Creation Attempts to Files - openat O_TRUNC_WRITE + + Ensure System is Not Acting as a Network Sniffer - ocil:ssg-audit_rules_successful_file_modification_openat_o_trunc_write_action:testaction:1 + ocil:ssg-network_sniffer_disabled_action:testaction:1 - - Configure the polyinstantiation_enabled SELinux Boolean + + Verify Permissions on Backup passwd File - ocil:ssg-sebool_polyinstantiation_enabled_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_passwd_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Special Characters + + Enable PAM - ocil:ssg-accounts_password_pam_ocredit_action:testaction:1 + ocil:ssg-sshd_enable_pam_action:testaction:1 - - Disable the use_nfs_home_dirs SELinux Boolean + + Disable rsh Service - ocil:ssg-sebool_use_nfs_home_dirs_action:testaction:1 + ocil:ssg-service_rsh_disabled_action:testaction:1 - - Disable the rsync_client SELinux Boolean + + Disable the cups_execmem SELinux Boolean - ocil:ssg-sebool_rsync_client_action:testaction:1 + ocil:ssg-sebool_cups_execmem_action:testaction:1 - - Verify Group Who Owns shadow File + + Enable authselect - ocil:ssg-file_groupowner_etc_shadow_action:testaction:1 + ocil:ssg-enable_authselect_action:testaction:1 - - Configure audit according to OSPP requirements + + The operating system must restrict privilege elevation to authorized personnel - ocil:ssg-audit_rules_for_ospp_action:testaction:1 + ocil:ssg-sudo_restrict_privilege_elevation_to_authorized_action:testaction:1 - - Ensure only owner and members of group owner of /usr/bin/sudo can execute it + + Record Events that Modify the System's Discretionary Access Controls - umount - ocil:ssg-sudo_restrict_others_executable_permission_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_umount_action:testaction:1 - - Install the cron service + + Disable storing core dumps - ocil:ssg-package_cron_installed_action:testaction:1 + ocil:ssg-sysctl_kernel_core_pattern_action:testaction:1 - - Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces + + Disable x86 vsyscall emulation - ocil:ssg-sysctl_net_ipv4_conf_all_shared_media_action:testaction:1 + ocil:ssg-kernel_config_x86_vsyscall_emulation_action:testaction:1 - - Kernel panic timeout + + Disable Accepting ICMP Redirects for All IPv6 Interfaces - ocil:ssg-kernel_config_panic_timeout_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_redirects_action:testaction:1 - - Boot Loader Is Not Installed On Removeable Media + + Enable SSH Warning Banner - ocil:ssg-grub2_no_removeable_media_action:testaction:1 + ocil:ssg-sshd_enable_warning_banner_net_action:testaction:1 - - Add nosuid Option to /opt + + Disable Kernel Parameter for Accepting Secure ICMP Redirects on all IPv4 Interfaces - ocil:ssg-mount_option_opt_nosuid_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_secure_redirects_action:testaction:1 - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default + + Disable DHCP Client in ifcfg - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_action:testaction:1 + ocil:ssg-sysconfig_networking_bootproto_ifcfg_action:testaction:1 - - Disable the squid_connect_any SELinux Boolean + + Verify that audit tools Have Mode 0755 or less - ocil:ssg-sebool_squid_connect_any_action:testaction:1 + ocil:ssg-file_permissions_audit_binaries_action:testaction:1 - - Remove Rsh Trust Files + + Disable support for /proc/kkcore - ocil:ssg-no_rsh_trust_files_action:testaction:1 + ocil:ssg-kernel_config_proc_kcore_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading and Unloading + + Limit the Number of Concurrent Login Sessions Allowed Per User - ocil:ssg-audit_rules_kernel_module_loading_action:testaction:1 + ocil:ssg-accounts_max_concurrent_login_sessions_action:testaction:1 - - Harden slab freelist metadata + + Require modules to be validly signed - ocil:ssg-kernel_config_slab_freelist_hardened_action:testaction:1 + ocil:ssg-kernel_config_module_sig_force_action:testaction:1 - - Disable the httpd_use_sasl SELinux Boolean + + Force initialization of variables containing userspace addresses - ocil:ssg-sebool_httpd_use_sasl_action:testaction:1 + ocil:ssg-kernel_config_gcc_plugin_structleak_action:testaction:1 - - Configure SSSD LDAP Backend Client CA Certificate + + Disable the httpd_tmp_exec SELinux Boolean - ocil:ssg-sssd_ldap_configure_tls_ca_action:testaction:1 + ocil:ssg-sebool_httpd_tmp_exec_action:testaction:1 - - Ensure Rsyslog Authenticates Off-Loaded Audit Records + + Disable Automatic Bug Reporting Tool (abrtd) - ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdriverauthmode_action:testaction:1 + ocil:ssg-service_abrtd_disabled_action:testaction:1 - - Ensure gpgcheck Enabled for Repository Metadata + + Disable the nfsd_anon_write SELinux Boolean - ocil:ssg-ensure_gpgcheck_repo_metadata_action:testaction:1 + ocil:ssg-sebool_nfsd_anon_write_action:testaction:1 - - Disable Accepting Packets Routed Between Local Interfaces + + Configure SSH Server to Use FIPS 140-2 Validated Ciphers: opensshserver.config - ocil:ssg-sysctl_net_ipv4_conf_all_accept_local_action:testaction:1 + ocil:ssg-harden_sshd_ciphers_opensshserver_conf_crypto_policy_action:testaction:1 - - Record Successful Permission Changes to Files - lsetxattr + + Configure auditing of successful ownership changes - ocil:ssg-audit_rules_successful_file_modification_lsetxattr_action:testaction:1 + ocil:ssg-audit_owner_change_success_action:testaction:1 - - Disable the unprivuser_use_svirt SELinux Boolean + + Installation of a compiler on production web server is prohibited - ocil:ssg-sebool_unprivuser_use_svirt_action:testaction:1 + ocil:ssg-httpd_no_compilers_in_prod_action:testaction:1 - - Generate some entropy during boot and runtime + + Set Password Warning Age - ocil:ssg-kernel_config_gcc_plugin_latent_entropy_action:testaction:1 + ocil:ssg-accounts_password_warn_age_login_defs_action:testaction:1 - - Disable GNOME3 Automount Opening + + Use Only FIPS 140-2 Validated Ciphers - ocil:ssg-dconf_gnome_disable_automount_open_action:testaction:1 + ocil:ssg-sshd_use_approved_ciphers_action:testaction:1 - - Disable the use_samba_home_dirs SELinux Boolean + + Configure AIDE to Verify Access Control Lists (ACLs) - ocil:ssg-sebool_use_samba_home_dirs_action:testaction:1 + ocil:ssg-aide_verify_acls_action:testaction:1 - - Restrict Exposed Kernel Pointer Addresses Access + + Verify Group Who Owns cron.d - ocil:ssg-sysctl_kernel_kptr_restrict_action:testaction:1 + ocil:ssg-file_groupowner_cron_d_action:testaction:1 - - Disable the mpd_use_cifs SELinux Boolean + + Disable the secure_mode_policyload SELinux Boolean - ocil:ssg-sebool_mpd_use_cifs_action:testaction:1 + ocil:ssg-sebool_secure_mode_policyload_action:testaction:1 - - Require Credential Prompting for Remote Access in GNOME3 + + Enable the postfix_local_write_mail_spool SELinux Boolean - ocil:ssg-dconf_gnome_remote_access_credential_prompt_action:testaction:1 + ocil:ssg-sebool_postfix_local_write_mail_spool_action:testaction:1 - - Add noexec Option to /var + + Disable the sanlock_use_nfs SELinux Boolean - ocil:ssg-mount_option_var_noexec_action:testaction:1 + ocil:ssg-sebool_sanlock_use_nfs_action:testaction:1 - - Ensure users' .netrc Files are not group or world accessible + + Ensure PAM Displays Last Logon/Access Notification - ocil:ssg-accounts_users_netrc_file_permissions_action:testaction:1 + ocil:ssg-display_login_attempts_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - at + + Mount Remote Filesystems with noexec - ocil:ssg-audit_rules_privileged_commands_at_action:testaction:1 + ocil:ssg-mount_option_noexec_remote_filesystems_action:testaction:1 - - Ensure /srv Located On Separate Partition + + Ensure All SGID Executables Are Authorized - ocil:ssg-partition_for_srv_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_sgid_action:testaction:1 - - Configure Error Log Format + + Disable the samba_share_fusefs SELinux Boolean - ocil:ssg-httpd_configure_log_format_action:testaction:1 + ocil:ssg-sebool_samba_share_fusefs_action:testaction:1 - - Enable the login_console_enabled SELinux Boolean + + Audit Configuration Files Must Be Owned By Root - ocil:ssg-sebool_login_console_enabled_action:testaction:1 + ocil:ssg-file_ownership_audit_configuration_action:testaction:1 - - Add grpquota Option to /home + + Enable Randomized Layout of Virtual Address Space - ocil:ssg-mount_option_home_grpquota_action:testaction:1 + ocil:ssg-sysctl_kernel_randomize_va_space_action:testaction:1 - - Record Successful Creation Attempts to Files - open O_TRUNC_WRITE + + Install the Samba Common Package - ocil:ssg-audit_rules_successful_file_modification_open_o_trunc_write_action:testaction:1 + ocil:ssg-package_samba-common_installed_action:testaction:1 - - Verify No .forward Files Exist + + Ensure All Groups on the System Have Unique Group ID - ocil:ssg-no_forward_files_action:testaction:1 + ocil:ssg-group_unique_id_action:testaction:1 - - Disable Squid + + Ensure auditd Collects System Administrator Actions - ocil:ssg-service_squid_disabled_action:testaction:1 + ocil:ssg-audit_rules_sysadmin_actions_action:testaction:1 - - Verify Permissions on passwd File + + Disable Kerberos Authentication - ocil:ssg-file_permissions_etc_passwd_action:testaction:1 + ocil:ssg-sshd_disable_kerb_auth_action:testaction:1 - - Verify that Interactive Boot is Disabled + + Verify Group Who Owns Backup gshadow File - ocil:ssg-grub2_disable_interactive_boot_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_gshadow_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv6 Interfaces + + System Audit Logs Must Be Owned By Root - ocil:ssg-sysctl_net_ipv6_conf_all_accept_source_route_action:testaction:1 + ocil:ssg-file_ownership_var_log_audit_action:testaction:1 - - Set Interval For Counting Failed Password Attempts + + Disable the mcelog_client SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_interval_action:testaction:1 + ocil:ssg-sebool_mcelog_client_action:testaction:1 - - Remove the kernel mapping in user mode + + Ensure that /etc/cron.deny does not exist - ocil:ssg-kernel_config_page_table_isolation_action:testaction:1 + ocil:ssg-file_cron_deny_not_exist_action:testaction:1 - - Prevent Unrestricted Mail Relaying + + Configure auditing of successful file accesses - ocil:ssg-postfix_prevent_unrestricted_relay_action:testaction:1 + ocil:ssg-audit_access_success_action:testaction:1 - - Modify the System Login Banner for Remote Connections + + Ensure auditd Collects Information on the Use of Privileged Commands - passwd - ocil:ssg-banner_etc_issue_net_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_passwd_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - poweroff + + Verify User Who Owns passwd File - ocil:ssg-audit_privileged_commands_poweroff_action:testaction:1 + ocil:ssg-file_owner_etc_passwd_action:testaction:1 - - Configure the tmux Lock Command + + Disable the git_cgi_use_nfs SELinux Boolean - ocil:ssg-configure_tmux_lock_command_action:testaction:1 + ocil:ssg-sebool_git_cgi_use_nfs_action:testaction:1 - - System Audit Logs Must Be Owned By Root + + Disable the samba_export_all_ro SELinux Boolean - ocil:ssg-file_ownership_var_log_audit_stig_action:testaction:1 + ocil:ssg-sebool_samba_export_all_ro_action:testaction:1 - - Disable the httpd_dontaudit_search_dirs SELinux Boolean + + Verify Permissions on cron.monthly - ocil:ssg-sebool_httpd_dontaudit_search_dirs_action:testaction:1 + ocil:ssg-file_permissions_cron_monthly_action:testaction:1 - - Configure basic parameters of Audit system + + Configure The Number of Allowed Simultaneous Requests - ocil:ssg-audit_basic_configuration_action:testaction:1 + ocil:ssg-httpd_configure_max_keepalive_requests_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - lsetxattr + + Install iptables-services Package - ocil:ssg-audit_rules_unsuccessful_file_modification_lsetxattr_action:testaction:1 + ocil:ssg-package_iptables-services_installed_action:testaction:1 - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default + + Disable the httpd_use_cifs SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_defrtr_action:testaction:1 + ocil:ssg-sebool_httpd_use_cifs_action:testaction:1 - - Enable systemd-journald Service + + Record Events that Modify User/Group Information - /etc/security/opasswd - ocil:ssg-service_systemd-journald_enabled_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_opasswd_action:testaction:1 - - Record Attempts to perform maintenance activities + + Ensure PAM Enforces Password Requirements - Enforce for Local Accounts Only - ocil:ssg-audit_sudo_log_events_action:testaction:1 + ocil:ssg-accounts_password_pam_enforce_local_action:testaction:1 - - Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces + + Add nosuid Option to /srv - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_pinfo_action:testaction:1 + ocil:ssg-mount_option_srv_nosuid_action:testaction:1 - - Disable the httpd_run_ipa SELinux Boolean + + Disable rexec Service - ocil:ssg-sebool_httpd_run_ipa_action:testaction:1 + ocil:ssg-service_rexec_disabled_action:testaction:1 - - Install systemd-journal-remote Package + + Appropriate Action Must be Setup When the Internal Audit Event Queue is Full - ocil:ssg-package_systemd-journal-remote_installed_action:testaction:1 + ocil:ssg-auditd_overflow_action_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - open_by_handle_at O_TRUNC_WRITE + + Verify Permissions on SSH Server config file - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 + ocil:ssg-file_permissions_sshd_config_action:testaction:1 - - Install subscription-manager Package + + Disable debug-shell SystemD Service - ocil:ssg-package_subscription-manager_installed_action:testaction:1 + ocil:ssg-service_debug-shell_disabled_action:testaction:1 - - Ensure auditd Collects System Administrator Actions + + Record Successful Creation Attempts to Files - open O_TRUNC_WRITE - ocil:ssg-audit_rules_sysadmin_actions_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_o_trunc_write_action:testaction:1 - - Enable Dracut FIPS Module + + Ensure auditd Collects Information on Kernel Module Loading - init_module - ocil:ssg-enable_dracut_fips_module_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_init_action:testaction:1 - - Enable the Hardware RNG Entropy Gatherer Service + + Enable ExecShield via sysctl - ocil:ssg-service_rngd_enabled_action:testaction:1 + ocil:ssg-sysctl_kernel_exec_shield_action:testaction:1 - - Disable the virt_use_comm SELinux Boolean + + Verify that Shared Library Files Have Restrictive Permissions - ocil:ssg-sebool_virt_use_comm_action:testaction:1 + ocil:ssg-file_permissions_library_dirs_action:testaction:1 - - Disable the icecast_use_any_tcp_ports SELinux Boolean + + Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces - ocil:ssg-sebool_icecast_use_any_tcp_ports_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_forwarding_action:testaction:1 - - Disable the prosody_bind_http_port SELinux Boolean + + Disable the nagios_run_pnp4nagios SELinux Boolean - ocil:ssg-sebool_prosody_bind_http_port_action:testaction:1 + ocil:ssg-sebool_nagios_run_pnp4nagios_action:testaction:1 - - Install AIDE + + Configure the deny_execmem SELinux Boolean - ocil:ssg-package_aide_installed_action:testaction:1 + ocil:ssg-sebool_deny_execmem_action:testaction:1 - - Disable the virt_transition_userdomain SELinux Boolean + + Configure session renegotiation for SSH client - ocil:ssg-sebool_virt_transition_userdomain_action:testaction:1 + ocil:ssg-ssh_client_rekey_limit_action:testaction:1 - - Enable Kernel Parameter to Ignore Bogus ICMP Error Responses on IPv4 Interfaces + + Verify Group Who Owns passwd File - ocil:ssg-sysctl_net_ipv4_icmp_ignore_bogus_error_responses_action:testaction:1 + ocil:ssg-file_groupowner_etc_passwd_action:testaction:1 - - Disable the gitosis_can_sendmail SELinux Boolean + + Verify /boot/grub2/grub.cfg User Ownership - ocil:ssg-sebool_gitosis_can_sendmail_action:testaction:1 + ocil:ssg-file_owner_grub2_cfg_action:testaction:1 - - Record Any Attempts to Run semanage + + Disable Avahi Server Software - ocil:ssg-audit_rules_execution_semanage_action:testaction:1 + ocil:ssg-service_avahi-daemon_disabled_action:testaction:1 - - Configure auditing of unsuccessful ownership changes + + Install fapolicyd Package - ocil:ssg-audit_owner_change_failed_action:testaction:1 + ocil:ssg-package_fapolicyd_installed_action:testaction:1 - - Ensure Log Files Are Owned By Appropriate User + + Disable Modprobe Loading of USB Storage Driver - ocil:ssg-rsyslog_files_ownership_action:testaction:1 + ocil:ssg-kernel_module_usb-storage_disabled_action:testaction:1 - - Perform full reference count validation + + Specify a Remote NTP Server - ocil:ssg-kernel_config_refcount_full_action:testaction:1 + ocil:ssg-ntpd_specify_remote_server_action:testaction:1 - - Uninstall nfs-utils Package + + Disable IPv6 Addressing on All IPv6 Interfaces - ocil:ssg-package_nfs-utils_removed_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_disable_ipv6_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newgrp + + All Interactive Users Home Directories Must Exist - ocil:ssg-audit_rules_privileged_commands_newgrp_action:testaction:1 + ocil:ssg-accounts_user_interactive_home_directory_exists_action:testaction:1 - - Record Attempts to Alter Time Through clock_settime + + Verify User Who Owns /etc/cron.allow file - ocil:ssg-audit_rules_time_clock_settime_action:testaction:1 + ocil:ssg-file_owner_cron_allow_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - setxattr + + Set number of records to cause an explicit flush to audit logs - ocil:ssg-audit_rules_dac_modification_setxattr_action:testaction:1 + ocil:ssg-auditd_freq_action:testaction:1 - - Verify Owner on cron.hourly + + Use Only FIPS 140-2 Validated Key Exchange Algorithms - ocil:ssg-file_owner_cron_hourly_action:testaction:1 + ocil:ssg-sshd_use_approved_kex_ordered_stig_action:testaction:1 - - Ensure /dev/shm is configured + + Verify nftables Service is Disabled - ocil:ssg-partition_for_dev_shm_action:testaction:1 + ocil:ssg-service_nftables_disabled_action:testaction:1 - - Enable automatic signing of all modules + + Disable CAN Support - ocil:ssg-kernel_config_module_sig_all_action:testaction:1 + ocil:ssg-kernel_module_can_disabled_action:testaction:1 - - Disable the selinuxuser_mysql_connect_enabled SELinux Boolean + + Record Events that Modify the System's Discretionary Access Controls - setxattr - ocil:ssg-sebool_selinuxuser_mysql_connect_enabled_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_setxattr_action:testaction:1 - - Disable the xdm_bind_vnc_tcp_port SELinux Boolean + + Limit Password Reuse: system-auth - ocil:ssg-sebool_xdm_bind_vnc_tcp_port_action:testaction:1 + ocil:ssg-accounts_password_pam_pwhistory_remember_system_auth_action:testaction:1 - - Enable Yama support + + Disable the IPv6 protocol - ocil:ssg-kernel_config_security_yama_action:testaction:1 + ocil:ssg-kernel_config_ipv6_action:testaction:1 - - Ensure nss-tools is installed + + Disable the pppd_can_insmod SELinux Boolean - ocil:ssg-package_nss-tools_installed_action:testaction:1 + ocil:ssg-sebool_pppd_can_insmod_action:testaction:1 - - Disable the ftpd_anon_write SELinux Boolean + + All Interactive User Home Directories Must Have mode 0750 Or Less Permissive - ocil:ssg-sebool_ftpd_anon_write_action:testaction:1 + ocil:ssg-file_permissions_home_directories_action:testaction:1 - - Unmap kernel when running in userspace (aka KAISER) + + Enable syslog-ng Service - ocil:ssg-kernel_config_unmap_kernel_at_el0_action:testaction:1 + ocil:ssg-service_syslogng_enabled_action:testaction:1 - - Disable the logging_syslogd_run_nagios_plugins SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap - ocil:ssg-sebool_logging_syslogd_run_nagios_plugins_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newuidmap_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow + + Enable the domain_fd_use SELinux Boolean - ocil:ssg-audit_rules_etc_gshadow_open_by_handle_at_action:testaction:1 + ocil:ssg-sebool_domain_fd_use_action:testaction:1 - - Remove telnet Clients + + Disable storing core dump - ocil:ssg-package_telnet_removed_action:testaction:1 + ocil:ssg-coredump_disable_storage_action:testaction:1 - - Disable the mock_enable_homedirs SELinux Boolean + + Disable Bluetooth Kernel Module - ocil:ssg-sebool_mock_enable_homedirs_action:testaction:1 + ocil:ssg-kernel_module_bluetooth_disabled_action:testaction:1 - - Ensure that Users Path Contains Only Local Directories + + Public web server resources must not be shared with private assets - ocil:ssg-accounts_user_home_paths_only_action:testaction:1 + ocil:ssg-httpd_public_resources_not_shared_action:testaction:1 - - Explicit arguments in sudo specifications + + Disable the samba_enable_home_dirs SELinux Boolean - ocil:ssg-sudoers_explicit_command_args_action:testaction:1 + ocil:ssg-sebool_samba_enable_home_dirs_action:testaction:1 - - All Interactive Users Must Have A Home Directory Defined + + Disable Accepting ICMP Redirects for All IPv4 Interfaces - ocil:ssg-accounts_user_interactive_home_directory_defined_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_redirects_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - chage + + Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap - ocil:ssg-audit_rules_privileged_commands_chage_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newgidmap_action:testaction:1 - - Disable IA32 emulation + + Disable the httpd_serve_cobbler_files SELinux Boolean - ocil:ssg-kernel_config_ia32_emulation_action:testaction:1 + ocil:ssg-sebool_httpd_serve_cobbler_files_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - fchown + + Uninstall setroubleshoot-server Package - ocil:ssg-audit_rules_unsuccessful_file_modification_fchown_action:testaction:1 + ocil:ssg-package_setroubleshoot-server_removed_action:testaction:1 - - Disable the cobbler_use_cifs SELinux Boolean + + System Audit Directories Must Be Group Owned By Root - ocil:ssg-sebool_cobbler_use_cifs_action:testaction:1 + ocil:ssg-directory_group_ownership_var_log_audit_action:testaction:1 - - Verify Permissions on Backup group File + + Record Unsuccessful Ownership Changes to Files - chown - ocil:ssg-file_permissions_backup_etc_group_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_chown_action:testaction:1 - - Disable Network Router Discovery Daemon (rdisc) + + Disable the polipo_use_cifs SELinux Boolean - ocil:ssg-service_rdisc_disabled_action:testaction:1 + ocil:ssg-sebool_polipo_use_cifs_action:testaction:1 - - Limit Password Reuse: system-auth + + Install policycoreutils-python-utils package - ocil:ssg-accounts_password_pam_pwhistory_remember_system_auth_action:testaction:1 + ocil:ssg-package_policycoreutils-python-utils_installed_action:testaction:1 - - Disable the httpd_can_connect_mythtv SELinux Boolean + + Disable Quagga Service - ocil:ssg-sebool_httpd_can_connect_mythtv_action:testaction:1 + ocil:ssg-service_zebra_disabled_action:testaction:1 - - Disable legacy (BSD) PTY support + + Disable the glance_use_execmem SELinux Boolean - ocil:ssg-kernel_config_legacy_ptys_action:testaction:1 + ocil:ssg-sebool_glance_use_execmem_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg User Ownership + + Ensure Red Hat GPG Key Installed - ocil:ssg-file_owner_efi_grub2_cfg_action:testaction:1 + ocil:ssg-ensure_redhat_gpgkey_installed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - umount + + Harden OpenSSL Crypto Policy - ocil:ssg-audit_rules_privileged_commands_umount_action:testaction:1 + ocil:ssg-harden_openssl_crypto_policy_action:testaction:1 - - Disable the use_ecryptfs_home_dirs SELinux Boolean + + Configure Denying Router Solicitations on All IPv6 Interfaces By Default - ocil:ssg-sebool_use_ecryptfs_home_dirs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_router_solicitations_action:testaction:1 - - Configure auditd flush priority + + Ensure SELinux Not Disabled in /etc/default/grub - ocil:ssg-auditd_data_retention_flush_action:testaction:1 + ocil:ssg-grub2_enable_selinux_action:testaction:1 - - Ensure that Root's Path Does Not Include World or Group-Writable Directories + + Ensure /dev/shm is configured - ocil:ssg-accounts_root_path_dirs_no_write_action:testaction:1 + ocil:ssg-partition_for_dev_shm_action:testaction:1 - - Support session locking with tmux (not enforcing) + + Ensure all users last password change date is in the past - ocil:ssg-configure_bashrc_tmux_action:testaction:1 + ocil:ssg-accounts_password_last_change_is_in_past_action:testaction:1 - - Modify the System Login Banner + + Install vim Package - ocil:ssg-banner_etc_issue_action:testaction:1 + ocil:ssg-package_vim_installed_action:testaction:1 - - Ensure All User Initialization Files Have Mode 0740 Or Less Permissive + + Disable the authlogin_yubikey SELinux Boolean - ocil:ssg-file_permission_user_init_files_action:testaction:1 + ocil:ssg-sebool_authlogin_yubikey_action:testaction:1 - - Disable GNOME3 Automounting + + Ensure PAM Enforces Password Requirements - Minimum Uppercase Characters - ocil:ssg-dconf_gnome_disable_automount_action:testaction:1 + ocil:ssg-accounts_password_pam_ucredit_action:testaction:1 - - Configure auditd space_left on Low Disk Space + + Disable the selinuxuser_use_ssh_chroot SELinux Boolean - ocil:ssg-auditd_data_retention_space_left_action:testaction:1 + ocil:ssg-sebool_selinuxuser_use_ssh_chroot_action:testaction:1 - - Configure TLS for rsyslog remote logging + + Ensure Logrotate Runs Periodically - ocil:ssg-rsyslog_remote_tls_action:testaction:1 + ocil:ssg-ensure_logrotate_activated_action:testaction:1 - - Randomize slab freelist + + Configure the polyinstantiation_enabled SELinux Boolean - ocil:ssg-kernel_config_slab_freelist_random_action:testaction:1 + ocil:ssg-sebool_polyinstantiation_enabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - usermod + + Disable the CUPS Service - ocil:ssg-audit_rules_privileged_commands_usermod_action:testaction:1 + ocil:ssg-service_cups_disabled_action:testaction:1 - - Disable the httpd_setrlimit SELinux Boolean + + Configure System to Forward All Mail From Postmaster to The Root Account - ocil:ssg-sebool_httpd_setrlimit_action:testaction:1 + ocil:ssg-postfix_client_configure_mail_alias_postmaster_action:testaction:1 - - Disable named Service + + Disable the httpd_verify_dns SELinux Boolean - ocil:ssg-service_named_disabled_action:testaction:1 + ocil:ssg-sebool_httpd_verify_dns_action:testaction:1 - - Disable WIFI Network Connection Creation in GNOME3 + + Record Events that Modify the System's Discretionary Access Controls - lremovexattr - ocil:ssg-dconf_gnome_disable_wifi_create_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lremovexattr_action:testaction:1 - - Public web server resources must not be shared with private assets + + Disable the httpd_run_ipa SELinux Boolean - ocil:ssg-httpd_public_resources_not_shared_action:testaction:1 + ocil:ssg-sebool_httpd_run_ipa_action:testaction:1 - - Only the VDSM User Can Use sudo NOPASSWD + + Configure SELinux Policy - ocil:ssg-sudo_vdsm_nopasswd_action:testaction:1 + ocil:ssg-selinux_policytype_action:testaction:1 - - Only Authorized Local User Accounts Exist on Operating System + + Configure Backups of User Data - ocil:ssg-accounts_authorized_local_users_action:testaction:1 + ocil:ssg-configure_user_data_backups_action:testaction:1 - - Record attempts to alter time through adjtimex + + Set configuration for IPv6 loopback traffic - ocil:ssg-audit_rules_time_adjtimex_action:testaction:1 + ocil:ssg-set_ipv6_loopback_traffic_action:testaction:1 - - Uninstall httpd Package + + The Installed Operating System Is FIPS 140-2 Certified - ocil:ssg-package_httpd_removed_action:testaction:1 + ocil:ssg-installed_OS_is_FIPS_certified_action:testaction:1 - - Verify Permissions on cron.d + + Uninstall abrt-plugin-logger Package - ocil:ssg-file_permissions_cron_d_action:testaction:1 + ocil:ssg-package_abrt-plugin-logger_removed_action:testaction:1 - - Disable SSH TCP Forwarding + + Disable Network File System (nfs) - ocil:ssg-sshd_disable_tcp_forwarding_action:testaction:1 + ocil:ssg-service_nfs_disabled_action:testaction:1 - - Audit Tools Must Have a Mode of 0755 or Less Permissive + + Disable the httpd_can_network_memcache SELinux Boolean - ocil:ssg-file_audit_tools_permissions_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_memcache_action:testaction:1 - - Shutdown System When Auditing Failures Occur + + Disable the httpd_can_connect_zabbix SELinux Boolean - ocil:ssg-audit_rules_system_shutdown_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_zabbix_action:testaction:1 - - Disable rlogin Service + + Verify User Who Owns gshadow File - ocil:ssg-service_rlogin_disabled_action:testaction:1 + ocil:ssg-file_owner_etc_gshadow_action:testaction:1 - - Disable the cups_execmem SELinux Boolean + + Add hidepid Option to /proc - ocil:ssg-sebool_cups_execmem_action:testaction:1 + ocil:ssg-mount_option_proc_hidepid_action:testaction:1 - - Enable the secadm_exec_content SELinux Boolean + + Enable poison of pages after freeing - ocil:ssg-sebool_secadm_exec_content_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fsetxattr + + Verify Group Ownership on SSH Server Public *.pub Key Files - ocil:ssg-audit_rules_unsuccessful_file_modification_fsetxattr_action:testaction:1 + ocil:ssg-file_groupownership_sshd_pub_key_action:testaction:1 - - Set Interactive Session Timeout + + Ensure auditd Collects Information on the Use of Privileged Commands - ocil:ssg-accounts_tmout_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_action:testaction:1 - - Verify that System Executables Have Restrictive Permissions + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default - ocil:ssg-file_permissions_binary_dirs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_max_addresses_action:testaction:1 - - Install libcap-ng-utils Package + + Disable LDAP Server (slapd) - ocil:ssg-package_libcap-ng-utils_installed_action:testaction:1 + ocil:ssg-service_slapd_disabled_action:testaction:1 - - Disable the mozilla_plugin_use_bluejeans SELinux Boolean + + Set Lockout Time for Failed Password Attempts - ocil:ssg-sebool_mozilla_plugin_use_bluejeans_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_unlock_time_action:testaction:1 - - Disable the polipo_use_nfs SELinux Boolean + + Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces - ocil:ssg-sebool_polipo_use_nfs_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_rp_filter_action:testaction:1 - - Disable IPv6 Addressing on All IPv6 Interfaces + + Remove telnet Clients - ocil:ssg-sysctl_net_ipv6_conf_all_disable_ipv6_action:testaction:1 + ocil:ssg-package_telnet_removed_action:testaction:1 - - Disable the authlogin_yubikey SELinux Boolean + + Install audispd-plugins Package - ocil:ssg-sebool_authlogin_yubikey_action:testaction:1 + ocil:ssg-package_audispd-plugins_installed_action:testaction:1 - - Uninstall python3-abrt-addon Package + + Disable the postgresql_selinux_transmit_client_label SELinux Boolean - ocil:ssg-package_python3-abrt-addon_removed_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_transmit_client_label_action:testaction:1 - - Ensure SMEP is not disabled during boot + + Disable Full User Name on Splash Shield - ocil:ssg-grub2_nosmep_argument_absent_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_user_info_action:testaction:1 - - Disable the tmpreaper_use_samba SELinux Boolean + + Add nodev Option to /var - ocil:ssg-sebool_tmpreaper_use_samba_action:testaction:1 + ocil:ssg-mount_option_var_nodev_action:testaction:1 - - Install rear Package + + An SELinux Context must be configured for the pam_faillock.so records directory - ocil:ssg-package_rear_installed_action:testaction:1 + ocil:ssg-account_password_selinux_faillock_dir_action:testaction:1 - - Disable the httpd_manage_ipa SELinux Boolean + + Audit Configuration Files Must Be Owned By Group root - ocil:ssg-sebool_httpd_manage_ipa_action:testaction:1 + ocil:ssg-file_groupownership_audit_configuration_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf.modules.d/ + + Enable HTTPD System Logging - ocil:ssg-file_permissions_httpd_server_modules_files_action:testaction:1 + ocil:ssg-httpd_enable_system_logging_action:testaction:1 - - Ensure No Device Files are Unlabeled by SELinux + + Enforce pam_faillock for Local Accounts Only - ocil:ssg-selinux_all_devicefiles_labeled_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_enforce_local_action:testaction:1 - - Verify Owner on cron.daily + + Disable the polipo_session_users SELinux Boolean - ocil:ssg-file_owner_cron_daily_action:testaction:1 + ocil:ssg-sebool_polipo_session_users_action:testaction:1 - - Direct root Logins Not Allowed + + Verify Permissions on /var/log/messages File - ocil:ssg-no_direct_root_logins_action:testaction:1 + ocil:ssg-file_permissions_var_log_messages_action:testaction:1 - - Harden memory copies between kernel and userspace + + Disable the samba_share_nfs SELinux Boolean - ocil:ssg-kernel_config_hardened_usercopy_action:testaction:1 + ocil:ssg-sebool_samba_share_nfs_action:testaction:1 - - Disable the daemons_use_tty SELinux Boolean + + Verify /boot/efi/EFI/redhat/user.cfg Permissions - ocil:ssg-sebool_daemons_use_tty_action:testaction:1 + ocil:ssg-file_permissions_efi_user_cfg_action:testaction:1 - - Mount Remote Filesystems with noexec + + Ensure Users Cannot Change GNOME3 Screensaver Settings - ocil:ssg-mount_option_noexec_remote_filesystems_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_user_locks_action:testaction:1 - - Uninstall abrt-addon-kerneloops Package + + Record Attempts to Alter Time Through clock_settime - ocil:ssg-package_abrt-addon-kerneloops_removed_action:testaction:1 + ocil:ssg-audit_rules_time_clock_settime_action:testaction:1 - - Add nosuid Option to /var/log/audit + + Verify Permissions on /etc/audit/auditd.conf - ocil:ssg-mount_option_var_log_audit_nosuid_action:testaction:1 + ocil:ssg-file_permissions_etc_audit_auditd_action:testaction:1 - - Configure CA certificate for rsyslog remote logging + + Ensure the Default Umask is Set Correctly in login.defs - ocil:ssg-rsyslog_remote_tls_cacert_action:testaction:1 + ocil:ssg-accounts_umask_etc_login_defs_action:testaction:1 - - Disable All GNOME3 Thumbnailers + + Disable the sge_use_nfs SELinux Boolean - ocil:ssg-dconf_gnome_disable_thumbnailers_action:testaction:1 + ocil:ssg-sebool_sge_use_nfs_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg Permissions + + Disable the daemons_use_tcp_wrapper SELinux Boolean - ocil:ssg-file_permissions_efi_grub2_cfg_action:testaction:1 + ocil:ssg-sebool_daemons_use_tcp_wrapper_action:testaction:1 - - Uninstall abrt-addon-ccpp Package + + Enable page allocator poisoning in zIPL - ocil:ssg-package_abrt-addon-ccpp_removed_action:testaction:1 + ocil:ssg-zipl_page_poison_argument_action:testaction:1 - - Disable the ksmtuned_use_nfs SELinux Boolean + + Use Only Strong MACs - ocil:ssg-sebool_ksmtuned_use_nfs_action:testaction:1 + ocil:ssg-sshd_use_strong_macs_action:testaction:1 - - Verify Group Who Owns cron.daily + + Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv4 Interfaces - ocil:ssg-file_groupowner_cron_daily_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_accept_redirects_action:testaction:1 - - Ensure All Files Are Owned by a Group + + Lock Accounts After Failed Password Attempts - ocil:ssg-file_permissions_ungroupowned_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_deny_action:testaction:1 - - Verify Group Who Owns passwd File + + Perform general configuration of Audit for OSPP - ocil:ssg-file_groupowner_etc_passwd_action:testaction:1 + ocil:ssg-audit_ospp_general_action:testaction:1 - - Record Successful Access Attempts to Files - truncate + + Disable the haproxy_connect_any SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_truncate_action:testaction:1 + ocil:ssg-sebool_haproxy_connect_any_action:testaction:1 - - Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server + + Record Successful Permission Changes to Files - fchmodat - ocil:ssg-sssd_ldap_configure_tls_reqcert_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchmodat_action:testaction:1 - - Configure Accepting Router Advertisements on All IPv6 Interfaces + + Ensure remote access methods are monitored in Rsyslog - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_action:testaction:1 + ocil:ssg-rsyslog_remote_access_monitoring_action:testaction:1 - - Scan All Uploaded Content for Malicious Software + + Make the kernel text and rodata read-only - ocil:ssg-httpd_antivirus_scan_uploads_action:testaction:1 + ocil:ssg-kernel_config_strict_kernel_rwx_action:testaction:1 - - Disable the selinuxuser_udp_server SELinux Boolean + + Enable the nfs_export_all_rw SELinux Boolean - ocil:ssg-sebool_selinuxuser_udp_server_action:testaction:1 + ocil:ssg-sebool_nfs_export_all_rw_action:testaction:1 - - Configure SSSD's Memory Cache to Expire + + Install binutils Package - ocil:ssg-sssd_memcache_timeout_action:testaction:1 + ocil:ssg-package_binutils_installed_action:testaction:1 - - Ensure '/etc/system-fips' exists + + Verify that Interactive Boot is Disabled - ocil:ssg-etc_system_fips_exists_action:testaction:1 + ocil:ssg-grub2_disable_interactive_boot_action:testaction:1 - - Install iptables Package + + Ensure rsyncd service is disabled - ocil:ssg-package_iptables_installed_action:testaction:1 + ocil:ssg-service_rsyncd_disabled_action:testaction:1 - - Deactivate Wireless Network Interfaces + + Ensure invoking users password for privilege escalation when using sudo - ocil:ssg-wireless_disable_interfaces_action:testaction:1 + ocil:ssg-sudoers_validate_passwd_action:testaction:1 - - Configure auditd to use audispd's syslog plugin + + Add nodev Option to /var/log/audit - ocil:ssg-auditd_audispd_syslog_plugin_activated_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_nodev_action:testaction:1 - - Write Audit Logs to the Disk + + Remove Host-Based Authentication Files - ocil:ssg-auditd_write_logs_action:testaction:1 + ocil:ssg-no_host_based_files_action:testaction:1 - - Ensure /tmp Located On Separate Partition + + The Postfix package is installed - ocil:ssg-partition_for_tmp_action:testaction:1 + ocil:ssg-package_postfix_installed_action:testaction:1 - - Prevent non-Privileged Users from Modifying Network Interfaces using nmcli + + Uninstall cyrus-imapd Package - ocil:ssg-network_nmcli_permissions_action:testaction:1 + ocil:ssg-package_cyrus-imapd_removed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - open_by_handle_at + + Uninstall squid Package - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_action:testaction:1 + ocil:ssg-package_squid_removed_action:testaction:1 - - Disallow magic SysRq key + + Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv4 Interfaces - ocil:ssg-sysctl_kernel_sysrq_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_source_route_action:testaction:1 - - Install McAfee Virus Scanning Software + + Configure BIND to use System Crypto Policy - ocil:ssg-install_mcafee_antivirus_action:testaction:1 + ocil:ssg-configure_bind_crypto_policy_action:testaction:1 - - Enable the nscd_use_shm SELinux Boolean + + Verify Permissions on /etc/at.allow file - ocil:ssg-sebool_nscd_use_shm_action:testaction:1 + ocil:ssg-file_permissions_at_allow_action:testaction:1 - - Disable the mozilla_plugin_can_network_connect SELinux Boolean + + Force frequent session key renegotiation - ocil:ssg-sebool_mozilla_plugin_can_network_connect_action:testaction:1 + ocil:ssg-sshd_rekey_limit_action:testaction:1 - - Disable IPv6 Networking Support Automatic Loading + + Require Authentication for Emergency Systemd Target - ocil:ssg-kernel_module_ipv6_option_disabled_action:testaction:1 + ocil:ssg-require_emergency_target_auth_action:testaction:1 - - Disable User Administration in GNOME3 + + Enable the GNOME3 Login Smartcard Authentication - ocil:ssg-dconf_gnome_disable_user_admin_action:testaction:1 + ocil:ssg-dconf_gnome_enable_smartcard_auth_action:testaction:1 - - Install iptables-services Package + + Enable the user_exec_content SELinux Boolean - ocil:ssg-package_iptables-services_installed_action:testaction:1 + ocil:ssg-sebool_user_exec_content_action:testaction:1 - - Enable Randomized Layout of Virtual Address Space + + Restrict Exposed Kernel Pointer Addresses Access - ocil:ssg-sysctl_kernel_randomize_va_space_action:testaction:1 + ocil:ssg-sysctl_kernel_kptr_restrict_action:testaction:1 - - Configure dnf-automatic to Install Only Security Updates + + Verify Group Who Owns cron.hourly - ocil:ssg-dnf-automatic_security_updates_only_action:testaction:1 + ocil:ssg-file_groupowner_cron_hourly_action:testaction:1 - - Verify /boot/grub2/user.cfg Permissions + + Record Successful Permission Changes to Files - lremovexattr - ocil:ssg-file_permissions_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lremovexattr_action:testaction:1 - - Disable the sanlock_use_samba SELinux Boolean + + Ensure Users Re-Authenticate for Privilege Escalation - sudo - ocil:ssg-sebool_sanlock_use_samba_action:testaction:1 + ocil:ssg-sudo_require_authentication_action:testaction:1 - - Verify Group Who Owns Backup group File + + Verify Permissions on cron.daily - ocil:ssg-file_groupowner_backup_etc_group_action:testaction:1 + ocil:ssg-file_permissions_cron_daily_action:testaction:1 - - Uninstall abrt-cli Package + + Disable the tftp_anon_write SELinux Boolean - ocil:ssg-package_abrt-cli_removed_action:testaction:1 + ocil:ssg-sebool_tftp_anon_write_action:testaction:1 - - Specify UID and GID for Anonymous NFS Connections + + Disable the zebra_write_config SELinux Boolean - ocil:ssg-nfs_no_anonymous_action:testaction:1 + ocil:ssg-sebool_zebra_write_config_action:testaction:1 - - Disable the boinc_execmem SELinux Boolean + + Disable IPv6 Networking Support Automatic Loading - ocil:ssg-sebool_boinc_execmem_action:testaction:1 + ocil:ssg-kernel_module_ipv6_option_disabled_action:testaction:1 - - Enable TCP/IP syncookie support + + Disable the pppd_for_user SELinux Boolean - ocil:ssg-kernel_config_syn_cookies_action:testaction:1 + ocil:ssg-sebool_pppd_for_user_action:testaction:1 - - Disable the spamassassin_can_network SELinux Boolean + + Enable the mount_anyfile SELinux Boolean - ocil:ssg-sebool_spamassassin_can_network_action:testaction:1 + ocil:ssg-sebool_mount_anyfile_action:testaction:1 - - Ensure /var/tmp Located On Separate Partition + + Record Events that Modify User/Group Information via openat syscall - /etc/gshadow - ocil:ssg-partition_for_var_tmp_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_openat_action:testaction:1 - - All User Files and Directories In The Home Directory Must Have Mode 0750 Or Less Permissive + + Shutdown System When Auditing Failures Occur - ocil:ssg-accounts_users_home_files_permissions_action:testaction:1 + ocil:ssg-audit_rules_system_shutdown_action:testaction:1 - - Configure Backups of User Data + + Set Boot Loader Password in grub2 - ocil:ssg-configure_user_data_backups_action:testaction:1 + ocil:ssg-grub2_password_action:testaction:1 - - Force opensc To Use Defined Smart Card Driver + + Verify that All World-Writable Directories Have Sticky Bits Set - ocil:ssg-force_opensc_card_drivers_action:testaction:1 + ocil:ssg-dir_perms_world_writable_sticky_bits_action:testaction:1 - - Ensure /home Located On Separate Partition + + Randomize the address of the kernel image (KASLR) - ocil:ssg-partition_for_home_action:testaction:1 + ocil:ssg-kernel_config_randomize_base_action:testaction:1 - - Record Successful Access Attempts to Files - open + + Disable the tor_can_network_relay SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_open_action:testaction:1 + ocil:ssg-sebool_tor_can_network_relay_action:testaction:1 - - Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments + + Ensure auditd Collects Information on the Use of Privileged Commands - crontab - ocil:ssg-sysctl_net_ipv4_tcp_invalid_ratelimit_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_crontab_action:testaction:1 - - Record Events When Executables Are Run As Another User + + Verify Group Who Owns /etc/cron.allow file - ocil:ssg-audit_rules_suid_auid_privilege_function_action:testaction:1 + ocil:ssg-file_groupowner_cron_allow_action:testaction:1 - - Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean + + Ensure All Files Are Owned by a User - ocil:ssg-sebool_telepathy_tcp_connect_generic_network_ports_action:testaction:1 + ocil:ssg-no_files_unowned_by_user_action:testaction:1 - - Disable the httpd_can_network_relay SELinux Boolean + + Ensure Users Cannot Change GNOME3 Session Idle Settings - ocil:ssg-sebool_httpd_can_network_relay_action:testaction:1 + ocil:ssg-dconf_gnome_session_idle_user_locks_action:testaction:1 - - Add nodev Option to /var/log + + Disable the mcelog_foreground SELinux Boolean - ocil:ssg-mount_option_var_log_nodev_action:testaction:1 + ocil:ssg-sebool_mcelog_foreground_action:testaction:1 - - Disable X Windows Startup By Setting Default Target + + Disable the mplayer_execstack SELinux Boolean - ocil:ssg-xwindows_runlevel_target_action:testaction:1 + ocil:ssg-sebool_mplayer_execstack_action:testaction:1 - - Verify that Shared Library Directories Have Restrictive Permissions + + Add noexec Option to /boot - ocil:ssg-dir_permissions_library_dirs_action:testaction:1 + ocil:ssg-mount_option_boot_noexec_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lchown + + Configure Sending and Accepting Shared Media Redirects for All IPv4 Interfaces - ocil:ssg-audit_rules_dac_modification_lchown_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_shared_media_action:testaction:1 - - Verify User Who Owns Backup group File + + Disable the pcp_read_generic_logs SELinux Boolean - ocil:ssg-file_owner_backup_etc_group_action:testaction:1 + ocil:ssg-sebool_pcp_read_generic_logs_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - renameat + + Disable the selinuxuser_rw_noexattrfile SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_renameat_action:testaction:1 + ocil:ssg-sebool_selinuxuser_rw_noexattrfile_action:testaction:1 - - Disable debug-shell SystemD Service + + Disable the rsync_full_access SELinux Boolean - ocil:ssg-service_debug-shell_disabled_action:testaction:1 + ocil:ssg-sebool_rsync_full_access_action:testaction:1 - - Uninstall ypserv Package + + Install usbguard Package - ocil:ssg-package_ypserv_removed_action:testaction:1 + ocil:ssg-package_usbguard_installed_action:testaction:1 - - Disable the virt_sandbox_use_sys_admin SELinux Boolean + + Ensure Rsyslog Encrypts Off-Loaded Audit Records - ocil:ssg-sebool_virt_sandbox_use_sys_admin_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_defaultnetstreamdriver_action:testaction:1 - - Disable the xguest_mount_media SELinux Boolean + + Disable the ssh_chroot_rw_homedirs SELinux Boolean - ocil:ssg-sebool_xguest_mount_media_action:testaction:1 + ocil:ssg-sebool_ssh_chroot_rw_homedirs_action:testaction:1 - - Disable the polipo_use_cifs SELinux Boolean + + Enable Kernel Page-Table Isolation (KPTI) - ocil:ssg-sebool_polipo_use_cifs_action:testaction:1 + ocil:ssg-grub2_pti_argument_action:testaction:1 - - Verify that local System.map file (if exists) is readable only by root + + Record Events that Modify User/Group Information - ocil:ssg-file_permissions_systemmap_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_action:testaction:1 - - Enable the SSSD Service + + Direct root Logins Not Allowed - ocil:ssg-service_sssd_enabled_action:testaction:1 + ocil:ssg-no_direct_root_logins_action:testaction:1 - - Disable vsyscall emulation + + Restrict unprivileged access to the kernel syslog - ocil:ssg-kernel_config_legacy_vsyscall_emulate_action:testaction:1 + ocil:ssg-kernel_config_security_dmesg_restrict_action:testaction:1 - - Install Smart Card Packages For Multifactor Authentication + + Enable the unconfined_login SELinux Boolean - ocil:ssg-install_smartcard_packages_action:testaction:1 + ocil:ssg-sebool_unconfined_login_action:testaction:1 - - Disable the daemons_enable_cluster_mode SELinux Boolean + + Verify Group Who Owns /var/log Directory - ocil:ssg-sebool_daemons_enable_cluster_mode_action:testaction:1 + ocil:ssg-file_groupowner_var_log_action:testaction:1 - - Disable the antivirus_use_jit SELinux Boolean + + Disable the samba_export_all_rw SELinux Boolean - ocil:ssg-sebool_antivirus_use_jit_action:testaction:1 + ocil:ssg-sebool_samba_export_all_rw_action:testaction:1 - - Verify Permissions on crontab + + Enable the spamd_enable_home_dirs SELinux Boolean - ocil:ssg-file_permissions_crontab_action:testaction:1 + ocil:ssg-sebool_spamd_enable_home_dirs_action:testaction:1 - - Ensure Home Directories are Created for New Users + + Record Any Attempts to Run chcon - ocil:ssg-accounts_have_homedir_login_defs_action:testaction:1 + ocil:ssg-audit_rules_execution_chcon_action:testaction:1 - - Verify ownership of Message of the Day Banner + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-file_owner_etc_motd_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_rtr_pref_action:testaction:1 - - Mount Remote Filesystems with Kerberos Security + + Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces - ocil:ssg-mount_option_krb_sec_remote_filesystems_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_rfc1337_action:testaction:1 - - Do not allow usercopy whitelist violations to fallback to object size + + Assign Expiration Date to Emergency Accounts - ocil:ssg-kernel_config_hardened_usercopy_fallback_action:testaction:1 + ocil:ssg-account_emergency_expire_date_action:testaction:1 - - Disable the pcp_read_generic_logs SELinux Boolean + + Remove User Host-Based Authentication Files - ocil:ssg-sebool_pcp_read_generic_logs_action:testaction:1 + ocil:ssg-no_user_host_based_files_action:testaction:1 - - Configure L1 Terminal Fault mitigations + + Ensure auditd Collects System Administrator Actions - /etc/sudoers - ocil:ssg-grub2_l1tf_argument_action:testaction:1 + ocil:ssg-audit_rules_sudoers_action:testaction:1 - - Enable SLUB/SLAB allocator poisoning + + Disable the git_system_enable_homedirs SELinux Boolean - ocil:ssg-grub2_slub_debug_argument_action:testaction:1 + ocil:ssg-sebool_git_system_enable_homedirs_action:testaction:1 - - Install nftables Package + + Install crypto-policies package - ocil:ssg-package_nftables_installed_action:testaction:1 + ocil:ssg-package_crypto-policies_installed_action:testaction:1 - - Ensure SELinux State is Enforcing + + Ensure /usr Located On Separate Partition - ocil:ssg-selinux_state_action:testaction:1 + ocil:ssg-partition_for_usr_action:testaction:1 - - Verify Permissions on gshadow File + + Disable RDS Support - ocil:ssg-file_permissions_etc_gshadow_action:testaction:1 + ocil:ssg-kernel_module_rds_disabled_action:testaction:1 - - Disable the Automounter + + Set Default firewalld Zone for Incoming Packets - ocil:ssg-service_autofs_disabled_action:testaction:1 + ocil:ssg-set_firewalld_default_zone_action:testaction:1 - - Disable the ftpd_use_cifs SELinux Boolean + + Configure opensc Smart Card Drivers - ocil:ssg-sebool_ftpd_use_cifs_action:testaction:1 + ocil:ssg-configure_opensc_card_drivers_action:testaction:1 - - SSH server uses strong entropy to seed + + Disable the staff_use_svirt SELinux Boolean - ocil:ssg-sshd_use_strong_rng_action:testaction:1 + ocil:ssg-sebool_staff_use_svirt_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lsetxattr + + Disable the selinuxuser_udp_server SELinux Boolean - ocil:ssg-audit_rules_dac_modification_lsetxattr_action:testaction:1 + ocil:ssg-sebool_selinuxuser_udp_server_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchownat + + The Chrony package is installed - ocil:ssg-audit_rules_dac_modification_fchownat_action:testaction:1 + ocil:ssg-package_chrony_installed_action:testaction:1 - - Configure SELinux Policy + + Configure the Use of the pam_faillock.so Module in the /etc/pam.d/system-auth File. - ocil:ssg-selinux_policytype_action:testaction:1 + ocil:ssg-account_password_pam_faillock_system_auth_action:testaction:1 - - Force kernel panic on uncorrected MCEs + + Verify Group Ownership of Message of the Day Banner - ocil:ssg-grub2_mce_argument_action:testaction:1 + ocil:ssg-file_groupowner_etc_motd_action:testaction:1 - - Set the GNOME3 Login Number of Failures + + Verify Permissions on Backup group File - ocil:ssg-dconf_gnome_login_retries_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_group_action:testaction:1 - - Configure auditing of unsuccessful permission changes + + Configure Auto Configuration on All IPv6 Interfaces - ocil:ssg-audit_perm_change_failed_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_autoconf_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/shadow + + Disable the rsync_client SELinux Boolean - ocil:ssg-audit_rules_etc_shadow_openat_action:testaction:1 + ocil:ssg-sebool_rsync_client_action:testaction:1 - - Configure System to Forward All Mail through a specific host + + Harden memory copies between kernel and userspace - ocil:ssg-postfix_client_configure_relayhost_action:testaction:1 + ocil:ssg-kernel_config_hardened_usercopy_action:testaction:1 - - Set PAM''s Password Hashing Algorithm + + Disable the racoon_read_shadow SELinux Boolean - ocil:ssg-set_password_hashing_algorithm_systemauth_action:testaction:1 + ocil:ssg-sebool_racoon_read_shadow_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - rmdir + + Write Audit Logs to the Disk - ocil:ssg-audit_rules_file_deletion_events_rmdir_action:testaction:1 + ocil:ssg-auditd_write_logs_action:testaction:1 - - Install firewalld Package + + Set existing passwords a period of inactivity before they been locked - ocil:ssg-package_firewalld_installed_action:testaction:1 + ocil:ssg-accounts_set_post_pw_existing_action:testaction:1 - - Enable seccomp to safely compute untrusted bytecode - - ocil:ssg-kernel_config_seccomp_action:testaction:1 - - - - Disable the GNOME3 Login User List + + Record Events that Modify User/Group Information via open syscall - /etc/gshadow - ocil:ssg-dconf_gnome_disable_user_list_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_open_action:testaction:1 - - Disable the sanlock_use_fusefs SELinux Boolean + + Disable the httpd_ssi_exec SELinux Boolean - ocil:ssg-sebool_sanlock_use_fusefs_action:testaction:1 + ocil:ssg-sebool_httpd_ssi_exec_action:testaction:1 - - Disable SSH Support for User Known Hosts + + Only the VDSM User Can Use sudo NOPASSWD - ocil:ssg-sshd_disable_user_known_hosts_action:testaction:1 + ocil:ssg-sudo_vdsm_nopasswd_action:testaction:1 - - Disable the dhcpc_exec_iptables SELinux Boolean + + Disable Recovery Booting - ocil:ssg-sebool_dhcpc_exec_iptables_action:testaction:1 + ocil:ssg-grub2_disable_recovery_action:testaction:1 - - Disable ATM Support + + Prevent applications from mapping low portion of virtual memory - ocil:ssg-kernel_module_atm_disabled_action:testaction:1 + ocil:ssg-sysctl_vm_mmap_min_addr_action:testaction:1 - - Configure auditd max_log_file_action Upon Reaching Maximum Log Size + + Verify Group Who Owns Backup passwd File - ocil:ssg-auditd_data_retention_max_log_file_action_stig_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_passwd_action:testaction:1 - - Disable the cobbler_use_nfs SELinux Boolean + + Disable DHCP Service - ocil:ssg-sebool_cobbler_use_nfs_action:testaction:1 + ocil:ssg-service_dhcpd_disabled_action:testaction:1 - - Record Successful Access Attempts to Files - creat + + Ensure /var/log/audit Located On Separate Partition - ocil:ssg-audit_rules_successful_file_modification_creat_action:testaction:1 + ocil:ssg-partition_for_var_log_audit_action:testaction:1 - - Disable the git_system_use_nfs SELinux Boolean + + Create Warning Banners for All FTP Users - ocil:ssg-sebool_git_system_use_nfs_action:testaction:1 + ocil:ssg-ftp_present_banner_action:testaction:1 - - Verify Permissions on cron.daily + + Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv6 Interfaces - ocil:ssg-file_permissions_cron_daily_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_source_route_action:testaction:1 - - Disable the mpd_enable_homedirs SELinux Boolean + + Set the UEFI Boot Loader Admin Username to a Non-Default Value - ocil:ssg-sebool_mpd_enable_homedirs_action:testaction:1 + ocil:ssg-grub2_uefi_admin_username_action:testaction:1 - - Disable /dev/kmem virtual device support + + The web server password(s) must be entrusted to the SA or Web Manager - ocil:ssg-kernel_config_devkmem_action:testaction:1 + ocil:ssg-httpd_entrust_passwords_action:testaction:1 - - Enable Use of Strict Mode Checking + + Add nosuid Option to /var/log - ocil:ssg-sshd_enable_strictmodes_action:testaction:1 + ocil:ssg-mount_option_var_log_nosuid_action:testaction:1 - - Use Centralized and Automated Authentication + + Disable the httpd_dontaudit_search_dirs SELinux Boolean - ocil:ssg-account_use_centralized_automated_auth_action:testaction:1 + ocil:ssg-sebool_httpd_dontaudit_search_dirs_action:testaction:1 - - Configure AIDE to Verify Access Control Lists (ACLs) + + Disable the xguest_connect_network SELinux Boolean - ocil:ssg-aide_verify_acls_action:testaction:1 + ocil:ssg-sebool_xguest_connect_network_action:testaction:1 - - Verify nftables Service is Disabled + + HTTPD Log Files Must Be Owned By Root - ocil:ssg-service_nftables_disabled_action:testaction:1 + ocil:ssg-http_configure_log_file_ownership_action:testaction:1 - - Uninstall setroubleshoot-server Package + + Record Events that Modify User/Group Information via openat syscall - /etc/shadow - ocil:ssg-package_setroubleshoot-server_removed_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_openat_action:testaction:1 - - Enable checks on credential management + + Ensure Home Directories are Created for New Users - ocil:ssg-kernel_config_debug_credentials_action:testaction:1 + ocil:ssg-accounts_have_homedir_login_defs_action:testaction:1 - - Disable the samba_create_home_dirs SELinux Boolean + + Enable the fips_mode SELinux Boolean - ocil:ssg-sebool_samba_create_home_dirs_action:testaction:1 + ocil:ssg-sebool_fips_mode_action:testaction:1 - - Disable the mcelog_server SELinux Boolean + + Verify User Who Owns /var/log/messages File - ocil:ssg-sebool_mcelog_server_action:testaction:1 + ocil:ssg-file_owner_var_log_messages_action:testaction:1 - - Disable snmpd Service + + Disable the xserver_object_manager SELinux Boolean - ocil:ssg-service_snmpd_disabled_action:testaction:1 + ocil:ssg-sebool_xserver_object_manager_action:testaction:1 - - Configure the confidence in TPM for entropy + + Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces by Default - ocil:ssg-grub2_rng_core_default_quality_argument_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_send_redirects_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/passwd + + Only Authorized Local User Accounts Exist on Operating System - ocil:ssg-audit_rules_etc_passwd_open_action:testaction:1 + ocil:ssg-accounts_authorized_local_users_action:testaction:1 - - Limit Users' SSH Access + + Enable the LDAP Client For Use in Authconfig - ocil:ssg-sshd_limit_user_access_action:testaction:1 + ocil:ssg-enable_ldap_client_action:testaction:1 - - Enable the nfs_export_all_ro SELinux Boolean + + Disable the daemons_enable_cluster_mode SELinux Boolean - ocil:ssg-sebool_nfs_export_all_ro_action:testaction:1 + ocil:ssg-sebool_daemons_enable_cluster_mode_action:testaction:1 - - Configure AIDE to Use FIPS 140-2 for Validating Hashes + + Configure Error Log Format - ocil:ssg-aide_use_fips_hashes_action:testaction:1 + ocil:ssg-httpd_configure_log_format_action:testaction:1 - - Configure tmux to lock session after inactivity + + Ignore HTTPD .htaccess Files - ocil:ssg-configure_tmux_lock_after_time_action:testaction:1 + ocil:ssg-httpd_ignore_htaccess_files_action:testaction:1 - - Use zero for poisoning instead of debugging value + + Set SSH Daemon LogLevel to VERBOSE - ocil:ssg-kernel_config_page_poisoning_zero_action:testaction:1 + ocil:ssg-sshd_set_loglevel_verbose_action:testaction:1 - - Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces + + Record Attempts to Alter Time Through stime - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_defrtr_action:testaction:1 + ocil:ssg-audit_rules_time_stime_action:testaction:1 - - Verify User Who Owns gshadow File + + Disable the httpd_mod_auth_pam SELinux Boolean - ocil:ssg-file_owner_etc_gshadow_action:testaction:1 + ocil:ssg-sebool_httpd_mod_auth_pam_action:testaction:1 - - Enable the File Access Policy Service + + Harden SSHD Crypto Policy - ocil:ssg-service_fapolicyd_enabled_action:testaction:1 + ocil:ssg-harden_sshd_crypto_policy_action:testaction:1 - - Disallow kernel profiling by unprivileged users + + Install rear Package - ocil:ssg-sysctl_kernel_perf_event_paranoid_action:testaction:1 + ocil:ssg-package_rear_installed_action:testaction:1 - - Audit Tools Must Be Group-owned by Root + + Uninstall abrt-addon-kerneloops Package - ocil:ssg-file_audit_tools_group_ownership_action:testaction:1 + ocil:ssg-package_abrt-addon-kerneloops_removed_action:testaction:1 - - Disable the httpd_unified SELinux Boolean + + Disable the use_fusefs_home_dirs SELinux Boolean - ocil:ssg-sebool_httpd_unified_action:testaction:1 + ocil:ssg-sebool_use_fusefs_home_dirs_action:testaction:1 - - Enable Transport Layer Security (TLS) Encryption + + Enable checks on credential management - ocil:ssg-httpd_configure_tls_action:testaction:1 + ocil:ssg-kernel_config_debug_credentials_action:testaction:1 - - Ensure Insecure File Locking is Not Allowed + + Configure the Firewalld Ports - ocil:ssg-no_insecure_locks_exports_action:testaction:1 + ocil:ssg-configure_firewalld_ports_action:testaction:1 - - Disable the conman_can_network SELinux Boolean + + Ensure All Files Are Owned by a Group - ocil:ssg-sebool_conman_can_network_action:testaction:1 + ocil:ssg-file_permissions_ungroupowned_action:testaction:1 - - Record Successful Access Attempts to Files - ftruncate + + Disable Cockpit Management Server - ocil:ssg-audit_rules_successful_file_modification_ftruncate_action:testaction:1 + ocil:ssg-service_cockpit_disabled_action:testaction:1 - - Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server + + Install OpenSSH client software - ocil:ssg-rsyslog_nolisten_action:testaction:1 + ocil:ssg-package_openssh-clients_installed_action:testaction:1 - - Add noexec Option to /var/log/audit + + Ensure debug-shell service is not enabled in zIPL - ocil:ssg-mount_option_var_log_audit_noexec_action:testaction:1 + ocil:ssg-zipl_systemd_debug-shell_argument_absent_action:testaction:1 - - Verify Permissions on shadow File + + Disable the mozilla_plugin_can_network_connect SELinux Boolean - ocil:ssg-file_permissions_etc_shadow_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_can_network_connect_action:testaction:1 - - Ensure that System Accounts Do Not Run a Shell Upon Login + + Set the GNOME3 Login Warning Banner Text - ocil:ssg-no_shelllogin_for_systemaccounts_action:testaction:1 + ocil:ssg-dconf_gnome_login_banner_text_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd + + Enable Kernel Paremeter to Log Martian Packets on all IPv4 Interfaces by Default - ocil:ssg-audit_rules_privileged_commands_gpasswd_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_log_martians_action:testaction:1 - - Disable the httpd_sys_script_anon_write SELinux Boolean + + Sign kernel modules with SHA-512 - ocil:ssg-sebool_httpd_sys_script_anon_write_action:testaction:1 + ocil:ssg-kernel_config_module_sig_sha512_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Length + + Uninstall Automatic Bug Reporting Tool (abrt) - ocil:ssg-accounts_password_pam_minlen_action:testaction:1 + ocil:ssg-package_abrt_removed_action:testaction:1 - - Configure kernel to trust the CPU random number generator + + Record Successful Ownership Changes to Files - lchown - ocil:ssg-grub2_kernel_trust_cpu_rng_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lchown_action:testaction:1 - - Disable SSH Server If Possible + + Configure auditd space_left Action on Low Disk Space - ocil:ssg-service_sshd_disabled_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_action_action:testaction:1 - - Record Any Attempts to Run seunshare + + Set Permissions on All Configuration Files Inside /etc/httpd/conf.d/ - ocil:ssg-audit_rules_execution_seunshare_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_conf_d_files_action:testaction:1 - - Enable poison without sanity check + + Require Encryption for Remote Access in GNOME3 - ocil:ssg-kernel_config_page_poisoning_no_sanity_action:testaction:1 + ocil:ssg-dconf_gnome_remote_access_encryption_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - lastlog + + Enable Kernel Parameter to Use TCP Syncookies on Network Interfaces - ocil:ssg-audit_rules_login_events_lastlog_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_syncookies_action:testaction:1 - - Configure the deny_execmem SELinux Boolean + + Verify Permissions on SSH Server Public *.pub Key Files - ocil:ssg-sebool_deny_execmem_action:testaction:1 + ocil:ssg-file_permissions_sshd_pub_key_action:testaction:1 - - Verify Permissions on cron.weekly + + Configure dnf-automatic to Install Only Security Updates - ocil:ssg-file_permissions_cron_weekly_action:testaction:1 + ocil:ssg-dnf-automatic_security_updates_only_action:testaction:1 - - Set the UEFI Boot Loader Admin Username to a Non-Default Value + + Disable the saslauthd_read_shadow SELinux Boolean - ocil:ssg-grub2_uefi_admin_username_action:testaction:1 + ocil:ssg-sebool_saslauthd_read_shadow_action:testaction:1 - - Enable the selinuxuser_ping SELinux Boolean + + Disable the boinc_execmem SELinux Boolean - ocil:ssg-sebool_selinuxuser_ping_action:testaction:1 + ocil:ssg-sebool_boinc_execmem_action:testaction:1 - - Disable Full User Name on Splash Shield + + Disable the mozilla_plugin_use_gps SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_user_info_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_gps_action:testaction:1 - - Disable the httpd_can_connect_ldap SELinux Boolean + + Certificate status checking in SSSD - ocil:ssg-sebool_httpd_can_connect_ldap_action:testaction:1 + ocil:ssg-sssd_certificate_verification_action:testaction:1 - - Prevent user from disabling the screen lock + + Uninstall rsh Package - ocil:ssg-no_tmux_in_shells_action:testaction:1 + ocil:ssg-package_rsh_removed_action:testaction:1 - - Set LogLevel to INFO + + Disable Access to Network bpf() Syscall From Unprivileged Processes - ocil:ssg-sshd_set_loglevel_info_action:testaction:1 + ocil:ssg-sysctl_kernel_unprivileged_bpf_disabled_action:testaction:1 - - Disable the neutron_can_network SELinux Boolean + + Install nftables Package - ocil:ssg-sebool_neutron_can_network_action:testaction:1 + ocil:ssg-package_nftables_installed_action:testaction:1 - - Configure Sending and Accepting Shared Media Redirects by Default + + Kernel panic on oops - ocil:ssg-sysctl_net_ipv4_conf_default_shared_media_action:testaction:1 + ocil:ssg-sysctl_kernel_panic_on_oops_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - su + + Record Unsuccessful Access Attempts to Files - ftruncate - ocil:ssg-audit_rules_privileged_commands_su_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_ftruncate_action:testaction:1 - - Ensure that User Home Directories are not Group-Writable or World-Readable + + Set SSH Client Alive Count Max to zero - ocil:ssg-file_permissions_home_dirs_action:testaction:1 + ocil:ssg-sshd_set_keepalive_0_action:testaction:1 - - Ensure a Table Exists for Nftables + + Disable the guest_exec_content SELinux Boolean - ocil:ssg-set_nftables_table_action:testaction:1 + ocil:ssg-sebool_guest_exec_content_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - umount2 + + Install libreswan Package - ocil:ssg-audit_rules_dac_modification_umount2_action:testaction:1 + ocil:ssg-package_libreswan_installed_action:testaction:1 - - Disable the privoxy_connect_any SELinux Boolean + + Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sebool_privoxy_connect_any_action:testaction:1 + ocil:ssg-sebool_polipo_session_bind_all_unreserved_ports_action:testaction:1 - - The Installed Operating System Is FIPS 140-2 Certified + + Enable cron Service - ocil:ssg-installed_OS_is_FIPS_certified_action:testaction:1 + ocil:ssg-service_crond_enabled_action:testaction:1 - - Verify firewalld Enabled + + Uninstall openldap-servers Package - ocil:ssg-service_firewalld_enabled_action:testaction:1 + ocil:ssg-package_openldap-servers_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newuidmap + + Record Any Attempts to Run setfacl - ocil:ssg-audit_rules_privileged_commands_newuidmap_action:testaction:1 + ocil:ssg-audit_rules_execution_setfacl_action:testaction:1 - - Add nodev Option to /home + + Record Attempts to Alter Logon and Logout Events - lastlog - ocil:ssg-mount_option_home_nodev_action:testaction:1 + ocil:ssg-audit_rules_login_events_lastlog_action:testaction:1 - - Account Lockouts Must Be Logged + + Configure Polyinstantiation of /var/tmp Directories - ocil:ssg-accounts_passwords_pam_faillock_audit_action:testaction:1 + ocil:ssg-accounts_polyinstantiated_var_tmp_action:testaction:1 - - All User Files and Directories In The Home Directory Must Have a Valid Owner + + A private web server must be located on a separate controlled access subnet - ocil:ssg-accounts_users_home_files_ownership_action:testaction:1 + ocil:ssg-httpd_private_server_on_separate_subnet_action:testaction:1 - - Disable the samba_portmapper SELinux Boolean + + Install the SSSD Package - ocil:ssg-sebool_samba_portmapper_action:testaction:1 + ocil:ssg-package_sssd_installed_action:testaction:1 - - Ensure rsyncd service is disabled + + Disable SSH Root Login - ocil:ssg-service_rsyncd_disabled_action:testaction:1 + ocil:ssg-sshd_disable_root_login_action:testaction:1 - - Verify Permissions on cron.monthly + + Disable the dbadm_manage_user_files SELinux Boolean - ocil:ssg-file_permissions_cron_monthly_action:testaction:1 + ocil:ssg-sebool_dbadm_manage_user_files_action:testaction:1 - - Disable ypbind Service + + Disable the rsync_anon_write SELinux Boolean - ocil:ssg-service_ypbind_disabled_action:testaction:1 + ocil:ssg-sebool_rsync_anon_write_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - removexattr + + User Initialization Files Must Not Run World-Writable Programs - ocil:ssg-audit_rules_unsuccessful_file_modification_removexattr_action:testaction:1 + ocil:ssg-accounts_user_dot_no_world_writable_programs_action:testaction:1 - - Disable the selinuxuser_share_music SELinux Boolean + + Disable the LDT (local descriptor table) - ocil:ssg-sebool_selinuxuser_share_music_action:testaction:1 + ocil:ssg-kernel_config_modify_ldt_syscall_action:testaction:1 - - Drop Gratuitious ARP frames on All IPv4 Interfaces + + Disable the fenced_can_ssh SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_drop_gratuitous_arp_action:testaction:1 + ocil:ssg-sebool_fenced_can_ssh_action:testaction:1 - - Disable the exim_manage_user_files SELinux Boolean + + Disable the mock_enable_homedirs SELinux Boolean - ocil:ssg-sebool_exim_manage_user_files_action:testaction:1 + ocil:ssg-sebool_mock_enable_homedirs_action:testaction:1 - - Disable Odd Job Daemon (oddjobd) + + Disable core dump backtraces - ocil:ssg-service_oddjobd_disabled_action:testaction:1 + ocil:ssg-coredump_disable_backtraces_action:testaction:1 - - Disable DCCP Support + + Set Existing Passwords Minimum Age - ocil:ssg-kernel_module_dccp_disabled_action:testaction:1 + ocil:ssg-accounts_password_set_min_life_existing_action:testaction:1 - - Ensure All Groups on the System Have Unique Group ID + + Set number of Password Hashing Rounds - system-auth - ocil:ssg-group_unique_id_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_rounds_system_auth_action:testaction:1 - - Disable Kernel cfg80211 Module + + Verify Permissions and Ownership of Old Passwords File - ocil:ssg-kernel_module_cfg80211_disabled_action:testaction:1 + ocil:ssg-file_etc_security_opasswd_action:testaction:1 - - Disable the httpd_can_connect_zabbix SELinux Boolean + + Disable the httpd_tty_comm SELinux Boolean - ocil:ssg-sebool_httpd_can_connect_zabbix_action:testaction:1 + ocil:ssg-sebool_httpd_tty_comm_action:testaction:1 - - Install policycoreutils Package + + Ensure /var Located On Separate Partition - ocil:ssg-package_policycoreutils_installed_action:testaction:1 + ocil:ssg-partition_for_var_action:testaction:1 - - Disable Bluetooth Kernel Module + + Disable the varnishd_connect_any SELinux Boolean - ocil:ssg-kernel_module_bluetooth_disabled_action:testaction:1 + ocil:ssg-sebool_varnishd_connect_any_action:testaction:1 - - Enable GNOME3 Screensaver Lock After Idle Period + + Verify that audit tools are owned by root - ocil:ssg-dconf_gnome_screensaver_lock_enabled_action:testaction:1 + ocil:ssg-file_ownership_audit_binaries_action:testaction:1 - - Encrypt Audit Records Sent With audispd Plugin + + Configure auditd admin_space_left Action on Low Disk Space - ocil:ssg-auditd_audispd_encrypt_sent_records_action:testaction:1 + ocil:ssg-auditd_data_retention_admin_space_left_action_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg User Ownership + + Verify Permissions on cron.hourly - ocil:ssg-file_owner_efi_user_cfg_action:testaction:1 + ocil:ssg-file_permissions_cron_hourly_action:testaction:1 - - Verify /boot/grub2/grub.cfg Group Ownership + + Ensure sudo passwd_timeout is appropriate - sudo passwd_timeout - ocil:ssg-file_groupowner_grub2_cfg_action:testaction:1 + ocil:ssg-sudo_add_passwd_timeout_action:testaction:1 - - Support session locking with tmux + + Disable Postfix Network Listening - ocil:ssg-configure_bashrc_exec_tmux_action:testaction:1 + ocil:ssg-postfix_network_listening_disabled_action:testaction:1 - - Enable the GNOME3 Screen Locking On Smartcard Removal + + Record Events that Modify User/Group Information via openat syscall - /etc/passwd - ocil:ssg-dconf_gnome_lock_screen_on_smartcard_removal_action:testaction:1 + ocil:ssg-audit_rules_etc_passwd_openat_action:testaction:1 - - Verify Any Configured IPSec Tunnel Connections + + Disable the sanlock_use_fusefs SELinux Boolean - ocil:ssg-libreswan_approved_tunnels_action:testaction:1 + ocil:ssg-sebool_sanlock_use_fusefs_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg Group Ownership + + Record Events that Modify the System's Discretionary Access Controls - fsetxattr - ocil:ssg-file_groupowner_efi_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fsetxattr_action:testaction:1 - - Verify /boot/efi/EFI/redhat/user.cfg Permissions + + Record Unsuccessful Access Attempts to Files - truncate - ocil:ssg-file_permissions_efi_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_truncate_action:testaction:1 - - Configure Kerberos to use System Crypto Policy + + Ensure auditd Collects Information on Exporting to Media (successful) - ocil:ssg-configure_kerberos_crypto_policy_action:testaction:1 + ocil:ssg-audit_rules_media_export_action:testaction:1 - - Verify Permissions on SSH Server Public *.pub Key Files + + Remove the kernel mapping in user mode - ocil:ssg-file_permissions_sshd_pub_key_action:testaction:1 + ocil:ssg-kernel_config_page_table_isolation_action:testaction:1 - - Set Account Expiration Following Inactivity + + Verify Permissions on Backup shadow File - ocil:ssg-account_disable_post_pw_expiration_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_shadow_action:testaction:1 - - Configure auditing of successful permission changes + + Enable the GNOME3 Screen Locking On Smartcard Removal - ocil:ssg-audit_perm_change_success_action:testaction:1 + ocil:ssg-dconf_gnome_lock_screen_on_smartcard_removal_action:testaction:1 - - Disable the smbd_anon_write SELinux Boolean + + Disable the swift_can_network SELinux Boolean - ocil:ssg-sebool_smbd_anon_write_action:testaction:1 + ocil:ssg-sebool_swift_can_network_action:testaction:1 - - Verify that audit tools are owned by group root + + Remove .java And .jpp Files - ocil:ssg-file_groupownership_audit_binaries_action:testaction:1 + ocil:ssg-httpd_limit_java_files_action:testaction:1 - - Configure the httpd_enable_cgi SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_update - ocil:ssg-sebool_httpd_enable_cgi_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_unix_update_action:testaction:1 - - User a virtually-mapped stack + + Add nodev Option to Non-Root Local Partitions - ocil:ssg-kernel_config_vmap_stack_action:testaction:1 + ocil:ssg-mount_option_nodev_nonroot_local_partitions_action:testaction:1 - - Enable rsyslog Service + + Ensure PAM Enforces Password Requirements - Minimum Different Categories - ocil:ssg-service_rsyslog_enabled_action:testaction:1 + ocil:ssg-accounts_password_pam_minclass_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/shadow + + Install Virus Scanning Software - ocil:ssg-audit_rules_usergroup_modification_shadow_action:testaction:1 + ocil:ssg-install_antivirus_action:testaction:1 - - Disable SCTP Support + + Verify Owner on cron.monthly - ocil:ssg-kernel_module_sctp_disabled_action:testaction:1 + ocil:ssg-file_owner_cron_monthly_action:testaction:1 - - Disable Accepting ICMP Redirects for All IPv6 Interfaces + + Deactivate Wireless Network Interfaces - ocil:ssg-sysctl_net_ipv6_conf_all_accept_redirects_action:testaction:1 + ocil:ssg-wireless_disable_interfaces_action:testaction:1 - - Disable Advanced Configuration and Power Interface (acpid) + + Generate USBGuard Policy - ocil:ssg-service_acpid_disabled_action:testaction:1 + ocil:ssg-usbguard_generate_policy_action:testaction:1 - - Disable the secure_mode SELinux Boolean + + Audit Configuration Files Permissions are 640 or More Restrictive - ocil:ssg-sebool_secure_mode_action:testaction:1 + ocil:ssg-file_permissions_audit_configuration_action:testaction:1 - - Ensure All World-Writable Directories Are Owned by root User + + Configure file name of core dumps - ocil:ssg-dir_perms_world_writable_root_owned_action:testaction:1 + ocil:ssg-sysctl_kernel_core_uses_pid_action:testaction:1 - - Disable the zoneminder_anon_write SELinux Boolean + + Uninstall abrt-plugin-rhtsupport Package - ocil:ssg-sebool_zoneminder_anon_write_action:testaction:1 + ocil:ssg-package_abrt-plugin-rhtsupport_removed_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/shadow + + Add nodev Option to Removable Media Partitions - ocil:ssg-audit_rules_etc_shadow_open_action:testaction:1 + ocil:ssg-mount_option_nodev_removable_partitions_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/gshadow + + Set the UEFI Boot Loader Password - ocil:ssg-audit_rules_etc_gshadow_open_action:testaction:1 + ocil:ssg-grub2_uefi_password_action:testaction:1 - - Disable the virt_sandbox_use_mknod SELinux Boolean + + Modify the System Message of the Day Banner - ocil:ssg-sebool_virt_sandbox_use_mknod_action:testaction:1 + ocil:ssg-banner_etc_motd_action:testaction:1 - - Ensure Web Content Located on Separate partition + + Disable the ftpd_anon_write SELinux Boolean - ocil:ssg-partition_for_web_content_action:testaction:1 + ocil:ssg-sebool_ftpd_anon_write_action:testaction:1 - - Disable Certmonger Service (certmonger) + + Verify Group Ownership on SSH Server Private *_key Key Files - ocil:ssg-service_certmonger_disabled_action:testaction:1 + ocil:ssg-file_groupownership_sshd_private_key_action:testaction:1 - - Disable the samba_domain_controller SELinux Boolean + + Disable the piranha_lvs_can_network_connect SELinux Boolean - ocil:ssg-sebool_samba_domain_controller_action:testaction:1 + ocil:ssg-sebool_piranha_lvs_can_network_connect_action:testaction:1 - - Disable Red Hat Subscription Manager Daemon (rhsmcertd) + + Ensure auditd Collects Information on the Use of Privileged Commands - usermod - ocil:ssg-service_rhsmcertd_disabled_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_usermod_action:testaction:1 - - Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo requiretty + + Enable Process Accounting (psacct) - ocil:ssg-sudo_add_requiretty_action:testaction:1 + ocil:ssg-service_psacct_enabled_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf.d/ + + Disable Compression Or Set Compression to delayed - ocil:ssg-file_permissions_httpd_server_conf_d_files_action:testaction:1 + ocil:ssg-sshd_disable_compression_action:testaction:1 - - Install McAfee Endpoint Security for Linux (ENSL) + + Verify that System Executable Directories Have Restrictive Permissions - ocil:ssg-package_mcafeetp_installed_action:testaction:1 + ocil:ssg-dir_permissions_binary_dirs_action:testaction:1 - - Disable the lsmd_plugin_connect_any SELinux Boolean + + Ensure SELinux Not Disabled in zIPL - ocil:ssg-sebool_lsmd_plugin_connect_any_action:testaction:1 + ocil:ssg-zipl_enable_selinux_action:testaction:1 - - Disable the httpd_can_network_memcache SELinux Boolean + + Record Unsuccessful Permission Changes to Files - fremovexattr - ocil:ssg-sebool_httpd_can_network_memcache_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fremovexattr_action:testaction:1 - - Verify Group Ownership of System Login Banner for Remote Connections + + Require Re-Authentication When Using the sudo Command - ocil:ssg-file_groupowner_etc_issue_net_action:testaction:1 + ocil:ssg-sudo_require_reauthentication_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - sudo + + Ensure iptables Firewall Rules Exist for All Open Ports - ocil:ssg-audit_rules_privileged_commands_sudo_action:testaction:1 + ocil:ssg-iptables_rules_for_open_ports_action:testaction:1 - - Disable the polipo_session_bind_all_unreserved_ports SELinux Boolean + + Remove the FreeRadius Server Package - ocil:ssg-sebool_polipo_session_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-package_freeradius_removed_action:testaction:1 - - Disable the httpd_use_cifs SELinux Boolean + + Disable the httpd_can_connect_ldap SELinux Boolean - ocil:ssg-sebool_httpd_use_cifs_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_ldap_action:testaction:1 - - Ensure SSH LoginGraceTime is configured + + Audit Tools Must Be Owned by Root - ocil:ssg-sshd_set_login_grace_time_action:testaction:1 + ocil:ssg-file_audit_tools_ownership_action:testaction:1 - - Set SSH Daemon LogLevel to VERBOSE + + Install subscription-manager Package - ocil:ssg-sshd_set_loglevel_verbose_action:testaction:1 + ocil:ssg-package_subscription-manager_installed_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words + + Support session locking with tmux - ocil:ssg-accounts_password_pam_dictcheck_action:testaction:1 + ocil:ssg-configure_bashrc_exec_tmux_action:testaction:1 - - Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean + + Unmap kernel when running in userspace (aka KAISER) - ocil:ssg-sebool_httpd_mod_auth_ntlm_winbind_action:testaction:1 + ocil:ssg-kernel_config_unmap_kernel_at_el0_action:testaction:1 - - Uninstall bind Package + + Add nosuid Option to /boot - ocil:ssg-package_bind_removed_action:testaction:1 + ocil:ssg-mount_option_boot_nosuid_action:testaction:1 - - Ensure McAfee Endpoint Security for Linux (ENSL) is running + + Ensure rsyslog Does Not Accept Remote Messages Unless Acting As Log Server - ocil:ssg-agent_mfetpd_running_action:testaction:1 + ocil:ssg-rsyslog_nolisten_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - newgidmap + + Make the auditd Configuration Immutable - ocil:ssg-audit_rules_privileged_commands_newgidmap_action:testaction:1 + ocil:ssg-audit_rules_immutable_action:testaction:1 - - Ensure SSH MaxStartups is configured + + Disable Network Router Discovery Daemon (rdisc) - ocil:ssg-sshd_set_maxstartups_action:testaction:1 + ocil:ssg-service_rdisc_disabled_action:testaction:1 - - Configure firewall to Allow Access to the Web Server + + Disable the mozilla_plugin_use_spice SELinux Boolean - ocil:ssg-httpd_configure_firewall_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_use_spice_action:testaction:1 - - Ensure tftp Daemon Uses Secure Mode + + Ensure rsyslog-gnutls is installed - ocil:ssg-tftpd_uses_secure_mode_action:testaction:1 + ocil:ssg-package_rsyslog-gnutls_installed_action:testaction:1 - - Limit CPU consumption of the Perf system + + Disable Certmonger Service (certmonger) - ocil:ssg-sysctl_kernel_perf_cpu_time_max_percent_action:testaction:1 + ocil:ssg-service_certmonger_disabled_action:testaction:1 - - Add hidepid Option to /proc + + Record Events that Modify the System's Discretionary Access Controls - fremovexattr - ocil:ssg-mount_option_proc_hidepid_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fremovexattr_action:testaction:1 - - System Audit Logs Must Be Group Owned By Root + + Enable seccomp to safely compute untrusted bytecode - ocil:ssg-file_group_ownership_var_log_audit_action:testaction:1 + ocil:ssg-kernel_config_seccomp_action:testaction:1 - - Disable the xdm_write_home SELinux Boolean + + Verify ufw Enabled - ocil:ssg-sebool_xdm_write_home_action:testaction:1 + ocil:ssg-service_ufw_enabled_action:testaction:1 - - Ensure All-Squashing Disabled On All Exports + + Disable the cron_system_cronjob_use_shares SELinux Boolean - ocil:ssg-no_all_squash_exports_action:testaction:1 + ocil:ssg-sebool_cron_system_cronjob_use_shares_action:testaction:1 - - Configure SSSD LDAP Backend Client CA Certificate Location + + Configure auditd Disk Error Action on Disk Error - ocil:ssg-sssd_ldap_configure_tls_ca_dir_action:testaction:1 + ocil:ssg-auditd_data_disk_error_action_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - chsh + + Disable Dovecot Service - ocil:ssg-audit_rules_privileged_commands_chsh_action:testaction:1 + ocil:ssg-service_dovecot_disabled_action:testaction:1 - - Require modules to be validly signed + + Ensure a dedicated group owns sudo - ocil:ssg-kernel_config_module_sig_force_action:testaction:1 + ocil:ssg-sudo_dedicated_group_action:testaction:1 - - Install the psacct package + + Disable the postgresql_can_rsync SELinux Boolean - ocil:ssg-package_psacct_installed_action:testaction:1 + ocil:ssg-sebool_postgresql_can_rsync_action:testaction:1 - - Add nosuid Option to /dev/shm + + Uninstall xinetd Package - ocil:ssg-mount_option_dev_shm_nosuid_action:testaction:1 + ocil:ssg-package_xinetd_removed_action:testaction:1 - - Enable the pcscd Service + + Enable SSH Server firewalld Firewall Exception - ocil:ssg-service_pcscd_enabled_action:testaction:1 + ocil:ssg-firewalld_sshd_port_enabled_action:testaction:1 - - System Audit Logs Must Have Mode 0750 or Less Permissive + + Restrict Access to Kernel Message Buffer - ocil:ssg-directory_permissions_var_log_audit_action:testaction:1 + ocil:ssg-sysctl_kernel_dmesg_restrict_action:testaction:1 - - Verify Group Who Owns /var/log Directory + + Disable the logging_syslogd_run_nagios_plugins SELinux Boolean - ocil:ssg-file_groupowner_var_log_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_run_nagios_plugins_action:testaction:1 - - Verify Group Who Owns cron.d + + Disable the openvpn_can_network_connect SELinux Boolean - ocil:ssg-file_groupowner_cron_d_action:testaction:1 + ocil:ssg-sebool_openvpn_can_network_connect_action:testaction:1 - - Verify Group Who Owns cron.monthly + + Disable vsyscalls in zIPL - ocil:ssg-file_groupowner_cron_monthly_action:testaction:1 + ocil:ssg-zipl_vsyscall_argument_action:testaction:1 - - Install Intrusion Detection Software + + Ensure auditd Collects Information on the Use of Privileged Commands - ssh-keysign - ocil:ssg-install_hids_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_ssh_keysign_action:testaction:1 - - Disable the tftp_anon_write SELinux Boolean + + Kernel panic timeout - ocil:ssg-sebool_tftp_anon_write_action:testaction:1 + ocil:ssg-kernel_config_panic_timeout_action:testaction:1 - - Enable different security models + + Configure GNOME3 DConf User Profile - ocil:ssg-kernel_config_security_action:testaction:1 + ocil:ssg-enable_dconf_user_profile_action:testaction:1 - - Verify Permissions and Ownership of Old Passwords File + + Enable the NTP Daemon - ocil:ssg-file_etc_security_opasswd_action:testaction:1 + ocil:ssg-service_ntpd_enabled_action:testaction:1 - - Ensure gpgcheck Enabled for All yum Package Repositories + + Disable the dbadm_read_user_files SELinux Boolean - ocil:ssg-ensure_gpgcheck_never_disabled_action:testaction:1 + ocil:ssg-sebool_dbadm_read_user_files_action:testaction:1 - - Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean + + Record Unsuccessful Permission Changes to Files - chmod - ocil:ssg-sebool_postgresql_selinux_unconfined_dbadm_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_chmod_action:testaction:1 - - Configure auditd max_log_file_action Upon Reaching Maximum Log Size + + Disable the ssh_sysadm_login SELinux Boolean - ocil:ssg-auditd_data_retention_max_log_file_action_action:testaction:1 + ocil:ssg-sebool_ssh_sysadm_login_action:testaction:1 - - Disable the xserver_object_manager SELinux Boolean + + Root Path Must Be Vendor Default - ocil:ssg-sebool_xserver_object_manager_action:testaction:1 + ocil:ssg-root_path_default_action:testaction:1 - - Verify Permissions on SSH Server Private *_key Key Files + + Disable User Administration in GNOME3 - ocil:ssg-file_permissions_sshd_private_key_action:testaction:1 + ocil:ssg-dconf_gnome_disable_user_admin_action:testaction:1 - - Ensure IPv6 is disabled through kernel boot parameter + + Verify and Correct File Permissions with RPM - ocil:ssg-grub2_ipv6_disable_argument_action:testaction:1 + ocil:ssg-rpm_verify_permissions_action:testaction:1 - - User Initialization Files Must Be Owned By the Primary User + + Backup interactive scripts on the production web server are prohibited - ocil:ssg-accounts_user_dot_user_ownership_action:testaction:1 + ocil:ssg-httpd_remove_backups_action:testaction:1 - - Disable the httpd_anon_write SELinux Boolean + + Disable the 32-bit vDSO - ocil:ssg-sebool_httpd_anon_write_action:testaction:1 + ocil:ssg-kernel_config_compat_vdso_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - creat + + Enforce Spectre v2 mitigation - ocil:ssg-audit_rules_unsuccessful_file_modification_creat_action:testaction:1 + ocil:ssg-grub2_spectre_v2_argument_action:testaction:1 - - Ignore HTTPD .htaccess Files + + Disable the named_tcp_bind_http_port SELinux Boolean - ocil:ssg-httpd_ignore_htaccess_files_action:testaction:1 + ocil:ssg-sebool_named_tcp_bind_http_port_action:testaction:1 - - Enable Kernel Parameter to Enforce DAC on Symlinks + + Don't define allowed commands in sudoers by means of exclusion - ocil:ssg-sysctl_fs_protected_symlinks_action:testaction:1 + ocil:ssg-sudoers_no_command_negation_action:testaction:1 - - Generate USBGuard Policy + + Configure a Sufficiently Large Partition for Audit Logs - ocil:ssg-usbguard_generate_policy_action:testaction:1 + ocil:ssg-auditd_audispd_configure_sufficiently_large_partition_action:testaction:1 - - Set Password Maximum Consecutive Repeating Characters + + Uninstall tuned Package - ocil:ssg-accounts_password_pam_maxrepeat_action:testaction:1 + ocil:ssg-package_tuned_removed_action:testaction:1 - - Set configuration for IPv6 loopback traffic + + Ensure SSH LoginGraceTime is configured - ocil:ssg-set_ipv6_loopback_traffic_action:testaction:1 + ocil:ssg-sshd_set_login_grace_time_action:testaction:1 - - Ensure auditd Collects System Administrator Actions - /etc/sudoers + + Disable the logwatch_can_network_connect_mail SELinux Boolean - ocil:ssg-audit_rules_sudoers_action:testaction:1 + ocil:ssg-sebool_logwatch_can_network_connect_mail_action:testaction:1 - - Enable the gssd_read_tmp SELinux Boolean + + Restrict Virtual Console Root Logins - ocil:ssg-sebool_gssd_read_tmp_action:testaction:1 + ocil:ssg-securetty_root_login_console_only_action:testaction:1 - - Configure SSSD LDAP Backend to Use TLS For All Transactions + + Disable the git_cgi_use_cifs SELinux Boolean - ocil:ssg-sssd_ldap_start_tls_action:testaction:1 + ocil:ssg-sebool_git_cgi_use_cifs_action:testaction:1 - - Ensure Logs Sent To Remote Host + + Ensure Software Patches Installed - ocil:ssg-rsyslog_remote_loghost_action:testaction:1 + ocil:ssg-security_patches_up_to_date_action:testaction:1 - - Set Password Hashing Algorithm in /etc/login.defs + + Disable the global_ssp SELinux Boolean - ocil:ssg-set_password_hashing_algorithm_logindefs_action:testaction:1 + ocil:ssg-sebool_global_ssp_action:testaction:1 - - Set Permissions on the /etc/httpd/conf/ Directory + + Ensure PAM Enforces Password Requirements - Minimum Length - ocil:ssg-dir_perms_etc_httpd_conf_action:testaction:1 + ocil:ssg-accounts_password_pam_minlen_action:testaction:1 - - Configure Logind to terminate idle sessions after certain time of inactivity + + Enable different security models - ocil:ssg-logind_session_timeout_action:testaction:1 + ocil:ssg-kernel_config_security_action:testaction:1 - - Ensure No World-Writable Files Exist + + Disable the use_samba_home_dirs SELinux Boolean - ocil:ssg-file_permissions_unauthorized_world_writable_action:testaction:1 + ocil:ssg-sebool_use_samba_home_dirs_action:testaction:1 - - Add nodev Option to /tmp + + Map System Users To The Appropriate SELinux Role - ocil:ssg-mount_option_tmp_nodev_action:testaction:1 + ocil:ssg-selinux_user_login_roles_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - removexattr + + Ensure Log Files Are Owned By Appropriate Group - ocil:ssg-audit_rules_dac_modification_removexattr_action:testaction:1 + ocil:ssg-rsyslog_files_groupownership_action:testaction:1 - - Disable the httpd_tty_comm SELinux Boolean + + Each Web Content Directory Must Contain An index.html File - ocil:ssg-sebool_httpd_tty_comm_action:testaction:1 + ocil:ssg-httpd_configure_documentroot_action:testaction:1 - - Verify Owner on SSH Server config file + + Disable the glance_api_can_network SELinux Boolean - ocil:ssg-file_owner_sshd_config_action:testaction:1 + ocil:ssg-sebool_glance_api_can_network_action:testaction:1 - - Verify Group Who Owns Backup passwd File + + Verify that local System.map file (if exists) is readable only by root - ocil:ssg-file_groupowner_backup_etc_passwd_action:testaction:1 + ocil:ssg-file_permissions_systemmap_action:testaction:1 - - Stack Protector buffer overlow detection + + Verify permissions on System Login Banner - ocil:ssg-kernel_config_stackprotector_action:testaction:1 + ocil:ssg-file_permissions_etc_issue_action:testaction:1 - - Enable the postfix_local_write_mail_spool SELinux Boolean + + Uninstall telnet-server Package - ocil:ssg-sebool_postfix_local_write_mail_spool_action:testaction:1 + ocil:ssg-package_telnet-server_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - kmod + + Disable Mounting of cramfs - ocil:ssg-audit_rules_privileged_commands_kmod_action:testaction:1 + ocil:ssg-kernel_module_cramfs_disabled_action:testaction:1 - - Set Password Warning Age + + Ensure the Default Umask is Set Correctly in /etc/profile - ocil:ssg-accounts_password_warn_age_login_defs_action:testaction:1 + ocil:ssg-accounts_umask_etc_profile_action:testaction:1 - - Uninstall net-snmp Package + + Do not allow usercopy whitelist violations to fallback to object size - ocil:ssg-package_net-snmp_removed_action:testaction:1 + ocil:ssg-kernel_config_hardened_usercopy_fallback_action:testaction:1 - - Disable the use_fusefs_home_dirs SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - userhelper - ocil:ssg-sebool_use_fusefs_home_dirs_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_userhelper_action:testaction:1 - - Enable the unconfined_chrome_sandbox_transition SELinux Boolean + + Disable the daemons_dump_core SELinux Boolean - ocil:ssg-sebool_unconfined_chrome_sandbox_transition_action:testaction:1 + ocil:ssg-sebool_daemons_dump_core_action:testaction:1 - - Disable TIPC Support + + Record Unsuccessful Access Attempts to Files - openat - ocil:ssg-kernel_module_tipc_disabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_action:testaction:1 - - Configure audispd's Plugin network_failure_action On Network Failure + + Disable Secure RPC Server Service (rpcsvcgssd) - ocil:ssg-auditd_audispd_network_failure_action_action:testaction:1 + ocil:ssg-service_rpcsvcgssd_disabled_action:testaction:1 - - Set Default iptables Policy for Forwarded Packets + + Disable network management of chrony daemon - ocil:ssg-set_iptables_default_rule_forward_action:testaction:1 + ocil:ssg-chronyd_no_chronyc_network_action:testaction:1 - - Uninstall talk Package + + Ensure gpgcheck Enabled for Local Packages - ocil:ssg-package_talk_removed_action:testaction:1 + ocil:ssg-ensure_gpgcheck_local_packages_action:testaction:1 - - Set Up a Private Namespace in PAM Configuration + + Record Unsuccessful Permission Changes to Files - lremovexattr - ocil:ssg-enable_pam_namespace_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lremovexattr_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - open O_CREAT + + Disable PubkeyAuthentication Authentication - ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_creat_action:testaction:1 + ocil:ssg-sshd_disable_pubkey_auth_action:testaction:1 - - Record Access Events to Audit Log Directory + + Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo use_pty - ocil:ssg-directory_access_var_log_audit_action:testaction:1 + ocil:ssg-sudo_add_use_pty_action:testaction:1 - - Disable Ctrl-Alt-Del Reboot Key Sequence in GNOME3 + + Disable the git_system_use_cifs SELinux Boolean - ocil:ssg-dconf_gnome_disable_ctrlaltdel_reboot_action:testaction:1 + ocil:ssg-sebool_git_system_use_cifs_action:testaction:1 - - Disable the samba_run_unconfined SELinux Boolean + + Enable the httpd_graceful_shutdown SELinux Boolean - ocil:ssg-sebool_samba_run_unconfined_action:testaction:1 + ocil:ssg-sebool_httpd_graceful_shutdown_action:testaction:1 - - Record Successful Creation Attempts to Files - open O_CREAT + + Set number of Password Hashing Rounds - password-auth - ocil:ssg-audit_rules_successful_file_modification_open_o_creat_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_rounds_password_auth_action:testaction:1 - - Disable the git_cgi_use_cifs SELinux Boolean + + Disable Host-Based Authentication - ocil:ssg-sebool_git_cgi_use_cifs_action:testaction:1 + ocil:ssg-disable_host_auth_action:testaction:1 - - Ensure logging is configured + + Ensure McAfee Endpoint Security for Linux (ENSL) is running - ocil:ssg-rsyslog_logging_configured_action:testaction:1 + ocil:ssg-agent_mfetpd_running_action:testaction:1 - - Disable the virt_rw_qemu_ga_data SELinux Boolean + + Ensure journald is configured to send logs to rsyslog - ocil:ssg-sebool_virt_rw_qemu_ga_data_action:testaction:1 + ocil:ssg-journald_forward_to_syslog_action:testaction:1 - - Configure AIDE to Verify Extended Attributes + + Disable the samba_domain_controller SELinux Boolean - ocil:ssg-aide_verify_ext_attributes_action:testaction:1 + ocil:ssg-sebool_samba_domain_controller_action:testaction:1 - - Disable the ftpd_connect_all_unreserved SELinux Boolean + + Record Unsuccessful Creation Attempts to Files - open_by_handle_at O_CREAT - ocil:ssg-sebool_ftpd_connect_all_unreserved_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_creat_action:testaction:1 - - Add noexec Option to Removable Media Partitions + + Ensure a Table Exists for Nftables - ocil:ssg-mount_option_noexec_removable_partitions_action:testaction:1 + ocil:ssg-set_nftables_table_action:testaction:1 - - Add noexec Option to /boot + + Verify Permissions on crontab - ocil:ssg-mount_option_boot_noexec_action:testaction:1 + ocil:ssg-file_permissions_crontab_action:testaction:1 - - The mailx Package Is Installed + + Enable the USBGuard Service - ocil:ssg-package_mailx_installed_action:testaction:1 + ocil:ssg-service_usbguard_enabled_action:testaction:1 - - Ensure All Files Are Owned by a User + + Disable the selinuxuser_share_music SELinux Boolean - ocil:ssg-no_files_unowned_by_user_action:testaction:1 + ocil:ssg-sebool_selinuxuser_share_music_action:testaction:1 - - Ensure PAM password complexity module is enabled in password-auth + + Record Events that Modify the System's Discretionary Access Controls - removexattr - ocil:ssg-accounts_password_pam_pwquality_password_auth_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_removexattr_action:testaction:1 - - Uninstall dovecot Package + + Ensure that System Accounts Are Locked - ocil:ssg-package_dovecot_removed_action:testaction:1 + ocil:ssg-no_password_auth_for_systemaccounts_action:testaction:1 - - Record Successful Ownership Changes to Files - lchown + + Set Interactive Session Timeout - ocil:ssg-audit_rules_successful_file_modification_lchown_action:testaction:1 + ocil:ssg-accounts_tmout_action:testaction:1 - - Remove ftp Package + + Record Successful Ownership Changes to Files - chown - ocil:ssg-package_ftp_removed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_chown_action:testaction:1 - - Record Any Attempts to Run setfacl + + Verify that System Executables Have Root Ownership - ocil:ssg-audit_rules_execution_setfacl_action:testaction:1 + ocil:ssg-file_ownership_binary_dirs_action:testaction:1 - - Disable the sge_domain_can_network_connect SELinux Boolean + + Disable the GNOME3 Login User List - ocil:ssg-sebool_sge_domain_can_network_connect_action:testaction:1 + ocil:ssg-dconf_gnome_disable_user_list_action:testaction:1 - - Uninstall cyrus-imapd Package + + Enable Public Key Authentication - ocil:ssg-package_cyrus-imapd_removed_action:testaction:1 + ocil:ssg-sshd_enable_pubkey_auth_action:testaction:1 - - Verify User Who Owns /var/log Directory + + Modify the System Login Banner - ocil:ssg-file_owner_var_log_action:testaction:1 + ocil:ssg-banner_etc_issue_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - crontab + + Ensure journald is configured to compress large log files - ocil:ssg-audit_rules_privileged_commands_crontab_action:testaction:1 + ocil:ssg-journald_compress_action:testaction:1 - - Configure Speculative Store Bypass Mitigation + + Disable the virt_use_samba SELinux Boolean - ocil:ssg-grub2_spec_store_bypass_disable_argument_action:testaction:1 + ocil:ssg-sebool_virt_use_samba_action:testaction:1 - - Disable the tor_bind_all_unreserved_ports SELinux Boolean + + Disable kernel debugfs - ocil:ssg-sebool_tor_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-kernel_config_debug_fs_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on all IPv4 Interfaces + + Verify permissions on System Login Banner for Remote Connections - ocil:ssg-sysctl_net_ipv4_conf_all_accept_source_route_action:testaction:1 + ocil:ssg-file_permissions_etc_issue_net_action:testaction:1 - - Configure SSH to use System Crypto Policy + + Ensure auditd Collects Information on the Use of Privileged Commands - gpasswd - ocil:ssg-configure_ssh_crypto_policy_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_gpasswd_action:testaction:1 - - Install libselinux Package + + Configure Speculative Store Bypass Mitigation - ocil:ssg-package_libselinux_installed_action:testaction:1 + ocil:ssg-grub2_spec_store_bypass_disable_argument_action:testaction:1 - - Disable the pcp_bind_all_unreserved_ports SELinux Boolean + + Record Any Attempts to Run chacl - ocil:ssg-sebool_pcp_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-audit_rules_execution_chacl_action:testaction:1 - - Verify Permissions on Backup passwd File + + Ensure auditd Collects Information on the Use of Privileged Commands - umount - ocil:ssg-file_permissions_backup_etc_passwd_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_umount_action:testaction:1 - - Enable the spamd_enable_home_dirs SELinux Boolean + + Enable Use of Strict Mode Checking - ocil:ssg-sebool_spamd_enable_home_dirs_action:testaction:1 + ocil:ssg-sshd_enable_strictmodes_action:testaction:1 - - Configure OpenSSL library to use System Crypto Policy + + Enable the antivirus_can_scan_system SELinux Boolean - ocil:ssg-configure_openssl_crypto_policy_action:testaction:1 + ocil:ssg-sebool_antivirus_can_scan_system_action:testaction:1 - - Disable xinetd Service + + Record Successful Delete Attempts to Files - unlink - ocil:ssg-service_xinetd_disabled_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_unlink_action:testaction:1 - - Install usbguard Package + + Uninstall krb5-workstation Package - ocil:ssg-package_usbguard_installed_action:testaction:1 + ocil:ssg-package_krb5-workstation_removed_action:testaction:1 - - Verify User Who Owns /var/log/messages File + + Disable the httpd_can_network_connect SELinux Boolean - ocil:ssg-file_owner_var_log_messages_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_action:testaction:1 - - Add nosuid Option to /tmp + + Verify Any Configured IPSec Tunnel Connections - ocil:ssg-mount_option_tmp_nosuid_action:testaction:1 + ocil:ssg-libreswan_approved_tunnels_action:testaction:1 - - Verify /boot/grub2/user.cfg Group Ownership + + Disable System Statistics Reset Service (sysstat) - ocil:ssg-file_groupowner_user_cfg_action:testaction:1 + ocil:ssg-service_sysstat_disabled_action:testaction:1 - - Set kernel parameter 'crypto.fips_enabled' to 1 + + Ensure only owner and members of group owner of /usr/bin/sudo can execute it - ocil:ssg-sysctl_crypto_fips_enabled_action:testaction:1 + ocil:ssg-sudo_restrict_others_executable_permission_action:testaction:1 - - Do not allow ACPI methods to be inserted/replaced at run time + + Disable the httpd_can_network_connect_cobbler SELinux Boolean - ocil:ssg-kernel_config_acpi_custom_method_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_cobbler_action:testaction:1 - - Remove the X Windows Package Group + + Add noexec Option to /var/log - ocil:ssg-package_xorg-x11-server-common_removed_action:testaction:1 + ocil:ssg-mount_option_var_log_noexec_action:testaction:1 - - Disable loading and unloading of kernel modules + + Disable IA32 emulation - ocil:ssg-sysctl_kernel_modules_disabled_action:testaction:1 + ocil:ssg-kernel_config_ia32_emulation_action:testaction:1 - - Set Permissions on the /var/log/httpd/ Directory + + Add nosuid Option to /tmp - ocil:ssg-dir_perms_var_log_httpd_action:testaction:1 + ocil:ssg-mount_option_tmp_nosuid_action:testaction:1 - - Disable the virt_use_execmem SELinux Boolean + + Add nosuid Option to /var/log/audit - ocil:ssg-sebool_virt_use_execmem_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_nosuid_action:testaction:1 - - Set SSH Client Alive Count Max + + Disable the logrotate_use_nfs SELinux Boolean - ocil:ssg-sshd_set_keepalive_action:testaction:1 + ocil:ssg-sebool_logrotate_use_nfs_action:testaction:1 - - Enable log_config_module For HTTPD Logging + + Uninstall libreport-plugin-logger Package - ocil:ssg-httpd_enable_log_config_action:testaction:1 + ocil:ssg-package_libreport-plugin-logger_removed_action:testaction:1 - - The Chronyd service is enabled + + Set Permissions on All Configuration Files Inside /etc/httpd/conf/ - ocil:ssg-service_chronyd_enabled_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_conf_files_action:testaction:1 - - Ensure auditd Unauthorized Access Attempts To open_by_handle_at Are Ordered Correctly + + Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_rule_order_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_unix_chkpwd_action:testaction:1 - - Remove NIS Client + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group - ocil:ssg-package_ypbind_removed_action:testaction:1 + ocil:ssg-audit_rules_etc_group_open_by_handle_at_action:testaction:1 - - Disable the httpd_ssi_exec SELinux Boolean + + Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean - ocil:ssg-sebool_httpd_ssi_exec_action:testaction:1 + ocil:ssg-sebool_selinuxuser_postgresql_connect_enabled_action:testaction:1 - - Emulate Privileged Access Never (PAN) + + Configure SSSD to run as user sssd - ocil:ssg-kernel_config_arm64_sw_ttbr0_pan_action:testaction:1 + ocil:ssg-sssd_run_as_sssd_user_action:testaction:1 - - Remove the Kerberos Server Package + + Ensure logging is configured - ocil:ssg-package_krb5-server_removed_action:testaction:1 + ocil:ssg-rsyslog_logging_configured_action:testaction:1 - - Disable ntpdate Service (ntpdate) + + Set Default iptables Policy for Incoming Packets - ocil:ssg-service_ntpdate_disabled_action:testaction:1 + ocil:ssg-set_iptables_default_rule_action:testaction:1 - - Disable the openvpn_enable_homedirs SELinux Boolean + + Enable Yama support - ocil:ssg-sebool_openvpn_enable_homedirs_action:testaction:1 + ocil:ssg-kernel_config_security_yama_action:testaction:1 - - Verify that system commands files are group owned by root or a system account + + Set the Boot Loader Admin Username to a Non-Default Value - ocil:ssg-file_groupownership_system_commands_dirs_action:testaction:1 + ocil:ssg-grub2_admin_username_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - renameat + + Disable the dhcpd_use_ldap SELinux Boolean - ocil:ssg-audit_rules_file_deletion_events_renameat_action:testaction:1 + ocil:ssg-sebool_dhcpd_use_ldap_action:testaction:1 - - Remove the GDM Package Group + + Ensure auditd Collects Information on the Use of Privileged Commands - chage - ocil:ssg-package_gdm_removed_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_chage_action:testaction:1 - - Mount Remote Filesystems with nodev + + Disable the wine_mmap_zero_ignore SELinux Boolean - ocil:ssg-mount_option_nodev_remote_filesystems_action:testaction:1 + ocil:ssg-sebool_wine_mmap_zero_ignore_action:testaction:1 - - Verify Owner on cron.d + + Ensure All User Initialization Files Have Mode 0740 Or Less Permissive - ocil:ssg-file_owner_cron_d_action:testaction:1 + ocil:ssg-file_permission_user_init_files_action:testaction:1 - - Verify Permissions on SSH Server config file + + Ensure users' .netrc Files are not group or world accessible - ocil:ssg-file_permissions_sshd_config_action:testaction:1 + ocil:ssg-accounts_users_netrc_file_permissions_action:testaction:1 - - Disable SSH Access via Empty Passwords + + The Installed Operating System Is Vendor Supported - ocil:ssg-sshd_disable_empty_passwords_action:testaction:1 + ocil:ssg-installed_OS_is_vendor_supported_action:testaction:1 - - Enforce usage of pam_wheel for su authentication + + Record Unsuccessful Permission Changes to Files - lsetxattr - ocil:ssg-use_pam_wheel_for_su_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lsetxattr_action:testaction:1 - - Remove User Host-Based Authentication Files + + Record Unsuccessful Ownership Changes to Files - fchown - ocil:ssg-no_user_host_based_files_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchown_action:testaction:1 - - Configure audispd Plugin To Send Logs To Remote Server + + Install McAfee Endpoint Security for Linux (ENSL) - ocil:ssg-auditd_audispd_configure_remote_server_action:testaction:1 + ocil:ssg-package_mcafeetp_installed_action:testaction:1 - - Disable the irc_use_any_tcp_ports SELinux Boolean + + Verify User Who Owns Backup gshadow File - ocil:ssg-sebool_irc_use_any_tcp_ports_action:testaction:1 + ocil:ssg-file_owner_backup_etc_gshadow_action:testaction:1 - - Configure the Firewalld Ports + + Enable Certmap in SSSD - ocil:ssg-configure_firewalld_ports_action:testaction:1 + ocil:ssg-sssd_enable_certmap_action:testaction:1 - - Configure SSH Server to Use FIPS 140-2 Validated Ciphers: opensshserver.config + + Ensure /srv Located On Separate Partition - ocil:ssg-harden_sshd_ciphers_opensshserver_conf_crypto_policy_action:testaction:1 + ocil:ssg-partition_for_srv_action:testaction:1 - - Uninstall geolite2-city Package + + Verify Group Who Owns gshadow File - ocil:ssg-package_geolite2-city_removed_action:testaction:1 + ocil:ssg-file_groupowner_etc_gshadow_action:testaction:1 - - Record Events that Modify User/Group Information + + Disable the squid_use_tproxy SELinux Boolean - ocil:ssg-audit_rules_usergroup_modification_action:testaction:1 + ocil:ssg-sebool_squid_use_tproxy_action:testaction:1 - - Configure Certificate Directives for LDAP Use of TLS + + Uninstall setroubleshoot-plugins Package - ocil:ssg-ldap_client_tls_cacertpath_action:testaction:1 + ocil:ssg-package_setroubleshoot-plugins_removed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - ftruncate + + Disable Anonymous FTP Access - ocil:ssg-audit_rules_unsuccessful_file_modification_ftruncate_action:testaction:1 + ocil:ssg-httpd_disable_anonymous_ftp_access_action:testaction:1 - - Limit Password Reuse: password-auth + + Disable vsftpd Service - ocil:ssg-accounts_password_pam_pwhistory_remember_password_auth_action:testaction:1 + ocil:ssg-service_vsftpd_disabled_action:testaction:1 - - Enable SLUB debugging support + + Set SSH authentication attempt limit - ocil:ssg-kernel_config_slub_debug_action:testaction:1 + ocil:ssg-sshd_set_max_auth_tries_action:testaction:1 - - Configure A Banner Page For Each Website + + Make the module text and rodata read-only - ocil:ssg-httpd_configure_banner_page_action:testaction:1 + ocil:ssg-kernel_config_strict_module_rwx_action:testaction:1 - - Disable Kernel mac80211 Module + + Enable the secadm_exec_content SELinux Boolean - ocil:ssg-kernel_module_mac80211_disabled_action:testaction:1 + ocil:ssg-sebool_secadm_exec_content_action:testaction:1 - - Audit Configuration Files Permissions are 640 or More Restrictive + + Add noexec Option to /var - ocil:ssg-file_permissions_audit_configuration_action:testaction:1 + ocil:ssg-mount_option_var_noexec_action:testaction:1 - - Disable the virt_use_xserver SELinux Boolean + + Verify User Who Owns /var/log Directory - ocil:ssg-sebool_virt_use_xserver_action:testaction:1 + ocil:ssg-file_owner_var_log_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Settings + + Disable the httpd_run_preupgrade SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_user_locks_action:testaction:1 + ocil:ssg-sebool_httpd_run_preupgrade_action:testaction:1 - - Record Attempts to Alter the localtime File + + Disable the xserver_execmem SELinux Boolean - ocil:ssg-audit_rules_time_watch_localtime_action:testaction:1 + ocil:ssg-sebool_xserver_execmem_action:testaction:1 - - Verify Root Has A Primary GID 0 + + System Audit Logs Must Be Group Owned By Root - ocil:ssg-accounts_root_gid_zero_action:testaction:1 + ocil:ssg-file_group_ownership_var_log_audit_action:testaction:1 - - Disable the zebra_write_config SELinux Boolean + + Uninstall httpd Package - ocil:ssg-sebool_zebra_write_config_action:testaction:1 + ocil:ssg-package_httpd_removed_action:testaction:1 - - Remove tftp Daemon + + Record Events that Modify User/Group Information - /etc/shadow - ocil:ssg-package_tftp_removed_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_shadow_action:testaction:1 - - Verify User Who Owns passwd File + + Do Not Allow SSH Environment Options - ocil:ssg-file_owner_etc_passwd_action:testaction:1 + ocil:ssg-sshd_do_not_permit_user_env_action:testaction:1 - - Disable the virt_use_fusefs SELinux Boolean + + Enable automatic signing of all modules - ocil:ssg-sebool_virt_use_fusefs_action:testaction:1 + ocil:ssg-kernel_config_module_sig_all_action:testaction:1 - - Configure SSSD to Expire Offline Credentials + + Configure maximum number of process identifiers - ocil:ssg-sssd_offline_cred_expiration_action:testaction:1 + ocil:ssg-sysctl_kernel_pid_max_action:testaction:1 - - Disable Mounting of cramfs + + Disable /dev/kmem virtual device support - ocil:ssg-kernel_module_cramfs_disabled_action:testaction:1 + ocil:ssg-kernel_config_devkmem_action:testaction:1 - - Disable the httpd_can_network_connect_cobbler SELinux Boolean + + Verify /boot/grub2/grub.cfg Group Ownership - ocil:ssg-sebool_httpd_can_network_connect_cobbler_action:testaction:1 + ocil:ssg-file_groupowner_grub2_cfg_action:testaction:1 - - Verify that audit tools are owned by root + + Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit - ocil:ssg-file_ownership_audit_binaries_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_sudoedit_action:testaction:1 - - Configure Auto Configuration on All IPv6 Interfaces By Default + + Disable the gluster_anon_write SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_autoconf_action:testaction:1 + ocil:ssg-sebool_gluster_anon_write_action:testaction:1 - - Disable the httpd_run_preupgrade SELinux Boolean + + Disable the virt_read_qemu_ga_data SELinux Boolean - ocil:ssg-sebool_httpd_run_preupgrade_action:testaction:1 + ocil:ssg-sebool_virt_read_qemu_ga_data_action:testaction:1 - - Disable the wine_mmap_zero_ignore SELinux Boolean + + Ensure auditd Collects File Deletion Events by User - unlinkat - ocil:ssg-sebool_wine_mmap_zero_ignore_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_unlinkat_action:testaction:1 - - Record Any Attempts to Run ssh-agent + + Ensure the Default Umask is Set Correctly For Interactive Users - ocil:ssg-audit_rules_privileged_commands_ssh_agent_action:testaction:1 + ocil:ssg-accounts_umask_interactive_users_action:testaction:1 - - Build and Test AIDE Database + + Install AIDE - ocil:ssg-aide_build_database_action:testaction:1 + ocil:ssg-package_aide_installed_action:testaction:1 - - Enable FIPS Mode + + Add nosuid Option to /home - ocil:ssg-enable_fips_mode_action:testaction:1 + ocil:ssg-mount_option_home_nosuid_action:testaction:1 - - Verify File Hashes with RPM + + Enable auditd Service - ocil:ssg-rpm_verify_hashes_action:testaction:1 + ocil:ssg-service_auditd_enabled_action:testaction:1 - - Uninstall Sendmail Package + + Configure CA certificate for rsyslog remote logging - ocil:ssg-package_sendmail_removed_action:testaction:1 + ocil:ssg-rsyslog_remote_tls_cacert_action:testaction:1 - - Ensure logrotate is Installed + + Install the pcsc-lite package - ocil:ssg-package_logrotate_installed_action:testaction:1 + ocil:ssg-package_pcsc-lite_installed_action:testaction:1 - - Disable the samba_load_libgfapi SELinux Boolean + + Disable the smbd_anon_write SELinux Boolean - ocil:ssg-sebool_samba_load_libgfapi_action:testaction:1 + ocil:ssg-sebool_smbd_anon_write_action:testaction:1 - - SSSD Has a Correct Trust Anchor + + Disable the git_session_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sssd_has_trust_anchor_action:testaction:1 + ocil:ssg-sebool_git_session_bind_all_unreserved_ports_action:testaction:1 - - Uninstall nginx Package + + Ensure auditd Collects Information on Kernel Module Unloading - create_module - ocil:ssg-package_nginx_removed_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_create_action:testaction:1 - - Disable the ftpd_full_access SELinux Boolean + + Ensure '/etc/system-fips' exists - ocil:ssg-sebool_ftpd_full_access_action:testaction:1 + ocil:ssg-etc_system_fips_exists_action:testaction:1 - - A private web server must be located on a separate controlled access subnet + + Install libcap-ng-utils Package - ocil:ssg-httpd_private_server_on_separate_subnet_action:testaction:1 + ocil:ssg-package_libcap-ng-utils_installed_action:testaction:1 - - Verify Owner on cron.weekly + + Use Centralized and Automated Authentication - ocil:ssg-file_owner_cron_weekly_action:testaction:1 + ocil:ssg-account_use_centralized_automated_auth_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - lremovexattr + + Record Attempts to perform maintenance activities - ocil:ssg-audit_rules_dac_modification_lremovexattr_action:testaction:1 + ocil:ssg-audit_sudo_log_events_action:testaction:1 - - Record Attempts to Alter Time Through stime + + Configure Time Service Maxpoll Interval - ocil:ssg-audit_rules_time_stime_action:testaction:1 + ocil:ssg-chronyd_or_ntpd_set_maxpoll_action:testaction:1 - - Disable support for /proc/kkcore + + Ensure there are no legacy + NIS entries in /etc/passwd - ocil:ssg-kernel_config_proc_kcore_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_passwd_action:testaction:1 - - Disable SSH Support for Rhosts RSA Authentication + + Configure auditing of unsuccessful file accesses - ocil:ssg-sshd_disable_rhosts_rsa_action:testaction:1 + ocil:ssg-audit_access_failed_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - truncate + + Disable the mmap_low_allowed SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_truncate_action:testaction:1 + ocil:ssg-sebool_mmap_low_allowed_action:testaction:1 - - Extend Audit Backlog Limit for the Audit Daemon + + Make sure that the dconf databases are up-to-date with regards to respective keyfiles - ocil:ssg-grub2_audit_backlog_limit_argument_action:testaction:1 + ocil:ssg-dconf_db_up_to_date_action:testaction:1 - - Avoid speculative indirect branches in kernel + + Enable cron Service - ocil:ssg-kernel_config_retpoline_action:testaction:1 + ocil:ssg-service_cron_enabled_action:testaction:1 - - Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ + + Log USBGuard daemon audit events using Linux Audit - ocil:ssg-audit_rules_sudoers_d_action:testaction:1 + ocil:ssg-configure_usbguard_auditbackend_action:testaction:1 - - Add nodev Option to Removable Media Partitions + + Enable GSSAPI Authentication - ocil:ssg-mount_option_nodev_removable_partitions_action:testaction:1 + ocil:ssg-sshd_enable_gssapi_auth_action:testaction:1 - - Disable IPv6 Addressing on IPv6 Interfaces by Default + + Build and Test AIDE Database - ocil:ssg-sysctl_net_ipv6_conf_default_disable_ipv6_action:testaction:1 + ocil:ssg-aide_build_database_action:testaction:1 - - Disable vsyscalls + + Disable the openvpn_enable_homedirs SELinux Boolean - ocil:ssg-grub2_vsyscall_argument_action:testaction:1 + ocil:ssg-sebool_openvpn_enable_homedirs_action:testaction:1 - - Enable checks on linked list manipulation + + Disable the puppetmaster_use_db SELinux Boolean - ocil:ssg-kernel_config_debug_list_action:testaction:1 + ocil:ssg-sebool_puppetmaster_use_db_action:testaction:1 - - Verify All Account Password Hashes are Shadowed + + Record Successful Creation Attempts to Files - openat O_CREAT - ocil:ssg-accounts_password_all_shadowed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_o_creat_action:testaction:1 - - Disable the ftpd_use_passive_mode SELinux Boolean + + Disable the polipo_use_nfs SELinux Boolean - ocil:ssg-sebool_ftpd_use_passive_mode_action:testaction:1 + ocil:ssg-sebool_polipo_use_nfs_action:testaction:1 - - Add usrquota Option to /home + + Account Lockouts Must Be Logged - ocil:ssg-mount_option_home_usrquota_action:testaction:1 + ocil:ssg-account_passwords_pam_faillock_audit_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/group + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow - ocil:ssg-audit_rules_etc_group_open_by_handle_at_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_open_by_handle_at_action:testaction:1 - - Disable the sanlock_use_nfs SELinux Boolean + + Uninstall pigz Package - ocil:ssg-sebool_sanlock_use_nfs_action:testaction:1 + ocil:ssg-package_pigz_removed_action:testaction:1 - - Disable the mcelog_client SELinux Boolean + + All User Files and Directories In The Home Directory Must Have Mode 0750 Or Less Permissive - ocil:ssg-sebool_mcelog_client_action:testaction:1 + ocil:ssg-accounts_users_home_files_permissions_action:testaction:1 - - Enable support for BUG() + + Ensure auditd Collects Unauthorized Access Attempts to Files (unsuccessful) - ocil:ssg-kernel_config_bug_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_action:testaction:1 - - Ensure all zIPL boot entries are BLS compliant + + Verify User Who Owns shadow File - ocil:ssg-zipl_bls_entries_only_action:testaction:1 + ocil:ssg-file_owner_etc_shadow_action:testaction:1 - - Configure auditd space_left on Low Disk Space + + Ensure PAM Enforces Password Requirements - Minimum Lowercase Characters - ocil:ssg-auditd_data_retention_space_left_percentage_action:testaction:1 + ocil:ssg-accounts_password_pam_lcredit_action:testaction:1 - - Disable the nfsd_anon_write SELinux Boolean + + Uninstall CUPS Package - ocil:ssg-sebool_nfsd_anon_write_action:testaction:1 + ocil:ssg-package_cups_removed_action:testaction:1 - - Disable the xdm_exec_bootloader SELinux Boolean + + Disable the xguest_use_bluetooth SELinux Boolean - ocil:ssg-sebool_xdm_exec_bootloader_action:testaction:1 + ocil:ssg-sebool_xguest_use_bluetooth_action:testaction:1 - - Disable Avahi Server Software + + Configure AIDE to Verify the Audit Tools - ocil:ssg-service_avahi-daemon_disabled_action:testaction:1 + ocil:ssg-aide_check_audit_tools_action:testaction:1 - - Ensure invoking users password for privilege escalation when using sudo + + Account Lockouts Must Be Logged - ocil:ssg-sudoers_validate_passwd_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_audit_action:testaction:1 - - Disable the mysql_connect_any SELinux Boolean + + All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary Group - ocil:ssg-sebool_mysql_connect_any_action:testaction:1 + ocil:ssg-accounts_users_home_files_groupownership_action:testaction:1 - - Remove the OpenSSH Server Package + + Configure the root Account for Failed Password Attempts - ocil:ssg-package_openssh-server_removed_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_deny_root_action:testaction:1 - - Uninstall vsftpd Package + + Record Unsuccessful Permission Changes to Files - fchmod - ocil:ssg-package_vsftpd_removed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchmod_action:testaction:1 - - Enable the kerberos_enabled SELinux Boolean + + Disable merging of slabs with similar size - ocil:ssg-sebool_kerberos_enabled_action:testaction:1 + ocil:ssg-grub2_slab_nomerge_argument_action:testaction:1 - - Disable the use of user namespaces + + Enable the pcscd Service - ocil:ssg-sysctl_user_max_user_namespaces_action:testaction:1 + ocil:ssg-service_pcscd_enabled_action:testaction:1 - - Ensure that System Accounts Are Locked + + Verify Owner on cron.hourly - ocil:ssg-no_password_auth_for_systemaccounts_action:testaction:1 + ocil:ssg-file_owner_cron_hourly_action:testaction:1 - - Disable the mailman_use_fusefs SELinux Boolean + + Disable IPv6 Addressing on IPv6 Interfaces by Default - ocil:ssg-sebool_mailman_use_fusefs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_disable_ipv6_action:testaction:1 - - Modify the System Message of the Day Banner + + Disable httpd Service - ocil:ssg-banner_etc_motd_action:testaction:1 + ocil:ssg-service_httpd_disabled_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - rename + + User Initialization Files Must Be Owned By the Primary User - ocil:ssg-audit_rules_file_deletion_events_rename_action:testaction:1 + ocil:ssg-accounts_user_dot_user_ownership_action:testaction:1 - - Enable the mount_anyfile SELinux Boolean + + SSSD Has a Correct Trust Anchor - ocil:ssg-sebool_mount_anyfile_action:testaction:1 + ocil:ssg-sssd_has_trust_anchor_action:testaction:1 - - Verify that System Executable Have Root Ownership + + Resolve information before writing to audit logs - ocil:ssg-dir_ownership_binary_dirs_action:testaction:1 + ocil:ssg-auditd_log_format_action:testaction:1 - - Set the UEFI Boot Loader Password + + Verify and Correct Ownership with RPM - ocil:ssg-grub2_uefi_password_action:testaction:1 + ocil:ssg-rpm_verify_ownership_action:testaction:1 - - Disable the httpd_enable_ftp_server SELinux Boolean + + Configure auditing of unsuccessful permission changes - ocil:ssg-sebool_httpd_enable_ftp_server_action:testaction:1 + ocil:ssg-audit_perm_change_failed_action:testaction:1 - - Set existing passwords a period of inactivity before they been locked + + Enable NX or XD Support in the BIOS - ocil:ssg-accounts_set_post_pw_existing_action:testaction:1 + ocil:ssg-bios_enable_execution_restrictions_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Enforce for root User + + Ensure PAM password complexity module is enabled in password-auth - ocil:ssg-accounts_password_pam_enforce_root_action:testaction:1 + ocil:ssg-accounts_password_pam_pwquality_password_auth_action:testaction:1 - - Enable the user_exec_content SELinux Boolean + + Record Events that Modify User/Group Information via openat syscall - /etc/group - ocil:ssg-sebool_user_exec_content_action:testaction:1 + ocil:ssg-audit_rules_etc_group_openat_action:testaction:1 - - All Interactive User Home Directories Must Be Group-Owned By The Primary Group + + Disable the telepathy_connect_all_ports SELinux Boolean - ocil:ssg-file_groupownership_home_directories_action:testaction:1 + ocil:ssg-sebool_telepathy_connect_all_ports_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Different Categories + + Enable Transport Layer Security (TLS) Encryption - ocil:ssg-accounts_password_pam_minclass_action:testaction:1 + ocil:ssg-httpd_configure_tls_action:testaction:1 - - Disable the global_ssp SELinux Boolean + + Disable the tor_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-sebool_global_ssp_action:testaction:1 + ocil:ssg-sebool_tor_bind_all_unreserved_ports_action:testaction:1 - - Disable the ksmtuned_use_cifs SELinux Boolean + + Disable xinetd Service - ocil:ssg-sebool_ksmtuned_use_cifs_action:testaction:1 + ocil:ssg-service_xinetd_disabled_action:testaction:1 - - Record Successful Permission Changes to Files - fremovexattr + + Ensure the audit Subsystem is Installed - ocil:ssg-audit_rules_successful_file_modification_fremovexattr_action:testaction:1 + ocil:ssg-package_audit_installed_action:testaction:1 - - Enable page allocator poisoning + + Disable Ctrl-Alt-Del Reboot Activation - ocil:ssg-grub2_page_poison_argument_action:testaction:1 + ocil:ssg-disable_ctrlaltdel_reboot_action:testaction:1 - - Disable the guest_exec_content SELinux Boolean + + Ensure Chrony is only configured with the server directive - ocil:ssg-sebool_guest_exec_content_action:testaction:1 + ocil:ssg-chronyd_server_directive_action:testaction:1 - - Disable Postfix Network Listening + + Disable the glance_use_fusefs SELinux Boolean - ocil:ssg-postfix_network_listening_disabled_action:testaction:1 + ocil:ssg-sebool_glance_use_fusefs_action:testaction:1 - - Install openscap-scanner Package + + Randomize slab freelist - ocil:ssg-package_openscap-scanner_installed_action:testaction:1 + ocil:ssg-kernel_config_slab_freelist_random_action:testaction:1 - - Disable Anonymous FTP Access + + Verify the UEFI Boot Loader grub.cfg Permissions - ocil:ssg-httpd_disable_anonymous_ftp_access_action:testaction:1 + ocil:ssg-file_permissions_efi_grub2_cfg_action:testaction:1 - - Set SSH Client Alive Count Max to zero + + Record Unsuccessful Permission Changes to Files - fchmodat - ocil:ssg-sshd_set_keepalive_0_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fchmodat_action:testaction:1 - - Verify Permissions on Backup gshadow File + + Enable dnf-automatic Timer - ocil:ssg-file_permissions_backup_etc_gshadow_action:testaction:1 + ocil:ssg-timer_dnf-automatic_enabled_action:testaction:1 - - Enable GSSAPI Authentication + + Ensure /boot Located On Separate Partition - ocil:ssg-sshd_enable_gssapi_auth_action:testaction:1 + ocil:ssg-partition_for_boot_action:testaction:1 - - Enable GNOME3 Login Warning Banner + + Disable Quota Netlink (quota_nld) - ocil:ssg-dconf_gnome_banner_enabled_action:testaction:1 + ocil:ssg-service_quota_nld_disabled_action:testaction:1 - - Assign Expiration Date to Emergency Accounts + + Enable the virt_sandbox_use_audit SELinux Boolean - ocil:ssg-account_emergency_expire_date_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_audit_action:testaction:1 - - Verify Group Who Owns group File + + Web Content Directories Must Not Be Shared Anonymously - ocil:ssg-file_groupowner_etc_group_action:testaction:1 + ocil:ssg-httpd_anonymous_content_sharing_action:testaction:1 - - Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean + + Virus Scanning Software Definitions Are Updated - ocil:ssg-sebool_mozilla_plugin_bind_unreserved_ports_action:testaction:1 + ocil:ssg-mcafee_antivirus_definitions_updated_action:testaction:1 - - Configure auditing of unsuccessful file accesses + + Verify Permissions on cron.weekly - ocil:ssg-audit_access_failed_action:testaction:1 + ocil:ssg-file_permissions_cron_weekly_action:testaction:1 - - Ensure gpgcheck Enabled In Main yum Configuration + + Ensure that User Home Directories are not Group-Writable or World-Readable - ocil:ssg-ensure_gpgcheck_globally_activated_action:testaction:1 + ocil:ssg-file_permissions_home_dirs_action:testaction:1 - - Disable the nis_enabled SELinux Boolean + + Disable the selinuxuser_mysql_connect_enabled SELinux Boolean - ocil:ssg-sebool_nis_enabled_action:testaction:1 + ocil:ssg-sebool_selinuxuser_mysql_connect_enabled_action:testaction:1 - - Limit the Number of Concurrent Login Sessions Allowed Per User + + Disable the httpd_run_stickshift SELinux Boolean - ocil:ssg-accounts_max_concurrent_login_sessions_action:testaction:1 + ocil:ssg-sebool_httpd_run_stickshift_action:testaction:1 - - Enable dnf-automatic Timer + + Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate - ocil:ssg-timer_dnf-automatic_enabled_action:testaction:1 + ocil:ssg-sudo_remove_no_authenticate_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Idle Activation + + Disable the irssi_use_full_network SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_idle_activation_locked_action:testaction:1 + ocil:ssg-sebool_irssi_use_full_network_action:testaction:1 - - Verify /boot/grub2/grub.cfg User Ownership + + Verify All Account Password Hashes are Shadowed with SHA512 - ocil:ssg-file_owner_grub2_cfg_action:testaction:1 + ocil:ssg-accounts_password_all_shadowed_sha512_action:testaction:1 - - Set Default firewalld Zone for Incoming Packets + + Ensure PAM Enforces Password Requirements - Minimum Special Characters - ocil:ssg-set_firewalld_default_zone_action:testaction:1 + ocil:ssg-accounts_password_pam_ocredit_action:testaction:1 - - Ensure the Logon Failure Delay is Set Correctly in login.defs + + Ensure auditd Collects Information on the Use of Privileged Commands - at - ocil:ssg-accounts_logon_fail_delay_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_at_action:testaction:1 - - Enable Public Key Authentication + + Enable GNOME3 Login Warning Banner - ocil:ssg-sshd_enable_pubkey_auth_action:testaction:1 + ocil:ssg-dconf_gnome_banner_enabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - reboot + + Disable SSH Support for .rhosts Files - ocil:ssg-audit_privileged_commands_reboot_action:testaction:1 + ocil:ssg-sshd_disable_rhosts_action:testaction:1 - - Record Any Attempts to Run restorecon + + Enable GNOME3 Screensaver Lock After Idle Period - ocil:ssg-audit_rules_execution_restorecon_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_enabled_action:testaction:1 - - Disable the zabbix_can_network SELinux Boolean + + Configure Multiple DNS Servers in /etc/resolv.conf - ocil:ssg-sebool_zabbix_can_network_action:testaction:1 + ocil:ssg-network_configure_name_resolution_action:testaction:1 - - Verify Permissions on Backup shadow File + + Disable the ftpd_use_fusefs SELinux Boolean - ocil:ssg-file_permissions_backup_etc_shadow_action:testaction:1 + ocil:ssg-sebool_ftpd_use_fusefs_action:testaction:1 - - All GIDs referenced in /etc/passwd must be defined in /etc/group + + Disable the ksmtuned_use_cifs SELinux Boolean - ocil:ssg-gid_passwd_group_same_action:testaction:1 + ocil:ssg-sebool_ksmtuned_use_cifs_action:testaction:1 - - Root Path Must Be Vendor Default + + Disable XDMCP in GDM - ocil:ssg-root_path_default_action:testaction:1 + ocil:ssg-gnome_gdm_disable_xdmcp_action:testaction:1 - - Add nosuid Option to /home + + Verify /boot/efi/EFI/redhat/user.cfg Group Ownership - ocil:ssg-mount_option_home_nosuid_action:testaction:1 + ocil:ssg-file_groupowner_efi_user_cfg_action:testaction:1 - - Ensure rsyslog is Installed + + Disable the gluster_export_all_ro SELinux Boolean - ocil:ssg-package_rsyslog_installed_action:testaction:1 + ocil:ssg-sebool_gluster_export_all_ro_action:testaction:1 - - Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces + + Configure auditing of successful file deletions - ocil:ssg-sysctl_net_ipv4_conf_all_send_redirects_action:testaction:1 + ocil:ssg-audit_delete_success_action:testaction:1 - - Add noexec Option to /var/log + + Ensure System Log Files Have Correct Permissions - ocil:ssg-mount_option_var_log_noexec_action:testaction:1 + ocil:ssg-rsyslog_files_permissions_action:testaction:1 - - Record Successful Permission Changes to Files - removexattr + + Use zero for poisoning instead of debugging value - ocil:ssg-audit_rules_successful_file_modification_removexattr_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_zero_action:testaction:1 - - Enable the logadm_exec_content SELinux Boolean + + Set Password Hashing Algorithm in /etc/login.defs - ocil:ssg-sebool_logadm_exec_content_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_logindefs_action:testaction:1 - - Randomize the address of the kernel image (KASLR) + + Ensure /home Located On Separate Partition - ocil:ssg-kernel_config_randomize_base_action:testaction:1 + ocil:ssg-partition_for_home_action:testaction:1 - - Disable the git_cgi_use_nfs SELinux Boolean + + Verify Owner on crontab - ocil:ssg-sebool_git_cgi_use_nfs_action:testaction:1 + ocil:ssg-file_owner_crontab_action:testaction:1 - - Verify Permissions on /etc/at.allow file + + Configure SSSD to Expire SSH Known Hosts - ocil:ssg-file_permissions_at_allow_action:testaction:1 + ocil:ssg-sssd_ssh_known_hosts_timeout_action:testaction:1 - - Configure opensc Smart Card Drivers + + Record Events that Modify the System's Discretionary Access Controls - chmod - ocil:ssg-configure_opensc_card_drivers_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_chmod_action:testaction:1 - - Configure BIND to use System Crypto Policy + + Ensure Privileged Escalated Commands Cannot Execute Other Commands - sudo NOEXEC - ocil:ssg-configure_bind_crypto_policy_action:testaction:1 + ocil:ssg-sudo_add_noexec_action:testaction:1 - - Ensure All World-Writable Directories Are Group Owned by a System Account + + Set Existing Passwords Warning Age - ocil:ssg-dir_perms_world_writable_system_owned_group_action:testaction:1 + ocil:ssg-accounts_password_set_warn_age_existing_action:testaction:1 - - Disable the named_write_master_zones SELinux Boolean + + Verify ownership of Message of the Day Banner - ocil:ssg-sebool_named_write_master_zones_action:testaction:1 + ocil:ssg-file_owner_etc_motd_action:testaction:1 - - Disable the virt_use_usb SELinux Boolean + + Disable telnet Service - ocil:ssg-sebool_virt_use_usb_action:testaction:1 + ocil:ssg-service_telnet_disabled_action:testaction:1 - - Verify that Shared Library Directories Have Root Group Ownership + + Disable the Automounter - ocil:ssg-dir_group_ownership_library_dirs_action:testaction:1 + ocil:ssg-service_autofs_disabled_action:testaction:1 - - Disable storing core dumps + + Enable the mcelog_exec_scripts SELinux Boolean - ocil:ssg-sysctl_kernel_core_pattern_action:testaction:1 + ocil:ssg-sebool_mcelog_exec_scripts_action:testaction:1 - - Log USBGuard daemon audit events using Linux Audit + + Record Successful Ownership Changes to Files - fchownat - ocil:ssg-configure_usbguard_auditbackend_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchownat_action:testaction:1 - - Ensure Log Files Are Owned By Appropriate Group + + Record Successful Creation Attempts to Files - open_by_handle_at O_CREAT - ocil:ssg-rsyslog_files_groupownership_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_creat_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo + + Add nodev Option to /dev/shm - ocil:ssg-sudo_require_authentication_action:testaction:1 + ocil:ssg-mount_option_dev_shm_nodev_action:testaction:1 - - Set number of Password Hashing Rounds - password-auth + + Use Only FIPS 140-2 Validated MACs - ocil:ssg-accounts_password_pam_unix_rounds_password_auth_action:testaction:1 + ocil:ssg-sshd_use_approved_macs_action:testaction:1 - - Enable SSH Warning Banner + + Enable nails Service - ocil:ssg-sshd_enable_warning_banner_action:testaction:1 + ocil:ssg-service_nails_enabled_action:testaction:1 - - Ensure /var/log/audit Located On Separate Partition + + Verify Group Who Owns Crontab - ocil:ssg-partition_for_var_log_audit_action:testaction:1 + ocil:ssg-file_groupowner_crontab_action:testaction:1 - - Disable the kdumpgui_run_bootloader SELinux Boolean + + Disable the rsync_export_all_ro SELinux Boolean - ocil:ssg-sebool_kdumpgui_run_bootloader_action:testaction:1 + ocil:ssg-sebool_rsync_export_all_ro_action:testaction:1 - - Disable kexec system call + + Limit Users' SSH Access - ocil:ssg-kernel_config_kexec_action:testaction:1 + ocil:ssg-sshd_limit_user_access_action:testaction:1 - - Ensure the Default Bash Umask is Set Correctly + + Ensure that /etc/at.deny does not exist - ocil:ssg-accounts_umask_etc_bashrc_action:testaction:1 + ocil:ssg-file_at_deny_not_exist_action:testaction:1 - - Enable the GNOME3 Login Smartcard Authentication + + Configure System Cryptography Policy - ocil:ssg-dconf_gnome_enable_smartcard_auth_action:testaction:1 + ocil:ssg-configure_crypto_policy_action:testaction:1 - - Disable the httpd_read_user_content SELinux Boolean + + A remote time server for Chrony is configured - ocil:ssg-sebool_httpd_read_user_content_action:testaction:1 + ocil:ssg-chronyd_specify_remote_server_action:testaction:1 - - System Audit Directories Must Be Owned By Root + + All Interactive Users Must Have A Home Directory Defined - ocil:ssg-directory_ownership_var_log_audit_action:testaction:1 + ocil:ssg-accounts_user_interactive_home_directory_defined_action:testaction:1 - - Ensure sudo Runs In A Minimal Environment - sudo env_reset + + Record Events that Modify the System's Discretionary Access Controls - umount2 - ocil:ssg-sudo_add_env_reset_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_umount2_action:testaction:1 - - Ensure /boot Located On Separate Partition + + Prevent Login to Accounts With Empty Password - ocil:ssg-partition_for_boot_action:testaction:1 + ocil:ssg-no_empty_passwords_action:testaction:1 - - Verify User Who Owns /etc/cron.allow file + + Configure SSSD LDAP Backend Client CA Certificate Location - ocil:ssg-file_owner_cron_allow_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_ca_dir_action:testaction:1 - - Verify Who Owns /etc/shells File + + Disable SSH Access via Empty Passwords - ocil:ssg-file_owner_etc_shells_action:testaction:1 + ocil:ssg-sshd_disable_empty_passwords_action:testaction:1 - - Disable the dbadm_manage_user_files SELinux Boolean + + Disable the ftpd_use_cifs SELinux Boolean - ocil:ssg-sebool_dbadm_manage_user_files_action:testaction:1 + ocil:ssg-sebool_ftpd_use_cifs_action:testaction:1 - - Enable the mcelog_exec_scripts SELinux Boolean + + Disable X Windows Startup By Setting Default Target - ocil:ssg-sebool_mcelog_exec_scripts_action:testaction:1 + ocil:ssg-xwindows_runlevel_target_action:testaction:1 - - Uninstall quagga Package + + Encrypt Audit Records Sent With audispd Plugin - ocil:ssg-package_quagga_removed_action:testaction:1 + ocil:ssg-auditd_audispd_encrypt_sent_records_action:testaction:1 - - Install Virus Scanning Software + + Add nodev Option to /home - ocil:ssg-install_antivirus_action:testaction:1 + ocil:ssg-mount_option_home_nodev_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - tallylog + + Verify the system-wide library files in directories +"/lib", "/lib64", "/usr/lib/" and "/usr/lib64" are group-owned by root. - ocil:ssg-audit_rules_login_events_tallylog_action:testaction:1 + ocil:ssg-root_permissions_syslibrary_files_action:testaction:1 - - Disable the smartmon_3ware SELinux Boolean + + Record Events that Modify User/Group Information - /etc/group - ocil:ssg-sebool_smartmon_3ware_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_group_action:testaction:1 - - Configure GNOME3 DConf User Profile + + Record Unsuccessful Access Attempts to Files - open - ocil:ssg-enable_dconf_user_profile_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_action:testaction:1 - - Install the Asset Configuration Compliance Module (ACCM) + + Set GNOME3 Screensaver Lock Delay After Activation Period - ocil:ssg-install_mcafee_hbss_accm_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_delay_action:testaction:1 - - Disable Kernel Parameter for IPv4 Forwarding on all IPv4 Interfaces + + Verify /boot/grub2/user.cfg Group Ownership - ocil:ssg-sysctl_net_ipv4_conf_all_forwarding_action:testaction:1 + ocil:ssg-file_groupowner_user_cfg_action:testaction:1 - - Require Client SMB Packet Signing, if using mount.cifs + + Disable Odd Job Daemon (oddjobd) - ocil:ssg-mount_option_smb_client_signing_action:testaction:1 + ocil:ssg-service_oddjobd_disabled_action:testaction:1 - - Set number of Password Hashing Rounds - system-auth + + Ensure LDAP client is not installed - ocil:ssg-accounts_password_pam_unix_rounds_system_auth_action:testaction:1 + ocil:ssg-package_openldap-clients_removed_action:testaction:1 - - Remove the FreeRadius Server Package + + Disable the lsmd_plugin_connect_any SELinux Boolean - ocil:ssg-package_freeradius_removed_action:testaction:1 + ocil:ssg-sebool_lsmd_plugin_connect_any_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - setxattr + + Disable the httpd_unified SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_setxattr_action:testaction:1 + ocil:ssg-sebool_httpd_unified_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - unlinkat + + Record Events When Executables Are Run As Another User - ocil:ssg-audit_rules_file_deletion_events_unlinkat_action:testaction:1 + ocil:ssg-audit_rules_suid_auid_privilege_function_action:testaction:1 - - Ensure System is Not Acting as a Network Sniffer + + Verify Only Root Has UID 0 - ocil:ssg-network_sniffer_disabled_action:testaction:1 + ocil:ssg-accounts_no_uid_except_zero_action:testaction:1 - - Disable the ssh_chroot_rw_homedirs SELinux Boolean + + Disable the polipo_connect_all_unreserved SELinux Boolean - ocil:ssg-sebool_ssh_chroot_rw_homedirs_action:testaction:1 + ocil:ssg-sebool_polipo_connect_all_unreserved_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Uppercase Characters + + Verify No .forward Files Exist - ocil:ssg-accounts_password_pam_ucredit_action:testaction:1 + ocil:ssg-no_forward_files_action:testaction:1 - - Disable the httpd_dbus_sssd SELinux Boolean + + Add usrquota Option to /home - ocil:ssg-sebool_httpd_dbus_sssd_action:testaction:1 + ocil:ssg-mount_option_home_usrquota_action:testaction:1 - - Disable vsyscalls in zIPL + + Disable the mozilla_plugin_bind_unreserved_ports SELinux Boolean - ocil:ssg-zipl_vsyscall_argument_action:testaction:1 + ocil:ssg-sebool_mozilla_plugin_bind_unreserved_ports_action:testaction:1 - - Add nosuid Option to /boot + + Ensure journald is configured to write log files to persistent disk - ocil:ssg-mount_option_boot_nosuid_action:testaction:1 + ocil:ssg-journald_storage_action:testaction:1 - - Configure the secure_mode_insmod SELinux Boolean + + Prevent Unrestricted Mail Relaying - ocil:ssg-sebool_secure_mode_insmod_action:testaction:1 + ocil:ssg-postfix_prevent_unrestricted_relay_action:testaction:1 - - Record Events When Privileged Executables Are Run + + Configure low address space to protect from user allocation - ocil:ssg-audit_rules_suid_privilege_function_action:testaction:1 + ocil:ssg-kernel_config_default_mmap_min_addr_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Maximum Consecutive Repeating Characters from Same Character Class + + Ensure auditd Collects Information on the Use of Privileged Commands - sudo - ocil:ssg-accounts_password_pam_maxclassrepeat_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_sudo_action:testaction:1 - - Ensure Privileged Escalated Commands Cannot Execute Other Commands - sudo NOEXEC + + Verify Group Ownership of System Login Banner for Remote Connections - ocil:ssg-sudo_add_noexec_action:testaction:1 + ocil:ssg-file_groupowner_etc_issue_net_action:testaction:1 - - Disable the cron_can_relabel SELinux Boolean + + Verify Group Who Owns /etc/at.allow file - ocil:ssg-sebool_cron_can_relabel_action:testaction:1 + ocil:ssg-file_groupowner_at_allow_action:testaction:1 - - Set the Boot Loader Admin Username to a Non-Default Value + + Record Events that Modify the System's Discretionary Access Controls - fchownat - ocil:ssg-grub2_admin_username_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchownat_action:testaction:1 - - A public web server, if hosted on the NIPRNet, must be isolated in an accredited DoD DMZ extension + + Enable Postfix Service - ocil:ssg-httpd_nipr_accredited_dmz_action:testaction:1 + ocil:ssg-service_postfix_enabled_action:testaction:1 - - Disable the staff_use_svirt SELinux Boolean + + Disable the entropyd_use_audio SELinux Boolean - ocil:ssg-sebool_staff_use_svirt_action:testaction:1 + ocil:ssg-sebool_entropyd_use_audio_action:testaction:1 - - Configure A Valid Server Certificate + + Ensure yum Removes Previous Package Versions - ocil:ssg-httpd_configure_valid_server_cert_action:testaction:1 + ocil:ssg-clean_components_post_updating_action:testaction:1 - - Configure auditing of unsuccessful file modifications + + Ensure auditd Collects Information on the Use of Privileged Commands - kmod - ocil:ssg-audit_modify_failed_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_kmod_action:testaction:1 - - Disable acquiring, saving, and processing core dumps + + Verify User Who Owns /var/log/syslog File - ocil:ssg-service_systemd-coredump_disabled_action:testaction:1 + ocil:ssg-file_owner_var_log_syslog_action:testaction:1 - - Use Only FIPS 140-2 Validated Key Exchange Algorithms + + Record Events that Modify the System's Discretionary Access Controls - chown - ocil:ssg-sshd_use_approved_kex_ordered_stig_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_chown_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - postdrop + + Verify Who Owns /etc/shells File - ocil:ssg-audit_rules_privileged_commands_postdrop_action:testaction:1 + ocil:ssg-file_owner_etc_shells_action:testaction:1 - - Record Successful Permission Changes to Files - chmod + + Disable Kernel Parameter for IPv6 Forwarding - ocil:ssg-audit_rules_successful_file_modification_chmod_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_forwarding_action:testaction:1 - - Disable httpd Service + + Disable Printer Browsing Entirely if Possible - ocil:ssg-service_httpd_disabled_action:testaction:1 + ocil:ssg-cups_disable_browsing_action:testaction:1 - - Disable the exim_read_user_files SELinux Boolean + + Implement Blank Screensaver - ocil:ssg-sebool_exim_read_user_files_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_mode_blank_action:testaction:1 - - Make the kernel text and rodata read-only + + Disable the webadm_manage_user_files SELinux Boolean - ocil:ssg-kernel_config_strict_kernel_rwx_action:testaction:1 + ocil:ssg-sebool_webadm_manage_user_files_action:testaction:1 - - Disable the gluster_anon_write SELinux Boolean + + Enable Kernel Parameter to Log Martian Packets on all IPv4 Interfaces - ocil:ssg-sebool_gluster_anon_write_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_log_martians_action:testaction:1 - - Record Successful Permission Changes to Files - fchmodat + + Configure Sending and Accepting Shared Media Redirects by Default - ocil:ssg-audit_rules_successful_file_modification_fchmodat_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_shared_media_action:testaction:1 - - Enable Certmap in SSSD + + Disable the mpd_use_cifs SELinux Boolean - ocil:ssg-sssd_enable_certmap_action:testaction:1 + ocil:ssg-sebool_mpd_use_cifs_action:testaction:1 - - Disable the httpd_can_sendmail SELinux Boolean + + Ensure zIPL bootmap is up to date - ocil:ssg-sebool_httpd_can_sendmail_action:testaction:1 + ocil:ssg-zipl_bootmap_is_up_to_date_action:testaction:1 - - Configure SSH Client to Use FIPS 140-2 Validated Ciphers: openssh.config + + Uninstall geolite2-city Package - ocil:ssg-harden_sshd_ciphers_openssh_conf_crypto_policy_action:testaction:1 + ocil:ssg-package_geolite2-city_removed_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading - init_module + + Verify the SSH Private Key Files Have a Passcode - ocil:ssg-audit_rules_kernel_module_loading_init_action:testaction:1 + ocil:ssg-ssh_keys_passphrase_protected_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - chown + + Disable the sanlock_use_samba SELinux Boolean - ocil:ssg-audit_rules_dac_modification_chown_action:testaction:1 + ocil:ssg-sebool_sanlock_use_samba_action:testaction:1 - - Enable nails Service + + Disable the httpd_can_check_spam SELinux Boolean - ocil:ssg-service_nails_enabled_action:testaction:1 + ocil:ssg-sebool_httpd_can_check_spam_action:testaction:1 - - Verify Ownership on SSH Server Private *_key Key Files + + Disable Kernel iwlmvm Module - ocil:ssg-file_ownership_sshd_private_key_action:testaction:1 + ocil:ssg-kernel_module_iwlmvm_disabled_action:testaction:1 - - Enable logrotate Timer + + Mount Remote Filesystems with Kerberos Security - ocil:ssg-timer_logrotate_enabled_action:testaction:1 + ocil:ssg-mount_option_krb_sec_remote_filesystems_action:testaction:1 - - Configure the selinuxuser_direct_dri_enabled SELinux Boolean + + Set Interval For Counting Failed Password Attempts - ocil:ssg-sebool_selinuxuser_direct_dri_enabled_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_interval_action:testaction:1 - - Disable the fenced_can_ssh SELinux Boolean + + Ensure the Default Bash Umask is Set Correctly - ocil:ssg-sebool_fenced_can_ssh_action:testaction:1 + ocil:ssg-accounts_umask_etc_bashrc_action:testaction:1 - - Disable the gluster_export_all_ro SELinux Boolean + + Disable the abrt_handle_event SELinux Boolean - ocil:ssg-sebool_gluster_export_all_ro_action:testaction:1 + ocil:ssg-sebool_abrt_handle_event_action:testaction:1 - - Disable kernel support for MISC binaries + + Disable the selinuxuser_tcp_server SELinux Boolean - ocil:ssg-kernel_config_binfmt_misc_action:testaction:1 + ocil:ssg-sebool_selinuxuser_tcp_server_action:testaction:1 - - Set Boot Loader Password in grub2 + + Specify module signing key to use - ocil:ssg-grub2_password_action:testaction:1 + ocil:ssg-kernel_config_module_sig_key_action:testaction:1 - - Disable the httpd_use_fusefs SELinux Boolean + + Install libselinux Package - ocil:ssg-sebool_httpd_use_fusefs_action:testaction:1 + ocil:ssg-package_libselinux_installed_action:testaction:1 - - Disable the git_cgi_enable_homedirs SELinux Boolean + + Verify that System Executable Have Root Ownership - ocil:ssg-sebool_git_cgi_enable_homedirs_action:testaction:1 + ocil:ssg-dir_ownership_binary_dirs_action:testaction:1 - - Uninstall libreport-plugin-logger Package + + All User Files and Directories In The Home Directory Must Have a Valid Owner - ocil:ssg-package_libreport-plugin-logger_removed_action:testaction:1 + ocil:ssg-accounts_users_home_files_ownership_action:testaction:1 - - Require Authentication for Emergency Systemd Target + + Disable SSH Server If Possible - ocil:ssg-require_emergency_target_auth_action:testaction:1 + ocil:ssg-service_sshd_disabled_action:testaction:1 - - Disable the selinuxuser_execheap SELinux Boolean + + IOMMU configuration directive - ocil:ssg-sebool_selinuxuser_execheap_action:testaction:1 + ocil:ssg-grub2_enable_iommu_force_action:testaction:1 - - Ensure the Group Used by pam_wheel.so Module Exists on System and is Empty + + Record Successful Delete Attempts to Files - rename - ocil:ssg-ensure_pam_wheel_group_empty_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_rename_action:testaction:1 - - Disable the authlogin_radius SELinux Boolean + + Disable the daemons_use_tty SELinux Boolean - ocil:ssg-sebool_authlogin_radius_action:testaction:1 + ocil:ssg-sebool_daemons_use_tty_action:testaction:1 - - Verify that System Executables Have Root Ownership + + Uninstall geolite2-country Package - ocil:ssg-file_ownership_binary_dirs_action:testaction:1 + ocil:ssg-package_geolite2-country_removed_action:testaction:1 - - Harden OpenSSL Crypto Policy + + Restrict Web Browser Use for Administrative Accounts - ocil:ssg-harden_openssl_crypto_policy_action:testaction:1 + ocil:ssg-no_root_webbrowsing_action:testaction:1 - - Ensure iptables Firewall Rules Exist for All Open Ports + + Strong Stack Protector - ocil:ssg-iptables_rules_for_open_ports_action:testaction:1 + ocil:ssg-kernel_config_stackprotector_strong_action:testaction:1 - - Account Lockouts Must Be Logged + + Verify Group Who Owns shadow File - ocil:ssg-account_passwords_pam_faillock_audit_action:testaction:1 + ocil:ssg-file_groupowner_etc_shadow_action:testaction:1 - - Record Events that Modify the System's Network Environment + + Uninstall abrt-plugin-sosreport Package - ocil:ssg-audit_rules_networkconfig_modification_action:testaction:1 + ocil:ssg-package_abrt-plugin-sosreport_removed_action:testaction:1 - - Use Kerberos Security on All Exports + + Harden SSH client Crypto Policy - ocil:ssg-use_kerberos_security_all_exports_action:testaction:1 + ocil:ssg-harden_ssh_client_crypto_policy_action:testaction:1 - - Disable the glance_use_fusefs SELinux Boolean + + Record Events that Modify the System's Mandatory Access Controls in usr/share - ocil:ssg-sebool_glance_use_fusefs_action:testaction:1 + ocil:ssg-audit_rules_mac_modification_usr_share_action:testaction:1 - - Uninstall rsh Package + + Configure Kernel Parameter for Accepting Secure Redirects By Default - ocil:ssg-package_rsh_removed_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_secure_redirects_action:testaction:1 - - Disable the tmpreaper_use_nfs SELinux Boolean + + Generate some entropy during boot and runtime - ocil:ssg-sebool_tmpreaper_use_nfs_action:testaction:1 + ocil:ssg-kernel_config_gcc_plugin_latent_entropy_action:testaction:1 - - Disable the postgresql_can_rsync SELinux Boolean + + Disable the ksmtuned_use_nfs SELinux Boolean - ocil:ssg-sebool_postgresql_can_rsync_action:testaction:1 + ocil:ssg-sebool_ksmtuned_use_nfs_action:testaction:1 - - Record Successful Permission Changes to Files - lremovexattr + + Set GNOME3 Screensaver Inactivity Timeout - ocil:ssg-audit_rules_successful_file_modification_lremovexattr_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_delay_action:testaction:1 - - Uninstall libreport-plugin-rhtsupport Package + + Ensure Logs Sent To Remote Host - ocil:ssg-package_libreport-plugin-rhtsupport_removed_action:testaction:1 + ocil:ssg-rsyslog_remote_loghost_action:testaction:1 - - Disable Web Content Symbolic Links + + Configure the httpd_enable_cgi SELinux Boolean - ocil:ssg-httpd_disable_content_symlinks_action:testaction:1 + ocil:ssg-sebool_httpd_enable_cgi_action:testaction:1 - - Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces by Default + + Verify No netrc Files Exist - ocil:ssg-sysctl_net_ipv4_conf_default_rp_filter_action:testaction:1 + ocil:ssg-no_netrc_files_action:testaction:1 - - Perform general configuration of Audit for OSPP + + Disable tftp Service - ocil:ssg-audit_ospp_general_action:testaction:1 + ocil:ssg-service_tftp_disabled_action:testaction:1 - - Ensure that /etc/cron.deny does not exist + + Configure audispd's Plugin network_failure_action On Network Failure - ocil:ssg-file_cron_deny_not_exist_action:testaction:1 + ocil:ssg-auditd_audispd_network_failure_action_action:testaction:1 - - Ensure auditd Collects Information on Exporting to Media (successful) + + Disallow Configuration to Bypass Password Requirements for Privilege Escalation - ocil:ssg-audit_rules_media_export_action:testaction:1 + ocil:ssg-disallow_bypass_password_sudo_action:testaction:1 - - Ensure the audit Subsystem is Installed + + Configure firewall to Allow Access to the Web Server - ocil:ssg-package_audit_installed_action:testaction:1 + ocil:ssg-httpd_configure_firewall_action:testaction:1 - - Remove .java And .jpp Files + + Disable the virt_use_sanlock SELinux Boolean - ocil:ssg-httpd_limit_java_files_action:testaction:1 + ocil:ssg-sebool_virt_use_sanlock_action:testaction:1 - - Disable the xserver_execmem SELinux Boolean + + Enforce Usage of pam_wheel with Group Parameter for su Authentication - ocil:ssg-sebool_xserver_execmem_action:testaction:1 + ocil:ssg-use_pam_wheel_group_for_su_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands + + All GIDs referenced in /etc/passwd must be defined in /etc/group - ocil:ssg-audit_rules_privileged_commands_action:testaction:1 + ocil:ssg-gid_passwd_group_same_action:testaction:1 - - Set the GNOME3 Login Warning Banner Text + + Audit Tools Must Be Group-owned by Root - ocil:ssg-dconf_gnome_login_banner_text_action:testaction:1 + ocil:ssg-file_audit_tools_group_ownership_action:testaction:1 - - Add noexec Option to /tmp + + Ensure gpgcheck Enabled for Repository Metadata - ocil:ssg-mount_option_tmp_noexec_action:testaction:1 + ocil:ssg-ensure_gpgcheck_repo_metadata_action:testaction:1 - - Enable SSH Server firewalld Firewall Exception + + Record Unsuccessful Creation Attempts to Files - open O_CREAT - ocil:ssg-firewalld_sshd_port_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_creat_action:testaction:1 - - Disable the swift_can_network SELinux Boolean + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-sebool_swift_can_network_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_pinfo_action:testaction:1 - - User Initialization Files Must Not Run World-Writable Programs + + Disable SCTP Support - ocil:ssg-accounts_user_dot_no_world_writable_programs_action:testaction:1 + ocil:ssg-kernel_module_sctp_disabled_action:testaction:1 - - Enable HTTPD LogLevel + + Uninstall iprutils Package - ocil:ssg-httpd_enable_loglevel_action:testaction:1 + ocil:ssg-package_iprutils_removed_action:testaction:1 - - Uninstall openldap-servers Package + + Set Default iptables Policy for Forwarded Packets - ocil:ssg-package_openldap-servers_removed_action:testaction:1 + ocil:ssg-set_iptables_default_rule_forward_action:testaction:1 - - Ensure SELinux Not Disabled in zIPL + + Ensure auditd Collects Information on the Use of Privileged Commands - init - ocil:ssg-zipl_enable_selinux_action:testaction:1 + ocil:ssg-audit_privileged_commands_init_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fchmodat + + Install the cron service - ocil:ssg-audit_rules_unsuccessful_file_modification_fchmodat_action:testaction:1 + ocil:ssg-package_cron_installed_action:testaction:1 - - Enable the NTP Daemon + + Ensure there are no legacy + NIS entries in /etc/shadow - ocil:ssg-service_chronyd_or_ntpd_enabled_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_shadow_action:testaction:1 - - Make sure that the dconf databases are up-to-date with regards to respective keyfiles + + Enable the nfs_export_all_ro SELinux Boolean - ocil:ssg-dconf_db_up_to_date_action:testaction:1 + ocil:ssg-sebool_nfs_export_all_ro_action:testaction:1 - - Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv6 Interfaces + + Disable mutable hooks - ocil:ssg-sysctl_net_ipv6_conf_default_accept_redirects_action:testaction:1 + ocil:ssg-kernel_config_security_writable_hooks_action:testaction:1 - - Configure the httpd_builtin_scripting SELinux Boolean + + Record Successful Access Attempts to Files - truncate - ocil:ssg-sebool_httpd_builtin_scripting_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_truncate_action:testaction:1 - - Record Successful Access Attempts to Files - open_by_handle_at + + Disable Ctrl-Alt-Del Reboot Key Sequence in GNOME3 - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_action:testaction:1 + ocil:ssg-dconf_gnome_disable_ctrlaltdel_reboot_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - lchown + + Uninstall vsftpd Package - ocil:ssg-audit_rules_unsuccessful_file_modification_lchown_action:testaction:1 + ocil:ssg-package_vsftpd_removed_action:testaction:1 - - Disable Printer Browsing Entirely if Possible + + Disable acquiring, saving, and processing core dumps - ocil:ssg-cups_disable_browsing_action:testaction:1 + ocil:ssg-service_systemd-coredump_disabled_action:testaction:1 - - Enable Kernel Parameter to Use TCP RFC 1337 on IPv4 Interfaces + + Configure TLS for rsyslog remote logging - ocil:ssg-sysctl_net_ipv4_tcp_rfc1337_action:testaction:1 + ocil:ssg-rsyslog_remote_tls_action:testaction:1 - - Enable Auditing for Processes Which Start Prior to the Audit Daemon + + Disable the httpd_manage_ipa SELinux Boolean - ocil:ssg-grub2_audit_argument_action:testaction:1 + ocil:ssg-sebool_httpd_manage_ipa_action:testaction:1 - - Disable Core Dumps for SUID programs + + Verify Group Who Owns /var/log/syslog File - ocil:ssg-sysctl_fs_suid_dumpable_action:testaction:1 + ocil:ssg-file_groupowner_var_log_syslog_action:testaction:1 - - Prevent Routing External Traffic to Local Loopback on All IPv4 Interfaces + + Disable the gpg_web_anon_write SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_route_localnet_action:testaction:1 + ocil:ssg-sebool_gpg_web_anon_write_action:testaction:1 - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces + + Disable the fcron_crond SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_max_addresses_action:testaction:1 + ocil:ssg-sebool_fcron_crond_action:testaction:1 - - Disable Accepting ICMP Redirects for All IPv4 Interfaces + + Configure System to Forward All Mail through a specific host - ocil:ssg-sysctl_net_ipv4_conf_all_accept_redirects_action:testaction:1 + ocil:ssg-postfix_client_configure_relayhost_action:testaction:1 - - Install fapolicyd Package + + SSH client uses strong entropy to seed (Bash-like shells) - ocil:ssg-package_fapolicyd_installed_action:testaction:1 + ocil:ssg-ssh_client_use_strong_rng_sh_action:testaction:1 - - Configure auditd Disk Error Action on Disk Error + + Verify Owner on cron.daily - ocil:ssg-auditd_data_disk_error_action_action:testaction:1 + ocil:ssg-file_owner_cron_daily_action:testaction:1 - - Ensure auditd Rules For Unauthorized Attempts To open Are Ordered Correctly + + Prevent remote hosts from connecting to the proxy display - ocil:ssg-audit_rules_unsuccessful_file_modification_open_rule_order_action:testaction:1 + ocil:ssg-sshd_x11_use_localhost_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fchmod + + Ensure sudo umask is appropriate - sudo umask - ocil:ssg-audit_rules_unsuccessful_file_modification_fchmod_action:testaction:1 + ocil:ssg-sudo_add_umask_action:testaction:1 - - Set PAM''s Password Hashing Algorithm - password-auth + + Enable the File Access Policy Service - ocil:ssg-set_password_hashing_algorithm_passwordauth_action:testaction:1 + ocil:ssg-service_fapolicyd_enabled_action:testaction:1 - - Disable the glance_api_can_network SELinux Boolean + + Configure Kerberos to use System Crypto Policy - ocil:ssg-sebool_glance_api_can_network_action:testaction:1 + ocil:ssg-configure_kerberos_crypto_policy_action:testaction:1 - - Disable the varnishd_connect_any SELinux Boolean + + All Interactive User Home Directories Must Be Group-Owned By The Primary Group - ocil:ssg-sebool_varnishd_connect_any_action:testaction:1 + ocil:ssg-file_groupownership_home_directories_action:testaction:1 - - Enable cron Service + + Uninstall gssproxy Package - ocil:ssg-service_crond_enabled_action:testaction:1 + ocil:ssg-package_gssproxy_removed_action:testaction:1 - - Verify Permissions on /var/log/syslog File + + Uninstall Sendmail Package - ocil:ssg-file_permissions_var_log_syslog_action:testaction:1 + ocil:ssg-package_sendmail_removed_action:testaction:1 - - Configure Periodic Execution of AIDE + + Limit CPU consumption of the Perf system - ocil:ssg-aide_periodic_cron_checking_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_cpu_time_max_percent_action:testaction:1 - - Verify Group Who Owns cron.weekly + + Record Successful Permission Changes to Files - fchmod - ocil:ssg-file_groupowner_cron_weekly_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchmod_action:testaction:1 - - Uninstall tftp-server Package + + Verify Owner on SSH Server config file - ocil:ssg-package_tftp-server_removed_action:testaction:1 + ocil:ssg-file_owner_sshd_config_action:testaction:1 - - Enable HTTPD System Logging + + Ensure PAM password complexity module is enabled in system-auth - ocil:ssg-httpd_enable_system_logging_action:testaction:1 + ocil:ssg-accounts_password_pam_pwquality_system_auth_action:testaction:1 - - Disable LDAP Server (slapd) + + Disable ATM Support - ocil:ssg-service_slapd_disabled_action:testaction:1 + ocil:ssg-kernel_module_atm_disabled_action:testaction:1 - - Enable auditd Service + + Record Any Attempts to Run setsebool - ocil:ssg-service_auditd_enabled_action:testaction:1 + ocil:ssg-audit_rules_execution_setsebool_action:testaction:1 - - Add nosuid Option to Removable Media Partitions + + Disable the sge_domain_can_network_connect SELinux Boolean - ocil:ssg-mount_option_nosuid_removable_partitions_action:testaction:1 + ocil:ssg-sebool_sge_domain_can_network_connect_action:testaction:1 - - Disable Kernel iwlmvm Module + + Limit Password Reuse - ocil:ssg-kernel_module_iwlmvm_disabled_action:testaction:1 + ocil:ssg-accounts_password_pam_unix_remember_action:testaction:1 - - MIME types for csh or sh shell programs must be disabled + + Specify a Remote NTP Server - ocil:ssg-httpd_disable_mime_types_action:testaction:1 + ocil:ssg-chronyd_or_ntpd_specify_remote_server_action:testaction:1 - - Ensure the Default Umask is Set Correctly For Interactive Users + + Set Permissions on All Configuration Files Inside /etc/httpd/conf.modules.d/ - ocil:ssg-accounts_umask_interactive_users_action:testaction:1 + ocil:ssg-file_permissions_httpd_server_modules_files_action:testaction:1 - - Record Successful Delete Attempts to Files - unlinkat + + Enable the postgresql_selinux_unconfined_dbadm SELinux Boolean - ocil:ssg-audit_rules_successful_file_modification_unlinkat_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_unconfined_dbadm_action:testaction:1 - - SSH client uses strong entropy to seed (Bash-like shells) + + Disable the httpd_can_sendmail SELinux Boolean - ocil:ssg-ssh_client_use_strong_rng_sh_action:testaction:1 + ocil:ssg-sebool_httpd_can_sendmail_action:testaction:1 - - Record Successful Ownership Changes to Files - chown + + System Audit Logs Must Have Mode 0640 or Less Permissive - ocil:ssg-audit_rules_successful_file_modification_chown_action:testaction:1 + ocil:ssg-file_permissions_var_log_audit_action:testaction:1 - - Audit Configuration Files Must Be Owned By Group root + + Disable anacron Service - ocil:ssg-file_groupownership_audit_configuration_action:testaction:1 + ocil:ssg-disable_anacron_action:testaction:1 - - Configure LDAP Client to Use TLS For All Transactions + + Verify /boot/grub2/user.cfg Permissions - ocil:ssg-ldap_client_start_tls_action:testaction:1 + ocil:ssg-file_permissions_user_cfg_action:testaction:1 - - Prevent applications from mapping low portion of virtual memory + + Ensure sudo Runs In A Minimal Environment - sudo env_reset - ocil:ssg-sysctl_vm_mmap_min_addr_action:testaction:1 + ocil:ssg-sudo_add_env_reset_action:testaction:1 - - Uninstall rsh-server Package + + Disable the httpd_sys_script_anon_write SELinux Boolean - ocil:ssg-package_rsh-server_removed_action:testaction:1 + ocil:ssg-sebool_httpd_sys_script_anon_write_action:testaction:1 - - Verify Group Who Owns Backup gshadow File + + Record Any Attempts to Run restorecon - ocil:ssg-file_groupowner_backup_etc_gshadow_action:testaction:1 + ocil:ssg-audit_rules_execution_restorecon_action:testaction:1 - - Verify Group Who Owns Crontab + + Install the Host Intrusion Prevention System (HIPS) Module - ocil:ssg-file_groupowner_crontab_action:testaction:1 + ocil:ssg-package_MFEhiplsm_installed_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session + + Disable the selinuxuser_execheap SELinux Boolean - ocil:ssg-accounts_password_pam_retry_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execheap_action:testaction:1 - - Disable hibernation + + Configure SSSD's Memory Cache to Expire - ocil:ssg-kernel_config_hibernation_action:testaction:1 + ocil:ssg-sssd_memcache_timeout_action:testaction:1 - - Configure low address space to protect from user allocation + + Disable Core Dumps for SUID programs - ocil:ssg-kernel_config_default_mmap_min_addr_action:testaction:1 + ocil:ssg-sysctl_fs_suid_dumpable_action:testaction:1 - - Add nodev Option to /boot + + Set Default ip6tables Policy for Incoming Packets - ocil:ssg-mount_option_boot_nodev_action:testaction:1 + ocil:ssg-set_ip6tables_default_rule_action:testaction:1 - - Disable the rsync_anon_write SELinux Boolean + + Add noexec Option to /tmp - ocil:ssg-sebool_rsync_anon_write_action:testaction:1 + ocil:ssg-mount_option_tmp_noexec_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_chkpwd + + Ensure auditd Collects File Deletion Events by User - rename - ocil:ssg-audit_rules_privileged_commands_unix_chkpwd_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_rename_action:testaction:1 - - Enable the staff_exec_content SELinux Boolean + + Verify Group Who Owns cron.monthly - ocil:ssg-sebool_staff_exec_content_action:testaction:1 + ocil:ssg-file_groupowner_cron_monthly_action:testaction:1 - - Disable WIFI Network Notification in GNOME3 + + Record Unsuccessful Delete Attempts to Files - unlinkat - ocil:ssg-dconf_gnome_disable_wifi_notification_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_unlinkat_action:testaction:1 - - Enable NX or XD Support in the BIOS + + Verify Permissions on /var/log/syslog File - ocil:ssg-bios_enable_execution_restrictions_action:testaction:1 + ocil:ssg-file_permissions_var_log_syslog_action:testaction:1 - - Enable checks on scatter-gather (SG) table operations + + Remove Write Permissions From Filesystem Paths And Server Scripts - ocil:ssg-kernel_config_debug_sg_action:testaction:1 + ocil:ssg-httpd_configure_script_permissions_action:testaction:1 - - Disable Core Dumps for All Users + + Configure auditing of successful file creations - ocil:ssg-disable_users_coredumps_action:testaction:1 + ocil:ssg-audit_create_success_action:testaction:1 - - Disable the samba_enable_home_dirs SELinux Boolean + + Disable the ftpd_full_access SELinux Boolean - ocil:ssg-sebool_samba_enable_home_dirs_action:testaction:1 + ocil:ssg-sebool_ftpd_full_access_action:testaction:1 - - Configure Time Service Maxpoll Interval + + Record Any Attempts to Run setfiles - ocil:ssg-chronyd_or_ntpd_set_maxpoll_action:testaction:1 + ocil:ssg-audit_rules_execution_setfiles_action:testaction:1 - - Configure auditd Disk Error Action on Disk Error + + Install tar Package - ocil:ssg-auditd_data_disk_error_action_stig_action:testaction:1 + ocil:ssg-package_tar_installed_action:testaction:1 - - Disable compatibility with brk() + + Enable support for BUG() - ocil:ssg-kernel_config_compat_brk_action:testaction:1 + ocil:ssg-kernel_config_bug_action:testaction:1 - - Add noauto Option to /boot + + Configure auditing of successful file modifications - ocil:ssg-mount_option_boot_noauto_action:testaction:1 + ocil:ssg-audit_modify_success_action:testaction:1 - - Enable HTTPD Error Logging + + Disable the httpd_use_nfs SELinux Boolean - ocil:ssg-httpd_enable_error_logging_action:testaction:1 + ocil:ssg-sebool_httpd_use_nfs_action:testaction:1 - - Set Password Minimum Length in login.defs + + Record Successful Creation Attempts to Files - openat O_TRUNC_WRITE - ocil:ssg-accounts_password_minlen_login_defs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_o_trunc_write_action:testaction:1 - - Configure auditd admin_space_left on Low Disk Space + + Verify Group Who Owns cron.weekly - ocil:ssg-auditd_data_retention_admin_space_left_percentage_action:testaction:1 + ocil:ssg-file_groupowner_cron_weekly_action:testaction:1 - - Verify that Shared Library Directories Have Root Ownership + + Ensure All World-Writable Directories Are Owned by a System Account - ocil:ssg-dir_ownership_library_dirs_action:testaction:1 + ocil:ssg-dir_perms_world_writable_system_owned_action:testaction:1 - - Record Attempts to Alter Logon and Logout Events - faillock + + Ensure auditd Collects Information on the Use of Privileged Commands - postqueue - ocil:ssg-audit_rules_login_events_faillock_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_postqueue_action:testaction:1 - - Enable the xend_run_qemu SELinux Boolean + + Encrypt All File Uploads - ocil:ssg-sebool_xend_run_qemu_action:testaction:1 + ocil:ssg-httpd_encrypt_file_uploads_action:testaction:1 - - Disable the samba_share_fusefs SELinux Boolean + + Disable Software RAID Monitor (mdmonitor) - ocil:ssg-sebool_samba_share_fusefs_action:testaction:1 + ocil:ssg-service_mdmonitor_disabled_action:testaction:1 - - Configure auditd Number of Logs Retained + + Ensure All World-Writable Directories Are Owned by root User - ocil:ssg-auditd_data_retention_num_logs_action:testaction:1 + ocil:ssg-dir_perms_world_writable_root_owned_action:testaction:1 - - Ensure network interfaces are assigned to appropriate zone + + Configure auditd max_log_file_action Upon Reaching Maximum Log Size - ocil:ssg-set_firewalld_appropriate_zone_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action_action:testaction:1 - - Install the pcsc-lite package + + Disable the virt_sandbox_use_mknod SELinux Boolean - ocil:ssg-package_pcsc-lite_installed_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_mknod_action:testaction:1 - - Disable GDM Automatic Login + + All Interactive User Home Directories Must Be Owned By The Primary User - ocil:ssg-gnome_gdm_disable_automatic_login_action:testaction:1 + ocil:ssg-file_ownership_home_directories_action:testaction:1 - - Verify and Correct File Permissions with RPM + + Configure Accepting Router Advertisements on All IPv6 Interfaces - ocil:ssg-rpm_verify_permissions_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_action:testaction:1 - - Configure auditd Max Log File Size + + Disable systemd-journal-remote Socket - ocil:ssg-auditd_data_retention_max_log_file_action:testaction:1 + ocil:ssg-socket_systemd-journal-remote_disabled_action:testaction:1 - - All Interactive User Home Directories Must Have mode 0750 Or Less Permissive + + Enforce usage of pam_wheel for su authentication - ocil:ssg-file_permissions_home_directories_action:testaction:1 + ocil:ssg-use_pam_wheel_for_su_action:testaction:1 - - Ensure Default SNMP Password Is Not Used + + Configure auditd space_left on Low Disk Space - ocil:ssg-snmpd_not_default_password_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_percentage_action:testaction:1 - - Uninstall krb5-workstation Package + + Disable WIFI Network Connection Creation in GNOME3 - ocil:ssg-package_krb5-workstation_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_wifi_create_action:testaction:1 - - Encrypt All File Uploads + + Disable the minidlna_read_generic_user_content SELinux Boolean - ocil:ssg-httpd_encrypt_file_uploads_action:testaction:1 + ocil:ssg-sebool_minidlna_read_generic_user_content_action:testaction:1 - - Record Successful Access Attempts to Files - openat + + Verify Permissions on SSH Server Private *_key Key Files - ocil:ssg-audit_rules_successful_file_modification_openat_action:testaction:1 + ocil:ssg-file_permissions_sshd_private_key_action:testaction:1 - - Disable the telepathy_connect_all_ports SELinux Boolean + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/gshadow - ocil:ssg-sebool_telepathy_connect_all_ports_action:testaction:1 + ocil:ssg-audit_rules_etc_gshadow_open_by_handle_at_action:testaction:1 - - Enable Auditing to Start Prior to the Audit Daemon in zIPL + + Disable the zabbix_can_network SELinux Boolean - ocil:ssg-zipl_audit_argument_action:testaction:1 + ocil:ssg-sebool_zabbix_can_network_action:testaction:1 - - Verify nftables Service is Enabled + + Record Unsuccessful Delete Attempts to Files - renameat - ocil:ssg-service_nftables_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_renameat_action:testaction:1 - - Ensure Rsyslog Encrypts Off-Loaded Audit Records + + Record Events that Modify User/Group Information - /etc/passwd - ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdrivermode_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_passwd_action:testaction:1 - - Ensure rsyslog Default File Permissions Configured + + Avoid speculative indirect branches in kernel - ocil:ssg-rsyslog_filecreatemode_action:testaction:1 + ocil:ssg-kernel_config_retpoline_action:testaction:1 - - Disable the postgresql_selinux_transmit_client_label SELinux Boolean + + Record Attempts to Alter Logon and Logout Events - tallylog - ocil:ssg-sebool_postgresql_selinux_transmit_client_label_action:testaction:1 + ocil:ssg-audit_rules_login_events_tallylog_action:testaction:1 - - Uninstall Samba Package + + Set kernel parameter 'crypto.fips_enabled' to 1 - ocil:ssg-package_samba_removed_action:testaction:1 + ocil:ssg-sysctl_crypto_fips_enabled_action:testaction:1 - - User Initialization Files Must Be Group-Owned By The Primary Group + + Record Any Attempts to Run semanage - ocil:ssg-accounts_user_dot_group_ownership_action:testaction:1 + ocil:ssg-audit_rules_execution_semanage_action:testaction:1 - - Enable syslog-ng Service + + Ensure that Root's Path Does Not Include World or Group-Writable Directories - ocil:ssg-service_syslogng_enabled_action:testaction:1 + ocil:ssg-accounts_root_path_dirs_no_write_action:testaction:1 - - Set Existing Passwords Minimum Age + + Mount Remote Filesystems with nosuid - ocil:ssg-accounts_password_set_min_life_existing_action:testaction:1 + ocil:ssg-mount_option_nosuid_remote_filesystems_action:testaction:1 - - Set SSH MaxSessions limit + + Disable Power Settings in GNOME3 - ocil:ssg-sshd_set_max_sessions_action:testaction:1 + ocil:ssg-dconf_gnome_disable_power_settings_action:testaction:1 - - Disable the zarafa_setrlimit SELinux Boolean + + Set SSH Client Alive Count Max - ocil:ssg-sebool_zarafa_setrlimit_action:testaction:1 + ocil:ssg-sshd_set_keepalive_action:testaction:1 - - Install the SSSD Package + + Warn on W+X mappings found at boot - ocil:ssg-package_sssd_installed_action:testaction:1 + ocil:ssg-kernel_config_debug_wx_action:testaction:1 - - Enforce Usage of pam_wheel with Group Parameter for su Authentication + + Disable Accepting Packets Routed Between Local Interfaces - ocil:ssg-use_pam_wheel_group_for_su_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_accept_local_action:testaction:1 - - Ensure No Daemons are Unconfined by SELinux + + Remove Rsh Trust Files - ocil:ssg-selinux_confinement_of_daemons_action:testaction:1 + ocil:ssg-no_rsh_trust_files_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - openat + + Record Events that Modify the System's Discretionary Access Controls - fchown - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchown_action:testaction:1 - - Enable cron Service + + Disable GNOME3 Automount Opening - ocil:ssg-service_cron_enabled_action:testaction:1 + ocil:ssg-dconf_gnome_disable_automount_open_action:testaction:1 - - Enable the selinuxuser_execmod SELinux Boolean + + SSH client uses strong entropy to seed (for CSH like shells) - ocil:ssg-sebool_selinuxuser_execmod_action:testaction:1 + ocil:ssg-ssh_client_use_strong_rng_csh_action:testaction:1 - - Verify ufw Enabled + + Record Unsuccessful Modification Attempts to Files - open_by_handle_at O_TRUNC_WRITE - ocil:ssg-service_ufw_enabled_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 - - Lock Accounts After Failed Password Attempts + + Record Successful Creation Attempts to Files - open_by_handle_at O_TRUNC_WRITE - ocil:ssg-accounts_passwords_pam_faillock_deny_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 - - Enable the virt_sandbox_use_audit SELinux Boolean + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - ocil:ssg-sebool_virt_sandbox_use_audit_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_action:testaction:1 - - Disallow merge of slab caches + + The robots.txt Files Must Not Exist - ocil:ssg-kernel_config_slab_merge_default_action:testaction:1 + ocil:ssg-httpd_remove_robots_file_action:testaction:1 - - Ensure the default plugins for the audit dispatcher are Installed + + Uninstall rpcbind Package - ocil:ssg-package_audit-audispd-plugins_installed_action:testaction:1 + ocil:ssg-package_rpcbind_removed_action:testaction:1 - - Disable the httpd_can_connect_ftp SELinux Boolean + + Disable GNOME3 Automount running - ocil:ssg-sebool_httpd_can_connect_ftp_action:testaction:1 + ocil:ssg-dconf_gnome_disable_autorun_action:testaction:1 - - Uninstall geolite2-country Package + + Add nodev Option to /var/tmp - ocil:ssg-package_geolite2-country_removed_action:testaction:1 + ocil:ssg-mount_option_var_tmp_nodev_action:testaction:1 - - Disable the virt_use_samba SELinux Boolean + + Ensure Log Files Are Owned By Appropriate User - ocil:ssg-sebool_virt_use_samba_action:testaction:1 + ocil:ssg-rsyslog_files_ownership_action:testaction:1 - - Record Successful Permission Changes to Files - fsetxattr + + Configure L1 Terminal Fault mitigations - ocil:ssg-audit_rules_successful_file_modification_fsetxattr_action:testaction:1 + ocil:ssg-grub2_l1tf_argument_action:testaction:1 - - Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces By Default + + Record Successful Access Attempts to Files - ftruncate - ocil:ssg-sysctl_net_ipv6_conf_default_max_addresses_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_ftruncate_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - userhelper + + Disable the samba_run_unconfined SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_userhelper_action:testaction:1 + ocil:ssg-sebool_samba_run_unconfined_action:testaction:1 - - Don't target root user in the sudoers file + + Disable the zoneminder_anon_write SELinux Boolean - ocil:ssg-sudoers_no_root_target_action:testaction:1 + ocil:ssg-sebool_zoneminder_anon_write_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/gshadow + + Disable the mailman_use_fusefs SELinux Boolean - ocil:ssg-audit_rules_usergroup_modification_gshadow_action:testaction:1 + ocil:ssg-sebool_mailman_use_fusefs_action:testaction:1 - - Disable the cluster_can_network_connect SELinux Boolean + + Enable Smartcards in SSSD - ocil:ssg-sebool_cluster_can_network_connect_action:testaction:1 + ocil:ssg-sssd_enable_smartcards_action:testaction:1 - - Configure Response Mode of ARP Requests for All IPv4 Interfaces + + Disable the kdumpgui_run_bootloader SELinux Boolean - ocil:ssg-sysctl_net_ipv4_conf_all_arp_ignore_action:testaction:1 + ocil:ssg-sebool_kdumpgui_run_bootloader_action:testaction:1 - - Disable the CUPS Service + + Remove the X Windows Package Group - ocil:ssg-service_cups_disabled_action:testaction:1 + ocil:ssg-package_xorg-x11-server-common_removed_action:testaction:1 - - Configure Denying Router Solicitations on All IPv6 Interfaces + + Disable the xdm_bind_vnc_tcp_port SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_router_solicitations_action:testaction:1 + ocil:ssg-sebool_xdm_bind_vnc_tcp_port_action:testaction:1 - - Add nodev Option to /var/log/audit + + Uninstall ypserv Package - ocil:ssg-mount_option_var_log_audit_nodev_action:testaction:1 + ocil:ssg-package_ypserv_removed_action:testaction:1 - - Enable ExecShield via sysctl + + Ensure Insecure File Locking is Not Allowed - ocil:ssg-sysctl_kernel_exec_shield_action:testaction:1 + ocil:ssg-no_insecure_locks_exports_action:testaction:1 - - Disable core dump backtraces + + Record Successful Delete Attempts to Files - renameat - ocil:ssg-coredump_disable_backtraces_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_renameat_action:testaction:1 - - Configure immutable Audit login UIDs + + Verify File Hashes with RPM - ocil:ssg-audit_immutable_login_uids_action:testaction:1 + ocil:ssg-rpm_verify_hashes_action:testaction:1 - - Disable Host-Based Authentication + + Enable HTTPD LogLevel - ocil:ssg-disable_host_auth_action:testaction:1 + ocil:ssg-httpd_enable_loglevel_action:testaction:1 - - Ensure SMAP is not disabled during boot + + Ensure /var/tmp Located On Separate Partition - ocil:ssg-grub2_nosmap_argument_absent_action:testaction:1 + ocil:ssg-partition_for_var_tmp_action:testaction:1 - - Configure Polyinstantiation of /var/tmp Directories + + Set Password Hashing Algorithm in /etc/libuser.conf - ocil:ssg-accounts_polyinstantiated_var_tmp_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_libuserconf_action:testaction:1 - - Restrict Virtual Console Root Logins + + Configure Libreswan to use System Crypto Policy - ocil:ssg-securetty_root_login_console_only_action:testaction:1 + ocil:ssg-configure_libreswan_crypto_policy_action:testaction:1 - - Add nodev Option to /var + + Ensure auditd Collects Information on the Use of Privileged Commands - poweroff - ocil:ssg-mount_option_var_nodev_action:testaction:1 + ocil:ssg-audit_privileged_commands_poweroff_action:testaction:1 - - Disable the container_connect_any SELinux Boolean + + Firewalld Must Employ a Deny-all, Allow-by-exception Policy for Allowing Connections to Other Systems - ocil:ssg-sebool_container_connect_any_action:testaction:1 + ocil:ssg-configured_firewalld_default_deny_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - open O_TRUNC_WRITE + + Set Password Maximum Age - ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_trunc_write_action:testaction:1 + ocil:ssg-accounts_maximum_age_login_defs_action:testaction:1 - - Ensure ip6tables Firewall Rules Exist for All Open Ports + + Disable the exim_can_connect_db SELinux Boolean - ocil:ssg-ip6tables_rules_for_open_ports_action:testaction:1 + ocil:ssg-sebool_exim_can_connect_db_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/passwd + + Enable the auditadm_exec_content SELinux Boolean - ocil:ssg-audit_rules_etc_passwd_openat_action:testaction:1 + ocil:ssg-sebool_auditadm_exec_content_action:testaction:1 - - Record Any Attempts to Run setsebool + + Configure immutable Audit login UIDs - ocil:ssg-audit_rules_execution_setsebool_action:testaction:1 + ocil:ssg-audit_rules_immutable_login_uids_action:testaction:1 - - Configure auditing of successful file deletions + + The mailx Package Is Installed - ocil:ssg-audit_delete_success_action:testaction:1 + ocil:ssg-package_mailx_installed_action:testaction:1 - - Disable the dbadm_read_user_files SELinux Boolean + + Install systemd-journal-remote Package - ocil:ssg-sebool_dbadm_read_user_files_action:testaction:1 + ocil:ssg-package_systemd-journal-remote_installed_action:testaction:1 - - Verify and Correct Ownership with RPM + + Record Successful Access Attempts to Files - creat - ocil:ssg-rpm_verify_ownership_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_creat_action:testaction:1 - - Disable the mozilla_plugin_use_spice SELinux Boolean + + Encrypt Partitions - ocil:ssg-sebool_mozilla_plugin_use_spice_action:testaction:1 + ocil:ssg-encrypt_partitions_action:testaction:1 - - Install crypto-policies package + + System Audit Directories Must Be Owned By Root - ocil:ssg-package_crypto-policies_installed_action:testaction:1 + ocil:ssg-directory_ownership_var_log_audit_action:testaction:1 - - Do Not Show System Messages When Unsuccessful Logon Attempts Occur + + Disable the zarafa_setrlimit SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_silent_action:testaction:1 + ocil:ssg-sebool_zarafa_setrlimit_action:testaction:1 - - Disable the httpd_can_check_spam SELinux Boolean + + Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly - ocil:ssg-sebool_httpd_can_check_spam_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_rule_order_action:testaction:1 - - Include Local Events in Audit Logs + + Configure Firewalld to Use the Nftables Backend - ocil:ssg-auditd_local_events_action:testaction:1 + ocil:ssg-firewalld-backend_action:testaction:1 - - Record Any Attempts to Run chacl + + Enable the NTP Daemon - ocil:ssg-audit_rules_execution_chacl_action:testaction:1 + ocil:ssg-service_chronyd_or_ntpd_enabled_action:testaction:1 - - Configure ARP filtering for All IPv4 Interfaces + + Configure auditd to use audispd's syslog plugin - ocil:ssg-sysctl_net_ipv4_conf_all_arp_filter_action:testaction:1 + ocil:ssg-auditd_audispd_syslog_plugin_activated_action:testaction:1 - - Install audispd-plugins Package + + Verify that Shared Library Directories Have Root Group Ownership - ocil:ssg-package_audispd-plugins_installed_action:testaction:1 + ocil:ssg-dir_group_ownership_library_dirs_action:testaction:1 - - Ensure /var Located On Separate Partition + + Uninstall dovecot Package - ocil:ssg-partition_for_var_action:testaction:1 + ocil:ssg-package_dovecot_removed_action:testaction:1 - - Ensure journald is configured to write log files to persistent disk + + Configure GnuTLS library to use DoD-approved TLS Encryption - ocil:ssg-journald_storage_action:testaction:1 + ocil:ssg-configure_gnutls_tls_crypto_policy_action:testaction:1 - - System Audit Directories Must Be Group Owned By Root + + Limit Password Reuse: password-auth - ocil:ssg-directory_group_ownership_var_log_audit_action:testaction:1 + ocil:ssg-accounts_password_pam_pwhistory_remember_password_auth_action:testaction:1 - - Disable System Statistics Reset Service (sysstat) + + Disable the httpd_dbus_avahi SELinux Boolean - ocil:ssg-service_sysstat_disabled_action:testaction:1 + ocil:ssg-sebool_httpd_dbus_avahi_action:testaction:1 - - Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv4 Interfaces + + Disable Ctrl-Alt-Del Burst Action - ocil:ssg-sysctl_net_ipv4_conf_default_accept_redirects_action:testaction:1 + ocil:ssg-disable_ctrlaltdel_burstaction_action:testaction:1 - - Appropriate Action Must be Setup When the Internal Audit Event Queue is Full + + Extend Audit Backlog Limit for the Audit Daemon - ocil:ssg-auditd_overflow_action_action:testaction:1 + ocil:ssg-grub2_audit_backlog_limit_argument_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - unlinkat + + Disable the use_nfs_home_dirs SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_unlinkat_action:testaction:1 + ocil:ssg-sebool_use_nfs_home_dirs_action:testaction:1 - - Configure maximum number of process identifiers + + Disable the virt_sandbox_use_sys_admin SELinux Boolean - ocil:ssg-sysctl_kernel_pid_max_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_sys_admin_action:testaction:1 - - Enable checks on notifier call chains + + Add nosuid Option to Removable Media Partitions - ocil:ssg-kernel_config_debug_notifiers_action:testaction:1 + ocil:ssg-mount_option_nosuid_removable_partitions_action:testaction:1 - - Disable the httpd_enable_homedirs SELinux Boolean + + Disable the mpd_use_nfs SELinux Boolean - ocil:ssg-sebool_httpd_enable_homedirs_action:testaction:1 + ocil:ssg-sebool_mpd_use_nfs_action:testaction:1 - - Ensure debug-shell service is not enabled during boot + + Ensure tftp Daemon Uses Secure Mode - ocil:ssg-grub2_systemd_debug-shell_argument_absent_action:testaction:1 + ocil:ssg-tftpd_uses_secure_mode_action:testaction:1 - - Disable the condor_tcp_network_connect SELinux Boolean + + Add nosuid Option to /boot/efi - ocil:ssg-sebool_condor_tcp_network_connect_action:testaction:1 + ocil:ssg-mount_option_boot_efi_nosuid_action:testaction:1 - - Add noexec Option to /var/tmp + + Disable At Service (atd) - ocil:ssg-mount_option_var_tmp_noexec_action:testaction:1 + ocil:ssg-service_atd_disabled_action:testaction:1 - - Enable Kernel Paremeter to Log Martian Packets on all IPv4 Interfaces by Default + + Record Attempts to Alter Logon and Logout Events - faillock - ocil:ssg-sysctl_net_ipv4_conf_default_log_martians_action:testaction:1 + ocil:ssg-audit_rules_login_events_faillock_action:testaction:1 - - Add nodev Option to Non-Root Local Partitions + + Configure auditd Number of Logs Retained - ocil:ssg-mount_option_nodev_nonroot_local_partitions_action:testaction:1 + ocil:ssg-auditd_data_retention_num_logs_action:testaction:1 - - Disable the pppd_for_user SELinux Boolean + + Disable ypserv Service - ocil:ssg-sebool_pppd_for_user_action:testaction:1 + ocil:ssg-service_ypserv_disabled_action:testaction:1 - - Verify User Who Owns shadow File + + Configure SSSD LDAP Backend Client to Demand a Valid Certificate from the Server - ocil:ssg-file_owner_etc_shadow_action:testaction:1 + ocil:ssg-sssd_ldap_configure_tls_reqcert_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User - unlink + + Enable HTTPD Error Logging - ocil:ssg-audit_rules_file_deletion_events_unlink_action:testaction:1 + ocil:ssg-httpd_enable_error_logging_action:testaction:1 - - Install the Policy Auditor (PA) Module + + Force opensc To Use Defined Smart Card Driver - ocil:ssg-install_mcafee_hbss_pa_action:testaction:1 + ocil:ssg-force_opensc_card_drivers_action:testaction:1 - - Disable the use_lpd_server SELinux Boolean + + Disable the collectd_tcp_network_connect SELinux Boolean - ocil:ssg-sebool_use_lpd_server_action:testaction:1 + ocil:ssg-sebool_collectd_tcp_network_connect_action:testaction:1 - - Require Re-Authentication When Using the sudo Command + + Disable SSH root Login with a Password (Insecure) - ocil:ssg-sudo_require_reauthentication_action:testaction:1 + ocil:ssg-sshd_disable_root_password_login_action:testaction:1 - - Prefer to use a 64-bit Operating System when supported + + Disable the cobbler_anon_write SELinux Boolean - ocil:ssg-prefer_64bit_os_action:testaction:1 + ocil:ssg-sebool_cobbler_anon_write_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/security/opasswd + + Verify that audit tools are owned by group root - ocil:ssg-audit_rules_usergroup_modification_opasswd_action:testaction:1 + ocil:ssg-file_groupownership_audit_binaries_action:testaction:1 - - Trigger a kernel BUG when data corruption is detected + + Record Successful Permission Changes to Files - fremovexattr - ocil:ssg-kernel_config_bug_on_data_corruption_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fremovexattr_action:testaction:1 - - Enable Kernel Parameter to Use TCP Syncookies on Network Interfaces + + Disable the httpd_can_network_connect_db SELinux Boolean - ocil:ssg-sysctl_net_ipv4_tcp_syncookies_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_connect_db_action:testaction:1 - - Harden SSH client Crypto Policy + + Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces - ocil:ssg-harden_ssh_client_crypto_policy_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_action:testaction:1 - - Configure SSSD to Expire SSH Known Hosts + + Install Intrusion Detection Software - ocil:ssg-sssd_ssh_known_hosts_timeout_action:testaction:1 + ocil:ssg-install_hids_action:testaction:1 - - Record Unsuccessful Modification Attempts to Files - openat O_TRUNC_WRITE + + Add nosuid Option to /var/tmp - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_trunc_write_action:testaction:1 + ocil:ssg-mount_option_var_tmp_nosuid_action:testaction:1 - - Verify that Shared Library Files Have Root Ownership + + Verify Permissions on passwd File - ocil:ssg-file_ownership_library_dirs_action:testaction:1 + ocil:ssg-file_permissions_etc_passwd_action:testaction:1 - - Enable Kernel Page-Table Isolation (KPTI) + + Set Existing Passwords Maximum Age - ocil:ssg-grub2_pti_argument_action:testaction:1 + ocil:ssg-accounts_password_set_max_life_existing_action:testaction:1 - - Disable the mozilla_read_content SELinux Boolean + + Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo requiretty - ocil:ssg-sebool_mozilla_read_content_action:testaction:1 + ocil:ssg-sudo_add_requiretty_action:testaction:1 - - A remote time server for Chrony is configured + + Add noauto Option to /boot - ocil:ssg-chronyd_specify_remote_server_action:testaction:1 + ocil:ssg-mount_option_boot_noauto_action:testaction:1 - - Configure AIDE to Verify the Audit Tools + + Disable the conman_can_network SELinux Boolean - ocil:ssg-aide_check_audit_tools_action:testaction:1 + ocil:ssg-sebool_conman_can_network_action:testaction:1 - - SSH client uses strong entropy to seed (for CSH like shells) + + Configure auditd Disk Full Action when Disk Space Is Full - ocil:ssg-ssh_client_use_strong_rng_csh_action:testaction:1 + ocil:ssg-auditd_data_disk_full_action_stig_action:testaction:1 - - Disable the mmap_low_allowed SELinux Boolean + + Verify Permissions on /etc/shells File - ocil:ssg-sebool_mmap_low_allowed_action:testaction:1 + ocil:ssg-file_permissions_etc_shells_action:testaction:1 - - Disable the tor_can_network_relay SELinux Boolean + + Install the McAfee Runtime Libraries and Linux Agent - ocil:ssg-sebool_tor_can_network_relay_action:testaction:1 + ocil:ssg-install_mcafee_cma_rt_action:testaction:1 - - Disable x86 vsyscall emulation + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces - ocil:ssg-kernel_config_x86_vsyscall_emulation_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_defrtr_action:testaction:1 - - Make the module text and rodata read-only + + Ensure auditd Unauthorized Access Attempts To open_by_handle_at Are Ordered Correctly - ocil:ssg-kernel_config_strict_module_rwx_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_rule_order_action:testaction:1 - - Disable rsh Service + + Trigger a kernel BUG when data corruption is detected - ocil:ssg-service_rsh_disabled_action:testaction:1 + ocil:ssg-kernel_config_bug_on_data_corruption_action:testaction:1 - - Disable Cyrus SASL Authentication Daemon (saslauthd) + + Uninstall bind Package - ocil:ssg-service_saslauthd_disabled_action:testaction:1 + ocil:ssg-package_bind_removed_action:testaction:1 - - Require Client Certificates + + Record Events that Modify User/Group Information - /etc/gshadow - ocil:ssg-httpd_require_client_certs_action:testaction:1 + ocil:ssg-audit_rules_usergroup_modification_gshadow_action:testaction:1 - - Disable the virt_read_qemu_ga_data SELinux Boolean + + Disable the smartmon_3ware SELinux Boolean - ocil:ssg-sebool_virt_read_qemu_ga_data_action:testaction:1 + ocil:ssg-sebool_smartmon_3ware_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Unloading - delete_module + + Uninstall net-snmp Package - ocil:ssg-audit_rules_kernel_module_loading_delete_action:testaction:1 + ocil:ssg-package_net-snmp_removed_action:testaction:1 - - Disable the openshift_use_nfs SELinux Boolean + + Enable the cron_userdomain_transition SELinux Boolean - ocil:ssg-sebool_openshift_use_nfs_action:testaction:1 + ocil:ssg-sebool_cron_userdomain_transition_action:testaction:1 - - Disable DHCP Service + + Enable poison without sanity check - ocil:ssg-service_dhcpd_disabled_action:testaction:1 + ocil:ssg-kernel_config_page_poisoning_no_sanity_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check + + Add noexec Option to /var/log/audit - ocil:ssg-audit_rules_privileged_commands_pam_timestamp_check_action:testaction:1 + ocil:ssg-mount_option_var_log_audit_noexec_action:testaction:1 - - Each Web Content Directory Must Contain An index.html File + + Ensure SMEP is not disabled during boot - ocil:ssg-httpd_configure_documentroot_action:testaction:1 + ocil:ssg-grub2_nosmep_argument_absent_action:testaction:1 - - Install tar Package + + Ensure gpgcheck Enabled In Main yum Configuration - ocil:ssg-package_tar_installed_action:testaction:1 + ocil:ssg-ensure_gpgcheck_globally_activated_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/passwd + + Audit Tools Must Have a Mode of 0755 or Less Permissive - ocil:ssg-audit_rules_usergroup_modification_passwd_action:testaction:1 + ocil:ssg-file_audit_tools_permissions_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fremovexattr + + Remove NIS Client - ocil:ssg-audit_rules_dac_modification_fremovexattr_action:testaction:1 + ocil:ssg-package_ypbind_removed_action:testaction:1 - - Set Permissions on All Configuration Files Inside /etc/httpd/conf/ + + UEFI Boot Loader Is Not Installed On Removeable Media - ocil:ssg-file_permissions_httpd_server_conf_files_action:testaction:1 + ocil:ssg-uefi_no_removeable_media_action:testaction:1 - - Disable IEEE 1394 (FireWire) Support + + Verify Ownership on SSH Server Private *_key Key Files - ocil:ssg-kernel_module_firewire-core_disabled_action:testaction:1 + ocil:ssg-file_ownership_sshd_private_key_action:testaction:1 - - Enable Kernel Parameter to Enforce DAC on Hardlinks + + Ensure SMAP is not disabled during boot - ocil:ssg-sysctl_fs_protected_hardlinks_action:testaction:1 + ocil:ssg-grub2_nosmap_argument_absent_action:testaction:1 - - Disable RDS Support + + Disable KDump Kernel Crash Analyzer (kdump) - ocil:ssg-kernel_module_rds_disabled_action:testaction:1 + ocil:ssg-service_kdump_disabled_action:testaction:1 - - Record Events that Modify User/Group Information via open syscall - /etc/group + + Configure the httpd_builtin_scripting SELinux Boolean - ocil:ssg-audit_rules_etc_group_open_action:testaction:1 + ocil:ssg-sebool_httpd_builtin_scripting_action:testaction:1 - - Disable the httpd_dbus_avahi SELinux Boolean + + Disable the httpd_can_connect_ftp SELinux Boolean - ocil:ssg-sebool_httpd_dbus_avahi_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_ftp_action:testaction:1 - - Disable the xserver_clients_write_xshm SELinux Boolean + + Ensure auditd Collects Information on the Use of Privileged Commands - newgrp - ocil:ssg-sebool_xserver_clients_write_xshm_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_newgrp_action:testaction:1 - - Disable the collectd_tcp_network_connect SELinux Boolean + + Verify Owner on cron.d - ocil:ssg-sebool_collectd_tcp_network_connect_action:testaction:1 + ocil:ssg-file_owner_cron_d_action:testaction:1 - - Verify Owner on crontab + + Disable the authlogin_nsswitch_use_ldap SELinux Boolean - ocil:ssg-file_owner_crontab_action:testaction:1 + ocil:ssg-sebool_authlogin_nsswitch_use_ldap_action:testaction:1 - - Disable vsftpd Service + + Disable the prosody_bind_http_port SELinux Boolean - ocil:ssg-service_vsftpd_disabled_action:testaction:1 + ocil:ssg-sebool_prosody_bind_http_port_action:testaction:1 - - Ensure SNMP Read Write is disabled + + Disable the cluster_manage_all_files SELinux Boolean - ocil:ssg-snmpd_no_rwusers_action:testaction:1 + ocil:ssg-sebool_cluster_manage_all_files_action:testaction:1 - - Record Successful Delete Attempts to Files - renameat + + Ensure PAM Enforces Password Requirements - Minimum Different Characters - ocil:ssg-audit_rules_successful_file_modification_renameat_action:testaction:1 + ocil:ssg-accounts_password_pam_difok_action:testaction:1 - - Virus Scanning Software Definitions Are Updated + + Verify Owner on cron.weekly - ocil:ssg-mcafee_antivirus_definitions_updated_action:testaction:1 + ocil:ssg-file_owner_cron_weekly_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - open_by_handle_at O_CREAT + + Perform full reference count validation - ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_o_creat_action:testaction:1 + ocil:ssg-kernel_config_refcount_full_action:testaction:1 - - Remove iptables-services Package + + Disable Geolocation in GNOME3 - ocil:ssg-package_iptables-services_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_geolocation_action:testaction:1 - - Verify iptables Enabled + + Assign Expiration Date to Temporary Accounts - ocil:ssg-service_iptables_enabled_action:testaction:1 + ocil:ssg-account_temp_expire_date_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchmod + + Ensure nss-tools is installed - ocil:ssg-audit_rules_dac_modification_fchmod_action:testaction:1 + ocil:ssg-package_nss-tools_installed_action:testaction:1 - - Certificate status checking in SSSD + + Disable the ssh_keysign SELinux Boolean - ocil:ssg-sssd_certificate_verification_action:testaction:1 + ocil:ssg-sebool_ssh_keysign_action:testaction:1 - - Disable Red Hat Network Service (rhnsd) + + Verify Permissions on gshadow File - ocil:ssg-service_rhnsd_disabled_action:testaction:1 + ocil:ssg-file_permissions_etc_gshadow_action:testaction:1 - - Disable the selinuxuser_postgresql_connect_enabled SELinux Boolean + + Configure auditing of unsuccessful file creations - ocil:ssg-sebool_selinuxuser_postgresql_connect_enabled_action:testaction:1 + ocil:ssg-audit_create_failed_action:testaction:1 - - Prevent remote hosts from connecting to the proxy display + + Disable snmpd Service - ocil:ssg-sshd_x11_use_localhost_action:testaction:1 + ocil:ssg-service_snmpd_disabled_action:testaction:1 - - Ensure that /etc/at.deny does not exist + + Ensure that System Accounts Do Not Run a Shell Upon Login - ocil:ssg-file_at_deny_not_exist_action:testaction:1 + ocil:ssg-no_shelllogin_for_systemaccounts_action:testaction:1 - - Disable Samba + + Don't target root user in the sudoers file - ocil:ssg-service_smb_disabled_action:testaction:1 + ocil:ssg-sudoers_no_root_target_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Screensaver Lock After Idle Period + + Disable the cron_can_relabel SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_lock_locked_action:testaction:1 + ocil:ssg-sebool_cron_can_relabel_action:testaction:1 - - Disable Kerberos by removing host keytab + + Use Only Strong Key Exchange algorithms - ocil:ssg-kerberos_disable_no_keytab_action:testaction:1 + ocil:ssg-sshd_use_strong_kex_action:testaction:1 - - Disable Kernel Parameter for IPv6 Forwarding + + Verify Permissions on Backup gshadow File - ocil:ssg-sysctl_net_ipv6_conf_all_forwarding_action:testaction:1 + ocil:ssg-file_permissions_backup_etc_gshadow_action:testaction:1 - - Verify User Who Owns Backup gshadow File + + Disable the git_cgi_enable_homedirs SELinux Boolean - ocil:ssg-file_owner_backup_etc_gshadow_action:testaction:1 + ocil:ssg-sebool_git_cgi_enable_homedirs_action:testaction:1 - - Set Default iptables Policy for Incoming Packets + + Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown - ocil:ssg-set_iptables_default_rule_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_pt_chown_action:testaction:1 - - Disable KDump Kernel Crash Analyzer (kdump) + + Configure auditd admin_space_left on Low Disk Space - ocil:ssg-service_kdump_disabled_action:testaction:1 + ocil:ssg-auditd_data_retention_admin_space_left_percentage_action:testaction:1 - - Enable the NTP Daemon + + Install McAfee Virus Scanning Software - ocil:ssg-service_ntp_enabled_action:testaction:1 + ocil:ssg-install_mcafee_antivirus_action:testaction:1 - - All User Files and Directories In The Home Directory Must Be Group-Owned By The Primary Group + + System Audit Logs Must Have Mode 0750 or Less Permissive - ocil:ssg-accounts_users_home_files_groupownership_action:testaction:1 + ocil:ssg-directory_permissions_var_log_audit_action:testaction:1 - - Verify Group Ownership on SSH Server Private *_key Key Files + + Disable the gitosis_can_sendmail SELinux Boolean - ocil:ssg-file_groupownership_sshd_private_key_action:testaction:1 + ocil:ssg-sebool_gitosis_can_sendmail_action:testaction:1 - - Disable the daemons_use_tcp_wrapper SELinux Boolean + + Authorize USB hubs in USBGuard daemon - ocil:ssg-sebool_daemons_use_tcp_wrapper_action:testaction:1 + ocil:ssg-usbguard_allow_hub_action:testaction:1 - - Disable Quagga Service + + Enable Dracut FIPS Module - ocil:ssg-service_zebra_disabled_action:testaction:1 + ocil:ssg-enable_dracut_fips_module_action:testaction:1 - - Ensure /var/log Located On Separate Partition + + Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces - ocil:ssg-partition_for_var_log_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_send_redirects_action:testaction:1 - - An SELinux Context must be configured for the pam_faillock.so records directory + + Disable the virt_use_usb SELinux Boolean - ocil:ssg-account_password_selinux_faillock_dir_action:testaction:1 + ocil:ssg-sebool_virt_use_usb_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on IPv4 Interfaces by Default + + Disable IEEE 1394 (FireWire) Support - ocil:ssg-sysctl_net_ipv4_conf_default_accept_source_route_action:testaction:1 + ocil:ssg-kernel_module_firewire-core_disabled_action:testaction:1 - - Disable the git_session_bind_all_unreserved_ports SELinux Boolean + + Harden slab freelist metadata - ocil:ssg-sebool_git_session_bind_all_unreserved_ports_action:testaction:1 + ocil:ssg-kernel_config_slab_freelist_hardened_action:testaction:1 - - Verify ownership of System Login Banner + + Ensure auditd Collects Information on the Use of Privileged Commands - postdrop - ocil:ssg-file_owner_etc_issue_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_postdrop_action:testaction:1 - - Uninstall talk-server Package + + Disable the xserver_clients_write_xshm SELinux Boolean - ocil:ssg-package_talk-server_removed_action:testaction:1 + ocil:ssg-sebool_xserver_clients_write_xshm_action:testaction:1 - - Specify the hash to use when signing modules + + Enable FIPS Mode - ocil:ssg-kernel_config_module_sig_hash_action:testaction:1 + ocil:ssg-enable_fips_mode_action:testaction:1 - - Configure System to Forward All Mail From Postmaster to The Root Account + + Disable the xdm_write_home SELinux Boolean - ocil:ssg-postfix_client_configure_mail_alias_postmaster_action:testaction:1 + ocil:ssg-sebool_xdm_write_home_action:testaction:1 - - Disable chrony daemon from acting as server + + Disable the nis_enabled SELinux Boolean - ocil:ssg-chronyd_client_only_action:testaction:1 + ocil:ssg-sebool_nis_enabled_action:testaction:1 - - Disable the abrt_handle_event SELinux Boolean + + Enable SLUB debugging support - ocil:ssg-sebool_abrt_handle_event_action:testaction:1 + ocil:ssg-kernel_config_slub_debug_action:testaction:1 - - Randomize the kernel memory sections + + Install pam_pwquality Package - ocil:ssg-kernel_config_randomize_memory_action:testaction:1 + ocil:ssg-package_pam_pwquality_installed_action:testaction:1 - - Configure auditing of unsuccessful file creations + + Disable the condor_tcp_network_connect SELinux Boolean - ocil:ssg-audit_create_failed_action:testaction:1 + ocil:ssg-sebool_condor_tcp_network_connect_action:testaction:1 - - Record attempts to alter time through settimeofday + + Record Events that Modify User/Group Information via open syscall - /etc/shadow - ocil:ssg-audit_rules_time_settimeofday_action:testaction:1 + ocil:ssg-audit_rules_etc_shadow_open_action:testaction:1 - - Verify that audit tools Have Mode 0755 or less + + Record Events that Modify the System's Mandatory Access Controls - ocil:ssg-file_permissions_audit_binaries_action:testaction:1 + ocil:ssg-audit_rules_mac_modification_action:testaction:1 - - Uninstall telnet-server Package + + Disable the GNOME3 Login Restart and Shutdown Buttons - ocil:ssg-package_telnet-server_removed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_restart_shutdown_action:testaction:1 - - Ensure LDAP client is not installed + + Enable the login_console_enabled SELinux Boolean - ocil:ssg-package_openldap-clients_removed_action:testaction:1 + ocil:ssg-sebool_login_console_enabled_action:testaction:1 - - Disable mutable hooks + + Enable Use of Privilege Separation - ocil:ssg-kernel_config_security_writable_hooks_action:testaction:1 + ocil:ssg-sshd_use_priv_separation_action:testaction:1 - - Configure auditing of successful file accesses + + Disable the cluster_can_network_connect SELinux Boolean - ocil:ssg-audit_access_success_action:testaction:1 + ocil:ssg-sebool_cluster_can_network_connect_action:testaction:1 - - Enable Encrypted X11 Forwarding + + Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. - ocil:ssg-sshd_enable_x11_forwarding_action:testaction:1 + ocil:ssg-fapolicy_default_deny_action:testaction:1 - - Configure the Use of the pam_faillock.so Module in the /etc/pam.d/password-auth File. + + Ensure SELinux State is Enforcing - ocil:ssg-account_password_pam_faillock_password_auth_action:testaction:1 + ocil:ssg-selinux_state_action:testaction:1 - - Ensure Chrony is only configured with the server directive + + Set Password Minimum Age - ocil:ssg-chronyd_server_directive_action:testaction:1 + ocil:ssg-accounts_minimum_age_login_defs_action:testaction:1 - - Disable the sge_use_nfs SELinux Boolean + + Enable the unconfined_mozilla_plugin_transition SELinux Boolean - ocil:ssg-sebool_sge_use_nfs_action:testaction:1 + ocil:ssg-sebool_unconfined_mozilla_plugin_transition_action:testaction:1 - - Record Successful Delete Attempts to Files - rename + + Configure HTTP PERL Scripts To Use TAINT Option - ocil:ssg-audit_rules_successful_file_modification_rename_action:testaction:1 + ocil:ssg-httpd_configure_perl_taint_action:testaction:1 - - Disable Quota Netlink (quota_nld) + + Set Password Hashing Rounds in /etc/login.defs - ocil:ssg-service_quota_nld_disabled_action:testaction:1 + ocil:ssg-set_password_hashing_min_rounds_logindefs_action:testaction:1 - - Enable SSH Print Last Log + + Install scap-security-guide Package - ocil:ssg-sshd_print_last_log_action:testaction:1 + ocil:ssg-package_scap-security-guide_installed_action:testaction:1 - - Ensure All Accounts on the System Have Unique Names + + Verify Group Who Owns Backup group File - ocil:ssg-account_unique_name_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_group_action:testaction:1 - - Disable the ftpd_connect_db SELinux Boolean + + Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD - ocil:ssg-sebool_ftpd_connect_db_action:testaction:1 + ocil:ssg-sudo_remove_nopasswd_action:testaction:1 - - Configure PAM in SSSD Services + + Add noexec Option to /home - ocil:ssg-sssd_enable_pam_services_action:testaction:1 + ocil:ssg-mount_option_home_noexec_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - fremovexattr + + Disable Apache Qpid (qpidd) - ocil:ssg-audit_rules_unsuccessful_file_modification_fremovexattr_action:testaction:1 + ocil:ssg-service_qpidd_disabled_action:testaction:1 - - Ensure PAM Displays Last Logon/Access Notification + + Verify User Who Owns Backup shadow File - ocil:ssg-display_login_attempts_action:testaction:1 + ocil:ssg-file_groupowner_backup_etc_shadow_action:testaction:1 - - Configure audispd's Plugin disk_full_action When Disk Is Full + + User Initialization Files Must Be Group-Owned By The Primary Group - ocil:ssg-auditd_audispd_disk_full_action_action:testaction:1 + ocil:ssg-accounts_user_dot_group_ownership_action:testaction:1 - - Disable anacron Service + + Configure Polyinstantiation of /tmp Directories - ocil:ssg-disable_anacron_action:testaction:1 + ocil:ssg-accounts_polyinstantiated_tmp_action:testaction:1 - - Disable the cron_system_cronjob_use_shares SELinux Boolean + + Enable page allocator poisoning - ocil:ssg-sebool_cron_system_cronjob_use_shares_action:testaction:1 + ocil:ssg-grub2_page_poison_argument_action:testaction:1 - - Disable the selinuxuser_rw_noexattrfile SELinux Boolean + + Disable CPU Speed (cpupower) - ocil:ssg-sebool_selinuxuser_rw_noexattrfile_action:testaction:1 + ocil:ssg-service_cpupower_disabled_action:testaction:1 - - Ensure SELinux Not Disabled in the kernel arguments + + Ensure auditd Collects File Deletion Events by User - ocil:ssg-coreos_enable_selinux_kernel_argument_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_action:testaction:1 - - Disable the xguest_exec_content SELinux Boolean + + Disable the exim_read_user_files SELinux Boolean - ocil:ssg-sebool_xguest_exec_content_action:testaction:1 + ocil:ssg-sebool_exim_read_user_files_action:testaction:1 - - Record Successful Ownership Changes to Files - fchownat + + Use Kerberos Security on All Exports - ocil:ssg-audit_rules_successful_file_modification_fchownat_action:testaction:1 + ocil:ssg-use_kerberos_security_all_exports_action:testaction:1 - - Disable the openvpn_run_unconfined SELinux Boolean + + Disable Kernel Parameter for Accepting ICMP Redirects by Default on IPv6 Interfaces - ocil:ssg-sebool_openvpn_run_unconfined_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_redirects_action:testaction:1 - - Disable telnet Service + + Configure Accepting Default Router in Router Advertisements on All IPv6 Interfaces By Default - ocil:ssg-service_telnet_disabled_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_defrtr_action:testaction:1 - - Configure immutable Audit login UIDs + + Configure auditing of unsuccessful ownership changes - ocil:ssg-audit_rules_immutable_login_uids_action:testaction:1 + ocil:ssg-audit_owner_change_failed_action:testaction:1 - - Configure Notification of Post-AIDE Scan Details + + Add nodev Option to /tmp - ocil:ssg-aide_scan_notification_action:testaction:1 + ocil:ssg-mount_option_tmp_nodev_action:testaction:1 - - OpenSSL uses strong entropy source + + A public web server, if hosted on the NIPRNet, must be isolated in an accredited DoD DMZ extension - ocil:ssg-openssl_use_strong_entropy_action:testaction:1 + ocil:ssg-httpd_nipr_accredited_dmz_action:testaction:1 - - Add nodev Option to /dev/shm + + Install the opensc Package For Multifactor Authentication - ocil:ssg-mount_option_dev_shm_nodev_action:testaction:1 + ocil:ssg-package_opensc_installed_action:testaction:1 - - Disable Automatic Bug Reporting Tool (abrtd) + + Record Successful Access Attempts to Files - open_by_handle_at - ocil:ssg-service_abrtd_disabled_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_action:testaction:1 - - Ensure Sudo Logfile Exists - sudo logfile + + Disable the mcelog_server SELinux Boolean - ocil:ssg-sudo_custom_logfile_action:testaction:1 + ocil:ssg-sebool_mcelog_server_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/passwd + + Disable Kerberos by removing host keytab - ocil:ssg-no_legacy_plus_entries_etc_passwd_action:testaction:1 + ocil:ssg-kerberos_disable_no_keytab_action:testaction:1 - - Configure Polyinstantiation of /tmp Directories + + Configure kernel to trust the CPU random number generator - ocil:ssg-accounts_polyinstantiated_tmp_action:testaction:1 + ocil:ssg-grub2_kernel_trust_cpu_rng_action:testaction:1 - - Disable At Service (atd) + + Configure tmux to lock session after inactivity - ocil:ssg-service_atd_disabled_action:testaction:1 + ocil:ssg-configure_tmux_lock_after_time_action:testaction:1 - - Configure auditing of successful file creations + + Require Credential Prompting for Remote Access in GNOME3 - ocil:ssg-audit_create_success_action:testaction:1 + ocil:ssg-dconf_gnome_remote_access_credential_prompt_action:testaction:1 - - Ensure Users Cannot Change GNOME3 Session Idle Settings + + Enable the logging_syslogd_use_tty SELinux Boolean - ocil:ssg-dconf_gnome_session_idle_user_locks_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_use_tty_action:testaction:1 - - Implement Blank Screensaver + + Configure Accepting Prefix Information in Router Advertisements on All IPv6 Interfaces - ocil:ssg-dconf_gnome_screensaver_mode_blank_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_pinfo_action:testaction:1 - - Disable the pppd_can_insmod SELinux Boolean + + Record Successful Ownership Changes to Files - fchown - ocil:ssg-sebool_pppd_can_insmod_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fchown_action:testaction:1 - - Disable SSH root Login with a Password (Insecure) + + Disable TIPC Support - ocil:ssg-sshd_disable_root_password_login_action:testaction:1 + ocil:ssg-kernel_module_tipc_disabled_action:testaction:1 - - Disable kernel debugfs + + Disable the tmpreaper_use_nfs SELinux Boolean - ocil:ssg-kernel_config_debug_fs_action:testaction:1 + ocil:ssg-sebool_tmpreaper_use_nfs_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Lowercase Characters + + Install sssd-ipa Package - ocil:ssg-accounts_password_pam_lcredit_action:testaction:1 + ocil:ssg-package_sssd-ipa_installed_action:testaction:1 - - Disable the ssh_keysign SELinux Boolean + + Disable kexec system call - ocil:ssg-sebool_ssh_keysign_action:testaction:1 + ocil:ssg-kernel_config_kexec_action:testaction:1 - - Uninstall 389-ds-base Package + + Ensure auditd Rules For Unauthorized Attempts To open Are Ordered Correctly - ocil:ssg-package_389-ds-base_removed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_rule_order_action:testaction:1 - - All Interactive Users Home Directories Must Exist + + Configure Denying Router Solicitations on All IPv6 Interfaces - ocil:ssg-accounts_user_interactive_home_directory_exists_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_router_solicitations_action:testaction:1 - - Ensure System Log Files Have Correct Permissions + + Verify that Shared Library Directories Have Root Ownership - ocil:ssg-rsyslog_files_permissions_action:testaction:1 + ocil:ssg-dir_ownership_library_dirs_action:testaction:1 - - Restrict Access to Kernel Message Buffer + + Record Events that Modify the System's Discretionary Access Controls - fchmod - ocil:ssg-sysctl_kernel_dmesg_restrict_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchmod_action:testaction:1 - - Enable Logging of All FTP Transactions + + Disable the httpd_enable_homedirs SELinux Boolean - ocil:ssg-ftp_log_transactions_action:testaction:1 + ocil:ssg-sebool_httpd_enable_homedirs_action:testaction:1 - - Remove Write Permissions From Filesystem Paths And Server Scripts + + Configure the selinuxuser_direct_dri_enabled SELinux Boolean - ocil:ssg-httpd_configure_script_permissions_action:testaction:1 + ocil:ssg-sebool_selinuxuser_direct_dri_enabled_action:testaction:1 - - Disable Secure RPC Server Service (rpcsvcgssd) + + Allow Only SSH Protocol 2 - ocil:ssg-service_rpcsvcgssd_disabled_action:testaction:1 + ocil:ssg-sshd_allow_only_protocol2_action:testaction:1 - - Disable the xen_use_nfs SELinux Boolean + + Record Successful Permission Changes to Files - setxattr - ocil:ssg-sebool_xen_use_nfs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_setxattr_action:testaction:1 - - Disable the xguest_connect_network SELinux Boolean + + Verify that system commands files are group owned by root or a system account - ocil:ssg-sebool_xguest_connect_network_action:testaction:1 + ocil:ssg-file_groupownership_system_commands_dirs_action:testaction:1 - - Disable XDMCP in GDM + + Ensure auditd Collects Information on the Use of Privileged Commands - chsh - ocil:ssg-gnome_gdm_disable_xdmcp_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_chsh_action:testaction:1 - - Ensure cron Is Logging To Rsyslog + + Disable the httpd_can_connect_mythtv SELinux Boolean - ocil:ssg-rsyslog_cron_logging_action:testaction:1 + ocil:ssg-sebool_httpd_can_connect_mythtv_action:testaction:1 - - Disable SSH Support for .rhosts Files + + Ensure logrotate is Installed - ocil:ssg-sshd_disable_rhosts_action:testaction:1 + ocil:ssg-package_logrotate_installed_action:testaction:1 - - Set Existing Passwords Warning Age + + Record Successful Permission Changes to Files - lsetxattr - ocil:ssg-accounts_password_set_warn_age_existing_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_lsetxattr_action:testaction:1 - - Disable the samba_export_all_ro SELinux Boolean + + Add grpquota Option to /home - ocil:ssg-sebool_samba_export_all_ro_action:testaction:1 + ocil:ssg-mount_option_home_grpquota_action:testaction:1 - - Set GNOME3 Screensaver Lock Delay After Activation Period + + Remove the GDM Package Group - ocil:ssg-dconf_gnome_screensaver_lock_delay_action:testaction:1 + ocil:ssg-package_gdm_removed_action:testaction:1 - - Audit Configuration Files Must Be Owned By Root + + Disable the httpd_read_user_content SELinux Boolean - ocil:ssg-file_ownership_audit_configuration_action:testaction:1 + ocil:ssg-sebool_httpd_read_user_content_action:testaction:1 - - Verify Group Ownership of Message of the Day Banner + + Ensure that /etc/cron.allow exists - ocil:ssg-file_groupowner_etc_motd_action:testaction:1 + ocil:ssg-file_cron_allow_exists_action:testaction:1 - - Detect stack corruption on calls to schedule() + + Uninstall nginx Package - ocil:ssg-kernel_config_sched_stack_end_check_action:testaction:1 + ocil:ssg-package_nginx_removed_action:testaction:1 - - Verify permissions on Message of the Day Banner + + Configure Periodic Execution of AIDE - ocil:ssg-file_permissions_etc_motd_action:testaction:1 + ocil:ssg-aide_periodic_cron_checking_action:testaction:1 - - Set SSH authentication attempt limit + + Verify Group Ownership of System Login Banner - ocil:ssg-sshd_set_max_auth_tries_action:testaction:1 + ocil:ssg-file_groupowner_etc_issue_action:testaction:1 - - Uninstall avahi-autoipd Server Package + + Remove iptables-services Package - ocil:ssg-package_avahi-autoipd_removed_action:testaction:1 + ocil:ssg-package_iptables-services_removed_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - umount + + Disable the logging_syslogd_can_sendmail SELinux Boolean - ocil:ssg-audit_rules_dac_modification_umount_action:testaction:1 + ocil:ssg-sebool_logging_syslogd_can_sendmail_action:testaction:1 - - Verify User Who Owns Backup shadow File + + Ensure Users Cannot Change GNOME3 Screensaver Lock After Idle Period - ocil:ssg-file_groupowner_backup_etc_shadow_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_lock_locked_action:testaction:1 - - Install the tmux Package + + Disable the httpd_can_network_relay SELinux Boolean - ocil:ssg-package_tmux_installed_action:testaction:1 + ocil:ssg-sebool_httpd_can_network_relay_action:testaction:1 - - Set Daemon Umask + + Enable GNOME3 Screensaver Idle Activation - ocil:ssg-umask_for_daemons_action:testaction:1 + ocil:ssg-dconf_gnome_screensaver_idle_activation_enabled_action:testaction:1 - - Enable authselect + + Limit sampling frequency of the Perf system - ocil:ssg-enable_authselect_action:testaction:1 + ocil:ssg-sysctl_kernel_perf_event_max_sample_rate_action:testaction:1 - - Ensure the Default Umask is Set Correctly in /etc/profile + + Record attempts to alter time through settimeofday - ocil:ssg-accounts_umask_etc_profile_action:testaction:1 + ocil:ssg-audit_rules_time_settimeofday_action:testaction:1 - - Ensure sudo only includes the default configuration directory + + Record Access Events to Audit Log Directory - ocil:ssg-sudoers_default_includedir_action:testaction:1 + ocil:ssg-directory_access_var_log_audit_action:testaction:1 - - Resolve information before writing to audit logs + + Ensure /opt Located On Separate Partition - ocil:ssg-auditd_log_format_action:testaction:1 + ocil:ssg-partition_for_opt_action:testaction:1 - - Enable Kernel Parameter to Ignore ICMP Broadcast Echo Requests on IPv4 Interfaces + + Enable the postgresql_selinux_users_ddl SELinux Boolean - ocil:ssg-sysctl_net_ipv4_icmp_echo_ignore_broadcasts_action:testaction:1 + ocil:ssg-sebool_postgresql_selinux_users_ddl_action:testaction:1 - - Disable the httpd_execmem SELinux Boolean + + Configure SSH to use System Crypto Policy - ocil:ssg-sebool_httpd_execmem_action:testaction:1 + ocil:ssg-configure_ssh_crypto_policy_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Enforce for Local Accounts Only + + Enable the xend_run_blktap SELinux Boolean - ocil:ssg-accounts_password_pam_enforce_local_action:testaction:1 + ocil:ssg-sebool_xend_run_blktap_action:testaction:1 - - Install dnf-plugin-subscription-manager Package + + Ensure Default SNMP Password Is Not Used - ocil:ssg-package_dnf-plugin-subscription-manager_installed_action:testaction:1 + ocil:ssg-snmpd_not_default_password_action:testaction:1 - - Set Password Minimum Age + + The Chronyd service is enabled - ocil:ssg-accounts_minimum_age_login_defs_action:testaction:1 + ocil:ssg-service_chronyd_enabled_action:testaction:1 - - Record Successful Permission Changes to Files - setxattr + + Verify permissions on Message of the Day Banner - ocil:ssg-audit_rules_successful_file_modification_setxattr_action:testaction:1 + ocil:ssg-file_permissions_etc_motd_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - mount + + Extend Audit Backlog Limit for the Audit Daemon in zIPL - ocil:ssg-audit_rules_privileged_commands_mount_action:testaction:1 + ocil:ssg-zipl_audit_backlog_limit_argument_action:testaction:1 - - Ensure Logrotate Runs Periodically + + Disable the virt_transition_userdomain SELinux Boolean - ocil:ssg-ensure_logrotate_activated_action:testaction:1 + ocil:ssg-sebool_virt_transition_userdomain_action:testaction:1 - - Verify that System Executable Directories Have Restrictive Permissions + + Disallow merge of slab caches - ocil:ssg-dir_permissions_binary_dirs_action:testaction:1 + ocil:ssg-kernel_config_slab_merge_default_action:testaction:1 - - Enforce pam_faillock for Local Accounts Only + + Authorize Human Interface Devices and USB hubs in USBGuard daemon - ocil:ssg-accounts_passwords_pam_faillock_enforce_local_action:testaction:1 + ocil:ssg-usbguard_allow_hid_and_hub_action:testaction:1 - - Disable the ftpd_use_fusefs SELinux Boolean + + Record Successful Permission Changes to Files - fsetxattr - ocil:ssg-sebool_ftpd_use_fusefs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_fsetxattr_action:testaction:1 - - Disable the cobbler_anon_write SELinux Boolean + + Install the OpenSSH Server Package - ocil:ssg-sebool_cobbler_anon_write_action:testaction:1 + ocil:ssg-package_openssh-server_installed_action:testaction:1 - - Web Content Directories Must Not Be Shared Anonymously + + Uninstall Samba Package - ocil:ssg-httpd_anonymous_content_sharing_action:testaction:1 + ocil:ssg-package_samba_removed_action:testaction:1 - - Verify User Who Owns /var/log/syslog File + + Uninstall 389-ds-base Package - ocil:ssg-file_owner_var_log_syslog_action:testaction:1 + ocil:ssg-package_389-ds-base_removed_action:testaction:1 - - Enable the nfs_export_all_rw SELinux Boolean + + Disable the cobbler_can_network_connect SELinux Boolean - ocil:ssg-sebool_nfs_export_all_rw_action:testaction:1 + ocil:ssg-sebool_cobbler_can_network_connect_action:testaction:1 - - Disable the deny_ptrace SELinux Boolean + + Disable the virt_use_xserver SELinux Boolean - ocil:ssg-sebool_deny_ptrace_action:testaction:1 + ocil:ssg-sebool_virt_use_xserver_action:testaction:1 - - Disable the samba_share_nfs SELinux Boolean + + Record Unsuccessful Creation Attempts to Files - openat O_CREAT - ocil:ssg-sebool_samba_share_nfs_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_creat_action:testaction:1 - - Disable the mcelog_foreground SELinux Boolean + + Configure SSSD to Expire Offline Credentials - ocil:ssg-sebool_mcelog_foreground_action:testaction:1 + ocil:ssg-sssd_offline_cred_expiration_action:testaction:1 - - Authorize Human Interface Devices in USBGuard daemon + + Configure AIDE to Verify Extended Attributes - ocil:ssg-usbguard_allow_hid_action:testaction:1 + ocil:ssg-aide_verify_ext_attributes_action:testaction:1 - - Configure HTTP PERL Scripts To Use TAINT Option + + Ensure Rsyslog Encrypts Off-Loaded Audit Records - ocil:ssg-httpd_configure_perl_taint_action:testaction:1 + ocil:ssg-rsyslog_encrypt_offload_actionsendstreamdrivermode_action:testaction:1 - - The Postfix package is installed + + Verify /boot/grub2/user.cfg User Ownership - ocil:ssg-package_postfix_installed_action:testaction:1 + ocil:ssg-file_owner_user_cfg_action:testaction:1 - - Enable the NTP Daemon + + Disable the secure_mode SELinux Boolean - ocil:ssg-service_ntpd_enabled_action:testaction:1 + ocil:ssg-sebool_secure_mode_action:testaction:1 - - Enable module signature verification + + Ensure PAM Enforces Password Requirements - Minimum Digit Characters - ocil:ssg-kernel_config_module_sig_action:testaction:1 + ocil:ssg-accounts_password_pam_dcredit_action:testaction:1 - - Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module + + Verify iptables Enabled - ocil:ssg-audit_rules_kernel_module_loading_query_action:testaction:1 + ocil:ssg-service_iptables_enabled_action:testaction:1 - - Allow Only SSH Protocol 2 + + Record Any Attempts to Run seunshare - ocil:ssg-sshd_allow_only_protocol2_action:testaction:1 + ocil:ssg-audit_rules_execution_seunshare_action:testaction:1 - - Install the ntp service + + Disable the xguest_exec_content SELinux Boolean - ocil:ssg-package_ntp_installed_action:testaction:1 + ocil:ssg-sebool_xguest_exec_content_action:testaction:1 - - Verify Permissions on /etc/shells File + + Disable the httpd_use_sasl SELinux Boolean - ocil:ssg-file_permissions_etc_shells_action:testaction:1 + ocil:ssg-sebool_httpd_use_sasl_action:testaction:1 - - Specify a Remote NTP Server + + Record attempts to alter time through adjtimex - ocil:ssg-ntpd_specify_remote_server_action:testaction:1 + ocil:ssg-audit_rules_time_adjtimex_action:testaction:1 - - Ensure a dedicated group owns sudo + + Prevent non-Privileged Users from Modifying Network Interfaces using nmcli - ocil:ssg-sudo_dedicated_group_action:testaction:1 + ocil:ssg-network_nmcli_permissions_action:testaction:1 - - Require Encryption for Remote Access in GNOME3 + + Configure auditd Disk Full Action when Disk Space Is Full - ocil:ssg-dconf_gnome_remote_access_encryption_action:testaction:1 + ocil:ssg-auditd_data_disk_full_action_action:testaction:1 - - Disable the webadm_manage_user_files SELinux Boolean + + Harden common str/mem functions against buffer overflows - ocil:ssg-sebool_webadm_manage_user_files_action:testaction:1 + ocil:ssg-kernel_config_fortify_source_action:testaction:1 - - Uninstall abrt-plugin-rhtsupport Package + + Disable the fenced_can_network_connect SELinux Boolean - ocil:ssg-package_abrt-plugin-rhtsupport_removed_action:testaction:1 + ocil:ssg-sebool_fenced_can_network_connect_action:testaction:1 - - Configure SNMP Service to Use Only SNMPv3 or Newer + + Randomize the kernel memory sections - ocil:ssg-snmpd_use_newer_protocol_action:testaction:1 + ocil:ssg-kernel_config_randomize_memory_action:testaction:1 - - Ensure All SGID Executables Are Authorized + + Disable rlogin Service - ocil:ssg-file_permissions_unauthorized_sgid_action:testaction:1 + ocil:ssg-service_rlogin_disabled_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - shutdown + + Enable systemd-journald Service - ocil:ssg-audit_privileged_commands_shutdown_action:testaction:1 + ocil:ssg-service_systemd-journald_enabled_action:testaction:1 - - Enable the OpenSSH Service + + Disable GSSAPI Authentication - ocil:ssg-service_sshd_enabled_action:testaction:1 + ocil:ssg-sshd_disable_gssapi_auth_action:testaction:1 - - Ensure All Accounts on the System Have Unique User IDs + + Configure Certificate Directives for LDAP Use of TLS - ocil:ssg-account_unique_id_action:testaction:1 + ocil:ssg-ldap_client_tls_cacertpath_action:testaction:1 - - Verify Group Who Owns gshadow File + + Disable Bluetooth Service - ocil:ssg-file_groupowner_etc_gshadow_action:testaction:1 + ocil:ssg-service_bluetooth_disabled_action:testaction:1 - - Set Password Hashing Algorithm in /etc/libuser.conf + + Set Password Maximum Consecutive Repeating Characters - ocil:ssg-set_password_hashing_algorithm_libuserconf_action:testaction:1 + ocil:ssg-accounts_password_pam_maxrepeat_action:testaction:1 - - Set Existing Passwords Maximum Age + + Verify that Shared Library Directories Have Restrictive Permissions - ocil:ssg-accounts_password_set_max_life_existing_action:testaction:1 + ocil:ssg-dir_permissions_library_dirs_action:testaction:1 - - Enable SLUB/SLAB allocator poisoning in zIPL + + Verify User Who Owns group File - ocil:ssg-zipl_slub_debug_argument_action:testaction:1 + ocil:ssg-file_owner_etc_group_action:testaction:1 - - Disable the zoneminder_run_sudo SELinux Boolean + + Disable the container_connect_any SELinux Boolean - ocil:ssg-sebool_zoneminder_run_sudo_action:testaction:1 + ocil:ssg-sebool_container_connect_any_action:testaction:1 - - Limit sampling frequency of the Perf system + + Disable graphical user interface - ocil:ssg-sysctl_kernel_perf_event_max_sample_rate_action:testaction:1 + ocil:ssg-xwindows_remove_packages_action:testaction:1 - - Verify Permissions on /etc/audit/rules.d/*.rules + + Ensure PAM Enforces Password Requirements - Prevent the Use of Dictionary Words - ocil:ssg-file_permissions_etc_audit_rulesd_action:testaction:1 + ocil:ssg-accounts_password_pam_dictcheck_action:testaction:1 - - Ensure All World-Writable Directories Are Owned by a System Account + + Remove the Kerberos Server Package - ocil:ssg-dir_perms_world_writable_system_owned_action:testaction:1 + ocil:ssg-package_krb5-server_removed_action:testaction:1 - - Mount Remote Filesystems with nosuid + + Configure auditd space_left on Low Disk Space - ocil:ssg-mount_option_nosuid_remote_filesystems_action:testaction:1 + ocil:ssg-auditd_data_retention_space_left_action:testaction:1 - - Verify Group Who Owns /var/log/syslog File + + Ensure All SUID Executables Are Authorized - ocil:ssg-file_groupowner_var_log_syslog_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_suid_action:testaction:1 - - Configure auditing of successful ownership changes + + Enable the sysadm_exec_content SELinux Boolean - ocil:ssg-audit_owner_change_success_action:testaction:1 + ocil:ssg-sebool_sysadm_exec_content_action:testaction:1 - - Configure Kernel Parameter for Accepting Secure Redirects By Default + + Enable the OpenSSH Service - ocil:ssg-sysctl_net_ipv4_conf_default_secure_redirects_action:testaction:1 + ocil:ssg-service_sshd_enabled_action:testaction:1 - - Disable the samba_export_all_rw SELinux Boolean + + Disable chrony daemon from acting as server - ocil:ssg-sebool_samba_export_all_rw_action:testaction:1 + ocil:ssg-chronyd_client_only_action:testaction:1 - - Uninstall pigz Package + + Enable the logadm_exec_content SELinux Boolean - ocil:ssg-package_pigz_removed_action:testaction:1 + ocil:ssg-sebool_logadm_exec_content_action:testaction:1 - - Harden the operation of the BPF just-in-time compiler + + Configure A Banner Page For Each Website - ocil:ssg-sysctl_net_core_bpf_jit_harden_action:testaction:1 + ocil:ssg-httpd_configure_banner_page_action:testaction:1 - - Disable the racoon_read_shadow SELinux Boolean + + Record Unsuccessful Permission Changes to Files - setxattr - ocil:ssg-sebool_racoon_read_shadow_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_setxattr_action:testaction:1 - - Disable the abrt_anon_write SELinux Boolean + + Disable Core Dumps for All Users - ocil:ssg-sebool_abrt_anon_write_action:testaction:1 + ocil:ssg-disable_users_coredumps_action:testaction:1 - - Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config + + Configure SSSD LDAP Backend to Use TLS For All Transactions - ocil:ssg-harden_sshd_macs_openssh_conf_crypto_policy_action:testaction:1 + ocil:ssg-sssd_ldap_start_tls_action:testaction:1 - - Disable the xdm_sysadm_login SELinux Boolean + + Ensure syslog-ng is Installed - ocil:ssg-sebool_xdm_sysadm_login_action:testaction:1 + ocil:ssg-package_syslogng_installed_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fchown + + Require Client Certificates - ocil:ssg-audit_rules_dac_modification_fchown_action:testaction:1 + ocil:ssg-httpd_require_client_certs_action:testaction:1 - - Set number of records to cause an explicit flush to audit logs + + Ensure rsyslog Default File Permissions Configured - ocil:ssg-auditd_freq_action:testaction:1 + ocil:ssg-rsyslog_filecreatemode_action:testaction:1 - - Ensure Remote Administrative Access Is Encrypted + + Ensure gpgcheck Enabled for All yum Package Repositories - ocil:ssg-httpd_configure_remote_session_encryption_action:testaction:1 + ocil:ssg-ensure_gpgcheck_never_disabled_action:testaction:1 - - Disable the nagios_run_sudo SELinux Boolean + + Ensure auditd Collects File Deletion Events by User - unlink - ocil:ssg-sebool_nagios_run_sudo_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_unlink_action:testaction:1 - - Enable the cron_userdomain_transition SELinux Boolean + + Disable the httpd_mod_auth_ntlm_winbind SELinux Boolean - ocil:ssg-sebool_cron_userdomain_transition_action:testaction:1 + ocil:ssg-sebool_httpd_mod_auth_ntlm_winbind_action:testaction:1 - - Disable the haproxy_connect_any SELinux Boolean + + Disable Kernel cfg80211 Module - ocil:ssg-sebool_haproxy_connect_any_action:testaction:1 + ocil:ssg-kernel_module_cfg80211_disabled_action:testaction:1 - - Disable the httpd_use_nfs SELinux Boolean + + Disable the exim_manage_user_files SELinux Boolean - ocil:ssg-sebool_httpd_use_nfs_action:testaction:1 + ocil:ssg-sebool_exim_manage_user_files_action:testaction:1 - - Ensure there are no legacy + NIS entries in /etc/group + + Enable SSH Print Last Log - ocil:ssg-no_legacy_plus_entries_etc_group_action:testaction:1 + ocil:ssg-sshd_print_last_log_action:testaction:1 - - All Interactive User Home Directories Must Be Owned By The Primary User + + Disable vsyscalls - ocil:ssg-file_ownership_home_directories_action:testaction:1 + ocil:ssg-grub2_vsyscall_argument_action:testaction:1 - - Disable Kerberos Authentication + + Disable the httpd_enable_ftp_server SELinux Boolean - ocil:ssg-sshd_disable_kerb_auth_action:testaction:1 + ocil:ssg-sebool_httpd_enable_ftp_server_action:testaction:1 - - Set GNOME3 Screensaver Inactivity Timeout + + Ensure No World-Writable Files Exist - ocil:ssg-dconf_gnome_screensaver_idle_delay_action:testaction:1 + ocil:ssg-file_permissions_unauthorized_world_writable_action:testaction:1 - - Authorize Human Interface Devices and USB hubs in USBGuard daemon + + Enable rsyslog Service - ocil:ssg-usbguard_allow_hid_and_hub_action:testaction:1 + ocil:ssg-service_rsyslog_enabled_action:testaction:1 - - Verify the UEFI Boot Loader grub.cfg Group Ownership + + Set Permissions on the /var/log/httpd/ Directory - ocil:ssg-file_groupowner_efi_grub2_cfg_action:testaction:1 + ocil:ssg-dir_perms_var_log_httpd_action:testaction:1 - - Configure OpenSSL library to use TLS Encryption + + Disable ntpdate Service (ntpdate) - ocil:ssg-configure_openssl_tls_crypto_policy_action:testaction:1 + ocil:ssg-service_ntpdate_disabled_action:testaction:1 - - Verify that Shared Library Files Have Restrictive Permissions + + Ensure auditd Collects System Administrator Actions - /etc/sudoers.d/ - ocil:ssg-file_permissions_library_dirs_action:testaction:1 + ocil:ssg-audit_rules_sudoers_d_action:testaction:1 - - Verify Permissions on cron.hourly + + Disable the zoneminder_run_sudo SELinux Boolean - ocil:ssg-file_permissions_cron_hourly_action:testaction:1 + ocil:ssg-sebool_zoneminder_run_sudo_action:testaction:1 - - Don't define allowed commands in sudoers by means of exclusion + + OpenSSL uses strong entropy source - ocil:ssg-sudoers_no_command_negation_action:testaction:1 + ocil:ssg-openssl_use_strong_entropy_action:testaction:1 - - Enable the domain_fd_use SELinux Boolean + + Enable the dbadm_exec_content SELinux Boolean - ocil:ssg-sebool_domain_fd_use_action:testaction:1 + ocil:ssg-sebool_dbadm_exec_content_action:testaction:1 - - Install policycoreutils-python-utils package + + Disable the cobbler_use_cifs SELinux Boolean - ocil:ssg-package_policycoreutils-python-utils_installed_action:testaction:1 + ocil:ssg-sebool_cobbler_use_cifs_action:testaction:1 - - Disable Apache Qpid (qpidd) + + Ensure debug-shell service is not enabled during boot - ocil:ssg-service_qpidd_disabled_action:testaction:1 + ocil:ssg-grub2_systemd_debug-shell_argument_absent_action:testaction:1 - - Install the opensc Package For Multifactor Authentication + + Mount Remote Filesystems with nodev - ocil:ssg-package_opensc_installed_action:testaction:1 + ocil:ssg-mount_option_nodev_remote_filesystems_action:testaction:1 - - The web server password(s) must be entrusted to the SA or Web Manager + + Disable Advanced Configuration and Power Interface (acpid) - ocil:ssg-httpd_entrust_passwords_action:testaction:1 + ocil:ssg-service_acpid_disabled_action:testaction:1 - - Account Lockouts Must Persist + + Require Client SMB Packet Signing, if using smbclient - ocil:ssg-account_passwords_pam_faillock_dir_action:testaction:1 + ocil:ssg-require_smb_client_signing_action:testaction:1 - - Disable Network File System (nfs) + + Disable the virt_use_rawip SELinux Boolean - ocil:ssg-service_nfs_disabled_action:testaction:1 + ocil:ssg-sebool_virt_use_rawip_action:testaction:1 - - Firewalld Must Employ a Deny-all, Allow-by-exception Policy for Allowing Connections to Other Systems + + Configure the tmux Lock Command - ocil:ssg-configured_firewalld_default_deny_action:testaction:1 + ocil:ssg-configure_tmux_lock_command_action:testaction:1 - - Record Unsuccessful Permission Changes to Files - chmod + + Disable the tftp_home_dir SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_chmod_action:testaction:1 + ocil:ssg-sebool_tftp_home_dir_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/gshadow + + Disable the tmpreaper_use_samba SELinux Boolean - ocil:ssg-audit_rules_etc_gshadow_openat_action:testaction:1 + ocil:ssg-sebool_tmpreaper_use_samba_action:testaction:1 - - Disable systemd-journal-remote Socket + + Enable Auditing to Start Prior to the Audit Daemon in zIPL - ocil:ssg-socket_systemd-journal-remote_disabled_action:testaction:1 + ocil:ssg-zipl_audit_argument_action:testaction:1 - - Disable the piranha_lvs_can_network_connect SELinux Boolean + + Uninstall quagga Package - ocil:ssg-sebool_piranha_lvs_can_network_connect_action:testaction:1 + ocil:ssg-package_quagga_removed_action:testaction:1 - - Verify Group Ownership on SSH Server Public *.pub Key Files + + Include Local Events in Audit Logs - ocil:ssg-file_groupownership_sshd_pub_key_action:testaction:1 + ocil:ssg-auditd_local_events_action:testaction:1 - - Ensure sudo umask is appropriate - sudo umask + + Set Daemon Umask - ocil:ssg-sudo_add_umask_action:testaction:1 + ocil:ssg-umask_for_daemons_action:testaction:1 - - Record Successful Delete Attempts to Files - unlink + + Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl - ocil:ssg-audit_rules_successful_file_modification_unlink_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_usernetctl_action:testaction:1 - - Authorize USB hubs in USBGuard daemon + + Disable Red Hat Network Service (rhnsd) - ocil:ssg-usbguard_allow_hub_action:testaction:1 + ocil:ssg-service_rhnsd_disabled_action:testaction:1 - - Disable GDM Guest Login + + Ensure auditd Collects Information on the Use of Privileged Commands - su - ocil:ssg-gnome_gdm_disable_guest_login_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_su_action:testaction:1 - - Configure auditd space_left Action on Low Disk Space + + Disable the icecast_use_any_tcp_ports SELinux Boolean - ocil:ssg-auditd_data_retention_space_left_action_action:testaction:1 + ocil:ssg-sebool_icecast_use_any_tcp_ports_action:testaction:1 - - Disable the git_system_enable_homedirs SELinux Boolean + + Configure the Use of the pam_faillock.so Module in the /etc/pam.d/password-auth File. - ocil:ssg-sebool_git_system_enable_homedirs_action:testaction:1 + ocil:ssg-account_password_pam_faillock_password_auth_action:testaction:1 - - Ensure auditd Rules For Unauthorized Attempts To openat Are Ordered Correctly + + Record Successful Delete Attempts to Files - unlinkat - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_rule_order_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_unlinkat_action:testaction:1 - - Enable PAM + + Disable Client Dynamic DNS Updates - ocil:ssg-sshd_enable_pam_action:testaction:1 + ocil:ssg-network_disable_ddns_interfaces_action:testaction:1 - - Disable the logrotate_use_nfs SELinux Boolean + + Enable Encrypted X11 Forwarding - ocil:ssg-sebool_logrotate_use_nfs_action:testaction:1 + ocil:ssg-sshd_enable_x11_forwarding_action:testaction:1 - - Encrypt Partitions + + Ensure auditd Collects Information on the Use of Privileged Commands - mount - ocil:ssg-encrypt_partitions_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_mount_action:testaction:1 - - Configure Denying Router Solicitations on All IPv6 Interfaces By Default + + Set configuration for loopback traffic - ocil:ssg-sysctl_net_ipv6_conf_default_router_solicitations_action:testaction:1 + ocil:ssg-set_loopback_traffic_action:testaction:1 - - Enable the unconfined_mozilla_plugin_transition SELinux Boolean + + Disable the mpd_enable_homedirs SELinux Boolean - ocil:ssg-sebool_unconfined_mozilla_plugin_transition_action:testaction:1 + ocil:ssg-sebool_mpd_enable_homedirs_action:testaction:1 - - Harden common str/mem functions against buffer overflows + + Disable GDM Guest Login - ocil:ssg-kernel_config_fortify_source_action:testaction:1 + ocil:ssg-gnome_gdm_disable_guest_login_action:testaction:1 - - Disable the glance_use_execmem SELinux Boolean + + Ensure ip6tables Firewall Rules Exist for All Open Ports - ocil:ssg-sebool_glance_use_execmem_action:testaction:1 + ocil:ssg-ip6tables_rules_for_open_ports_action:testaction:1 - - Disable the selinuxuser_tcp_server SELinux Boolean + + Verify the UEFI Boot Loader grub.cfg Group Ownership - ocil:ssg-sebool_selinuxuser_tcp_server_action:testaction:1 + ocil:ssg-file_groupowner_efi_grub2_cfg_action:testaction:1 - - Disable the mplayer_execstack SELinux Boolean + + Configure auditd mail_acct Action on Low Disk Space - ocil:ssg-sebool_mplayer_execstack_action:testaction:1 + ocil:ssg-auditd_data_retention_action_mail_acct_action:testaction:1 - - Enable Use of Privilege Separation + + Disable loading and unloading of kernel modules - ocil:ssg-sshd_use_priv_separation_action:testaction:1 + ocil:ssg-sysctl_kernel_modules_disabled_action:testaction:1 - - Record Events that Modify the System's Mandatory Access Controls + + Ensure cron Is Logging To Rsyslog - ocil:ssg-audit_rules_mac_modification_action:testaction:1 + ocil:ssg-rsyslog_cron_logging_action:testaction:1 - - Disable the virt_use_rawip SELinux Boolean + + Add nodev Option to /boot - ocil:ssg-sebool_virt_use_rawip_action:testaction:1 + ocil:ssg-mount_option_boot_nodev_action:testaction:1 - - Disable storing core dump + + Disable the samba_create_home_dirs SELinux Boolean - ocil:ssg-coredump_disable_storage_action:testaction:1 + ocil:ssg-sebool_samba_create_home_dirs_action:testaction:1 - - Enable the postgresql_selinux_users_ddl SELinux Boolean + + Disable the xdm_exec_bootloader SELinux Boolean - ocil:ssg-sebool_postgresql_selinux_users_ddl_action:testaction:1 + ocil:ssg-sebool_xdm_exec_bootloader_action:testaction:1 - - Restrict Serial Port Root Logins + + Disable the httpd_use_fusefs SELinux Boolean - ocil:ssg-restrict_serial_port_logins_action:testaction:1 + ocil:ssg-sebool_httpd_use_fusefs_action:testaction:1 - - Use Only FIPS 140-2 Validated MACs + + Ensure auditd Collects Information on the Use of Privileged Commands - shutdown - ocil:ssg-sshd_use_approved_macs_action:testaction:1 + ocil:ssg-audit_privileged_commands_shutdown_action:testaction:1 - - Disable the dhcpd_use_ldap SELinux Boolean + + Configure audispd Plugin To Send Logs To Remote Server - ocil:ssg-sebool_dhcpd_use_ldap_action:testaction:1 + ocil:ssg-auditd_audispd_configure_remote_server_action:testaction:1 - - Configure Auto Configuration on All IPv6 Interfaces + + Enable the selinuxuser_execmod SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_all_autoconf_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execmod_action:testaction:1 - - Enable the auditadm_exec_content SELinux Boolean + + Set Kernel Parameter to Increase Local Port Range - ocil:ssg-sebool_auditadm_exec_content_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_ip_local_port_range_action:testaction:1 - - Install the Samba Common Package + + Configure Notification of Post-AIDE Scan Details - ocil:ssg-package_samba-common_installed_action:testaction:1 + ocil:ssg-aide_scan_notification_action:testaction:1 - - Disable the git_system_use_cifs SELinux Boolean + + Disable Accepting Router Advertisements on all IPv6 Interfaces by Default - ocil:ssg-sebool_git_system_use_cifs_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_ra_action:testaction:1 - - Disable the named_tcp_bind_http_port SELinux Boolean + + Ensure IPv6 is disabled through kernel boot parameter - ocil:ssg-sebool_named_tcp_bind_http_port_action:testaction:1 + ocil:ssg-grub2_ipv6_disable_argument_action:testaction:1 - - Configure dnf-automatic to Install Available Updates Automatically + + Enable SLUB/SLAB allocator poisoning - ocil:ssg-dnf-automatic_apply_updates_action:testaction:1 + ocil:ssg-grub2_slub_debug_argument_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - rename + + Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces by Default - ocil:ssg-audit_rules_unsuccessful_file_modification_rename_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_rp_filter_action:testaction:1 - - Make the auditd Configuration Immutable + + Ensure gnutls-utils is installed - ocil:ssg-audit_rules_immutable_action:testaction:1 + ocil:ssg-package_gnutls-utils_installed_action:testaction:1 - - Disable the rsync_full_access SELinux Boolean + + Disable legacy (BSD) PTY support - ocil:ssg-sebool_rsync_full_access_action:testaction:1 + ocil:ssg-kernel_config_legacy_ptys_action:testaction:1 + + + + Record Events that Modify User/Group Information via open syscall - /etc/passwd + + ocil:ssg-audit_rules_etc_passwd_open_action:testaction:1 + + + + Disable the abrt_anon_write SELinux Boolean + + ocil:ssg-sebool_abrt_anon_write_action:testaction:1 + + + + User a virtually-mapped stack + + ocil:ssg-kernel_config_vmap_stack_action:testaction:1 @@ -357748,370 +358250,370 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_cdrecord_read_content_action:testaction:1 - - Verify All Account Password Hashes are Shadowed with SHA512 + + Configure auditd max_log_file_action Upon Reaching Maximum Log Size - ocil:ssg-accounts_password_all_shadowed_sha512_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action_stig_action:testaction:1 - - Disable the minidlna_read_generic_user_content SELinux Boolean + + Ensure SNMP Read Write is disabled - ocil:ssg-sebool_minidlna_read_generic_user_content_action:testaction:1 + ocil:ssg-snmpd_no_rwusers_action:testaction:1 - - Verify Group Who Owns SSH Server config file + + Ensure PAM Enforces Password Requirements - Authentication Retry Prompts Permitted Per-Session - ocil:ssg-file_groupowner_sshd_config_action:testaction:1 + ocil:ssg-accounts_password_pam_retry_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - sudoedit + + Ensure the Group Used by pam_wheel.so Module Exists on System and is Empty - ocil:ssg-audit_rules_privileged_commands_sudoedit_action:testaction:1 + ocil:ssg-ensure_pam_wheel_group_empty_action:testaction:1 - - Disable the authlogin_nsswitch_use_ldap SELinux Boolean + + Disable the cvs_read_shadow SELinux Boolean - ocil:ssg-sebool_authlogin_nsswitch_use_ldap_action:testaction:1 + ocil:ssg-sebool_cvs_read_shadow_action:testaction:1 - - Disable Kernel Image Loading + + Set SSH MaxSessions limit - ocil:ssg-sysctl_kernel_kexec_load_disabled_action:testaction:1 + ocil:ssg-sshd_set_max_sessions_action:testaction:1 - - Uninstall rsync Package + + Configure SSH Client to Use FIPS 140-2 Validated Ciphers: openssh.config - ocil:ssg-package_rsync_removed_action:testaction:1 + ocil:ssg-harden_sshd_ciphers_openssh_conf_crypto_policy_action:testaction:1 - - Verify Permissions on /etc/audit/auditd.conf + + Disable the irc_use_any_tcp_ports SELinux Boolean - ocil:ssg-file_permissions_etc_audit_auditd_action:testaction:1 + ocil:ssg-sebool_irc_use_any_tcp_ports_action:testaction:1 - - Install the Host Intrusion Prevention System (HIPS) Module + + Configure Kernel to Rate Limit Sending of Duplicate TCP Acknowledgments - ocil:ssg-package_MFEhiplsm_installed_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_tcp_invalid_ratelimit_action:testaction:1 - - Install sssd-ipa Package + + Do Not Show System Messages When Unsuccessful Logon Attempts Occur - ocil:ssg-package_sssd-ipa_installed_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_silent_action:testaction:1 - - Disable Kernel Parameter for Accepting Source-Routed Packets on IPv6 Interfaces by Default + + Configure the secure_mode_insmod SELinux Boolean - ocil:ssg-sysctl_net_ipv6_conf_default_accept_source_route_action:testaction:1 + ocil:ssg-sebool_secure_mode_insmod_action:testaction:1 - - System Audit Logs Must Be Owned By Root + + Disable compatibility with brk() - ocil:ssg-file_ownership_var_log_audit_action:testaction:1 + ocil:ssg-kernel_config_compat_brk_action:testaction:1 - - Disable the httpd_use_gpg SELinux Boolean + + Configure dnf-automatic to Install Available Updates Automatically - ocil:ssg-sebool_httpd_use_gpg_action:testaction:1 + ocil:ssg-dnf-automatic_apply_updates_action:testaction:1 - - Disable Ctrl-Alt-Del Burst Action + + Disable the git_session_users SELinux Boolean - ocil:ssg-disable_ctrlaltdel_burstaction_action:testaction:1 + ocil:ssg-sebool_git_session_users_action:testaction:1 - - Lock Accounts Must Persist + + Disable the virt_use_nfs SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_dir_action:testaction:1 + ocil:ssg-sebool_virt_use_nfs_action:testaction:1 - - Verify /boot/grub2/user.cfg User Ownership + + Configure audit according to OSPP requirements - ocil:ssg-file_owner_user_cfg_action:testaction:1 + ocil:ssg-audit_rules_for_ospp_action:testaction:1 - - Disable tftp Service + + Record Attempts to Alter the localtime File - ocil:ssg-service_tftp_disabled_action:testaction:1 + ocil:ssg-audit_rules_time_watch_localtime_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD + + Disable the mozilla_read_content SELinux Boolean - ocil:ssg-sudo_remove_nopasswd_action:testaction:1 + ocil:ssg-sebool_mozilla_read_content_action:testaction:1 - - Disable the webadm_read_user_files SELinux Boolean + + Enable the SSSD Service - ocil:ssg-sebool_webadm_read_user_files_action:testaction:1 + ocil:ssg-service_sssd_enabled_action:testaction:1 - - Warn on W+X mappings found at boot + + Verify /boot/grub2/grub.cfg Permissions - ocil:ssg-kernel_config_debug_wx_action:testaction:1 + ocil:ssg-file_permissions_grub2_cfg_action:testaction:1 - - Verify Owner on cron.monthly + + Disable the spamassassin_can_network SELinux Boolean - ocil:ssg-file_owner_cron_monthly_action:testaction:1 + ocil:ssg-sebool_spamassassin_can_network_action:testaction:1 - - Ensure Only Users Logged In To Real tty Can Execute Sudo - sudo use_pty + + Boot Loader Is Not Installed On Removeable Media - ocil:ssg-sudo_add_use_pty_action:testaction:1 + ocil:ssg-grub2_no_removeable_media_action:testaction:1 - - Record Events that Modify the System's Mandatory Access Controls in usr/share + + Install Smart Card Packages For Multifactor Authentication - ocil:ssg-audit_rules_mac_modification_usr_share_action:testaction:1 + ocil:ssg-install_smartcard_packages_action:testaction:1 - - Disable the entropyd_use_audio SELinux Boolean + + Disable the samba_portmapper SELinux Boolean - ocil:ssg-sebool_entropyd_use_audio_action:testaction:1 + ocil:ssg-sebool_samba_portmapper_action:testaction:1 - - Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate + + Verify the UEFI Boot Loader grub.cfg User Ownership - ocil:ssg-sudo_remove_no_authenticate_action:testaction:1 + ocil:ssg-file_owner_efi_grub2_cfg_action:testaction:1 - - Disable the httpd_can_network_connect SELinux Boolean + + Disable SSH TCP Forwarding - ocil:ssg-sebool_httpd_can_network_connect_action:testaction:1 + ocil:ssg-sshd_disable_tcp_forwarding_action:testaction:1 - - Ensure remote access methods are monitored in Rsyslog + + Disable the virt_use_execmem SELinux Boolean - ocil:ssg-rsyslog_remote_access_monitoring_action:testaction:1 + ocil:ssg-sebool_virt_use_execmem_action:testaction:1 - - Disable ypserv Service + + Disable the use_ecryptfs_home_dirs SELinux Boolean - ocil:ssg-service_ypserv_disabled_action:testaction:1 + ocil:ssg-sebool_use_ecryptfs_home_dirs_action:testaction:1 - - Verify Group Who Owns /etc/at.allow file + + Disable Network Console (netconsole) - ocil:ssg-file_groupowner_at_allow_action:testaction:1 + ocil:ssg-service_netconsole_disabled_action:testaction:1 - - Configure the gluster_export_all_rw SELinux Boolean + + Ensure All-Squashing Disabled On All Exports - ocil:ssg-sebool_gluster_export_all_rw_action:testaction:1 + ocil:ssg-no_all_squash_exports_action:testaction:1 - - Verify /boot/grub2/grub.cfg Permissions + + Emulate Privileged Access Never (PAN) - ocil:ssg-file_permissions_grub2_cfg_action:testaction:1 + ocil:ssg-kernel_config_arm64_sw_ttbr0_pan_action:testaction:1 - - Prevent Login to Accounts With Empty Password + + Verify Group Who Owns /etc/shells File - ocil:ssg-no_empty_passwords_action:testaction:1 + ocil:ssg-file_groupowner_etc_shells_action:testaction:1 - - Configure file name of core dumps + + Ensure that Users Path Contains Only Local Directories - ocil:ssg-sysctl_kernel_core_uses_pid_action:testaction:1 + ocil:ssg-accounts_user_home_paths_only_action:testaction:1 - - Enable the logging_syslogd_use_tty SELinux Boolean + + Ensure PAM Enforces Password Requirements - Enforce for root User - ocil:ssg-sebool_logging_syslogd_use_tty_action:testaction:1 + ocil:ssg-accounts_password_pam_enforce_root_action:testaction:1 - - Add noexec Option to /home + + Uninstall nfs-utils Package - ocil:ssg-mount_option_home_noexec_action:testaction:1 + ocil:ssg-package_nfs-utils_removed_action:testaction:1 - - Disable the polipo_connect_all_unreserved SELinux Boolean + + Require Authentication for Single User Mode - ocil:ssg-sebool_polipo_connect_all_unreserved_action:testaction:1 + ocil:ssg-require_singleuser_auth_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Different Characters + + Configure LDAP Client to Use TLS For All Transactions - ocil:ssg-accounts_password_pam_difok_action:testaction:1 + ocil:ssg-ldap_client_start_tls_action:testaction:1 - - Ensure PAM Enforces Password Requirements - Minimum Digit Characters + + Disable the use of user namespaces - ocil:ssg-accounts_password_pam_dcredit_action:testaction:1 + ocil:ssg-sysctl_user_max_user_namespaces_action:testaction:1 - - Ensure that chronyd is running under chrony user account + + Configure Auto Configuration on All IPv6 Interfaces By Default - ocil:ssg-chronyd_run_as_chrony_user_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_autoconf_action:testaction:1 - - Uninstall rpcbind Package + + Disable the httpd_anon_write SELinux Boolean - ocil:ssg-package_rpcbind_removed_action:testaction:1 + ocil:ssg-sebool_httpd_anon_write_action:testaction:1 - - Disable Portreserve (portreserve) + + Account Lockouts Must Persist - ocil:ssg-service_portreserve_disabled_action:testaction:1 + ocil:ssg-account_passwords_pam_faillock_dir_action:testaction:1 - - Install libreswan Package + + Disable the webadm_read_user_files SELinux Boolean - ocil:ssg-package_libreswan_installed_action:testaction:1 + ocil:ssg-sebool_webadm_read_user_files_action:testaction:1 - - Disable Access to Network bpf() Syscall From Unprivileged Processes + + Disable vsyscall emulation - ocil:ssg-sysctl_kernel_unprivileged_bpf_disabled_action:testaction:1 + ocil:ssg-kernel_config_legacy_vsyscall_emulate_action:testaction:1 - - The robots.txt Files Must Not Exist + + Disable the cobbler_use_nfs SELinux Boolean - ocil:ssg-httpd_remove_robots_file_action:testaction:1 + ocil:ssg-sebool_cobbler_use_nfs_action:testaction:1 - - Verify ownership of System Login Banner for Remote Connections + + Disable the selinuxuser_execstack SELinux Boolean - ocil:ssg-file_owner_etc_issue_net_action:testaction:1 + ocil:ssg-sebool_selinuxuser_execstack_action:testaction:1 - - Enable Kernel Parameter to Use Reverse Path Filtering on all IPv4 Interfaces + + Configure immutable Audit login UIDs - ocil:ssg-sysctl_net_ipv4_conf_all_rp_filter_action:testaction:1 + ocil:ssg-audit_immutable_login_uids_action:testaction:1 - - Record Events that Modify User/Group Information - /etc/group + + Verify Permissions on /etc/cron.allow file - ocil:ssg-audit_rules_usergroup_modification_group_action:testaction:1 + ocil:ssg-file_permissions_cron_allow_action:testaction:1 - - Kernel panic oops + + Configure SNMP Service to Use Only SNMPv3 or Newer - ocil:ssg-kernel_config_panic_on_oops_action:testaction:1 + ocil:ssg-snmpd_use_newer_protocol_action:testaction:1 - - Installation of a compiler on production web server is prohibited + + Uninstall avahi Server Package - ocil:ssg-httpd_no_compilers_in_prod_action:testaction:1 + ocil:ssg-package_avahi_removed_action:testaction:1 - - Disable CPU Speed (cpupower) + + Enable the gssd_read_tmp SELinux Boolean - ocil:ssg-service_cpupower_disabled_action:testaction:1 + ocil:ssg-sebool_gssd_read_tmp_action:testaction:1 - - Configure SSSD to run as user sssd + + Harden the operation of the BPF just-in-time compiler - ocil:ssg-sssd_run_as_sssd_user_action:testaction:1 + ocil:ssg-sysctl_net_core_bpf_jit_harden_action:testaction:1 - - Do Not Allow SSH Environment Options + + Configure OpenSSL library to use TLS Encryption - ocil:ssg-sshd_do_not_permit_user_env_action:testaction:1 + ocil:ssg-configure_openssl_tls_crypto_policy_action:testaction:1 - - Disable Software RAID Monitor (mdmonitor) + + Ensure auditd Collects File Deletion Events by User - renameat - ocil:ssg-service_mdmonitor_disabled_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_renameat_action:testaction:1 - - Map System Users To The Appropriate SELinux Role + + Require Client SMB Packet Signing, if using mount.cifs - ocil:ssg-selinux_user_login_roles_action:testaction:1 + ocil:ssg-mount_option_smb_client_signing_action:testaction:1 - - Add nosuid Option to /var + + Verify Permissions on /etc/audit/rules.d/*.rules - ocil:ssg-mount_option_var_nosuid_action:testaction:1 + ocil:ssg-file_permissions_etc_audit_rulesd_action:testaction:1 - - Verify Group Who Owns /etc/shells File + + Uninstall DHCP Server Package - ocil:ssg-file_groupowner_etc_shells_action:testaction:1 + ocil:ssg-package_dhcp_removed_action:testaction:1 - - The operating system must restrict privilege elevation to authorized personnel + + Enable Kernel Parameter to Enforce DAC on Symlinks - ocil:ssg-sudo_restrict_privilege_elevation_to_authorized_action:testaction:1 + ocil:ssg-sysctl_fs_protected_symlinks_action:testaction:1 - - Enable use of Berkeley Packet Filter with seccomp + + Configure Response Mode of ARP Requests for All IPv4 Interfaces - ocil:ssg-kernel_config_seccomp_filter_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_arp_ignore_action:testaction:1 - - Verify Only Root Has UID 0 + + Remove the OpenSSH Server Package - ocil:ssg-accounts_no_uid_except_zero_action:testaction:1 + ocil:ssg-package_openssh-server_removed_action:testaction:1 - - Ensure that /etc/cron.allow exists + + Ensure PAM Enforces Password Requirements - Maximum Consecutive Repeating Characters from Same Character Class - ocil:ssg-file_cron_allow_exists_action:testaction:1 + ocil:ssg-accounts_password_pam_maxclassrepeat_action:testaction:1 - - Disable Kernel iwlwifi Module + + Prefer to use a 64-bit Operating System when supported - ocil:ssg-kernel_module_iwlwifi_disabled_action:testaction:1 + ocil:ssg-prefer_64bit_os_action:testaction:1 @@ -358120,244 +358622,244 @@ which the system will be deployed as closely as possible.ocil:ssg-audit_rules_kernel_module_loading_finit_action:testaction:1 - - Verify Group Who Owns Backup shadow File + + Disable the deny_ptrace SELinux Boolean - ocil:ssg-file_owner_backup_etc_shadow_action:testaction:1 + ocil:ssg-sebool_deny_ptrace_action:testaction:1 - - Disable Recovery Booting + + Disable the squid_connect_any SELinux Boolean - ocil:ssg-grub2_disable_recovery_action:testaction:1 + ocil:ssg-sebool_squid_connect_any_action:testaction:1 - - Configure auditd mail_acct Action on Low Disk Space + + Uninstall rsh-server Package - ocil:ssg-auditd_data_retention_action_mail_acct_action:testaction:1 + ocil:ssg-package_rsh-server_removed_action:testaction:1 - - Record Any Attempts to Run chcon + + Disable the pcp_bind_all_unreserved_ports SELinux Boolean - ocil:ssg-audit_rules_execution_chcon_action:testaction:1 + ocil:ssg-sebool_pcp_bind_all_unreserved_ports_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - usernetctl + + Ensure the Logon Failure Delay is Set Correctly in login.defs - ocil:ssg-audit_rules_privileged_commands_usernetctl_action:testaction:1 + ocil:ssg-accounts_logon_fail_delay_action:testaction:1 - - Configure auditd Disk Full Action when Disk Space Is Full + + Record Unsuccessful Ownership Changes to Files - lchown - ocil:ssg-auditd_data_disk_full_action_stig_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_lchown_action:testaction:1 - - Configure Firewalld to Use the Nftables Backend + + Configure Logind to terminate idle sessions after certain time of inactivity - ocil:ssg-firewalld-backend_action:testaction:1 + ocil:ssg-logind_session_timeout_action:testaction:1 - - Add nosuid Option to /var/log + + Ensure network interfaces are assigned to appropriate zone - ocil:ssg-mount_option_var_log_nosuid_action:testaction:1 + ocil:ssg-set_firewalld_appropriate_zone_action:testaction:1 - - Enable the sysadm_exec_content SELinux Boolean + + Set Account Expiration Following Inactivity - ocil:ssg-sebool_sysadm_exec_content_action:testaction:1 + ocil:ssg-account_disable_post_pw_expiration_action:testaction:1 - - Verify Group Ownership of System Login Banner + + Record Events that Modify the System's Network Environment - ocil:ssg-file_groupowner_etc_issue_action:testaction:1 + ocil:ssg-audit_rules_networkconfig_modification_action:testaction:1 - - Disable the saslauthd_read_shadow SELinux Boolean + + Install openscap-scanner Package - ocil:ssg-sebool_saslauthd_read_shadow_action:testaction:1 + ocil:ssg-package_openscap-scanner_installed_action:testaction:1 - - Disable X11 Forwarding + + Specify UID and GID for Anonymous NFS Connections - ocil:ssg-sshd_disable_x11_forwarding_action:testaction:1 + ocil:ssg-nfs_no_anonymous_action:testaction:1 - - Disable the 32-bit vDSO + + Add nosuid Option to /var - ocil:ssg-kernel_config_compat_vdso_action:testaction:1 + ocil:ssg-mount_option_var_nosuid_action:testaction:1 - - Uninstall setroubleshoot-plugins Package + + Disable the virt_rw_qemu_ga_data SELinux Boolean - ocil:ssg-package_setroubleshoot-plugins_removed_action:testaction:1 + ocil:ssg-sebool_virt_rw_qemu_ga_data_action:testaction:1 - - Ensure There Are No Accounts With Blank or Null Passwords + + Ensure auditd Collects Information on Kernel Module Loading and Unloading - query_module - ocil:ssg-no_empty_passwords_etc_shadow_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_query_action:testaction:1 - - Configure Libreswan to use System Crypto Policy + + Set Up a Private Namespace in PAM Configuration - ocil:ssg-configure_libreswan_crypto_policy_action:testaction:1 + ocil:ssg-enable_pam_namespace_action:testaction:1 - - Disable the awstats_purge_apache_log_files SELinux Boolean + + Disable the neutron_can_network SELinux Boolean - ocil:ssg-sebool_awstats_purge_apache_log_files_action:testaction:1 + ocil:ssg-sebool_neutron_can_network_action:testaction:1 - - Disable Geolocation in GNOME3 + + Modify the System Login Banner for Remote Connections - ocil:ssg-dconf_gnome_disable_geolocation_action:testaction:1 + ocil:ssg-banner_etc_issue_net_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - init + + Disable the unprivuser_use_svirt SELinux Boolean - ocil:ssg-audit_privileged_commands_init_action:testaction:1 + ocil:ssg-sebool_unprivuser_use_svirt_action:testaction:1 - - Disable Compression Or Set Compression to delayed + + Enable the Hardware RNG Entropy Gatherer Service - ocil:ssg-sshd_disable_compression_action:testaction:1 + ocil:ssg-service_rngd_enabled_action:testaction:1 - - Ensure auditd Collects Unauthorized Access Attempts to Files (unsuccessful) + + Support session locking with tmux (not enforcing) - ocil:ssg-audit_rules_unsuccessful_file_modification_action:testaction:1 + ocil:ssg-configure_bashrc_tmux_action:testaction:1 - - Disable the nagios_run_pnp4nagios SELinux Boolean + + Disable vsyscall mapping - ocil:ssg-sebool_nagios_run_pnp4nagios_action:testaction:1 + ocil:ssg-kernel_config_legacy_vsyscall_none_action:testaction:1 - - Ensure All SUID Executables Are Authorized + + Enable the kerberos_enabled SELinux Boolean - ocil:ssg-file_permissions_unauthorized_suid_action:testaction:1 + ocil:ssg-sebool_kerberos_enabled_action:testaction:1 - - Uninstall iprutils Package + + Record Events When Privileged Executables Are Run - ocil:ssg-package_iprutils_removed_action:testaction:1 + ocil:ssg-audit_rules_suid_privilege_function_action:testaction:1 - - Configure System Cryptography Policy + + Disable Kernel Parameter for IP Forwarding on IPv4 Interfaces - ocil:ssg-configure_crypto_policy_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_ip_forward_action:testaction:1 - - Set Password Maximum Age + + Enable Kernel Parameter to Enforce DAC on Hardlinks - ocil:ssg-accounts_maximum_age_login_defs_action:testaction:1 + ocil:ssg-sysctl_fs_protected_hardlinks_action:testaction:1 - - Add nosuid Option to /boot/efi + + Ensure there are no legacy + NIS entries in /etc/group - ocil:ssg-mount_option_boot_efi_nosuid_action:testaction:1 + ocil:ssg-no_legacy_plus_entries_etc_group_action:testaction:1 - - Disable merging of slabs with similar size + + Configure auditd Max Log File Size - ocil:ssg-grub2_slab_nomerge_argument_action:testaction:1 + ocil:ssg-auditd_data_retention_max_log_file_action:testaction:1 - - Disable the httpd_mod_auth_pam SELinux Boolean + + Enable checks on notifier call chains - ocil:ssg-sebool_httpd_mod_auth_pam_action:testaction:1 + ocil:ssg-kernel_config_debug_notifiers_action:testaction:1 - - Disable the daemons_dump_core SELinux Boolean + + Record Any Attempts to Run ssh-agent - ocil:ssg-sebool_daemons_dump_core_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_ssh_agent_action:testaction:1 - - Disable the mozilla_plugin_use_gps SELinux Boolean + + Configure ARP filtering for All IPv4 Interfaces - ocil:ssg-sebool_mozilla_plugin_use_gps_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_arp_filter_action:testaction:1 - - Enable poison of pages after freeing + + Verify Group Who Owns Backup shadow File - ocil:ssg-kernel_config_page_poisoning_action:testaction:1 + ocil:ssg-file_owner_backup_etc_shadow_action:testaction:1 - - Uninstall tuned Package + + Disable the telepathy_tcp_connect_generic_network_ports SELinux Boolean - ocil:ssg-package_tuned_removed_action:testaction:1 + ocil:ssg-sebool_telepathy_tcp_connect_generic_network_ports_action:testaction:1 - - Enable the httpd_graceful_shutdown SELinux Boolean + + Install the tmux Package - ocil:ssg-sebool_httpd_graceful_shutdown_action:testaction:1 + ocil:ssg-package_tmux_installed_action:testaction:1 - - Verify ip6tables Enabled if Using IPv6 + + Disable the named_write_master_zones SELinux Boolean - ocil:ssg-service_ip6tables_enabled_action:testaction:1 + ocil:ssg-sebool_named_write_master_zones_action:testaction:1 - - Sign kernel modules with SHA-512 + + Enable the xend_run_qemu SELinux Boolean - ocil:ssg-kernel_config_module_sig_sha512_action:testaction:1 + ocil:ssg-sebool_xend_run_qemu_action:testaction:1 - - Ensure gnutls-utils is installed + + Configure System to Forward All Mail For The Root Account - ocil:ssg-package_gnutls-utils_installed_action:testaction:1 + ocil:ssg-postfix_client_configure_mail_alias_action:testaction:1 - - Uninstall avahi Server Package + + Ensure Authentication Required for Single User Mode - ocil:ssg-package_avahi_removed_action:testaction:1 + ocil:ssg-ensure_root_password_configured_action:testaction:1 - - Set type of computer node name logging in audit logs + + Record Successful Access Attempts to Files - open - ocil:ssg-auditd_name_format_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_action:testaction:1 - - Remove Host-Based Authentication Files + + Record Unsuccessful Delete Attempts to Files - rename - ocil:ssg-no_host_based_files_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_rename_action:testaction:1 @@ -358366,172 +358868,172 @@ which the system will be deployed as closely as possible.ocil:ssg-has_nonlocal_mta_action:testaction:1 - - Disable the cobbler_can_network_connect SELinux Boolean + + Ensure the Default C Shell Umask is Set Correctly - ocil:ssg-sebool_cobbler_can_network_connect_action:testaction:1 + ocil:ssg-accounts_umask_etc_csh_cshrc_action:testaction:1 - - Disable the polipo_session_users SELinux Boolean + + Configure A Valid Server Certificate - ocil:ssg-sebool_polipo_session_users_action:testaction:1 + ocil:ssg-httpd_configure_valid_server_cert_action:testaction:1 - - Strong Stack Protector + + Stack Protector buffer overlow detection - ocil:ssg-kernel_config_stackprotector_strong_action:testaction:1 + ocil:ssg-kernel_config_stackprotector_action:testaction:1 - - Enable Postfix Service + + Enable Auditing for Processes Which Start Prior to the Audit Daemon - ocil:ssg-service_postfix_enabled_action:testaction:1 + ocil:ssg-grub2_audit_argument_action:testaction:1 - - Enable the USBGuard Service + + Add nosuid Option to /dev/shm - ocil:ssg-service_usbguard_enabled_action:testaction:1 + ocil:ssg-mount_option_dev_shm_nosuid_action:testaction:1 - - Disable Client Dynamic DNS Updates + + Disable the domain_kernel_load_modules SELinux Boolean - ocil:ssg-network_disable_ddns_interfaces_action:testaction:1 + ocil:ssg-sebool_domain_kernel_load_modules_action:testaction:1 - - Disable PubkeyAuthentication Authentication + + Verify All Account Password Hashes are Shadowed - ocil:ssg-sshd_disable_pubkey_auth_action:testaction:1 + ocil:ssg-accounts_password_all_shadowed_action:testaction:1 - - Install the McAfee Runtime Libraries and Linux Agent + + Enable checks on scatter-gather (SG) table operations - ocil:ssg-install_mcafee_cma_rt_action:testaction:1 + ocil:ssg-kernel_config_debug_sg_action:testaction:1 - - Require Client SMB Packet Signing, if using smbclient + + Configure OpenSSL library to use System Crypto Policy - ocil:ssg-require_smb_client_signing_action:testaction:1 + ocil:ssg-configure_openssl_crypto_policy_action:testaction:1 - - HTTPD Log Files Must Be Owned By Root + + Disable Samba - ocil:ssg-http_configure_log_file_ownership_action:testaction:1 + ocil:ssg-service_smb_disabled_action:testaction:1 - - Ensure yum Removes Previous Package Versions + + Prevent user from disabling the screen lock - ocil:ssg-clean_components_post_updating_action:testaction:1 + ocil:ssg-no_tmux_in_shells_action:testaction:1 - - Record Unsuccessful Access Attempts to Files - open + + Ensure Sudo Logfile Exists - sudo logfile - ocil:ssg-audit_rules_unsuccessful_file_modification_open_action:testaction:1 + ocil:ssg-sudo_custom_logfile_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - unix_update + + Disable hibernation - ocil:ssg-audit_rules_privileged_commands_unix_update_action:testaction:1 + ocil:ssg-kernel_config_hibernation_action:testaction:1 - - Install vim Package + + Record Unsuccessful Permission Changes to Files - fsetxattr - ocil:ssg-package_vim_installed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_fsetxattr_action:testaction:1 - - System Audit Logs Must Have Mode 0640 or Less Permissive + + Record Unsuccessful Delete Attempts to Files - unlink - ocil:ssg-file_permissions_var_log_audit_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_unlink_action:testaction:1 - - Disable Bluetooth Service + + Disable the awstats_purge_apache_log_files SELinux Boolean - ocil:ssg-service_bluetooth_disabled_action:testaction:1 + ocil:ssg-sebool_awstats_purge_apache_log_files_action:testaction:1 - - Ensure /opt Located On Separate Partition + + Disable the virt_use_fusefs SELinux Boolean - ocil:ssg-partition_for_opt_action:testaction:1 + ocil:ssg-sebool_virt_use_fusefs_action:testaction:1 - - Install the OpenSSH Server Package + + Set LogLevel to INFO - ocil:ssg-package_openssh-server_installed_action:testaction:1 + ocil:ssg-sshd_set_loglevel_info_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - fsetxattr + + Ensure that chronyd is running under chrony user account - ocil:ssg-audit_rules_dac_modification_fsetxattr_action:testaction:1 + ocil:ssg-chronyd_run_as_chrony_user_action:testaction:1 - - Disable the httpd_use_openstack SELinux Boolean + + Verify ownership of System Login Banner for Remote Connections - ocil:ssg-sebool_httpd_use_openstack_action:testaction:1 + ocil:ssg-file_owner_etc_issue_net_action:testaction:1 - - Verify User Who Owns Backup passwd File + + Verify that Shared Library Files Have Root Ownership - ocil:ssg-file_owner_backup_etc_passwd_action:testaction:1 + ocil:ssg-file_ownership_library_dirs_action:testaction:1 - - Ensure sudo Ignores Commands In Current Dir - sudo ignore_dot + + Verify Group Who Owns cron.daily - ocil:ssg-sudo_add_ignore_dot_action:testaction:1 + ocil:ssg-file_groupowner_cron_daily_action:testaction:1 - - Ensure all users last password change date is in the past + + Configure the tmux lock session key binding - ocil:ssg-accounts_password_last_change_is_in_past_action:testaction:1 + ocil:ssg-configure_tmux_lock_keybinding_action:testaction:1 - - Disable the secure_mode_policyload SELinux Boolean + + Disable named Service - ocil:ssg-sebool_secure_mode_policyload_action:testaction:1 + ocil:ssg-service_named_disabled_action:testaction:1 - - Install dnf-automatic Package + + Disable the httpd_execmem SELinux Boolean - ocil:ssg-package_dnf-automatic_installed_action:testaction:1 + ocil:ssg-sebool_httpd_execmem_action:testaction:1 - - Disable Cockpit Management Server + + Ensure Web Content Located on Separate partition - ocil:ssg-service_cockpit_disabled_action:testaction:1 + ocil:ssg-partition_for_web_content_action:testaction:1 - - Configure GnuTLS library to use DoD-approved TLS Encryption + + Disable WIFI Network Notification in GNOME3 - ocil:ssg-configure_gnutls_tls_crypto_policy_action:testaction:1 + ocil:ssg-dconf_gnome_disable_wifi_notification_action:testaction:1 - - Ensure the Default Umask is Set Correctly in login.defs + + Ensure /var/log Located On Separate Partition - ocil:ssg-accounts_umask_etc_login_defs_action:testaction:1 + ocil:ssg-partition_for_var_log_action:testaction:1 @@ -358540,395 +359042,394 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_abrt_upload_watch_anon_write_action:testaction:1 - - Ensure auditd Collects File Deletion Events by User + + Disable Squid - ocil:ssg-audit_rules_file_deletion_events_action:testaction:1 + ocil:ssg-service_squid_disabled_action:testaction:1 - - UEFI Boot Loader Is Not Installed On Removeable Media + + Restrict Serial Port Root Logins - ocil:ssg-uefi_no_removeable_media_action:testaction:1 + ocil:ssg-restrict_serial_port_logins_action:testaction:1 - - Configure System to Forward All Mail For The Root Account + + Record Successful Access Attempts to Files - openat - ocil:ssg-postfix_client_configure_mail_alias_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_openat_action:testaction:1 - - Enable Kernel Parameter to Log Martian Packets on all IPv4 Interfaces + + Install sudo Package - ocil:ssg-sysctl_net_ipv4_conf_all_log_martians_action:testaction:1 + ocil:ssg-package_sudo_installed_action:testaction:1 - - Disable the git_session_users SELinux Boolean + + Configure auditd Disk Error Action on Disk Error - ocil:ssg-sebool_git_session_users_action:testaction:1 + ocil:ssg-auditd_data_disk_error_action_stig_action:testaction:1 - - Disable the virt_use_nfs SELinux Boolean + + Record Successful Permission Changes to Files - removexattr - ocil:ssg-sebool_virt_use_nfs_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_removexattr_action:testaction:1 - - Verify the system-wide library files in directories -"/lib", "/lib64", "/usr/lib/" and "/usr/lib64" are group-owned by root. + + Disable Web Content Symbolic Links - ocil:ssg-root_permissions_syslibrary_files_action:testaction:1 + ocil:ssg-httpd_disable_content_symlinks_action:testaction:1 - - Configure the tmux lock session key binding + + Disable the virt_use_comm SELinux Boolean - ocil:ssg-configure_tmux_lock_keybinding_action:testaction:1 + ocil:ssg-sebool_virt_use_comm_action:testaction:1 - - Disable GNOME3 Automount running + + Ensure auditd Collects Information on the Use of Privileged Commands - pam_timestamp_check - ocil:ssg-dconf_gnome_disable_autorun_action:testaction:1 + ocil:ssg-audit_rules_privileged_commands_pam_timestamp_check_action:testaction:1 - - Disable the openvpn_can_network_connect SELinux Boolean + + Disable the cluster_use_execmem SELinux Boolean - ocil:ssg-sebool_openvpn_can_network_connect_action:testaction:1 + ocil:ssg-sebool_cluster_use_execmem_action:testaction:1 - - Verify Group Who Owns /etc/cron.allow file + + Ensure auditd Collects Information on the Use of Privileged Commands - reboot - ocil:ssg-file_groupowner_cron_allow_action:testaction:1 + ocil:ssg-audit_privileged_commands_reboot_action:testaction:1 - - Enable SSH Warning Banner + + Ensure sudo only includes the default configuration directory - ocil:ssg-sshd_enable_warning_banner_net_action:testaction:1 + ocil:ssg-sudoers_default_includedir_action:testaction:1 - - Install binutils Package + + Record Events that Modify the System's Discretionary Access Controls - fchmodat - ocil:ssg-package_binutils_installed_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_fchmodat_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - ssh-keysign + + Enable the staff_exec_content SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_ssh_keysign_action:testaction:1 + ocil:ssg-sebool_staff_exec_content_action:testaction:1 - - Disable the cluster_manage_all_files SELinux Boolean + + Restrict usage of ptrace to descendant processes - ocil:ssg-sebool_cluster_manage_all_files_action:testaction:1 + ocil:ssg-sysctl_kernel_yama_ptrace_scope_action:testaction:1 - - Disable Dovecot Service + + Uninstall python3-abrt-addon Package - ocil:ssg-service_dovecot_disabled_action:testaction:1 + ocil:ssg-package_python3-abrt-addon_removed_action:testaction:1 - - Verify the SSH Private Key Files Have a Passcode + + Verify Permissions on shadow File - ocil:ssg-ssh_keys_passphrase_protected_action:testaction:1 + ocil:ssg-file_permissions_etc_shadow_action:testaction:1 - - Configure Fapolicy Module to Employ a Deny-all, Permit-by-exception Policy to Allow the Execution of Authorized Software Programs. + + Enable module signature verification - ocil:ssg-fapolicy_default_deny_action:testaction:1 + ocil:ssg-kernel_config_module_sig_action:testaction:1 - - Disable Ctrl-Alt-Del Reboot Activation + + Verify User Who Owns Backup group File - ocil:ssg-disable_ctrlaltdel_reboot_action:testaction:1 + ocil:ssg-file_owner_backup_etc_group_action:testaction:1 - - Ensure journald is configured to compress large log files + + Uninstall tftp-server Package - ocil:ssg-journald_compress_action:testaction:1 + ocil:ssg-package_tftp-server_removed_action:testaction:1 - - Configure the Use of the pam_faillock.so Module in the /etc/pam.d/system-auth File. + + Disable the uvcvideo module - ocil:ssg-account_password_pam_faillock_system_auth_action:testaction:1 + ocil:ssg-kernel_module_uvcvideo_disabled_action:testaction:1 - - Set configuration for loopback traffic + + Ensure All Groups on the System Have Unique Group Names - ocil:ssg-set_loopback_traffic_action:testaction:1 + ocil:ssg-group_unique_name_action:testaction:1 - - Verify Group Who Owns /var/log/messages File + + Configure auditing of loading and unloading of kernel modules - ocil:ssg-file_groupowner_var_log_messages_action:testaction:1 + ocil:ssg-audit_module_load_action:testaction:1 - - Enable the dbadm_exec_content SELinux Boolean + + Configure Maximum Number of Autoconfigured Addresses on All IPv6 Interfaces - ocil:ssg-sebool_dbadm_exec_content_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_all_max_addresses_action:testaction:1 - - Audit Tools Must Be Owned by Root + + Ensure SELinux Not Disabled in the kernel arguments - ocil:ssg-file_audit_tools_ownership_action:testaction:1 + ocil:ssg-coreos_enable_selinux_kernel_argument_action:testaction:1 - - Restrict usage of ptrace to descendant processes + + Disable the privoxy_connect_any SELinux Boolean - ocil:ssg-sysctl_kernel_yama_ptrace_scope_action:testaction:1 + ocil:ssg-sebool_privoxy_connect_any_action:testaction:1 - - Disable the selinuxuser_execstack SELinux Boolean + + Ensure auditd Collects Information on Kernel Module Unloading - delete_module - ocil:ssg-sebool_selinuxuser_execstack_action:testaction:1 + ocil:ssg-audit_rules_kernel_module_loading_delete_action:testaction:1 - - Add nosuid Option to /var/tmp + + Detect stack corruption on calls to schedule() - ocil:ssg-mount_option_var_tmp_nosuid_action:testaction:1 + ocil:ssg-kernel_config_sched_stack_end_check_action:testaction:1 - - Configure The Number of Allowed Simultaneous Requests + + Disable Kernel Parameter for Accepting Source-Routed Packets on IPv4 Interfaces by Default - ocil:ssg-httpd_configure_max_keepalive_requests_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_default_accept_source_route_action:testaction:1 - - Ensure syslog-ng is Installed + + Disable the mysql_connect_any SELinux Boolean - ocil:ssg-package_syslogng_installed_action:testaction:1 + ocil:ssg-sebool_mysql_connect_any_action:testaction:1 - - Disable Network Console (netconsole) + + Configure auditing of unsuccessful file deletions - ocil:ssg-service_netconsole_disabled_action:testaction:1 + ocil:ssg-audit_delete_failed_action:testaction:1 - - Uninstall xinetd Package + + Record Successful Creation Attempts to Files - open O_CREAT - ocil:ssg-package_xinetd_removed_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_open_o_creat_action:testaction:1 - - Verify that All World-Writable Directories Have Sticky Bits Set + + Ensure the default plugins for the audit dispatcher are Installed - ocil:ssg-dir_perms_world_writable_sticky_bits_action:testaction:1 + ocil:ssg-package_audit-audispd-plugins_installed_action:testaction:1 - - Uninstall Automatic Bug Reporting Tool (abrt) + + Enable SSH Warning Banner - ocil:ssg-package_abrt_removed_action:testaction:1 + ocil:ssg-sshd_enable_warning_banner_action:testaction:1 - - Disable the xguest_use_bluetooth SELinux Boolean + + Install dnf-plugin-subscription-manager Package - ocil:ssg-sebool_xguest_use_bluetooth_action:testaction:1 + ocil:ssg-package_dnf-plugin-subscription-manager_installed_action:testaction:1 - - Configure auditing of loading and unloading of kernel modules + + Enable the NTP Daemon - ocil:ssg-audit_module_load_action:testaction:1 + ocil:ssg-service_ntp_enabled_action:testaction:1 - - Add nosuid Option to /srv + + Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config - ocil:ssg-mount_option_srv_nosuid_action:testaction:1 + ocil:ssg-harden_sshd_macs_openssh_conf_crypto_policy_action:testaction:1 - - Disable Modprobe Loading of USB Storage Driver + + Record Events that Modify the System's Discretionary Access Controls - lchown - ocil:ssg-kernel_module_usb-storage_disabled_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lchown_action:testaction:1 - - Enable the fips_mode SELinux Boolean + + Disable DCCP Support - ocil:ssg-sebool_fips_mode_action:testaction:1 + ocil:ssg-kernel_module_dccp_disabled_action:testaction:1 - - Set Password Hashing Rounds in /etc/login.defs + + Configure PAM in SSSD Services - ocil:ssg-set_password_hashing_min_rounds_logindefs_action:testaction:1 + ocil:ssg-sssd_enable_pam_services_action:testaction:1 - - Disable the squid_use_tproxy SELinux Boolean + + Enable logrotate Timer - ocil:ssg-sebool_squid_use_tproxy_action:testaction:1 + ocil:ssg-timer_logrotate_enabled_action:testaction:1 - - Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/shadow + + Scan All Uploaded Content for Malicious Software - ocil:ssg-audit_rules_etc_shadow_open_by_handle_at_action:testaction:1 + ocil:ssg-httpd_antivirus_scan_uploads_action:testaction:1 - - Ensure PAM password complexity module is enabled in system-auth + + Uninstall abrt-addon-ccpp Package - ocil:ssg-accounts_password_pam_pwquality_system_auth_action:testaction:1 + ocil:ssg-package_abrt-addon-ccpp_removed_action:testaction:1 - - Ensure journald is configured to send logs to rsyslog + + Add noexec Option to /dev/shm - ocil:ssg-journald_forward_to_syslog_action:testaction:1 + ocil:ssg-mount_option_dev_shm_noexec_action:testaction:1 - - Disable the IPv6 protocol + + Kernel panic oops - ocil:ssg-kernel_config_ipv6_action:testaction:1 + ocil:ssg-kernel_config_panic_on_oops_action:testaction:1 - - Configure session renegotiation for SSH client + + Uninstall avahi-autoipd Server Package - ocil:ssg-ssh_client_rekey_limit_action:testaction:1 + ocil:ssg-package_avahi-autoipd_removed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - passwd + + Record Unsuccessful Access Attempts to Files - open_by_handle_at - ocil:ssg-audit_rules_privileged_commands_passwd_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_by_handle_at_action:testaction:1 - - Require Authentication for Single User Mode + + Disable the samba_load_libgfapi SELinux Boolean - ocil:ssg-require_singleuser_auth_action:testaction:1 + ocil:ssg-sebool_samba_load_libgfapi_action:testaction:1 - - Use Only FIPS 140-2 Validated Ciphers + + Disable Red Hat Subscription Manager Daemon (rhsmcertd) - ocil:ssg-sshd_use_approved_ciphers_action:testaction:1 + ocil:ssg-service_rhsmcertd_disabled_action:testaction:1 - - Set Lockout Time for Failed Password Attempts + + Disable the virt_sandbox_use_netlink SELinux Boolean - ocil:ssg-accounts_passwords_pam_faillock_unlock_time_action:testaction:1 + ocil:ssg-sebool_virt_sandbox_use_netlink_action:testaction:1 - - Ensure Red Hat GPG Key Installed + + Enable the nscd_use_shm SELinux Boolean - ocil:ssg-ensure_redhat_gpgkey_installed_action:testaction:1 + ocil:ssg-sebool_nscd_use_shm_action:testaction:1 - - Disable the gpg_web_anon_write SELinux Boolean + + Disable the httpd_setrlimit SELinux Boolean - ocil:ssg-sebool_gpg_web_anon_write_action:testaction:1 + ocil:ssg-sebool_httpd_setrlimit_action:testaction:1 - - Enforce Spectre v2 mitigation + + Install the Policy Auditor (PA) Module - ocil:ssg-grub2_spectre_v2_argument_action:testaction:1 + ocil:ssg-install_mcafee_hbss_pa_action:testaction:1 - - Ensure Software Patches Installed + + Enable Logging of All FTP Transactions - ocil:ssg-security_patches_up_to_date_action:testaction:1 + ocil:ssg-ftp_log_transactions_action:testaction:1 - - Enable the xend_run_blktap SELinux Boolean + + Install policycoreutils Package - ocil:ssg-sebool_xend_run_blktap_action:testaction:1 + ocil:ssg-package_policycoreutils_installed_action:testaction:1 - - Configure Accepting Router Preference in Router Advertisements on All IPv6 Interfaces + + Record Events that Modify User/Group Information via open syscall - /etc/group - ocil:ssg-sysctl_net_ipv6_conf_all_accept_ra_rtr_pref_action:testaction:1 + ocil:ssg-audit_rules_etc_group_open_action:testaction:1 - - Record Successful Creation Attempts to Files - open_by_handle_at O_TRUNC_WRITE + + Verify Ownership on SSH Server Public *.pub Key Files - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_trunc_write_action:testaction:1 + ocil:ssg-file_ownership_sshd_pub_key_action:testaction:1 - - Disable vsyscall mapping + + Verify ip6tables Enabled if Using IPv6 - ocil:ssg-kernel_config_legacy_vsyscall_none_action:testaction:1 + ocil:ssg-service_ip6tables_enabled_action:testaction:1 - - Verify Group Who Owns cron.hourly + + Ensure No Device Files are Unlabeled by SELinux - ocil:ssg-file_groupowner_cron_hourly_action:testaction:1 + ocil:ssg-selinux_all_devicefiles_labeled_action:testaction:1 - - Record Events that Modify the System's Discretionary Access Controls - chmod + + SSH server uses strong entropy to seed - ocil:ssg-audit_rules_dac_modification_chmod_action:testaction:1 + ocil:ssg-sshd_use_strong_rng_action:testaction:1 - - Disable GSSAPI Authentication + + Remove tftp Daemon - ocil:ssg-sshd_disable_gssapi_auth_action:testaction:1 + ocil:ssg-package_tftp_removed_action:testaction:1 - - Disable DHCP Client in ifcfg + + Install firewalld Package - ocil:ssg-sysconfig_networking_bootproto_ifcfg_action:testaction:1 + ocil:ssg-package_firewalld_installed_action:testaction:1 - - Disable the puppetmaster_use_db SELinux Boolean + + Set type of computer node name logging in audit logs - ocil:ssg-sebool_puppetmaster_use_db_action:testaction:1 + ocil:ssg-auditd_name_format_action:testaction:1 - - Uninstall squid Package + + Remove ftp Package - ocil:ssg-package_squid_removed_action:testaction:1 + ocil:ssg-package_ftp_removed_action:testaction:1 - - Ensure /usr Located On Separate Partition + + Disable the xen_use_nfs SELinux Boolean - ocil:ssg-partition_for_usr_action:testaction:1 + ocil:ssg-sebool_xen_use_nfs_action:testaction:1 @@ -358937,267 +359438,273 @@ which the system will be deployed as closely as possible.ocil:ssg-sebool_ftpd_use_nfs_action:testaction:1 - - Enable the unconfined_login SELinux Boolean + + Lock Accounts Must Persist - ocil:ssg-sebool_unconfined_login_action:testaction:1 + ocil:ssg-accounts_passwords_pam_faillock_dir_action:testaction:1 - - Disable Kernel Parameter for Sending ICMP Redirects on all IPv4 Interfaces by Default + + Enable TCP/IP syncookie support - ocil:ssg-sysctl_net_ipv4_conf_default_send_redirects_action:testaction:1 + ocil:ssg-kernel_config_syn_cookies_action:testaction:1 - - Install scap-security-guide Package + + Disable the nagios_run_sudo SELinux Boolean - ocil:ssg-package_scap-security-guide_installed_action:testaction:1 + ocil:ssg-sebool_nagios_run_sudo_action:testaction:1 - - Ensure gpgcheck Enabled for Local Packages + + Ensure all zIPL boot entries are BLS compliant - ocil:ssg-ensure_gpgcheck_local_packages_action:testaction:1 + ocil:ssg-zipl_bls_entries_only_action:testaction:1 - - Record Unsuccessful Delete Attempts to Files - unlink + + MIME types for csh or sh shell programs must be disabled - ocil:ssg-audit_rules_unsuccessful_file_modification_unlink_action:testaction:1 + ocil:ssg-httpd_disable_mime_types_action:testaction:1 - - Enable page allocator poisoning in zIPL + + Add nosuid Option to /opt - ocil:ssg-zipl_page_poison_argument_action:testaction:1 + ocil:ssg-mount_option_opt_nosuid_action:testaction:1 - - Uninstall DHCP Server Package + + Verify Group Who Owns /var/log/messages File - ocil:ssg-package_dhcp_removed_action:testaction:1 + ocil:ssg-file_groupowner_var_log_messages_action:testaction:1 - - Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config + + Disable ypbind Service - ocil:ssg-harden_sshd_macs_opensshserver_conf_crypto_policy_action:testaction:1 + ocil:ssg-service_ypbind_disabled_action:testaction:1 - - Verify Ownership on SSH Server Public *.pub Key Files + + Ensure auditd Collects File Deletion Events by User - rmdir - ocil:ssg-file_ownership_sshd_pub_key_action:testaction:1 + ocil:ssg-audit_rules_file_deletion_events_rmdir_action:testaction:1 - - Disable the GNOME3 Login Restart and Shutdown Buttons + + Set the GNOME3 Login Number of Failures - ocil:ssg-dconf_gnome_disable_restart_shutdown_action:testaction:1 + ocil:ssg-dconf_gnome_login_retries_action:testaction:1 - - Ensure SELinux Not Disabled in /etc/default/grub + + Specify the hash to use when signing modules - ocil:ssg-grub2_enable_selinux_action:testaction:1 + ocil:ssg-kernel_config_module_sig_hash_action:testaction:1 - - Ensure rsyslog-gnutls is installed + + Record Unsuccessful Permission Changes to Files - removexattr - ocil:ssg-package_rsyslog-gnutls_installed_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_removexattr_action:testaction:1 - - Enable Process Accounting (psacct) + + Configure auditd flush priority - ocil:ssg-service_psacct_enabled_action:testaction:1 + ocil:ssg-auditd_data_retention_flush_action:testaction:1 - - Disable the exim_can_connect_db SELinux Boolean + + Verify Group Who Owns group File - ocil:ssg-sebool_exim_can_connect_db_action:testaction:1 + ocil:ssg-file_groupowner_etc_group_action:testaction:1 - - Disable the logging_syslogd_can_sendmail SELinux Boolean + + Disable the openshift_use_nfs SELinux Boolean - ocil:ssg-sebool_logging_syslogd_can_sendmail_action:testaction:1 + ocil:ssg-sebool_openshift_use_nfs_action:testaction:1 - - The Chrony package is installed + + Disable GNOME3 Automounting - ocil:ssg-package_chrony_installed_action:testaction:1 + ocil:ssg-dconf_gnome_disable_automount_action:testaction:1 - - Force frequent session key renegotiation + + Install the psacct package - ocil:ssg-sshd_rekey_limit_action:testaction:1 + ocil:ssg-package_psacct_installed_action:testaction:1 - - Record Unsuccessful Creation Attempts to Files - openat O_CREAT + + Add nodev Option to /var/log - ocil:ssg-audit_rules_unsuccessful_file_modification_openat_o_creat_action:testaction:1 + ocil:ssg-mount_option_var_log_nodev_action:testaction:1 - - Disable the mpd_use_nfs SELinux Boolean + + Ensure rsyslog is Installed - ocil:ssg-sebool_mpd_use_nfs_action:testaction:1 + ocil:ssg-package_rsyslog_installed_action:testaction:1 - - Ensure auditd Collects Information on the Use of Privileged Commands - pt_chown + + Disable the httpd_dbus_sssd SELinux Boolean - ocil:ssg-audit_rules_privileged_commands_pt_chown_action:testaction:1 + ocil:ssg-sebool_httpd_dbus_sssd_action:testaction:1 - - Disable the cvs_read_shadow SELinux Boolean + + Ensure SSH MaxStartups is configured - ocil:ssg-sebool_cvs_read_shadow_action:testaction:1 + ocil:ssg-sshd_set_maxstartups_action:testaction:1 - - Limit Password Reuse + + Force kernel panic on uncorrected MCEs - ocil:ssg-accounts_password_pam_unix_remember_action:testaction:1 + ocil:ssg-grub2_mce_argument_action:testaction:1 - - Ensure debug-shell service is not enabled in zIPL + + Disable the puppetagent_manage_all_files SELinux Boolean - ocil:ssg-zipl_systemd_debug-shell_argument_absent_action:testaction:1 + ocil:ssg-sebool_puppetagent_manage_all_files_action:testaction:1 - - Record Unsuccessful Ownership Changes to Files - chown + + Disable the ftpd_connect_all_unreserved SELinux Boolean - ocil:ssg-audit_rules_unsuccessful_file_modification_chown_action:testaction:1 + ocil:ssg-sebool_ftpd_connect_all_unreserved_action:testaction:1 - - Verify Permissions on group File + + Ensure Remote Administrative Access Is Encrypted - ocil:ssg-file_permissions_etc_group_action:testaction:1 + ocil:ssg-httpd_configure_remote_session_encryption_action:testaction:1 - - Record Successful Creation Attempts to Files - open_by_handle_at O_CREAT + + Record Successful Permission Changes to Files - chmod - ocil:ssg-audit_rules_successful_file_modification_open_by_handle_at_o_creat_action:testaction:1 + ocil:ssg-audit_rules_successful_file_modification_chmod_action:testaction:1 - - Record Successful Permission Changes to Files - fchmod + + Disable Kernel Parameter for Accepting Source-Routed Packets on IPv6 Interfaces by Default - ocil:ssg-audit_rules_successful_file_modification_fchmod_action:testaction:1 + ocil:ssg-sysctl_net_ipv6_conf_default_accept_source_route_action:testaction:1 - - Ensure Rsyslog Encrypts Off-Loaded Audit Records + + Set PAM''s Password Hashing Algorithm - ocil:ssg-rsyslog_encrypt_offload_defaultnetstreamdriver_action:testaction:1 + ocil:ssg-set_password_hashing_algorithm_systemauth_action:testaction:1 - - Disable the virt_use_sanlock SELinux Boolean + + Enable the unconfined_chrome_sandbox_transition SELinux Boolean - ocil:ssg-sebool_virt_use_sanlock_action:testaction:1 + ocil:ssg-sebool_unconfined_chrome_sandbox_transition_action:testaction:1 - - Verify Permissions on /var/log Directory + + Record Events that Modify the System's Discretionary Access Controls - lsetxattr - ocil:ssg-file_permissions_var_log_action:testaction:1 + ocil:ssg-audit_rules_dac_modification_lsetxattr_action:testaction:1 - - Record Successful Ownership Changes to Files - fchown + + Record Events that Modify User/Group Information via open_by_handle_at syscall - /etc/passwd - ocil:ssg-audit_rules_successful_file_modification_fchown_action:testaction:1 + ocil:ssg-audit_rules_etc_passwd_open_by_handle_at_action:testaction:1 - - Add noexec Option to /dev/shm + + Configure audispd's Plugin disk_full_action When Disk Is Full - ocil:ssg-mount_option_dev_shm_noexec_action:testaction:1 + ocil:ssg-auditd_audispd_disk_full_action_action:testaction:1 - - Configure auditing of unsuccessful file deletions + + Ensure There Are No Accounts With Blank or Null Passwords - ocil:ssg-audit_delete_failed_action:testaction:1 + ocil:ssg-no_empty_passwords_etc_shadow_action:testaction:1 - - The Installed Operating System Is Vendor Supported + + Disable the httpd_use_openstack SELinux Boolean - ocil:ssg-installed_OS_is_vendor_supported_action:testaction:1 + ocil:ssg-sebool_httpd_use_openstack_action:testaction:1 - - Install sudo Package + + Verify ownership of System Login Banner - ocil:ssg-package_sudo_installed_action:testaction:1 + ocil:ssg-file_owner_etc_issue_action:testaction:1 - - Disable the fenced_can_network_connect SELinux Boolean + + Record Unsuccessful Modification Attempts to Files - open O_TRUNC_WRITE - ocil:ssg-sebool_fenced_can_network_connect_action:testaction:1 + ocil:ssg-audit_rules_unsuccessful_file_modification_open_o_trunc_write_action:testaction:1 - - Uninstall CUPS Package + + Uninstall libreport-plugin-rhtsupport Package - ocil:ssg-package_cups_removed_action:testaction:1 + ocil:ssg-package_libreport-plugin-rhtsupport_removed_action:testaction:1 - - Record Any Attempts to Run setfiles + + Enable Kernel Parameter to Ignore ICMP Broadcast Echo Requests on IPv4 Interfaces - ocil:ssg-audit_rules_execution_setfiles_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_icmp_echo_ignore_broadcasts_action:testaction:1 - - Set Default ip6tables Policy for Incoming Packets + + Verify Root Has A Primary GID 0 - ocil:ssg-set_ip6tables_default_rule_action:testaction:1 + ocil:ssg-accounts_root_gid_zero_action:testaction:1 - - Disable the virt_sandbox_use_all_caps SELinux Boolean + + Verify firewalld Enabled - ocil:ssg-sebool_virt_sandbox_use_all_caps_action:testaction:1 + ocil:ssg-service_firewalld_enabled_action:testaction:1 - - Record Events that Modify User/Group Information via openat syscall - /etc/group + + Configure AIDE to Use FIPS 140-2 for Validating Hashes - ocil:ssg-audit_rules_etc_group_openat_action:testaction:1 + ocil:ssg-aide_use_fips_hashes_action:testaction:1 - - Disable the selinuxuser_use_ssh_chroot SELinux Boolean + + Drop Gratuitious ARP frames on All IPv4 Interfaces - ocil:ssg-sebool_selinuxuser_use_ssh_chroot_action:testaction:1 + ocil:ssg-sysctl_net_ipv4_conf_all_drop_gratuitous_arp_action:testaction:1 - - Enable GNOME3 Screensaver Idle Activation + + Disable the ftpd_use_passive_mode SELinux Boolean - ocil:ssg-dconf_gnome_screensaver_idle_activation_enabled_action:testaction:1 + ocil:ssg-sebool_ftpd_use_passive_mode_action:testaction:1 + + + + Verify Permissions on /var/log Directory + + ocil:ssg-file_permissions_var_log_action:testaction:1 - + PASS @@ -359205,7 +359712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359213,7 +359720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359221,7 +359728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359229,7 +359736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359237,7 +359744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359245,7 +359752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359253,7 +359760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359261,7 +359768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359269,7 +359776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359277,7 +359784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359285,7 +359792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359293,7 +359800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359301,7 +359808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359309,7 +359816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359317,7 +359824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359325,7 +359832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359333,7 +359840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359341,7 +359848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359349,7 +359856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359357,7 +359864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359365,7 +359872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359373,7 +359880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359381,7 +359888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359389,7 +359896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359397,7 +359904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359405,7 +359912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359413,7 +359920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359421,7 +359928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359429,7 +359936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359437,7 +359944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359445,7 +359952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359453,7 +359960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359461,7 +359968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359469,7 +359976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359477,7 +359984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359485,7 +359992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359493,7 +360000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359501,7 +360008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359509,7 +360016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359517,7 +360024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359525,7 +360032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359533,7 +360040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359541,7 +360048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359549,7 +360056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359557,7 +360064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359565,7 +360072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359573,7 +360080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359581,7 +360088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359589,7 +360096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359597,7 +360104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359605,7 +360112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359613,7 +360120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359621,7 +360128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359629,7 +360136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359637,7 +360144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359645,7 +360152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359653,7 +360160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359661,7 +360168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359669,7 +360176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359677,7 +360184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359685,7 +360192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359693,7 +360200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359701,7 +360208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359709,7 +360216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359717,7 +360224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359725,7 +360232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359733,7 +360240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359741,7 +360248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359749,7 +360256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359757,7 +360264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359765,7 +360272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359773,7 +360280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359781,7 +360288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359789,7 +360296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359797,7 +360304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359805,7 +360312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359813,7 +360320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359821,7 +360328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359829,7 +360336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359837,7 +360344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359845,7 +360352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359853,7 +360360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359861,7 +360368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359869,7 +360376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359877,7 +360384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359885,7 +360392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359893,7 +360400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359901,7 +360408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359909,7 +360416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359917,7 +360424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359925,7 +360432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359933,7 +360440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359941,7 +360448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359949,7 +360456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359957,7 +360464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359965,7 +360472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359973,7 +360480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359981,7 +360488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359989,7 +360496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -359997,7 +360504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360005,7 +360512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360013,7 +360520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360021,7 +360528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360029,7 +360536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360037,7 +360544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360045,7 +360552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360053,7 +360560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360061,7 +360568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360069,7 +360576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360077,7 +360584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360085,7 +360592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360093,7 +360600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360101,7 +360608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360109,7 +360616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360117,7 +360624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360125,7 +360632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360133,7 +360640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360141,7 +360648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360149,7 +360656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360157,7 +360664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360165,7 +360672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360173,7 +360680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360181,7 +360688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360189,7 +360696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360197,7 +360704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360205,7 +360712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360213,7 +360720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360221,7 +360728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360229,7 +360736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360237,7 +360744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360245,7 +360752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360253,7 +360760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360261,7 +360768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360269,7 +360776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360277,7 +360784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360285,7 +360792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360293,7 +360800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360301,7 +360808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360309,7 +360816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360317,7 +360824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360325,7 +360832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360333,7 +360840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360341,7 +360848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360349,7 +360856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360357,7 +360864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360365,7 +360872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360373,7 +360880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360381,7 +360888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360389,7 +360896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360397,7 +360904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360405,7 +360912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360413,7 +360920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360421,7 +360928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360429,7 +360936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360437,7 +360944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360445,7 +360952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360453,7 +360960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360461,7 +360968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360469,7 +360976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360477,7 +360984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360485,7 +360992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360493,7 +361000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360501,7 +361008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360509,7 +361016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360517,7 +361024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360525,7 +361032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360533,7 +361040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360541,7 +361048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360549,7 +361056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360557,7 +361064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360565,7 +361072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360573,7 +361080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360581,7 +361088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360589,7 +361096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360597,7 +361104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360605,7 +361112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360613,7 +361120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360621,7 +361128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360629,7 +361136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360637,7 +361144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360645,7 +361152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360653,7 +361160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360661,7 +361168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360669,7 +361176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360677,7 +361184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360685,7 +361192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360693,7 +361200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360701,7 +361208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360709,7 +361216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360717,7 +361224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360725,7 +361232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360733,7 +361240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360741,7 +361248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360749,7 +361256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360757,7 +361264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360765,7 +361272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360773,7 +361280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360781,7 +361288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360789,7 +361296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360797,7 +361304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360805,7 +361312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360813,7 +361320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360821,7 +361328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360829,7 +361336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360837,7 +361344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360845,7 +361352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360853,7 +361360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360861,7 +361368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360869,7 +361376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360877,7 +361384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360885,7 +361392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360893,7 +361400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360901,7 +361408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360909,7 +361416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360917,7 +361424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360925,7 +361432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360933,7 +361440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360941,7 +361448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360949,7 +361456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360957,7 +361464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360965,7 +361472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360973,7 +361480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360981,7 +361488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360989,7 +361496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -360997,7 +361504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361005,7 +361512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361013,7 +361520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361021,7 +361528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361029,7 +361536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361037,7 +361544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361045,7 +361552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361053,7 +361560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361061,7 +361568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361069,7 +361576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361077,7 +361584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361085,7 +361592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361093,7 +361600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361101,7 +361608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361109,7 +361616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361117,7 +361624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361125,7 +361632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361133,7 +361640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361141,7 +361648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361149,7 +361656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361157,7 +361664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361165,7 +361672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361173,7 +361680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361181,7 +361688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361189,7 +361696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361197,7 +361704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361205,7 +361712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361213,7 +361720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361221,7 +361728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361229,7 +361736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361237,7 +361744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361245,7 +361752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361253,7 +361760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361261,7 +361768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361269,7 +361776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361277,7 +361784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361285,7 +361792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361293,7 +361800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361301,7 +361808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361309,7 +361816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361317,7 +361824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361325,7 +361832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361333,7 +361840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361341,7 +361848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361349,7 +361856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361357,7 +361864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361365,7 +361872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361373,7 +361880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361381,7 +361888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361389,7 +361896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361397,7 +361904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361405,7 +361912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361413,7 +361920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361421,7 +361928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361429,7 +361936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361437,7 +361944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361445,7 +361952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361453,7 +361960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361461,7 +361968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361469,7 +361976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361477,7 +361984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361485,7 +361992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361493,7 +362000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361501,7 +362008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361509,7 +362016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361517,7 +362024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361525,7 +362032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361533,7 +362040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361541,7 +362048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361549,7 +362056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361557,7 +362064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361565,7 +362072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361573,7 +362080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361581,7 +362088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361589,7 +362096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361597,7 +362104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361605,7 +362112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361613,7 +362120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361621,7 +362128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361629,7 +362136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361637,7 +362144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361645,7 +362152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361653,7 +362160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361661,7 +362168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361669,7 +362176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361677,7 +362184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361685,7 +362192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361693,7 +362200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361701,7 +362208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361709,7 +362216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361717,7 +362224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361725,7 +362232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361733,7 +362240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361741,7 +362248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361749,7 +362256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361757,7 +362264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361765,7 +362272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361773,7 +362280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361781,7 +362288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361789,7 +362296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361797,7 +362304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361805,7 +362312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361813,7 +362320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361821,7 +362328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361829,7 +362336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361837,7 +362344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361845,7 +362352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361853,7 +362360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361861,7 +362368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361869,7 +362376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361877,7 +362384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361885,7 +362392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361893,7 +362400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361901,7 +362408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361909,7 +362416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361917,7 +362424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361925,7 +362432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361933,7 +362440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361941,7 +362448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361949,7 +362456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361957,7 +362464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361965,7 +362472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361973,7 +362480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361981,7 +362488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361989,7 +362496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -361997,7 +362504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362005,7 +362512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362013,7 +362520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362021,7 +362528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362029,7 +362536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362037,7 +362544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362045,7 +362552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362053,7 +362560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362061,7 +362568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362069,7 +362576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362077,7 +362584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362085,7 +362592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362093,7 +362600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362101,7 +362608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362109,7 +362616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362117,7 +362624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362125,7 +362632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362133,7 +362640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362141,7 +362648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362149,7 +362656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362157,7 +362664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362165,7 +362672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362173,7 +362680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362181,7 +362688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362189,7 +362696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362197,7 +362704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362205,7 +362712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362213,7 +362720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362221,7 +362728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362229,7 +362736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362237,7 +362744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362245,7 +362752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362253,7 +362760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362261,7 +362768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362269,7 +362776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362277,7 +362784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362285,7 +362792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362293,7 +362800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362301,7 +362808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362309,7 +362816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362317,7 +362824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362325,7 +362832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362333,7 +362840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362341,7 +362848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362349,7 +362856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362357,7 +362864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362365,7 +362872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362373,7 +362880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362381,7 +362888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362389,7 +362896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362397,7 +362904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362405,7 +362912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362413,7 +362920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362421,7 +362928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362429,7 +362936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362437,7 +362944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362445,7 +362952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362453,7 +362960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362461,7 +362968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362469,7 +362976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362477,7 +362984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362485,7 +362992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362493,7 +363000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362501,7 +363008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362509,7 +363016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362517,7 +363024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362525,7 +363032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362533,7 +363040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362541,7 +363048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362549,7 +363056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362557,7 +363064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362565,7 +363072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362573,7 +363080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362581,7 +363088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362589,7 +363096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362597,7 +363104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362605,7 +363112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362613,7 +363120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362621,7 +363128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362629,7 +363136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362637,7 +363144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362645,7 +363152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362653,7 +363160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362661,7 +363168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362669,7 +363176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362677,7 +363184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362685,7 +363192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362693,7 +363200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362701,7 +363208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362709,7 +363216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362717,7 +363224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362725,7 +363232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362733,7 +363240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362741,7 +363248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362749,7 +363256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362757,7 +363264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362765,7 +363272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362773,7 +363280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362781,7 +363288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362789,7 +363296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362797,7 +363304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362805,7 +363312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362813,7 +363320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362821,7 +363328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362829,7 +363336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362837,7 +363344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362845,7 +363352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362853,7 +363360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362861,7 +363368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362869,7 +363376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362877,7 +363384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362885,7 +363392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362893,7 +363400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362901,7 +363408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362909,7 +363416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362917,7 +363424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362925,7 +363432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362933,7 +363440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362941,7 +363448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362949,7 +363456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362957,7 +363464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362965,7 +363472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362973,7 +363480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362981,7 +363488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362989,7 +363496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -362997,7 +363504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363005,7 +363512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363013,7 +363520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363021,7 +363528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363029,7 +363536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363037,7 +363544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363045,7 +363552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363053,7 +363560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363061,7 +363568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363069,7 +363576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363077,7 +363584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363085,7 +363592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363093,7 +363600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363101,7 +363608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363109,7 +363616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363117,7 +363624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363125,7 +363632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363133,7 +363640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363141,7 +363648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363149,7 +363656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363157,7 +363664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363165,7 +363672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363173,7 +363680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363181,7 +363688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363189,7 +363696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363197,7 +363704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363205,7 +363712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363213,7 +363720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363221,7 +363728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363229,7 +363736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363237,7 +363744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363245,7 +363752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363253,7 +363760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363261,7 +363768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363269,7 +363776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363277,7 +363784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363285,7 +363792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363293,7 +363800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363301,7 +363808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363309,7 +363816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363317,7 +363824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363325,7 +363832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363333,7 +363840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363341,7 +363848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363349,7 +363856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363357,7 +363864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363365,7 +363872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363373,7 +363880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363381,7 +363888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363389,7 +363896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363397,7 +363904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363405,7 +363912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363413,7 +363920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363421,7 +363928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363429,7 +363936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363437,7 +363944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363445,7 +363952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363453,7 +363960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363461,7 +363968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363469,7 +363976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363477,7 +363984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363485,7 +363992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363493,7 +364000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363501,7 +364008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363509,7 +364016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363517,7 +364024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363525,7 +364032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363533,7 +364040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363541,7 +364048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363549,7 +364056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363557,7 +364064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363565,7 +364072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363573,7 +364080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363581,7 +364088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363589,7 +364096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363597,7 +364104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363605,7 +364112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363613,7 +364120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363621,7 +364128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363629,7 +364136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363637,7 +364144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363645,7 +364152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363653,7 +364160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363661,7 +364168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363669,7 +364176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363677,7 +364184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363685,7 +364192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363693,7 +364200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363701,7 +364208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363709,7 +364216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363717,7 +364224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363725,7 +364232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363733,7 +364240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363741,7 +364248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363749,7 +364256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363757,7 +364264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363765,7 +364272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363773,7 +364280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363781,7 +364288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363789,7 +364296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363797,7 +364304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363805,7 +364312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363813,7 +364320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363821,7 +364328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363829,7 +364336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363837,7 +364344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363845,7 +364352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363853,7 +364360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363861,7 +364368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363869,7 +364376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363877,7 +364384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363885,7 +364392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363893,7 +364400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363901,7 +364408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363909,7 +364416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363917,7 +364424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363925,7 +364432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363933,7 +364440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363941,7 +364448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363949,7 +364456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363957,7 +364464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363965,7 +364472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363973,7 +364480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363981,7 +364488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363989,7 +364496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -363997,7 +364504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364005,7 +364512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364013,7 +364520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364021,7 +364528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364029,7 +364536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364037,7 +364544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364045,7 +364552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364053,7 +364560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364061,7 +364568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364069,7 +364576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364077,7 +364584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364085,7 +364592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364093,7 +364600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364101,7 +364608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364109,7 +364616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364117,7 +364624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364125,7 +364632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364133,7 +364640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364141,7 +364648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364149,7 +364656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364157,7 +364664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364165,7 +364672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364173,7 +364680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364181,7 +364688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364189,7 +364696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364197,7 +364704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364205,7 +364712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364213,7 +364720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364221,7 +364728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364229,7 +364736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364237,7 +364744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364245,7 +364752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364253,7 +364760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364261,7 +364768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364269,7 +364776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364277,7 +364784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364285,7 +364792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364293,7 +364800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364301,7 +364808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364309,7 +364816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364317,7 +364824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364325,7 +364832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364333,7 +364840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364341,7 +364848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364349,7 +364856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364357,7 +364864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364365,7 +364872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364373,7 +364880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364381,7 +364888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364389,7 +364896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364397,7 +364904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364405,7 +364912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364413,7 +364920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364421,7 +364928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364429,7 +364936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364437,7 +364944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364445,7 +364952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364453,7 +364960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364461,7 +364968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364469,7 +364976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364477,7 +364984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364485,7 +364992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364493,7 +365000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364501,7 +365008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364509,7 +365016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364517,7 +365024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364525,7 +365032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364533,7 +365040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364541,7 +365048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364549,7 +365056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364557,7 +365064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364565,7 +365072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364573,7 +365080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364581,7 +365088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364589,7 +365096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364597,7 +365104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364605,7 +365112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364613,7 +365120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364621,7 +365128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364629,7 +365136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364637,7 +365144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364645,7 +365152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364653,7 +365160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364661,7 +365168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364669,7 +365176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364677,7 +365184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364685,7 +365192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364693,7 +365200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364701,7 +365208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364709,7 +365216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364717,7 +365224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364725,7 +365232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364733,7 +365240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364741,7 +365248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364749,7 +365256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364757,7 +365264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364765,7 +365272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364773,7 +365280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364781,7 +365288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364789,7 +365296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364797,7 +365304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364805,7 +365312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364813,7 +365320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364821,7 +365328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364829,7 +365336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364837,7 +365344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364845,7 +365352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364853,7 +365360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364861,7 +365368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364869,7 +365376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364877,7 +365384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364885,7 +365392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364893,7 +365400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364901,7 +365408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364909,7 +365416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364917,7 +365424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364925,7 +365432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364933,7 +365440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364941,7 +365448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364949,7 +365456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364957,7 +365464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364965,7 +365472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364973,7 +365480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364981,7 +365488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364989,7 +365496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -364997,7 +365504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365005,7 +365512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365013,7 +365520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365021,7 +365528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365029,7 +365536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365037,7 +365544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365045,7 +365552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365053,7 +365560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365061,7 +365568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365069,7 +365576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365077,7 +365584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365085,7 +365592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365093,7 +365600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365101,7 +365608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365109,7 +365616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365117,7 +365624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365125,7 +365632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365133,7 +365640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365141,7 +365648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365149,7 +365656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365157,7 +365664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365165,7 +365672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365173,7 +365680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365181,7 +365688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365189,7 +365696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365197,7 +365704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365205,7 +365712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365213,7 +365720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365221,7 +365728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365229,7 +365736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365237,7 +365744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365245,7 +365752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365253,7 +365760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365261,7 +365768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365269,7 +365776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365277,7 +365784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365285,7 +365792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365293,7 +365800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365301,7 +365808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365309,7 +365816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365317,7 +365824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365325,7 +365832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365333,7 +365840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365341,7 +365848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365349,7 +365856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365357,7 +365864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365365,7 +365872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365373,7 +365880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365381,7 +365888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365389,7 +365896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365397,7 +365904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365405,7 +365912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365413,7 +365920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365421,7 +365928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365429,7 +365936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365437,7 +365944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365445,7 +365952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365453,7 +365960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365461,7 +365968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365469,7 +365976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365477,7 +365984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365485,7 +365992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365493,7 +366000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365501,7 +366008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365509,7 +366016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365517,7 +366024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365525,7 +366032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365533,7 +366040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365541,7 +366048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365549,7 +366056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365557,7 +366064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365565,7 +366072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365573,7 +366080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365581,7 +366088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365589,7 +366096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365597,7 +366104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365605,7 +366112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365613,7 +366120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365621,7 +366128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365629,7 +366136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365637,7 +366144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365645,7 +366152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365653,7 +366160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365661,7 +366168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365669,7 +366176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365677,7 +366184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365685,7 +366192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365693,7 +366200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365701,7 +366208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365709,7 +366216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365717,7 +366224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365725,7 +366232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365733,7 +366240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365741,7 +366248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365749,7 +366256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365757,7 +366264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365765,7 +366272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365773,7 +366280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365781,7 +366288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365789,7 +366296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365797,7 +366304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365805,7 +366312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365813,7 +366320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365821,7 +366328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365829,7 +366336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365837,7 +366344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365845,7 +366352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365853,7 +366360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365861,7 +366368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365869,7 +366376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365877,7 +366384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365885,7 +366392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365893,7 +366400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365901,7 +366408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365909,7 +366416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365917,7 +366424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365925,7 +366432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365933,7 +366440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365941,7 +366448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365949,7 +366456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365957,7 +366464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365965,7 +366472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365973,7 +366480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365981,7 +366488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365989,7 +366496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -365997,7 +366504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366005,7 +366512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366013,7 +366520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366021,7 +366528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366029,7 +366536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366037,7 +366544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366045,7 +366552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366053,7 +366560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366061,7 +366568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366069,7 +366576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366077,7 +366584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366085,7 +366592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366093,7 +366600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366101,7 +366608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366109,7 +366616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366117,7 +366624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366125,7 +366632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366133,7 +366640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366141,7 +366648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366149,7 +366656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366157,7 +366664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366165,7 +366672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366173,7 +366680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366181,7 +366688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366189,7 +366696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366197,7 +366704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366205,7 +366712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366213,7 +366720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366221,7 +366728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366229,7 +366736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366237,7 +366744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366245,7 +366752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366253,7 +366760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366261,7 +366768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366269,7 +366776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366277,7 +366784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366285,7 +366792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366293,7 +366800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366301,7 +366808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366309,7 +366816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366317,7 +366824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366325,7 +366832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366333,7 +366840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366341,7 +366848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366349,7 +366856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366357,7 +366864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366365,7 +366872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366373,7 +366880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366381,7 +366888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366389,7 +366896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366397,7 +366904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366405,7 +366912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366413,7 +366920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366421,7 +366928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366429,7 +366936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366437,7 +366944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366445,7 +366952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366453,7 +366960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366461,7 +366968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366469,7 +366976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366477,7 +366984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366485,7 +366992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366493,7 +367000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366501,7 +367008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366509,7 +367016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366517,7 +367024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366525,7 +367032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366533,7 +367040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366541,7 +367048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366549,7 +367056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366557,7 +367064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366565,7 +367072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366573,7 +367080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366581,7 +367088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366589,7 +367096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366597,7 +367104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366605,7 +367112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366613,7 +367120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366621,7 +367128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366629,7 +367136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366637,7 +367144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366645,7 +367152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366653,7 +367160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366661,7 +367168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366669,7 +367176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366677,7 +367184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366685,7 +367192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366693,7 +367200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366701,7 +367208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366709,7 +367216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366717,7 +367224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366725,7 +367232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366733,7 +367240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366741,7 +367248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366749,7 +367256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366757,7 +367264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366765,7 +367272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366773,7 +367280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366781,7 +367288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366789,7 +367296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366797,7 +367304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366805,7 +367312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366813,7 +367320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366821,7 +367328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366829,7 +367336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366837,7 +367344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366845,7 +367352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366853,7 +367360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366861,7 +367368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366869,7 +367376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366877,7 +367384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366885,7 +367392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366893,7 +367400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366901,7 +367408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366909,7 +367416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366917,7 +367424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366925,7 +367432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366933,7 +367440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366941,7 +367448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366949,7 +367456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366957,7 +367464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366965,7 +367472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366973,7 +367480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366981,7 +367488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366989,7 +367496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -366997,7 +367504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367005,7 +367512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367013,7 +367520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367021,7 +367528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367029,7 +367536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367037,7 +367544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367045,7 +367552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367053,7 +367560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367061,7 +367568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367069,7 +367576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367077,7 +367584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367085,7 +367592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367093,7 +367600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367101,7 +367608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367109,7 +367616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367117,7 +367624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367125,7 +367632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367133,7 +367640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367141,7 +367648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367149,7 +367656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367157,7 +367664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367165,7 +367672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367173,7 +367680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367181,7 +367688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367189,7 +367696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367197,7 +367704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367205,7 +367712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367213,7 +367720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367221,7 +367728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367229,7 +367736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367237,7 +367744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367245,7 +367752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367253,7 +367760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367261,7 +367768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367269,7 +367776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367277,7 +367784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367285,7 +367792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367293,7 +367800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367301,7 +367808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367309,7 +367816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367317,7 +367824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367325,7 +367832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367333,7 +367840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367341,7 +367848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367349,7 +367856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367357,7 +367864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367365,7 +367872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367373,7 +367880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367381,7 +367888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367389,7 +367896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367397,7 +367904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367405,7 +367912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367413,7 +367920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367421,7 +367928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367429,7 +367936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367437,7 +367944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367445,7 +367952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367453,7 +367960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367461,7 +367968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367469,7 +367976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367477,7 +367984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367485,7 +367992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367493,7 +368000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367501,7 +368008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367509,7 +368016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367517,7 +368024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367525,7 +368032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367533,7 +368040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367541,7 +368048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367549,7 +368056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367557,7 +368064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367565,7 +368072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367573,7 +368080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367581,7 +368088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367589,7 +368096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367597,7 +368104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367605,7 +368112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367613,7 +368120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367621,7 +368128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367629,7 +368136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367637,7 +368144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367645,7 +368152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367653,7 +368160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367661,7 +368168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367669,7 +368176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367677,7 +368184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367685,7 +368192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367693,7 +368200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367701,7 +368208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367709,7 +368216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367717,7 +368224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367725,7 +368232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367733,7 +368240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367741,7 +368248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367749,7 +368256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367757,7 +368264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367765,7 +368272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367773,7 +368280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367781,7 +368288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367789,7 +368296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367797,7 +368304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367805,7 +368312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367813,7 +368320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367821,7 +368328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367829,7 +368336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367837,7 +368344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367845,7 +368352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367853,7 +368360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367861,7 +368368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367869,7 +368376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367877,7 +368384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367885,7 +368392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367893,7 +368400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367901,7 +368408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367909,7 +368416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367917,7 +368424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367925,7 +368432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367933,7 +368440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367941,7 +368448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367949,7 +368456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367957,7 +368464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367965,7 +368472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367973,7 +368480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367981,7 +368488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367989,7 +368496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -367997,7 +368504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368005,7 +368512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368013,7 +368520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368021,7 +368528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368029,7 +368536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368037,7 +368544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368045,7 +368552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368053,7 +368560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368061,7 +368568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368069,7 +368576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368077,7 +368584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368085,7 +368592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368093,7 +368600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368101,7 +368608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368109,7 +368616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368117,7 +368624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368125,7 +368632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368133,7 +368640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368141,7 +368648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368149,7 +368656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368157,7 +368664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368165,7 +368672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368173,7 +368680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368181,7 +368688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368189,7 +368696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368197,7 +368704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368205,7 +368712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368213,7 +368720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368221,7 +368728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368229,7 +368736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368237,7 +368744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368245,7 +368752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368253,7 +368760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368261,7 +368768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368269,7 +368776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368277,7 +368784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368285,7 +368792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368293,7 +368800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368301,7 +368808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368309,7 +368816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368317,7 +368824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368325,7 +368832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368333,7 +368840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368341,7 +368848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368349,7 +368856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368357,7 +368864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368365,7 +368872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368373,7 +368880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368381,7 +368888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368389,7 +368896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368397,7 +368904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368405,7 +368912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368413,7 +368920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368421,7 +368928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368429,7 +368936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368437,7 +368944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368445,7 +368952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368453,7 +368960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368461,7 +368968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368469,7 +368976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368477,7 +368984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368485,7 +368992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368493,7 +369000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368501,7 +369008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368509,7 +369016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368517,7 +369024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368525,7 +369032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368533,7 +369040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368541,7 +369048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368549,7 +369056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368557,7 +369064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368565,7 +369072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368573,7 +369080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368581,7 +369088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368589,7 +369096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368597,7 +369104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368605,7 +369112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368613,7 +369120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368621,7 +369128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368629,7 +369136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368637,7 +369144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368645,7 +369152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368653,7 +369160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368661,7 +369168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368669,7 +369176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368677,7 +369184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368685,7 +369192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368693,7 +369200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368701,7 +369208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368709,7 +369216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368717,7 +369224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368725,7 +369232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368733,7 +369240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368741,7 +369248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368749,7 +369256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368757,7 +369264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368765,7 +369272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368773,7 +369280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368781,7 +369288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368789,7 +369296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368797,7 +369304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368805,7 +369312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368813,7 +369320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368821,7 +369328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368829,7 +369336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368837,7 +369344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368845,7 +369352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368853,7 +369360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368861,7 +369368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368869,7 +369376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368877,7 +369384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368885,7 +369392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368893,7 +369400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368901,7 +369408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368909,7 +369416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368917,7 +369424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368925,7 +369432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368933,7 +369440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368941,7 +369448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368949,7 +369456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368957,7 +369464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368965,7 +369472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368973,7 +369480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368981,7 +369488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368989,7 +369496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -368997,7 +369504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369005,7 +369512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369013,7 +369520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369021,7 +369528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369029,7 +369536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369037,7 +369544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369045,7 +369552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369053,7 +369560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369061,7 +369568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369069,7 +369576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369077,7 +369584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369085,7 +369592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369093,7 +369600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369101,7 +369608,23 @@ which the system will be deployed as closely as possible.FAIL - + + + PASS + + + FAIL + + + + + PASS + + + FAIL + + + PASS @@ -369117,7 +369640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369125,7 +369648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369133,7 +369656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369141,7 +369664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369149,7 +369672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369157,7 +369680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369165,7 +369688,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369173,7 +369696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369181,7 +369704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369189,7 +369712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369197,7 +369720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369205,7 +369728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369213,7 +369736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369221,7 +369744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369229,7 +369752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369237,7 +369760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369245,7 +369768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369253,7 +369776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369261,7 +369784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369269,7 +369792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369277,7 +369800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369285,7 +369808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369293,7 +369816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369301,7 +369824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369309,7 +369832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369317,7 +369840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369325,7 +369848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369333,7 +369856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369341,7 +369864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369349,7 +369872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369357,7 +369880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369365,7 +369888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369373,7 +369896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369381,7 +369904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369389,7 +369912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369397,7 +369920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369405,7 +369928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369413,7 +369936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369421,7 +369944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369429,7 +369952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369437,7 +369960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369445,7 +369968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369453,7 +369976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369461,7 +369984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369469,7 +369992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369477,7 +370000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369485,7 +370008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369493,7 +370016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369501,7 +370024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369509,7 +370032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369517,7 +370040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369525,7 +370048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369533,7 +370056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369541,7 +370064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369549,7 +370072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369557,7 +370080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369565,7 +370088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369573,7 +370096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369581,7 +370104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369589,7 +370112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369597,7 +370120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369613,7 +370136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369621,7 +370144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369629,7 +370152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369637,7 +370160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369645,7 +370168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369653,7 +370176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369661,7 +370184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369669,7 +370192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369677,7 +370200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369685,7 +370208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369693,7 +370216,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369701,7 +370224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369709,7 +370232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369717,7 +370240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369725,7 +370248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369733,7 +370256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369741,7 +370264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369749,7 +370272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369757,7 +370280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369765,7 +370288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369773,7 +370296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369781,7 +370304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369789,7 +370312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369797,7 +370320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369805,7 +370328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369813,7 +370336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369821,7 +370344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369829,7 +370352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369837,7 +370360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369845,7 +370368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369853,7 +370376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369861,7 +370384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369869,7 +370392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369877,7 +370400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369885,7 +370408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369893,7 +370416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369901,7 +370424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369909,7 +370432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369917,7 +370440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369925,7 +370448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369941,7 +370464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369949,7 +370472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369957,7 +370480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369965,7 +370488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369973,7 +370496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369981,7 +370504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369989,7 +370512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -369997,7 +370520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370005,7 +370528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370013,7 +370536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370021,7 +370544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370029,7 +370552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370037,7 +370560,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370045,7 +370568,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370053,7 +370576,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370061,7 +370584,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370069,7 +370592,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370077,7 +370600,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370085,7 +370608,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370093,7 +370616,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370101,7 +370624,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370109,7 +370632,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370117,7 +370640,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370125,7 +370648,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370133,7 +370656,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370141,7 +370664,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370149,7 +370672,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370157,7 +370680,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370173,7 +370696,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370181,7 +370704,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370189,7 +370712,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370197,7 +370720,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370205,7 +370728,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370213,7 +370736,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370221,7 +370744,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370229,7 +370752,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370237,7 +370760,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370245,7 +370768,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370253,7 +370776,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370261,7 +370784,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370269,7 +370792,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370277,7 +370800,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370285,7 +370808,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370293,7 +370816,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370301,7 +370824,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370309,7 +370832,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370317,7 +370840,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370325,7 +370848,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370333,7 +370856,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370341,7 +370864,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370349,7 +370872,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370357,7 +370880,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370365,7 +370888,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370373,7 +370896,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370381,7 +370904,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370389,7 +370912,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370397,7 +370920,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370405,7 +370928,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370413,7 +370936,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370421,7 +370944,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370429,7 +370952,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370437,7 +370960,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370445,7 +370968,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370453,7 +370976,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370461,7 +370984,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370469,7 +370992,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370477,7 +371000,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370485,7 +371008,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370493,7 +371016,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370501,7 +371024,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370509,7 +371032,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370517,7 +371040,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370525,7 +371048,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370533,7 +371056,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370541,7 +371064,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370549,7 +371072,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370557,7 +371080,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370565,7 +371088,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370573,7 +371096,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370581,7 +371104,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370589,7 +371112,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370597,7 +371120,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370605,7 +371128,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370613,7 +371136,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370621,7 +371144,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370629,7 +371152,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370637,7 +371160,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370645,7 +371168,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370653,7 +371176,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370661,7 +371184,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370669,7 +371192,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370677,7 +371200,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370685,7 +371208,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370701,7 +371224,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370709,7 +371232,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370717,7 +371240,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370725,7 +371248,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370733,7 +371256,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370741,7 +371264,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370749,7 +371272,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370757,7 +371280,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370765,7 +371288,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370773,7 +371296,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370781,7 +371304,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370789,7 +371312,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370797,7 +371320,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370805,7 +371328,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370813,7 +371336,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370821,7 +371344,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370829,7 +371352,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370837,7 +371360,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370845,7 +371368,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370853,7 +371376,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370861,7 +371384,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370869,7 +371392,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370877,7 +371400,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370885,7 +371408,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370893,7 +371416,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370901,7 +371424,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370909,7 +371432,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370917,7 +371440,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370925,7 +371448,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370933,7 +371456,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370941,7 +371464,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370949,7 +371472,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370957,7 +371480,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370965,7 +371488,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370973,7 +371496,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370981,7 +371504,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370989,7 +371512,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -370997,7 +371520,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371005,7 +371528,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371013,7 +371536,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371021,7 +371544,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371029,7 +371552,7 @@ which the system will be deployed as closely as possible.FAIL - + PASS @@ -371037,7 +371560,15 @@ which the system will be deployed as closely as possible.FAIL - + + + PASS + + + FAIL + + + PASS @@ -371047,761 +371578,703 @@ which the system will be deployed as closely as possible. - - To ensure that the GUI power settings are not active, run the following command: -$ gsettings get org.gnome.settings-daemon.plugins.power active -If properly configured, the output should be false. -To ensure that users cannot enable the power settings, run the following: -$ grep power /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/settings-daemon/plugins/power/active - Is it the case that power settings are enabled and are not disabled? - - - - -Run the following command to determine if the httpd_serve_cobbler_files SELinux boolean is disabled: -$ getsebool httpd_serve_cobbler_files -If properly configured, the output should show the following: -httpd_serve_cobbler_files --> off - Is it the case that httpd_serve_cobbler_files is not disabled? - - - - Run the following command to see what the timeout interval is: -$ sudo grep ClientAliveInterval /etc/ssh/sshd_config -If properly configured, the output should be: -ClientAliveInterval - Is it the case that it is commented out or not configured properly? + + To check the permissions of /etc/cron.d, +run the command: +$ ls -l /etc/cron.d +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.d does not have unix mode -rwx------? - - To determine if LDAP is being used for authentication, use the following -command: -$ sudo grep -i useldapauth /etc/sysconfig/authconfig -The output should return: -USELDAPAUTH=yes - Is it the case that USELDAPAUTH=yes is not configured correctly in /etc/sysconfig/authconfig? + + Run the following command to determine if the dnf-automatic package is installed: $ rpm -q dnf-automatic + Is it the case that the package is not installed? - - To check that all boot entries extend the backlog limit; -Check that all boot entries extend the log events queue: -sudo grep -L "^options\s+.*\baudit_backlog_limit=8192\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that does not extend the log events queue. - Is it the case that audit backlog limit is not configured? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules +The output has to be exactly as follows: +## Successful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change + Is it the case that the file does not exist or the content differs? - - Verify the operating system is not configured to bypass password requirements for privilege -escalation. Check the configuration of the "/etc/pam.d/sudo" file with the following command: -$ sudo grep pam_succeed_if /etc/pam.d/sudo - Is it the case that system is configured to bypass password requirements for privilege escalation? + + +Run the following command to determine if the mozilla_plugin_use_bluejeans SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_bluejeans +If properly configured, the output should show the following: +mozilla_plugin_use_bluejeans --> off + Is it the case that mozilla_plugin_use_bluejeans is not disabled? - + -Run the following command to determine if the puppetagent_manage_all_files SELinux boolean is disabled: -$ getsebool puppetagent_manage_all_files +Run the following command to determine if the authlogin_radius SELinux boolean is disabled: +$ getsebool authlogin_radius If properly configured, the output should show the following: -puppetagent_manage_all_files --> off - Is it the case that puppetagent_manage_all_files is not disabled? +authlogin_radius --> off + Is it the case that authlogin_radius is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postqueue" command with the following command: - -$ sudo auditctl -l | grep postqueue + + --a always,exit -F path=/usr/bin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postqueue - Is it the case that the command does not return a line, or the line is commented out? +Run the following command to determine the current status of the +nftables service: +$ sudo systemctl is-active nftables +If the service is running, it should return the following: active + Is it the case that the "nftables" service is disabled, masked, or not started.? - - -Run the following command to determine if the httpd_verify_dns SELinux boolean is disabled: -$ getsebool httpd_verify_dns -If properly configured, the output should show the following: -httpd_verify_dns --> off - Is it the case that httpd_verify_dns is not disabled? + + Verify the system commands contained in the following directories have mode "755" or less permissive with the following command: + +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin -perm /022 -exec ls -l {} \; + Is it the case that any system commands are found to be group-writable or world-writable? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_GCC_PLUGIN_STRUCTLEAK /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that binaries cannot be directly executed from removable media, run the following command: +$ grep -v noexec /etc/fstab +The resulting output will show partitions which do not have the noexec flag. Verify all partitions +in the output are not removable media. + Is it the case that removable media partitions are present? - - To check the ownership of /etc/group, -run the command: -$ ls -lL /etc/group -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/group does not have an owner of root? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes rng_core.default_quality=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*rng_core.default_quality=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*rng_core.default_quality=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'rng_core.default_quality=' +The command should not return any output. + Is it the case that trust on hardware random number generator is not configured appropriately? - + -Run the following command to determine if the httpd_tmp_exec SELinux boolean is disabled: -$ getsebool httpd_tmp_exec +Run the following command to determine if the xguest_mount_media SELinux boolean is disabled: +$ getsebool xguest_mount_media If properly configured, the output should show the following: -httpd_tmp_exec --> off - Is it the case that httpd_tmp_exec is not disabled? - - - - Run the following command to determine if the gssproxy package is installed: -$ rpm -q gssproxy - Is it the case that the package is installed? - - - - Run the following command to determine if the rng-tools package is installed: $ rpm -q rng-tools - Is it the case that the package is not installed? - - - - To check the permissions of /var/log/messages, -run the command: -$ ls -l /var/log/messages -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /var/log/messages does not have unix mode -rw-r-----? +xguest_mount_media --> off + Is it the case that xguest_mount_media is not disabled? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: - -$ sudo grep disk_full_action /etc/audit/auditd.conf - -disk_full_action = - -If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. - Is it the case that there is no evidence of appropriate action? + + To verify that HBSS ACCM is installed, run the following command(s): +$ sudo ls /opt/McAfee/accm/bin/accm + Is it the case that the HBSS ACCM module is not installed? - - -Run the following command to determine if the domain_kernel_load_modules SELinux boolean is disabled: -$ getsebool domain_kernel_load_modules -If properly configured, the output should show the following: -domain_kernel_load_modules --> off - Is it the case that domain_kernel_load_modules is not disabled? + + Run the following command to determine if the talk package is installed: +$ rpm -q talk + Is it the case that the package is installed? - + -Run the following command to determine if the cluster_use_execmem SELinux boolean is disabled: -$ getsebool cluster_use_execmem +Run the following command to determine if the openvpn_run_unconfined SELinux boolean is disabled: +$ getsebool openvpn_run_unconfined If properly configured, the output should show the following: -cluster_use_execmem --> off - Is it the case that cluster_use_execmem is not disabled? +openvpn_run_unconfined --> off + Is it the case that openvpn_run_unconfined is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_KEY /boot/config.* - - For each kernel installed, a line with value "" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to see what the timeout interval is: +$ sudo grep ClientAliveInterval /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveInterval + Is it the case that it is commented out or not configured properly? - - To verify that a remote NTP service is configured for time synchronization, -open the following file: - -/etc/chrony.conf in the case the system in question is -configured to use the chronyd as the NTP daemon (default setting) -/etc/ntp.conf in the case the system in question is configured -to use the ntpd as the NTP daemon + + The runtime status of the net.ipv4.icmp_ignore_bogus_error_responses kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.icmp_ignore_bogus_error_responses +1. -In the file, there should be a section similar to the following: -server ntpserver - Is it the case that this is not the case? + Is it the case that the correct value is not returned? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config.* + $ grep CONFIG_DEBUG_LIST /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter can be queried + + To ensure that users cannot disable the screensaver idle inactivity setting, run the following: +$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled + Is it the case that idle-activation-enabled is not locked? + + + + To check the ownership of /etc/passwd-, +run the command: +$ ls -lL /etc/passwd- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/passwd- does not have an owner of root? + + + + The runtime status of the kernel.kexec_load_disabled kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_pinfo -0. +$ sysctl kernel.kexec_load_disabled +1. Is it the case that the correct value is not returned? - - To check for legacy lines in /etc/shadow, run the following command: - grep '^\+' /etc/shadow -The command should not return any output. - Is it the case that the file contains legacy lines? + + Run the following command to determine if the abrt-cli package is installed: +$ rpm -q abrt-cli + Is it the case that the package is installed? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes iommu=force, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*iommu=force.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*iommu=force.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'iommu=force' -The command should not return any output. - Is it the case that I/OMMU is not activated? + + +Run the following command to determine if the git_system_use_nfs SELinux boolean is disabled: +$ getsebool git_system_use_nfs +If properly configured, the output should show the following: +git_system_use_nfs --> off + Is it the case that git_system_use_nfs is not disabled? - + -Run the following command to determine if the rsync_export_all_ro SELinux boolean is disabled: -$ getsebool rsync_export_all_ro +Run the following command to determine if the xdm_sysadm_login SELinux boolean is disabled: +$ getsebool xdm_sysadm_login If properly configured, the output should show the following: -rsync_export_all_ro --> off - Is it the case that rsync_export_all_ro is not disabled? +xdm_sysadm_login --> off + Is it the case that xdm_sysadm_login is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to take action in the event of allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep admin_space_left_action /etc/audit/auditd.conf - -admin_space_left_action = single + + To determine if the system is configured to audit unsuccessful calls +to the fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -If the value of the "admin_space_left_action" is not set to "single", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. - Is it the case that there is no evidence that real-time alerts are configured on the system? + Is it the case that no line is returned? - - Verify that DNS servers have been configured properly, perform the following: -$ sudo grep nameserver /etc/resolv.conf - Is it the case that less than two lines are returned that are not commented out? + + The runtime status of the kernel.sysrq kernel parameter can be queried +by running the following command: +$ sysctl kernel.sysrq +0. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the virt_sandbox_use_netlink SELinux boolean is disabled: -$ getsebool virt_sandbox_use_netlink -If properly configured, the output should show the following: -virt_sandbox_use_netlink --> off - Is it the case that virt_sandbox_use_netlink is not disabled? - - - - -Run the following command to determine if the httpd_can_network_connect_db SELinux boolean is disabled: -$ getsebool httpd_can_network_connect_db -If properly configured, the output should show the following: -httpd_can_network_connect_db --> off - Is it the case that httpd_can_network_connect_db is not disabled? - - - - Run the following command to determine if the abrt-plugin-sosreport package is installed: -$ rpm -q abrt-plugin-sosreport - Is it the case that the package is installed? - - - - To determine if passwd_timeout has been configured for sudo, run the following command: -$ sudo grep -ri '^Defaults.*passwd_timeout=' /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that passwd_timeout is not set with the appropriate value for sudo? + + To determine how the SSH daemon's IgnoreUserKnownHosts option is set, run the following command: + +$ sudo grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine how the SSH daemon's PermitRootLogin option is set, run the following command: + + To check that the saslauthd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled saslauthd +Output should indicate the saslauthd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled saslauthd disabled -$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config +Run the following command to verify saslauthd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active saslauthd -If a line indicating no is returned, then the required value is set. +If the service is not running the command will return the following output: +inactive - Is it the case that the required value is not set? +The service will also be masked, to check that the saslauthd is masked, run the following command: +$ sudo systemctl show saslauthd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "saslauthd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -create_module system call, run the following command: -$ sudo grep "create_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the operating system authenticates the remote logging server for off-loading audit logs with the following command: - Is it the case that no line is returned? +$ sudo grep -i '$ActionSendStreamDriverAuthMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should be +$/etc/rsyslog.conf:$ActionSendStreamDriverAuthMode x509/name + Is it the case that $ActionSendStreamDriverAuthMode in /etc/rsyslog.conf is not set to x509/name? - + -If the system is configured to prevent the loading of the can kernel module, +Run the following command to determine if the ftpd_connect_db SELinux boolean is disabled: +$ getsebool ftpd_connect_db +If properly configured, the output should show the following: +ftpd_connect_db --> off + Is it the case that ftpd_connect_db is not disabled? + + + + To verify that automatic logins are disabled, run the following command: +$ grep -Pzoi "^\[daemon]\\nautomaticlogin.*" /etc/gdm/custom.conf +The output should show the following: +[daemon] +AutomaticLoginEnable=false + Is it the case that GDM allows users to automatically login? + + + + +If the system is configured to prevent the loading of the iwlwifi kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the can kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the iwlwifi kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r can /etc/modprobe.conf /etc/modprobe.d +$ grep -r iwlwifi /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the minimum password length, run the command: +$ grep PASS_MIN_LEN /etc/login.defs +The DoD requirement is 15. + Is it the case that it is not set to the required value? - - Ensure that CGI backup scripts are not left on the production web server. -This check is limited to CGI/interactive content and not static HTML. - -Search for backup copies of CGI scripts on the web server or ask the Web -Administrator if they keep backup copies of CGI scripts on the web server. - -Common backup file extensions are: *.bak, *.old, *.temp, *.tmp, *.backup, -*.??0. This would also apply to .jsp files. - -On Red Hat Enterprise Linux, run the following commands to find backup -scripts: -find / name "*.bak" -print -find / name "*.*" -print -find / name "*.old" -print - Is it the case that If fileos with these extensions have no relationship with web activity, -such as backup batch file for operating system utility, and they are -not accessible by the web application, this is not a finding. - -If files with these extensions are found in either the document -directory or the home directory of the web server, this is -a finding. - -If files with these extensions are stored in a repository (not in the -document root) as backups for the web server? + + To verify all accounts have unique names, run the following command: +$ sudo getent passwd | awk -F: '{ print $1}' | uniq -d +No output should be returned. + Is it the case that a line is returned? - + -Run the following command to determine if the logwatch_can_network_connect_mail SELinux boolean is disabled: -$ getsebool logwatch_can_network_connect_mail +Run the following command to determine if the gluster_export_all_rw SELinux boolean is disabled: +$ getsebool gluster_export_all_rw If properly configured, the output should show the following: -logwatch_can_network_connect_mail --> off - Is it the case that logwatch_can_network_connect_mail is not disabled? +gluster_export_all_rw --> off + Is it the case that gluster_export_all_rw is not disabled? - - Run the following command to determine if the openssh-clients package is installed: $ rpm -q openssh-clients - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECCOMP_FILTER /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Ensure that Red Hat Enterprise Linux 8 does not disable SELinux. - -Check if "SELinux" is active and in "enforcing" or "permissive" mode with the following command: - -$ sudo getenforce -Enforcing --OR- -Permissive - Is it the case that SELinux is disabled? + + To verify that the log_config_module exists in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep log_config_module /etc/httpd/conf/httpd.conf +The output should return: +<IfModule log_config_module> + Is it the case that it is not? - - If the device or Red Hat Enterprise Linux 8 does not have a camera installed, this requirement is not applicable. - -This requirement is not applicable to mobile devices (smartphones and tablets), where the use of the camera is a local AO decision. - -This requirement is not applicable to dedicated VTC suites located in approved VTC locations that are centrally managed. - -For an external camera, if there is not a method for the operator to manually disconnect the camera at the end of collaborative computing sessions, this is a finding. - -For a built-in camera, the camera must be protected by a camera cover (e.g., laptop camera cover slide) when not in use. If the built-in camera is not protected with a camera cover, or is not physically disabled, this is a finding. - -If the camera is not disconnected, covered, or physically disabled, determine if it is being disabled via software with the following commands: - -Verify the operating system disables the ability to load the uvcvideo kernel module. - -$ sudo grep -r uvcvideo /etc/modprobe.d/* | grep "/bin/true" - -install uvcvideo /bin/true - Is it the case that the command does not return any output, or the line is commented out, and the collaborative computing device has not been authorized for use? + + To check the group ownership of /etc/ssh/sshd_config, +run the command: +$ ls -lL /etc/ssh/sshd_config +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/ssh/sshd_config does not have a group owner of root? - - -To check that the rexec service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rexec --list -Output should indicate the rexec service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rexec --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. - -rexec off - -To check that the rexec socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rexec -Output should indicate the rexec socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rexecdisabled - -Run the following command to verify rexec is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rexec - -If the socket is not running the command will return the following output: -inactive - -The socket will also be masked, to check that the rexec is masked, run the following command: -$ sudo systemctl show rexec | grep "LoadState\|UnitFileState" - -If the socket is masked the command will return the following outputs: - -LoadState=masked + + Verify the noexec option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . noexec . . . -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that the "/var/tmp" file system does not have the "noexec" option set? - - To verify that smart cards are enabled in SSSD, run the following command: -$ sudo grep pam_cert_auth /etc/sssd/sssd.conf -If configured properly, output should be -pam_cert_auth = True - - -To verify that smart cards are enabled in PAM files, run the following command: -$ sudo grep -e "auth.*pam_sss\.so.*\(allow_missing_name\|try_cert_auth\)" /etc/pam.d/smartcard-auth /etc/pam.d/system-auth -If configured properly, output should be - -/etc/pam.d/smartcard-auth:auth sufficient pam_sss.so allow_missing_name -/etc/pam.d/system-auth:auth [success=done authinfo_unavail=ignore ignore=ignore default=die] pam_sss.so try_cert_auth + + The runtime status of the kernel.perf_event_paranoid kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_event_paranoid +2. - Is it the case that smart cards are not enabled in SSSD? + Is it the case that the correct value is not returned? - - The runtime status of the net.ipv4.conf.all.secure_redirects kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.route_localnet kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.secure_redirects +$ sysctl net.ipv4.conf.all.route_localnet 0. Is it the case that the correct value is not returned? - - Verify that temporary accounts have been provisioned with an expiration date -of 72 hours. For every temporary account, run the following command to -obtain its account aging and expiration information: -$ sudo chage -l temporary_account_name -Verify each of these accounts has an expiration date set within 72 hours or -as documented. - Is it the case that any temporary accounts have no expiration date set or do not expire within 72 hours? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_ACPI_CUSTOM_METHOD /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify if the OpenSSH server uses defined Crypto Policy, run: -$ grep 'CRYPTO_POLICY' /etc/crypto-policies/back-ends/opensshserver.config | tail -n 1 -and verify that the line matches -CRYPTO_POLICY='-oCiphers=aes256-ctr,aes128-ctr,aes256-cbc,aes128-cbc -oMACs=hmac-sha2-512,hmac-sha2-256 -oGSSAPIKeyExchange=no -oKexAlgorithms=ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 -oHostKeyAlgorithms=ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -oPubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256' - Is it the case that Crypto Policy for OpenSSH Server is not configured according to CC requirements? + + To verify the operating system implements cryptography to protect the integrity of +remote ldap access sessions, run the following command: +$ sudo grep ldap_tls_cacert /etc/sssd/sssd.conf +The output should return the following with a correctly configured CA cert path: +ldap_tls_cacert /path/to/tls/ca.cert + Is it the case that the TLS CA cert is not configured? - - To determine if the system is configured to audit calls to the -fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Inspect the password section of /etc/pam.d/password-auth +and ensure that the pam_unix.so module includes the argument +sha512: +$ grep sha512 /etc/pam.d/password-auth + Is it the case that it does not? - - To check the permissions of /etc/cron.allow, + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules +The output has to be exactly as follows: +## Unsuccessful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification + Is it the case that the file does not exist or the content differs? + + + + To check the permissions of /etc/group, run the command: -$ ls -l /etc/cron.allow +$ ls -l /etc/group If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/cron.allow does not have unix mode -rw-------? +-rw-r--r-- + Is it the case that /etc/group does not have unix mode -rw-r--r--? - - -Run the following command to determine if the irssi_use_full_network SELinux boolean is disabled: -$ getsebool irssi_use_full_network -If properly configured, the output should show the following: -irssi_use_full_network --> off - Is it the case that irssi_use_full_network is not disabled? + + To check the permissions of /etc/http/conf, +run the command: +$ ls -l /etc/http/conf +If properly configured, the output should indicate the following permissions: +-rwxr-x--- + Is it the case that ? - - -Run the following command to determine if the httpd_run_stickshift SELinux boolean is disabled: -$ getsebool httpd_run_stickshift -If properly configured, the output should show the following: -httpd_run_stickshift --> off - Is it the case that httpd_run_stickshift is not disabled? + + To check the ownership of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have an owner of root? - - If FTP services are not installed, this is not applicable. - -To verify this configuration, run the following command: + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/10-base-config.rules +The output has to be exactly as follows: +## First rule - delete all +-D -grep "banner_file" /etc/vsftpd/vsftpd.conf +## Increase the buffers to survive stress events. +## Make this bigger for busy systems +-b 8192 +## This determine how long to wait in burst of events +--backlog_wait_time 60000 -The output should show the value of banner_file is set to /etc/issue, an example of which is shown below: +## Set failure mode to syslog +-f 1 + Is it the case that the file does not exist or the content differs? + + + + Verify that Red Hat Enterprise Linux 8 contains no duplicate User IDs (UIDs) for interactive users. -$ sudo grep "banner_file" /etc/vsftpd/vsftpd.conf +Check that the operating system contains no duplicate UIDs for interactive users with the following command: -banner_file=/etc/issue - Is it the case that it does not? +$ sudo awk -F ":" 'list[$3]++{print $1, $3}' /etc/passwd + Is it the case that output is produced and the accounts listed are interactive user accounts? - - Verify Red Hat Enterprise Linux 8 disables network management of the chrony daemon with the following command: -$ grep -w cmdport /etc/chrony.conf -cmdport 0 - Is it the case that the "cmdport" option is not set to "0", is commented out, or is missing? + + The following command will discover and print world-writable directories that +are not group owned by a system account, given the assumption that only system +accounts have a gid lower than 1000. Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -gid +999 -print + Is it the case that there is output? - - To check the permissions of /etc/issue, -run the command: -$ ls -l /etc/issue -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/issue does not have unix mode -rw-r--r--? + + Run the following command to determine if the iptables package is installed: $ rpm -q iptables + Is it the case that the package is not installed? - - To verify whether audispd plugin off-loads audit records onto a different -system or media from the system being audited, run the following command: - -$ sudo grep -i remote_server /etc/audit/audisp-remote.conf - -The output should return something similar to where REMOTE_SYSTEM -is an IP address or hostname: -remote_server = REMOTE_SYSTEM - -Determine which partition the audit records are being written to with the -following command: - -$ sudo grep log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log - -Check the size of the partition that audit records are written to with the -following command and verify whether it is sufficiently large: - -$ sudo df -h /var/log/audit/ -/dev/sda2 24G 10.4G 13.6G 43% /var/log/audit - Is it the case that audispd is not sending logs to a remote system and the local partition has inadequate space? + + +Run the following command to determine if the antivirus_use_jit SELinux boolean is disabled: +$ getsebool antivirus_use_jit +If properly configured, the output should show the following: +antivirus_use_jit --> off + Is it the case that antivirus_use_jit is not disabled? - - Verify Red Hat Enterprise Linux 8 is configured to lock the root account after -unsuccessful logon attempts with the command: - - -$ grep even_deny_root /etc/security/faillock.conf -even_deny_root - Is it the case that the "even_deny_root" option is not set, is missing or commented out? + + To verify if the OpenSSH server uses defined MACs in the Crypto Policy, run: +$ grep -Po '(-oMACs=\S+)' /etc/crypto-policies/back-ends/opensshserver.config +and verify that the line matches: +-oMACS= + Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? - + -Run the following command to determine if the ssh_sysadm_login SELinux boolean is disabled: -$ getsebool ssh_sysadm_login +Run the following command to determine if the use_lpd_server SELinux boolean is disabled: +$ getsebool use_lpd_server If properly configured, the output should show the following: -ssh_sysadm_login --> off - Is it the case that ssh_sysadm_login is not disabled? +use_lpd_server --> off + Is it the case that use_lpd_server is not disabled? - - -Run the following command to determine if the fcron_crond SELinux boolean is disabled: -$ getsebool fcron_crond -If properly configured, the output should show the following: -fcron_crond --> off - Is it the case that fcron_crond is not disabled? + + Run the following command to determine if the rng-tools package is installed: $ rpm -q rng-tools + Is it the case that the package is not installed? - - To ensure the X Windows package group is removed, run the following command: + + To check that SLUB/SLAB poisoning is enabled, check all boot entries with following command; +sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that does not enable poisoning. + Is it the case that SLUB/SLAB poisoning is not enabled? + + + + To determine if arguments that commands can be executed with are restricted, run the following command: +$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+(?:[ \t]+[^,\s]+)+[ \t]*,)*(\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+[ \t]*(?:,|$))' /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that /etc/sudoers file contains user specifications that allow execution of commands with any arguments? + + + + To check that the portreserve service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled portreserve +Output should indicate the portreserve service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled portreserve disabled -$ rpm -qi xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-server-Xwayland +Run the following command to verify portreserve is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active portreserve -For each package mentioned above you should receive following line: -package <package> is not installed - Is it the case that xorg related packages are not removed and run level is not correctly configured? +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the portreserve is masked, run the following command: +$ sudo systemctl show portreserve | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "portreserve" is loaded and not masked? - + -Run the following command to determine if the tftp_home_dir SELinux boolean is disabled: -$ getsebool tftp_home_dir -If properly configured, the output should show the following: -tftp_home_dir --> off - Is it the case that tftp_home_dir is not disabled? - - - - To determine if the system is configured to audit unsuccessful calls -to the lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the system is configured to prevent the loading of the mac80211 kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the mac80211 kernel module via blacklist keyword. +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r mac80211 /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - The runtime status of the net.ipv4.ip_forward kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.ip_forward -0. -The ability to forward packets is only appropriate for routers. - Is it the case that the correct value is not returned? + + Run the following command to determine if the ntp package is installed: $ rpm -q ntp + Is it the case that the package is not installed? - - The runtime status of the net.ipv4.ip_local_port_range kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.ip_local_port_range -32768 65535. - - Is it the case that the correct value is not returned? + + To verify that USB Human Interface Devices will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +The output lines should include +allow with-interface match-all { 03:*:* } + Is it the case that USB devices of class 3 are not authorized? - + + Verify the audit logs are owned by "root". First, determine where the audit logs are stored with the following command: +$ sudo grep -iw log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log +Using the location of the audit log file, determine if the audit log is owned by "root" using the following command: +$ sudo stat -c "%n %U" /var/log/audit/audit.log +Audit logs must be owned by user root. +If the log_file isn't defined in /etc/audit/auditd.conf, check all files in /var/log/audit/ directory instead. + Is it the case that the audit log is not owned by root? + + + -Run the following command to determine if the antivirus_can_scan_system SELinux boolean is enabled: -$ getsebool antivirus_can_scan_system +Run the following command to determine if the selinuxuser_ping SELinux boolean is enabled: +$ getsebool selinuxuser_ping If properly configured, the output should show the following: -antivirus_can_scan_system --> on - Is it the case that antivirus_can_scan_system is not enabled? +selinuxuser_ping --> on + Is it the case that selinuxuser_ping is not enabled? - - Verify the nodev option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . nodev . . . + + Verify that a separate file system/partition has been created for /tmp with the following command: - Is it the case that the "/var/tmp" file system does not have the "nodev" option set? +$ mountpoint /tmp + + Is it the case that "/tmp is not a mountpoint" is returned? - - Verify the "umask" setting is configured correctly in the "/etc/csh.cshrc" file with the following command: + + Ensure that Red Hat Enterprise Linux 8 does not disable SELinux. -$ grep umask /etc/csh.cshrc +Check if "SELinux" is active and in "enforcing" or "permissive" mode with the following command: -umask 077 -umask 077 - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? +$ sudo getenforce +Enforcing +-OR- +Permissive + Is it the case that SELinux is disabled? - - The runtime status of the net.ipv6.conf.default.accept_ra kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra -0. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the openat system call with O_TRUNC_WRITE flag. - Is it the case that the correct value is not returned? - - - - Check the root home directory for a .mozilla directory. If -one exists, ensure browsing is limited to local service administration. - Is it the case that this is not the case? +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit unsuccessful calls -to the fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the creat system call. - Is it the case that no line is returned? +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r creat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep creat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - - To check the system for the existence of any .netrc files, -run the following command: -$ sudo find /home -xdev -name .netrc - Is it the case that any .netrc files exist? + + To determine if ignore_dot has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\bignore_dot\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that ignore_dot is not enabled in sudo? - - Run the following command to determine if the libpwquality package is installed: -$ rpm -q libpwquality - Is it the case that the package is not installed? + + +Run the following command to determine if the httpd_use_gpg SELinux boolean is disabled: +$ getsebool httpd_use_gpg +If properly configured, the output should show the following: +httpd_use_gpg --> off + Is it the case that httpd_use_gpg is not disabled? - - The runtime status of the kernel.panic_on_oops kernel parameter can be queried -by running the following command: -$ sysctl kernel.panic_on_oops -1. - - Is it the case that the correct value is not returned? + + Ensure there are no unconfined daemons running on the system, +the following command should produce no output: +$ sudo ps -eZ | grep "unconfined_service_t" + Is it the case that There are unconfined daemons running on the system? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules -The output has to be exactly as follows: -## Successful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification - Is it the case that the file does not exist or the content differs? + + Run the following command to determine if the rsync-daemon package is installed: +$ rpm -q rsync-daemon + Is it the case that the package is installed? - - Run the following command to check for duplicate group names: -Check that the operating system contains no duplicate group names for interactive users by running the following command: + + To check which SSH protocol version is allowed, check version of +openssh-server with following command: +$ rpm -qi openssh-server | grep Version +Versions equal to or higher than 7.4 have deprecated the RhostsRSAAuthentication option. +If version is lower than 7.4, run the following command to check configuration: +To determine how the SSH daemon's RhostsRSAAuthentication option is set, run the following command: - cut -d : -f 1 /etc/group | uniq -d +$ sudo grep -i RhostsRSAAuthentication /etc/ssh/sshd_config -If output is produced, this is a finding. -Configure the operating system to contain no duplicate names for groups. -Edit the file "/etc/group" and provide each group that has a duplicate group name with a unique group name. - Is it the case that has duplicate group names? - - - - To check the permissions of /etc/issue.net, -run the command: -$ ls -l /etc/issue.net -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/issue.net does not have unix mode -rw-r--r--? +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODIFY_LDT_SYSCALL /boot/config.* + $ grep CONFIG_BINFMT_MISC /boot/config.* Configs with value 'n' are not explicitly set in the file, so either commented lines or no lines should be returned. @@ -371809,641 +372282,475 @@ If properly configured, the output should indicate the following permissions: Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the abrt-plugin-logger package is installed: -$ rpm -q abrt-plugin-logger + + Run the following command to determine if the talk-server package is installed: +$ rpm -q talk-server Is it the case that the package is installed? - - Make sure that /boot/bootmap is newer than /boot/loader/entries/*.conf -and /etc/zipl.conf: -find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap -No line should be returned, if a line is returned /boot/bootmap is outdated and needs to be regenerated. - Is it the case that the bootmap is outdated? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.thumbnailers disable-all +If properly configured, the output should be true. +To ensure that users cannot how long until the screensaver locks, run the following: +$ grep disable-all /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/thumbnailers/disable-all + Is it the case that GNOME thumbnailers are not disabled? - - To determine if the system is configured to audit successful calls -to the openat system call, run the following command: -$ sudo grep "openat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the virt_sandbox_use_all_caps SELinux boolean is disabled: +$ getsebool virt_sandbox_use_all_caps +If properly configured, the output should show the following: +virt_sandbox_use_all_caps --> off + Is it the case that virt_sandbox_use_all_caps is not disabled? - - To determine if the system is configured to audit successful calls -to the openat system call, run the following command: -$ sudo grep "openat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine how the SSH daemon's X11Forwarding option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i X11Forwarding /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to get the current configured value for polyinstantiation_enabled -SELinux boolean: -$ getsebool polyinstantiation_enabled -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that polyinstantiation_enabled is not set as expected? +Run the following command to determine if the dhcpc_exec_iptables SELinux boolean is disabled: +$ getsebool dhcpc_exec_iptables +If properly configured, the output should show the following: +dhcpc_exec_iptables --> off + Is it the case that dhcpc_exec_iptables is not disabled? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one special character with the following command: + + Verify that Promiscuous mode of an interface is disabled, run the following command: +$ ip link | grep PROMISC + Is it the case that any network device is in promiscuous mode? + + + + To check the permissions of /etc/passwd-, +run the command: +$ ls -l /etc/passwd- +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/passwd- does not have unix mode -rw-r--r--? + + + + To determine how the SSH daemon's UsePAM option is set, run the following command: -$ sudo grep ocredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +$ sudo grep -i UsePAM /etc/ssh/sshd_config -ocredit = - Is it the case that value of "ocredit" is a positive number or is commented out? +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to determine if the use_nfs_home_dirs SELinux boolean is disabled: -$ getsebool use_nfs_home_dirs -If properly configured, the output should show the following: -use_nfs_home_dirs --> off - Is it the case that use_nfs_home_dirs is not disabled? +To check that the rsh service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rsh --list +Output should indicate the rsh service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rsh --list + +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. + +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. + +rsh off + +To check that the rsh socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rsh +Output should indicate the rsh socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rshdisabled + +Run the following command to verify rsh is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rsh + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the rsh is masked, run the following command: +$ sudo systemctl show rsh | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - + -Run the following command to determine if the rsync_client SELinux boolean is disabled: -$ getsebool rsync_client +Run the following command to determine if the cups_execmem SELinux boolean is disabled: +$ getsebool cups_execmem If properly configured, the output should show the following: -rsync_client --> off - Is it the case that rsync_client is not disabled? - - - - To check the group ownership of /etc/shadow, -run the command: -$ ls -lL /etc/shadow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shadow does not have a group owner of root? +cups_execmem --> off + Is it the case that cups_execmem is not disabled? - - To verify that audit is configured for OSPP v4.2.1, run the following commands: -for file in "10-base-config" "11-loginuid" "30-ospp-v42" "43-module-load";do diff /etc/audit/rules.d/$file.rules /usr/share/doc/audit*/rules/$file.rules; done - -If the system is configured properly, no lines should be returned. - Is it the case that the files are not there or differ? + + Verify that authselect is enabled by running +authselect current +If authselect is enabled on the system, the output should show the ID of the profile which is currently in use. + Is it the case that authselect is not used to manage user authentication setup on the system? - - To check the permissions of /usr/bin/sudo, -run the command: -$ ls -l /usr/bin/sudo -If properly configured, the output should indicate the following permissions: ----s--x--- - Is it the case that /usr/bin/sudo does not have unix mode ---s--x---? + + Determine if "sudoers" file restricts sudo access run the following commands: +$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* +$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\:ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* + Is it the case that either of the commands returned a line? - - Run the following command to determine if the cron package is installed: -$ rpm -q cron - Is it the case that the package is installed? + + Verify that Red Hat Enterprise Linux 8 generates an audit record for all uses of the "umount" and system call. +To determine if the system is configured to audit calls to the +"umount" system call, run the following command: +$ sudo grep "umount" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line like the following. +-a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -k privileged-umount + Is it the case that the command does not return a line, or the line is commented out? - - The runtime status of the net.ipv4.conf.all.shared_media kernel parameter can be queried + + The runtime status of the kernel.core_pattern kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.shared_media -0. +$ sysctl kernel.core_pattern +|/bin/false. - Is it the case that the correct value is not returned? + Is it the case that the returned line does not have a value of "|/bin/false", or a line is not +returned and the need for core dumps is not documented with the Information +System Security Officer (ISSO) as an operational requirement? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PANIC_TIMEOUT /boot/config.* + $ grep CONFIG_X86_VSYSCALL_EMULATION /boot/config.* - For each kernel installed, a line with value "" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - To verify the system is not configured to use a boot loader on removable media, -check that the grub configuration file has the set root command in each menu -entry with the following commands: -$ sudo grep -cw menuentry /boot/grub2/grub.cfg -Note that the -c option for the grep command will print -only the count of menuentry occurrences. This number should match -the number of occurrences reported by the following command: -$ sudo grep "set root='hd0" /boot/grub2/grub.cfg -The output should return something similar to: -set root='hd0,msdos1' -usb0, cd, fd0, etc. are some examples of removeable -media which should not exist in the lines: -set root='hd0,msdos1' - Is it the case that it is not? + + The runtime status of the net.ipv6.conf.all.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_redirects +0. + + Is it the case that the correct value is not returned? - - Verify the nosuid option is configured for the /opt mount point, - run the following command: - $ sudo mount | grep '\s/opt\s' - . . . /opt . . . nosuid . . . + + To determine how the SSH daemon's Banner option is set, run the following command: - Is it the case that the "/opt" file system does not have the "nosuid" option set? +$ sudo grep -i Banner /etc/ssh/sshd_config + +If a line indicating /etc/issue.net is returned, then the required value is set. + + Is it the case that the required value is not set? - - The runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.secure_redirects kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_rtr_pref +$ sysctl net.ipv4.conf.all.secure_redirects 0. Is it the case that the correct value is not returned? - - -Run the following command to determine if the squid_connect_any SELinux boolean is disabled: -$ getsebool squid_connect_any -If properly configured, the output should show the following: -squid_connect_any --> off - Is it the case that squid_connect_any is not disabled? - - - - The existence of the file /etc/hosts.equiv or a file named -.rhosts inside a user home directory indicates the presence -of an Rsh trust relationship. - Is it the case that these files exist? + + To verify that DHCP is not being used, examine the following file for each interface: +# /etc/sysconfig/network-scripts/ifcfg-interface +Look for the following: +BOOTPROTO=none +and the following, substituting the appropriate values based on your site's addressing scheme: +NETMASK=255.255.255.0 +IPADDR=192.168.1.2 +GATEWAY=192.168.1.1 + Is it the case that it does not? - - To determine if the system is configured to audit calls to the -init_module system call, run the following command: -$ sudo grep "init_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -finit_module system call, run the following command: -$ sudo grep "finit_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -delete_module system call, run the following command: -$ sudo grep "delete_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? + + Verify it by running the following command: +$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + +/sbin/auditctl 755 +/sbin/aureport 755 +/sbin/ausearch 755 +/sbin/autrace 755 +/sbin/auditd 755 +/sbin/audispd 755 +/sbin/augenrules 755 + + +If the command does not return all the above lines, the missing ones +need to be added. + +Run the following command to correct the permissions of the missing +entries: +$ sudo chmod 0755 [audit_tool] + +Replace "[audit_tool]" with the audit tool that does not have the +correct permissions. + Is it the case that ? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_FREELIST_HARDENED /boot/config.* + $ grep CONFIG_PROC_KCORE /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - -Run the following command to determine if the httpd_use_sasl SELinux boolean is disabled: -$ getsebool httpd_use_sasl -If properly configured, the output should show the following: -httpd_use_sasl --> off - Is it the case that httpd_use_sasl is not disabled? - - - - To verify the operating system implements cryptography to protect the integrity of -remote ldap access sessions, run the following command: -$ sudo grep ldap_tls_cacert /etc/sssd/sssd.conf -The output should return the following with a correctly configured CA cert path: -ldap_tls_cacert /path/to/tls/ca.cert - Is it the case that the TLS CA cert is not configured? - - - - Verify the operating system authenticates the remote logging server for off-loading audit logs with the following command: - -$ sudo grep -i '$ActionSendStreamDriverAuthMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should be -$/etc/rsyslog.conf:$ActionSendStreamDriverAuthMode x509/name - Is it the case that $ActionSendStreamDriverAuthMode in /etc/rsyslog.conf is not set to x509/name? - - - - To verify that repo_gpgcheck is configured properly, run the following -command: -$ grep repo_gpgcheck /etc/yum.conf -The output should return something similar to: -repo_gpgcheck=1 - Is it the case that gpgcheck is not enabled or configured correctly to verify repository metadata? - - - - The runtime status of the net.ipv4.conf.all.accept_local kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_local -0. - - Is it the case that the correct value is not returned? - - - - To determine if the system is configured to audit successful calls -to the lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - -Run the following command to determine if the unprivuser_use_svirt SELinux boolean is disabled: -$ getsebool unprivuser_use_svirt -If properly configured, the output should show the following: -unprivuser_use_svirt --> off - Is it the case that unprivuser_use_svirt is not disabled? + + Verify Red Hat Enterprise Linux 8 limits the number of concurrent sessions to +"" for all +accounts and/or account types with the following command: +$ grep -r -s maxlogins /etc/security/limits.conf /etc/security/limits.d/*.conf +/etc/security/limits.conf:* hard maxlogins 10 +This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. + Is it the case that the "maxlogins" item is missing, commented out, or the value is set greater +than "<sub idref="var_accounts_max_concurrent_login_sessions" />" and +is not documented with the Information System Security Officer (ISSO) as an +operational requirement for all domains that have the "maxlogins" item +assigned'? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_GCC_PLUGIN_LATENT_ENTROPY /boot/config.* + $ grep CONFIG_MODULE_SIG_FORCE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling automount-open -If properly configured, the output for automount-openshould be false. -To ensure that users cannot enable automount opening in GNOME3, run the following: -$ grep 'automount-open' /etc/dconf/db/local.d/locks/* -If properly configured, the output for automount-open should be /org/gnome/desktop/media-handling/automount-open - Is it the case that GNOME automounting is not disabled? - - - - -Run the following command to determine if the use_samba_home_dirs SELinux boolean is disabled: -$ getsebool use_samba_home_dirs -If properly configured, the output should show the following: -use_samba_home_dirs --> off - Is it the case that use_samba_home_dirs is not disabled? - - - - The runtime status of the kernel.kptr_restrict kernel parameter can be queried -by running the following command: -$ sysctl kernel.kptr_restrict -The output of the command should indicate either: -kernel.kptr_restrict = 1 -or: -kernel.kptr_restrict = 2 -The output of the command should not indicate: -kernel.kptr_restrict = 0 - -The preferable way how to assure the runtime compliance is to have -correct persistent configuration, and rebooting the system. - -The persistent kernel parameter configuration is performed by specifying the appropriate -assignment in any file located in the /etc/sysctl.d directory. -Verify that there is not any existing incorrect configuration by executing the following command: -$ grep -r '^\s*kernel.kptr_restrict\s*=' /etc/sysctl.conf /etc/sysctl.d -The command should not find any assignments other than: -kernel.kptr_restrict = 1 -or: -kernel.kptr_restrict = 2 - -Conflicting assignments are not allowed. - Is it the case that the kernel.kptr_restrict is not set to 1 or 2 or is configured to be 0? - - - - -Run the following command to determine if the mpd_use_cifs SELinux boolean is disabled: -$ getsebool mpd_use_cifs -If properly configured, the output should show the following: -mpd_use_cifs --> off - Is it the case that mpd_use_cifs is not disabled? - - - - To ensure that remote access requires credentials, run the following command: -$ gsettings get org.gnome.Vino authentication-methods -If properly configured, the output should be false. -To ensure that users cannot disable credentials for remote access, run the following: -$ grep authentication-methods /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/Vino/authentication-methods - Is it the case that wireless network notification is enabled and not disabled? - - - - Verify the noexec option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . noexec . . . - - Is it the case that the "/var" file system does not have the "noexec" option set? - - - - To verify .netrc file in interactive user home directory is -not group or world accessible", run the following command: -$ sudo ls -lLR /home/USER/.netrc - Is it the case that the group and world permissions are incorrect? - - - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep '\bat\b' /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? - - - - Verify that a separate file system/partition has been created for /srv with the following command: - -$ mountpoint /srv - - Is it the case that "/srv is not a mountpoint" is returned? - - - - To verify if LogFormat is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i logformat /etc/httpd/conf/httpd.conf -The output should contain the following: -LogFormat "a %A %h %H %l %m %s %t %u %U \"%{Referer}i\" \"%{User-Agent}i\"" combined - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_GCC_PLUGIN_STRUCTLEAK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the login_console_enabled SELinux boolean is enabled: -$ getsebool login_console_enabled +Run the following command to determine if the httpd_tmp_exec SELinux boolean is disabled: +$ getsebool httpd_tmp_exec If properly configured, the output should show the following: -login_console_enabled --> on - Is it the case that login_console_enabled is not enabled? - - - - Verify the grpquota option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . grpquota . . . - - Is it the case that the "/home" file system does not have the "grpquota" option set? - - - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To check the system for the existence of any .forward files, -run the following command: -$ sudo find /home -xdev -name .forward - Is it the case that any .forward files exist? +httpd_tmp_exec --> off + Is it the case that httpd_tmp_exec is not disabled? - - To check that the squid service is disabled in system boot configuration, + + To check that the abrtd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled squid -Output should indicate the squid service has either not been installed, +$ sudo systemctl is-enabled abrtd +Output should indicate the abrtd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled squid disabled +$ sudo systemctl is-enabled abrtd disabled -Run the following command to verify squid is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active squid +Run the following command to verify abrtd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active abrtd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the squid is masked, run the following command: -$ sudo systemctl show squid | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the abrtd is masked, run the following command: +$ sudo systemctl show abrtd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "squid" is loaded and not masked? + Is it the case that the "abrtd" is loaded and not masked? - - To check the permissions of /etc/passwd, -run the command: -$ ls -l /etc/passwd -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/passwd does not have unix mode -rw-r--r--? + + +Run the following command to determine if the nfsd_anon_write SELinux boolean is disabled: +$ getsebool nfsd_anon_write +If properly configured, the output should show the following: +nfsd_anon_write --> off + Is it the case that nfsd_anon_write is not disabled? - - Inspect /etc/default/grub for any instances of -systemd.confirm_spawn=(1|yes|true|on) in the kernel boot arguments. -Presence of a systemd.confirm_spawn=(1|yes|true|on) indicates -that interactive boot is enabled at boot time and verify that -GRUB_DISABLE_RECOVERY=true to disable recovery boot. - Is it the case that Interactive boot is enabled at boot time? + + To verify if the OpenSSH server uses defined ciphers in the Crypto Policy, run: +$ grep -Po '(-oCiphers=\S+)' /etc/crypto-policies/back-ends/opensshserver.config +and verify that the line matches: +-oCiphers= + Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? - - The runtime status of the net.ipv6.conf.all.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_source_route -0. - - Is it the case that the correct value is not returned? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules +The output has to be exactly as follows: +## Successful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change + Is it the case that the file does not exist or the content differs? - - To ensure the failed password attempt policy is configured correctly, run the following command: + + Query the SA and the Web Manager to determine if a compiler is present on +the server. + Is it the case that the web server is part of an application suite and a comiler is needed +for installation, patching, and upgrading of the suite or if the compiler +is embedded and can't be removed without breaking the suite, document the +installation of the compiler with the ISSO/ISSM and verify that the compiler +is restricted to administrative users only. If documented and restricted to +administrative users, this is not a finding. -$ grep fail_interval /etc/security/faillock.conf -The output should show fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. - Is it the case that the "fail_interval" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_fail_interval" />" -or less (but not "0"), the line is commented out, or the line is missing? +If an undocumented compiler is present, and available to non-administrative +users? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_TABLE_ISOLATION /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the password warning age, run the command: +$ grep PASS_WARN_AGE /etc/login.defs +The DoD requirement is 7. + Is it the case that it is not set to the required value? - - Verify that Red Hat Enterprise Linux 8 is configured to prevent unrestricted mail relaying, -run the following command: -$ sudo postconf -n smtpd_client_restrictions - Is it the case that the "smtpd_client_restrictions" parameter contains any entries other than "permit_mynetworks" and "reject"? + + Only FIPS ciphers should be used. To verify that only FIPS-approved +ciphers are in use, run the following command: +$ sudo grep Ciphers /etc/ssh/sshd_config +The output should contain only those ciphers which are FIPS-approved. + Is it the case that FIPS ciphers are not configured or the enabled ciphers are not FIPS-approved? - - To check if the system login banner is compliant, run the following command: -$ cat /etc/issue.net - Is it the case that it does not display the required banner? + + To determine that AIDE is verifying ACLs, run the following command: +$ grep acl /etc/aide.conf +Verify that the acl option is added to the correct ruleset. + Is it the case that the acl option is missing or not added to the correct ruleset? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "poweroff" command with the following command: - -$ sudo auditctl -l | grep poweroff - --a always,exit -F path=/poweroff -F perm=x -F auid>=1000 -F auid!=unset -k privileged-poweroff - Is it the case that the command does not return a line, or the line is commented out? + + To check the group ownership of /etc/cron.d, +run the command: +$ ls -lL /etc/cron.d +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.d does not have a group owner of root? - - Verify Red Hat Enterprise Linux 8 enables the user to initiate a session lock with the following command: - -$ grep lock-command /etc/tmux.conf - -set -g lock-command vlock - -Then, verify that the /etc/tmux.conf file can be read by other users than root: - -$ sudo ls -al /etc/tmux.conf - Is it the case that the "lock-command" is not set in the global settings to call "vlock"? + + +Run the following command to determine if the secure_mode_policyload SELinux boolean is disabled: +$ getsebool secure_mode_policyload +If properly configured, the output should show the following: +secure_mode_policyload --> off + Is it the case that secure_mode_policyload is not disabled? - - Verify the audit logs are owned by "root". First, determine where the audit logs are stored with the following command: -$ sudo grep -iw log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log -Using the location of the audit log file, determine if the audit log is owned by "root" using the following command: -$ sudo stat -c "%n %U" /var/log/audit/audit.log -Audit logs must be owned by user root. -If the log_file isn't defined in /etc/audit/auditd.conf, check all files in /var/log/audit/ directory instead. - Is it the case that the audit log is not owned by root? + + +Run the following command to determine if the postfix_local_write_mail_spool SELinux boolean is enabled: +$ getsebool postfix_local_write_mail_spool +If properly configured, the output should show the following: +postfix_local_write_mail_spool --> on + Is it the case that postfix_local_write_mail_spool is not enabled? - + -Run the following command to determine if the httpd_dontaudit_search_dirs SELinux boolean is disabled: -$ getsebool httpd_dontaudit_search_dirs +Run the following command to determine if the sanlock_use_nfs SELinux boolean is disabled: +$ getsebool sanlock_use_nfs If properly configured, the output should show the following: -httpd_dontaudit_search_dirs --> off - Is it the case that httpd_dontaudit_search_dirs is not disabled? +sanlock_use_nfs --> off + Is it the case that sanlock_use_nfs is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/10-base-config.rules -The output has to be exactly as follows: -## First rule - delete all --D - -## Increase the buffers to survive stress events. -## Make this bigger for busy systems --b 8192 + + Verify users are provided with feedback on when account accesses last occurred with the following command: -## This determine how long to wait in burst of events ---backlog_wait_time 60000 +$ sudo grep pam_lastlog /etc/pam.d/postlogin -## Set failure mode to syslog --f 1 - Is it the case that the file does not exist or the content differs? +session [default=1] pam_lastlog.so showfailed + Is it the case that "pam_lastlog.so" is not properly configured in "/etc/pam.d/postlogin" file? - - To determine if the system is configured to audit unsuccessful calls -to the lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify the noexec option is configured for all NFS mounts, run the following command: +$ mount | grep nfs +All NFS mounts should show the noexec setting in parentheses. This is not applicable if NFS is +not implemented. + Is it the case that the setting does not show? - - The runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_ra_defrtr -0. - - Is it the case that the correct value is not returned? + + To find SGID files, run the following command: +$ sudo find / -xdev -type f -perm -2000 + Is it the case that there is output? - + - -Run the following command to determine the current status of the -systemd-journald service: -$ sudo systemctl is-active systemd-journald -If the service is running, it should return the following: active - Is it the case that the systemd-journald service is not running? +Run the following command to determine if the samba_share_fusefs SELinux boolean is disabled: +$ getsebool samba_share_fusefs +If properly configured, the output should show the following: +samba_share_fusefs --> off + Is it the case that samba_share_fusefs is not disabled? - - Verify the operating system audits activities performed during nonlocal -maintenance and diagnostic sessions. Run the following command: -$ sudo auditctl -l | grep sudo.log --w /var/log/sudo.log -p wa -k maintenance + + +To properly set the owner of /etc/audit/, run the command: +$ sudo chown root /etc/audit/ - Is it the case that Audit rule is not present? +To properly set the owner of /etc/audit/rules.d/, run the command: +$ sudo chown root /etc/audit/rules.d/ + Is it the case that ? - - The runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter can be queried + + The runtime status of the kernel.randomize_va_space kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_pinfo -0. +$ sysctl kernel.randomize_va_space +2. Is it the case that the correct value is not returned? - - -Run the following command to determine if the httpd_run_ipa SELinux boolean is disabled: -$ getsebool httpd_run_ipa -If properly configured, the output should show the following: -httpd_run_ipa --> off - Is it the case that httpd_run_ipa is not disabled? - - - - Run the following command to determine if the systemd-journal-remote package is installed: $ rpm -q systemd-journal-remote + + Run the following command to determine if the samba-common package is installed: $ rpm -q samba-common Is it the case that the package is not installed? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open_by_handle_at system call with O_TRUNC_WRITE flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open_by_handle_at /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep open_by_handle_at /etc/audit/audit.rules + + Run the following command to check for duplicate group names: +Check that the operating system contains no duplicate group names for interactive users by running the following command: -The output should be the following: + cut -d : -f 3 /etc/group | uniq -d --a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? - - - - Run the following command to determine if the subscription-manager package is installed: $ rpm -q subscription-manager - Is it the case that the package is not installed? +If output is produced, this is a finding. +Configure the operating system to contain no duplicate names for groups. +Edit the file "/etc/group" and provide each group that has a duplicate group id with a unique group id. + Is it the case that the system has duplicate group ids? @@ -372452,580 +372759,598 @@ $ sudo auditctl -l | grep "watch=/etc/sudoers\|watch=/etc/sudoers.d\|-w /etc/sud Is it the case that there is not output? - - To verify that the Dracut FIPS module is enabled, run the following command: -grep "add_dracutmodules" /etc/dracut.conf.d/40-fips.conf -The output should look like this: -add_dracutmodules+=" fips " - Is it the case that the Dracut FIPS module is not enabled? - - - - + + To determine how the SSH daemon's KerberosAuthentication option is set, run the following command: -Run the following command to determine the current status of the -rngd service: -$ sudo systemctl is-active rngd -If the service is running, it should return the following: active - Is it the case that the "rngd" service is disabled, masked, or not started.? - - - - -Run the following command to determine if the virt_use_comm SELinux boolean is disabled: -$ getsebool virt_use_comm -If properly configured, the output should show the following: -virt_use_comm --> off - Is it the case that virt_use_comm is not disabled? - - - - -Run the following command to determine if the icecast_use_any_tcp_ports SELinux boolean is disabled: -$ getsebool icecast_use_any_tcp_ports -If properly configured, the output should show the following: -icecast_use_any_tcp_ports --> off - Is it the case that icecast_use_any_tcp_ports is not disabled? - - - - -Run the following command to determine if the prosody_bind_http_port SELinux boolean is disabled: -$ getsebool prosody_bind_http_port -If properly configured, the output should show the following: -prosody_bind_http_port --> off - Is it the case that prosody_bind_http_port is not disabled? +$ sudo grep -i KerberosAuthentication /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - Run the following command to determine if the aide package is installed: $ rpm -q aide - Is it the case that the package is not installed? + + To check the group ownership of /etc/gshadow-, +run the command: +$ ls -lL /etc/gshadow- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/gshadow- does not have a group owner of root? - + -Run the following command to determine if the virt_transition_userdomain SELinux boolean is disabled: -$ getsebool virt_transition_userdomain -If properly configured, the output should show the following: -virt_transition_userdomain --> off - Is it the case that virt_transition_userdomain is not disabled? - - - - The runtime status of the net.ipv4.icmp_ignore_bogus_error_responses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.icmp_ignore_bogus_error_responses -1. +To properly set the owner of /var/log/audit, run the command: +$ sudo chown root /var/log/audit - Is it the case that the correct value is not returned? +To properly set the owner of /var/log/audit/*, run the command: +$ sudo chown root /var/log/audit/* + Is it the case that ? - + -Run the following command to determine if the gitosis_can_sendmail SELinux boolean is disabled: -$ getsebool gitosis_can_sendmail +Run the following command to determine if the mcelog_client SELinux boolean is disabled: +$ getsebool mcelog_client If properly configured, the output should show the following: -gitosis_can_sendmail --> off - Is it the case that gitosis_can_sendmail is not disabled? +mcelog_client --> off + Is it the case that mcelog_client is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "semanage" command with the following command: + + The file /etc/cron.deny should not exist. +This can be checked by runnig the following -$ sudo auditctl -l | grep semanage +stat /etc/cron.deny --a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update - Is it the case that the command does not return a line, or the line is commented out? +and the output should be + +stat: cannot stat `/etc/cron.deny': No such file or directory + + Is it the case that the file /etc/cron.deny exists? - + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +cat /etc/audit/rules.d/30-ospp-v42-3-access-success.rules The output has to be exactly as follows: -## Unsuccessful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +## Successful file access (any other opens) This has to go last. +## These next two are likely to result in a whole lot of events +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access Is it the case that the file does not exist or the content differs? - - The owner of all log files written by rsyslog should be - -root. - -These log files are determined by the second part of each Rule line in -/etc/rsyslog.conf and typically all appear in /var/log. -To see the owner of a given log file, run the following command: -$ ls -l LOGFILE - Is it the case that the owner is not correct? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_REFCOUNT_FULL /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? - - - - Run the following command to determine if the nfs-utils package is installed: -$ rpm -q nfs-utils - Is it the case that the package is installed? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "newgrp" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "passwd" command with the following command: -$ sudo auditctl -l | grep newgrp +$ sudo auditctl -l | grep passwd --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -k privileged-newgrp +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-passwd Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit calls to the -clock_settime system call, run the following command: -$ sudo grep "clock_settime" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To determine if the system is configured to audit calls to the -setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To check the ownership of /etc/cron.hourly, + + To check the ownership of /etc/passwd, run the command: -$ ls -lL /etc/cron.hourly +$ ls -lL /etc/passwd If properly configured, the output should indicate the following owner: root - Is it the case that /etc/cron.hourly does not have an owner of root? - - - - Verify that a separate file system/partition has been created for /dev/shm with the following command: - -$ mountpoint /dev/shm - - Is it the case that "/dev/shm is not a mountpoint" is returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_ALL /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + Is it the case that /etc/passwd does not have an owner of root? - + -Run the following command to determine if the selinuxuser_mysql_connect_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_mysql_connect_enabled +Run the following command to determine if the git_cgi_use_nfs SELinux boolean is disabled: +$ getsebool git_cgi_use_nfs If properly configured, the output should show the following: -selinuxuser_mysql_connect_enabled --> off - Is it the case that selinuxuser_mysql_connect_enabled is not disabled? +git_cgi_use_nfs --> off + Is it the case that git_cgi_use_nfs is not disabled? - + -Run the following command to determine if the xdm_bind_vnc_tcp_port SELinux boolean is disabled: -$ getsebool xdm_bind_vnc_tcp_port +Run the following command to determine if the samba_export_all_ro SELinux boolean is disabled: +$ getsebool samba_export_all_ro If properly configured, the output should show the following: -xdm_bind_vnc_tcp_port --> off - Is it the case that xdm_bind_vnc_tcp_port is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_YAMA /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +samba_export_all_ro --> off + Is it the case that samba_export_all_ro is not disabled? - - Run the following command to determine if the nss-tools package is installed: $ rpm -q nss-tools - Is it the case that the package is not installed? + + To check the permissions of /etc/cron.monthly, +run the command: +$ ls -l /etc/cron.monthly +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.monthly does not have unix mode -rwx------? - - -Run the following command to determine if the ftpd_anon_write SELinux boolean is disabled: -$ getsebool ftpd_anon_write -If properly configured, the output should show the following: -ftpd_anon_write --> off - Is it the case that ftpd_anon_write is not disabled? + + To verify if MaxKeepAliveRequests is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i maxkeepaliverequests /etc/httpd/conf/httpd.conf +The command should return the following: +MaxKeepAliveRequests 100 + Is it the case that it is not? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_UNMAP_KERNEL_AT_EL0 /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services + Is it the case that the iptables-services package is not installed? - + -Run the following command to determine if the logging_syslogd_run_nagios_plugins SELinux boolean is disabled: -$ getsebool logging_syslogd_run_nagios_plugins +Run the following command to determine if the httpd_use_cifs SELinux boolean is disabled: +$ getsebool httpd_use_cifs If properly configured, the output should show the following: -logging_syslogd_run_nagios_plugins --> off - Is it the case that logging_syslogd_run_nagios_plugins is not disabled? +httpd_use_cifs --> off + Is it the case that httpd_use_cifs is not disabled? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep -E '(/etc/security/opasswd)' + +-w /etc/security/opasswd -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - - The telnet package can be removed with the following command: $ sudo yum erase telnet - Is it the case that ? + + To verify if password complexities are only enforce on local users, run the following command: +$ grep local_users_only /etc/security/pwquality.conf +The output should return local_users_only uncommented. + Is it the case that local_users_only is not uncommented or configured correctly? - - -Run the following command to determine if the mock_enable_homedirs SELinux boolean is disabled: -$ getsebool mock_enable_homedirs -If properly configured, the output should show the following: -mock_enable_homedirs --> off - Is it the case that mock_enable_homedirs is not disabled? + + Verify the nosuid option is configured for the /srv mount point, + run the following command: + $ sudo mount | grep '\s/srv\s' + . . . /srv . . . nosuid . . . + + Is it the case that the "/srv" file system does not have the "nosuid" option set? - - Verify that all local interactive user initialization file executable search path statements do not contain statements that will reference a working directory other than user home directories with the following commands: + + +To check that the rexec service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rexec --list +Output should indicate the rexec service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rexec --list -$ sudo grep -i path= /home/*/.* +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. -/home/[localinteractiveuser]/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin - Is it the case that any local interactive user initialization files have executable search path statements that include directories outside of their home directory and is not documented with the ISSO as an operational requirement? - - - - To determine if arguments that commands can be executed with are restricted, run the following command: -$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+(?:[ \t]+[^,\s]+)+[ \t]*,)*(\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,\s]+[ \t]*(?:,|$))' /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that /etc/sudoers file contains user specifications that allow execution of commands with any arguments? - - - - Verify that interactive users on the system have a home directory assigned with the following command: +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. -$ sudo awk -F: '($3>=1000)&&($7 !~ /nologin/){print $1, $3, $6}' /etc/passwd +rexec off -Inspect the output and verify that all interactive users (normally users with a UID greater than 1000) have a home directory defined. - Is it the case that users home directory is not defined? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chage" command with the following command: +To check that the rexec socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rexec +Output should indicate the rexec socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rexecdisabled -$ sudo auditctl -l | grep chage +Run the following command to verify rexec is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rexec --a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_IA32_EMULATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine if the system is configured to audit unsuccessful calls -to the fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the socket is not running the command will return the following output: +inactive - Is it the case that no line is returned? +The socket will also be masked, to check that the rexec is masked, run the following command: +$ sudo systemctl show rexec | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - - -Run the following command to determine if the cobbler_use_cifs SELinux boolean is disabled: -$ getsebool cobbler_use_cifs -If properly configured, the output should show the following: -cobbler_use_cifs --> off - Is it the case that cobbler_use_cifs is not disabled? + + Verify the audit system is configured to take an appropriate action when the internal event queue is full: +$ sudo grep -i overflow_action /etc/audit/auditd.conf + +The output should contain overflow_action = syslog + +If the value of the "overflow_action" option is not set to syslog, +single, halt or the line is commented out, ask the System Administrator +to indicate how the audit logs are off-loaded to a different system or media. + Is it the case that auditd overflow action is not set correctly? - - To check the permissions of /etc/group-, + + To check the permissions of /etc/ssh/sshd_config, run the command: -$ ls -l /etc/group- +$ ls -l /etc/ssh/sshd_config If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/group- does not have unix mode -rw-r--r--? +-rw------- + Is it the case that /etc/ssh/sshd_config does not have unix mode -rw-------? - - To check that the rdisc service is disabled in system boot configuration, + + To check that the debug-shell service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled rdisc -Output should indicate the rdisc service has either not been installed, +$ sudo systemctl is-enabled debug-shell +Output should indicate the debug-shell service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rdisc disabled +$ sudo systemctl is-enabled debug-shell disabled -Run the following command to verify rdisc is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rdisc +Run the following command to verify debug-shell is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active debug-shell If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the rdisc is masked, run the following command: -$ sudo systemctl show rdisc | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the debug-shell is masked, run the following command: +$ sudo systemctl show debug-shell | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "rdisc" is loaded and not masked? + Is it the case that the "debug-shell" is loaded and not masked? - - Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/system-auth file -and is configured to prohibit password reuse for a minimum of -generations. - -Verify the "/etc/pam.d/system-auth" file with the following command: - -$ grep pam_pwhistory.so /etc/pam.d/system-auth -password pam_pwhistory.so use_authtok remember= - - -Verify the "/etc/security/pwhistory.conf" file using the following command: - -$ grep remember /etc/security/pwhistory.conf -remember = + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -The pam_pwhistory.so "remember" option must be configured only in one file. - Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in -/etc/pam.d/system-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set -with a value less than "<sub idref="var_password_pam_remember" />"? - - - - -Run the following command to determine if the httpd_can_connect_mythtv SELinux boolean is disabled: -$ getsebool httpd_can_connect_mythtv -If properly configured, the output should show the following: -httpd_can_connect_mythtv --> off - Is it the case that httpd_can_connect_mythtv is not disabled? + Is it the case that no line is returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_PTYS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit calls to the +init_module system call, run the following command: +$ sudo grep "init_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the ownership of /boot/efi/EFI/redhat/grub.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following owner: -root - Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have an owner of root? + + To verify ExecShield is enabled on 64-bit Red Hat Enterprise Linux 8 systems, +run the following command: +$ dmesg | grep '[NX|DX]*protection' +The output should not contain 'disabled by kernel command line option'. +Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes noexec=off, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*noexec=off.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*noexec=off.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'noexec=off' +The command should not return any output. + Is it the case that ExecShield is not supported by the hardware, is not enabled, or has been disabled by the kernel configuration.? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "umount" command with the following command: - -$ sudo auditctl -l | grep umount + + Verify the system-wide shared library files contained in the following directories have mode "755" or less permissive with the following command: --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-umount - Is it the case that the command does not return a line, or the line is commented out? +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 -perm /022 -type f -exec ls -l {} \; + Is it the case that any system-wide shared library file is found to be group-writable or world-writable? - + + The runtime status of the net.ipv4.conf.all.forwarding kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.forwarding +0. +The ability to forward packets is only appropriate for routers. + Is it the case that IP forwarding value is "1" and the system is not router? + + + -Run the following command to determine if the use_ecryptfs_home_dirs SELinux boolean is disabled: -$ getsebool use_ecryptfs_home_dirs +Run the following command to determine if the nagios_run_pnp4nagios SELinux boolean is disabled: +$ getsebool nagios_run_pnp4nagios If properly configured, the output should show the following: -use_ecryptfs_home_dirs --> off - Is it the case that use_ecryptfs_home_dirs is not disabled? +nagios_run_pnp4nagios --> off + Is it the case that nagios_run_pnp4nagios is not disabled? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine if the system is configured to synchronize audit event data -with the log files on the disk: -$ sudo grep flush /etc/audit/auditd.conf -flush = DATA -Acceptable values are DATA, and SYNC. The setting is -case-insensitive. - Is it the case that auditd is not configured to synchronously write audit event data to disk? + + +Run the following command to get the current configured value for deny_execmem +SELinux boolean: +$ getsebool deny_execmem +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that deny_execmem is not set as expected? - - To ensure write permissions are disabled for group and other - for each element in root's path, run the following command: -# ls -ld DIR - Is it the case that group or other write permissions exist? + + To check if RekeyLimit is set correctly, run the following command: +$ sudo grep RekeyLimit /etc/ssh/ssh_config.d/*.conf +If configured properly, output should be +/etc/ssh/ssh_config.d/02-rekey-limit.conf: +RekeyLimit +Check also the main configuration file with the following command: +$ sudo grep RekeyLimit /etc/ssh/ssh_config +The command should not return any output. + Is it the case that it is commented out or is not set? - - Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. - -Determine the location of the tmux script with the following command: - -$ sudo grep tmux /etc/bashrc /etc/profile.d/* - -/etc/profile.d/tmux.sh: case "$name" in (sshd|login) tmux ;; esac + + To check the group ownership of /etc/passwd, +run the command: +$ ls -lL /etc/passwd +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/passwd does not have a group owner of root? + + + + To check the ownership of /boot/grub2/grub.cfg, +run the command: +$ ls -lL /boot/grub2/grub.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/grub2/grub.cfg does not have an owner of root? + + + + To check that the avahi-daemon service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled avahi-daemon +Output should indicate the avahi-daemon service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled avahi-daemon disabled -Review the tmux script by using the following example: +Run the following command to verify avahi-daemon is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active avahi-daemon -$ cat /etc/profile.d/tmux.sh +If the service is not running the command will return the following output: +inactive -if [ "$PS1" ]; then -parent=$(ps -o ppid= -p $$) -name=$(ps -o comm= -p $parent) -case "$name" in (sshd|login) tmux ;; esac -fi +The service will also be masked, to check that the avahi-daemon is masked, run the following command: +$ sudo systemctl show avahi-daemon | grep "LoadState\|UnitFileState" -If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. +If the service is masked the command will return the following outputs: -Determine if tmux is currently running with the following command: +LoadState=masked -$ sudo ps all | grep tmux | grep -v grep - Is it the case that the command does not produce output? +UnitFileState=masked + Is it the case that the "avahi-daemon" is loaded and not masked? - - To check if the system login banner is compliant, -run the following command: -$ cat /etc/issue - Is it the case that it does not display the required banner? + + Run the following command to determine if the fapolicyd package is installed: $ rpm -q fapolicyd + Is it the case that the fapolicyd package is not installed? - - To verify that all user initialization files have a mode of 0740 or -less permissive, run the following command: -$ sudo find /home -type f -name '\.*' \( -perm -0002 -o -perm -0020 \) -There should be no output. - Is it the case that they are not 0740 or more permissive? + + +If the system is configured to prevent the loading of the usb-storage kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the usb-storage kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r usb-storage /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling automount -If properly configured, the output for automount should be false. -To ensure that users cannot enable automount in GNOME3, run the following: -$ grep 'automount' /etc/dconf/db/local.d/locks/* -If properly configured, the output for automount should be /org/gnome/desktop/media-handling/automount - Is it the case that GNOME automounting is not disabled? + + To verify that a remote NTP service is configured for time synchronization, +open the following file: +/etc/ntp.conf +In the file, there should be a section similar to the following: +server ntpserver + Is it the case that this is not the case? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine if the system is configured correctly: -space_left SIZE_in_MB - Is it the case that the system is not configured a specfic size in MB to notify administrators of an issue? + + If the system uses IPv6, this is not applicable. + +If the system is configured to prevent the usage of the ipv6 on +network interfaces, it will contain a line of the form: +net.ipv6.conf.all.disable_ipv6 = 1 +Such lines may be inside any file in the /etc/sysctl.d directory. +This permits insertion of the IPv6 kernel module (which other parts of the +system expect to be present), but otherwise keeps all network interfaces +from using IPv6. Run the following command to search for such lines in all +files in /etc/sysctl.d: +$ grep -r ipv6 /etc/sysctl.d + Is it the case that the ipv6 support is disabled on all network interfaces? - - To verify that rsyslog's Forwarding Output Module is configured -to use TLS for logging to remote server, run the following command: -$ grep omfwd /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should include record similar to -action(type="omfwd" protocol="tcp" Target="<remote system>" port="6514" - StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name" streamdriver.CheckExtendedKeyPurpose="on") + + Verify the assigned home directories of all interactive users on the system exist with the following command: -where the <remote system> present in the configuration line above must be a valid IP address or a host name of the remote logging server. - Is it the case that omfwd is not configured with gtls and AuthMode? +$ sudo pwck -r + +user 'mailnull': directory 'var/spool/mqueue' does not exist + +The output should not return any interactive users. + Is it the case that users home directory does not exist? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_FREELIST_RANDOM /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/cron.allow, +run the command: +$ ls -lL /etc/cron.allow +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.allow does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "usermod" command with the following command: - -$ sudo auditctl -l | grep usermod - --a always,exit -F path=/usr/bin/usermod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-usermod - Is it the case that the command does not return a line, or the line is commented out? + + To verify that Audit Daemon is configured to flush to disk after +every records, run the following command: +$ sudo grep freq /etc/audit/auditd.conf +The output should return the following: +freq = + Is it the case that freq isn't set to <sub idref="var_auditd_freq" />? - - -Run the following command to determine if the httpd_setrlimit SELinux boolean is disabled: -$ getsebool httpd_setrlimit -If properly configured, the output should show the following: -httpd_setrlimit --> off - Is it the case that httpd_setrlimit is not disabled? + + Only FIPS-approved key exchange algorithms must be used. To verify that only FIPS-approved +key exchange algorithms are in use, run the following command: +$ sudo grep -i kexalgorithms /etc/crypto-policies/back-ends/opensshserver.config +The output should contain only following algorithms (or a subset) in the exact order: +CRYPTO_POLICY='-oKexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512' + Is it the case that KexAlgorithms option is commented out, contains non-approved algorithms, or the FIPS-approved algorithms are not in the exact order? - - To check that the named service is disabled in system boot configuration, + + To check that the nftables service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled named -Output should indicate the named service has either not been installed, +$ sudo systemctl is-enabled nftables +Output should indicate the nftables service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled named disabled +$ sudo systemctl is-enabled nftables disabled -Run the following command to verify named is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active named +Run the following command to verify nftables is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active nftables If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the named is masked, run the following command: -$ sudo systemctl show named | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the nftables is masked, run the following command: +$ sudo systemctl show nftables | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "named" is loaded and not masked? + Is it the case that the "nftables" is loaded and not masked? - - To ensure that WIFI connections caanot be created, run the following command: -$ gsettings get org.gnome.nm-applet disable-wifi-create -If properly configured, the output should be true. -To ensure that users cannot enable WIFI connection creation, run the following: -$ grep wifi-create /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/nm-applet/disable-wifi-create - Is it the case that WIFI connections can be created through GNOME? + + +If the system is configured to prevent the loading of the can kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the can kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r can /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? + + + + To determine if the system is configured to audit calls to the +setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/system-auth file +and is configured to prohibit password reuse for a minimum of +generations. + +Verify the "/etc/pam.d/system-auth" file with the following command: + +$ grep pam_pwhistory.so /etc/pam.d/system-auth +password pam_pwhistory.so use_authtok remember= + + +Verify the "/etc/security/pwhistory.conf" file using the following command: + +$ grep remember /etc/security/pwhistory.conf +remember = + +The pam_pwhistory.so "remember" option must be configured only in one file. + Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in +/etc/pam.d/system-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set +with a value less than "<sub idref="var_password_pam_remember" />"? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_IPV6 /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + + +Run the following command to determine if the pppd_can_insmod SELinux boolean is disabled: +$ getsebool pppd_can_insmod +If properly configured, the output should show the following: +pppd_can_insmod --> off + Is it the case that pppd_can_insmod is not disabled? + + + + To verify the assigned home directory of all interactive user home directories +have a mode of 0750 or less permissive, run the following command: +$ sudo ls -l /home +Inspect the output for any directories with incorrect permissions. + Is it the case that they are more permissive? + + + + + +Run the following command to determine the current status of the +syslog-ng service: +$ sudo systemctl is-active syslog-ng +If the service is running, it should return the following: active + Is it the case that the "syslog-ng" service is disabled, masked, or not started.? + + + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep newuidmap /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? + + + + +Run the following command to determine if the domain_fd_use SELinux boolean is enabled: +$ getsebool domain_fd_use +If properly configured, the output should show the following: +domain_fd_use --> on + Is it the case that domain_fd_use is not enabled? + + + + Verify Red Hat Enterprise Linux 8 disables storing core dumps for all users by issuing the following command: + +$ grep -i storage /etc/systemd/coredump.conf + +Storage=none + Is it the case that Storage is not set to none or is commented out and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + + + +If the system is configured to prevent the loading of the bluetooth kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the bluetooth kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r bluetooth /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? @@ -373043,195 +373368,172 @@ If private resources (e.g. drives, partitions, folders/directories, printers, etc.) are sharedw ith the public web server? - - To determine if NOPASSWD has been configured for the vdsm user for sudo, -run the following command: -$ sudo grep -ri nopasswd /etc/sudoers.d/ -The command should return output only for the vdsm user. - Is it the case that nopasswd is set for any users beyond vdsm? + + +Run the following command to determine if the samba_enable_home_dirs SELinux boolean is disabled: +$ getsebool samba_enable_home_dirs +If properly configured, the output should show the following: +samba_enable_home_dirs --> off + Is it the case that samba_enable_home_dirs is not disabled? - - To verify that there are no unauthorized local user accounts, run the following command: -$ less /etc/passwd -Inspect the results, and if unauthorized local user accounts exist, remove them by running -the following command: -$ sudo userdel unauthorized_user - Is it the case that there are unauthorized local user accounts on the system? + + The runtime status of the net.ipv4.conf.all.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.accept_redirects +0. + + Is it the case that the correct value is not returned? - - To determine if the system is configured to audit calls to the -adjtimex system call, run the following command: -$ sudo grep "adjtimex" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep newgidmap /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the httpd package is installed: -$ rpm -q httpd - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_serve_cobbler_files SELinux boolean is disabled: +$ getsebool httpd_serve_cobbler_files +If properly configured, the output should show the following: +httpd_serve_cobbler_files --> off + Is it the case that httpd_serve_cobbler_files is not disabled? - - To check the permissions of /etc/cron.d, -run the command: -$ ls -l /etc/cron.d -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.d does not have unix mode -rwx------? + + Run the following command to determine if the setroubleshoot-server package is installed: +$ rpm -q setroubleshoot-server + Is it the case that the package is installed? - - To determine how the SSH daemon's AllowTcpForwarding option is set, run the following command: + + +Determine the audit log group by running the following command: -$ sudo grep -i AllowTcpForwarding /etc/ssh/sshd_config +$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf -If a line indicating no is returned, then the required value is set. - Is it the case that The AllowTcpForwarding option exists and is disabled? - - - - Verify the audit tools are protected from unauthorized access, deletion, or modification by checking the permissive mode. +Then, check that all directories within the /var/log/audit directory are owned by the group specified as log_group or by root if the log_group is not specified. +Run the following command: -Check the octal permission of each audit tool by running the following command: +$ sudo find /var/log/audit -type d -printf "%p %g\n" -$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules - Is it the case that any of these files have more permissive permissions than 0755? +All listed directories must be owned by the log_group or by root if the log_group is not specified. + Is it the case that there is a directory owned by different group? - - To verify that the system will shutdown when auditd fails, -run the following command: -$ sudo grep "\-f " /etc/audit/audit.rules -The output should contain: --f - Is it the case that the system is not configured to shutdown on auditd failures? + + To determine if the system is configured to audit unsuccessful calls +to the chown system call, run the following command: +$ sudo grep "chown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -To check that the rlogin service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rlogin --list -Output should indicate the rlogin service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rlogin --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. - -rlogin off - -To check that the rlogin socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rlogin -Output should indicate the rlogin socket has either not been installed, +Run the following command to determine if the polipo_use_cifs SELinux boolean is disabled: +$ getsebool polipo_use_cifs +If properly configured, the output should show the following: +polipo_use_cifs --> off + Is it the case that polipo_use_cifs is not disabled? + + + + Run the following command to determine if the policycoreutils-python-utils package is installed: $ rpm -q policycoreutils-python-utils + Is it the case that the package is not installed? + + + + To check that the zebra service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled zebra +Output should indicate the zebra service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rlogindisabled +$ sudo systemctl is-enabled zebra disabled -Run the following command to verify rlogin is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rlogin +Run the following command to verify zebra is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active zebra -If the socket is not running the command will return the following output: +If the service is not running the command will return the following output: inactive -The socket will also be masked, to check that the rlogin is masked, run the following command: -$ sudo systemctl show rlogin | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the zebra is masked, run the following command: +$ sudo systemctl show zebra | grep "LoadState\|UnitFileState" -If the socket is masked the command will return the following outputs: +If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that service and/or socket are running? - - - - -Run the following command to determine if the cups_execmem SELinux boolean is disabled: -$ getsebool cups_execmem -If properly configured, the output should show the following: -cups_execmem --> off - Is it the case that cups_execmem is not disabled? + Is it the case that the "zebra" is loaded and not masked? - + -Run the following command to determine if the secadm_exec_content SELinux boolean is enabled: -$ getsebool secadm_exec_content +Run the following command to determine if the glance_use_execmem SELinux boolean is disabled: +$ getsebool glance_use_execmem If properly configured, the output should show the following: -secadm_exec_content --> on - Is it the case that secadm_exec_content is not enabled? +glance_use_execmem --> off + Is it the case that glance_use_execmem is not disabled? - - To determine if the system is configured to audit unsuccessful calls -to the fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To ensure that the GPG key is installed, run: +$ rpm -q --queryformat "%{SUMMARY}\n" gpg-pubkey +The command should return the string below: +gpg(Red Hat, Inc. (release key 2) <security@redhat.com> + Is it the case that the Red Hat GPG Key is not installed? - - Run the following command to ensure the TMOUT value is configured for all users -on the system: - -$ sudo grep TMOUT /etc/profile /etc/profile.d/*.sh - -The output should return the following: -TMOUT= - Is it the case that value of TMOUT is not less than or equal to expected setting? + + To verify if the OpenSSL uses defined Crypto Policy, run: +$ grep 'Ciphersuites' /etc/crypto-policies/back-ends/opensslcnf.config | tail -n 1 +and verify that the line matches +Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 + Is it the case that Crypto Policy for OpenSSL is not configured according to CC requirements? - - Verify the system commands contained in the following directories have mode "755" or less permissive with the following command: + + The runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.router_solicitations +0. -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin -perm /022 -exec ls -l {} \; - Is it the case that any system commands are found to be group-writable or world-writable? + Is it the case that the correct value is not returned? - - Run the following command to determine if the libcap-ng-utils package is installed: $ rpm -q libcap-ng-utils - Is it the case that the package is not installed? + + Inspect /etc/default/grub for any instances of selinux=0 +in the kernel boot arguments. Presence of selinux=0 indicates +that SELinux is disabled at boot time. + Is it the case that SELinux is disabled at boot time? - - -Run the following command to determine if the mozilla_plugin_use_bluejeans SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_bluejeans -If properly configured, the output should show the following: -mozilla_plugin_use_bluejeans --> off - Is it the case that mozilla_plugin_use_bluejeans is not disabled? + + Verify that a separate file system/partition has been created for /dev/shm with the following command: + +$ mountpoint /dev/shm + + Is it the case that "/dev/shm is not a mountpoint" is returned? - - -Run the following command to determine if the polipo_use_nfs SELinux boolean is disabled: -$ getsebool polipo_use_nfs -If properly configured, the output should show the following: -polipo_use_nfs --> off - Is it the case that polipo_use_nfs is not disabled? + + Verify that the interactive user account passwords last change time is not in the future +The following command should return no output +$ sudo expiration=$(cat /etc/shadow|awk -F ':' '{print $3}'); +for edate in ${expiration[@]}; do if [[ $edate > $(( $(date +%s)/86400 )) ]]; +then echo "Expiry date in future"; +fi; done + Is it the case that any interactive user password that has last change time in the future? - - If the system uses IPv6, this is not applicable. - -If the system is configured to prevent the usage of the ipv6 on -network interfaces, it will contain a line of the form: -net.ipv6.conf.all.disable_ipv6 = 1 -Such lines may be inside any file in the /etc/sysctl.d directory. -This permits insertion of the IPv6 kernel module (which other parts of the -system expect to be present), but otherwise keeps all network interfaces -from using IPv6. Run the following command to search for such lines in all -files in /etc/sysctl.d: -$ grep -r ipv6 /etc/sysctl.d - Is it the case that the ipv6 support is disabled on all network interfaces? + + Run the following command to determine if the vim-enhanced package is installed: $ rpm -q vim-enhanced + Is it the case that the package is not installed? @@ -373243,1121 +373545,871 @@ authlogin_yubikey --> off Is it the case that authlogin_yubikey is not disabled? - - Run the following command to determine if the python3-abrt-addon package is installed: -$ rpm -q python3-abrt-addon - Is it the case that the package is installed? - - - - Make sure that the kernel is not disabling SMEP with the following -commands. -grep -q nosmep /boot/config-`uname -r` -If the command returns a line, it means that SMEP is being disabled. - Is it the case that the kernel is configured to disable SMEP? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one upper-case character. + +Check the value for "ucredit" with the following command: + +$ sudo grep ucredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +ucredit = -1 + Is it the case that the value of "ucredit" is a positive number or is commented out? - + -Run the following command to determine if the tmpreaper_use_samba SELinux boolean is disabled: -$ getsebool tmpreaper_use_samba +Run the following command to determine if the selinuxuser_use_ssh_chroot SELinux boolean is disabled: +$ getsebool selinuxuser_use_ssh_chroot If properly configured, the output should show the following: -tmpreaper_use_samba --> off - Is it the case that tmpreaper_use_samba is not disabled? +selinuxuser_use_ssh_chroot --> off + Is it the case that selinuxuser_use_ssh_chroot is not disabled? - - Run the following command to determine if the rear package is installed: $ rpm -q rear - Is it the case that the package is not installed? + + To determine the status and frequency of logrotate, run the following command: +$ sudo grep logrotate /var/log/cron* +If logrotate is configured properly, output should include references to +/etc/cron.daily. + Is it the case that logrotate is not configured to run daily? - + -Run the following command to determine if the httpd_manage_ipa SELinux boolean is disabled: -$ getsebool httpd_manage_ipa -If properly configured, the output should show the following: -httpd_manage_ipa --> off - Is it the case that httpd_manage_ipa is not disabled? - - - - To check the permissions of /etc/http/conf.modules.d/*, -run the command: -$ ls -l /etc/http/conf.modules.d/* -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/http/conf.modules.d/* does not have unix mode -rw-r-----? +Run the following command to get the current configured value for polyinstantiation_enabled +SELinux boolean: +$ getsebool polyinstantiation_enabled +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that polyinstantiation_enabled is not set as expected? - - To check for incorrectly labeled device files, run following commands: -$ sudo find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n" -$ sudo find /dev -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z\n" -It should produce no output in a well-configured system. - Is it the case that there is output? + + To check that the cups service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled cups +Output should indicate the cups service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled cups disabled + +Run the following command to verify cups is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cups + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the cups is masked, run the following command: +$ sudo systemctl show cups | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "cups" is loaded and not masked? - - To check the ownership of /etc/cron.daily, -run the command: -$ ls -lL /etc/cron.daily -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.daily does not have an owner of root? + + Find the list of alias maps used by the Postfix mail server: +$ sudo postconf alias_maps +Query the Postfix alias maps for an alias for the postmaster user: +$ sudo postmap -q postmaster hash:/etc/aliases +The output should return root. + Is it the case that the alias is not set or is not root? - - To ensure root may not directly login to the system over physical consoles, -run the following command: -cat /etc/securetty -If any output is returned, this is a finding. - Is it the case that the /etc/securetty file is not empty? + + +Run the following command to determine if the httpd_verify_dns SELinux boolean is disabled: +$ getsebool httpd_verify_dns +If properly configured, the output should show the following: +httpd_verify_dns --> off + Is it the case that httpd_verify_dns is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HARDENED_USERCOPY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit calls to the +lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -Run the following command to determine if the daemons_use_tty SELinux boolean is disabled: -$ getsebool daemons_use_tty +Run the following command to determine if the httpd_run_ipa SELinux boolean is disabled: +$ getsebool httpd_run_ipa If properly configured, the output should show the following: -daemons_use_tty --> off - Is it the case that daemons_use_tty is not disabled? +httpd_run_ipa --> off + Is it the case that httpd_run_ipa is not disabled? - - To verify the noexec option is configured for all NFS mounts, run the following command: -$ mount | grep nfs -All NFS mounts should show the noexec setting in parentheses. This is not applicable if NFS is -not implemented. - Is it the case that the setting does not show? + + Verify the SELINUX on Red Hat Enterprise Linux 8 is using the policy with the following command: + +$ sestatus | grep policy + +Loaded policy name: + Is it the case that the loaded policy name is not "<sub idref="var_selinux_policy_name" />"? - - Run the following command to determine if the abrt-addon-kerneloops package is installed: -$ rpm -q abrt-addon-kerneloops - Is it the case that the package is installed? + + Verify that the system backups user data. + Is it the case that it is not? - - Verify the nosuid option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . nosuid . . . - - Is it the case that the "/var/log/audit" file system does not have the "nosuid" option set? + + Verify that the ipv6 loopback interface has required rules in order: +$ iptables -L INPUT -v -n + Is it the case that ipv6 loopback traffic is not configured? - - To verify that rsyslog's Forwarding Output Module has CA certificate -configured for its TLS connections to remote server, run the following command: -$ grep DefaultNetstreamDriverCAFile /etc/rsyslog.conf /etc/rsyslog.d/*.conf -The output should include record similar to -global(DefaultNetstreamDriverCAFile="/etc/pki/tls/cert.pem") -where the path to the CA file (/etc/pki/tls/cert.pem in case above) must point to the correct CA certificate. - Is it the case that CA certificate for rsyslog remote logging via TLS is not set? + + To verify that the installed operating system is supported or certified, run +the following command: + +The output should contain something similar to: +Red Hat Enterprise Linux 8 + Is it the case that the installed operating system is not FIPS 140-2 certified? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.thumbnailers disable-all -If properly configured, the output should be true. -To ensure that users cannot how long until the screensaver locks, run the following: -$ grep disable-all /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/thumbnailers/disable-all - Is it the case that GNOME thumbnailers are not disabled? + + Run the following command to determine if the abrt-plugin-logger package is installed: +$ rpm -q abrt-plugin-logger + Is it the case that the package is installed? - - To check the permissions of /boot/efi/EFI/redhat/grub.cfg, run the command: -$ sudo ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following -permissions: -rwx------ - Is it the case that it does not? + + To check that the nfs-server service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled nfs-server +Output should indicate the nfs-server service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled nfs-server disabled + +Run the following command to verify nfs-server is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active nfs-server + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the nfs-server is masked, run the following command: +$ sudo systemctl show nfs-server | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "nfs-server" is loaded and not masked? - - Run the following command to determine if the abrt-addon-ccpp package is installed: -$ rpm -q abrt-addon-ccpp - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_can_network_memcache SELinux boolean is disabled: +$ getsebool httpd_can_network_memcache +If properly configured, the output should show the following: +httpd_can_network_memcache --> off + Is it the case that httpd_can_network_memcache is not disabled? - + -Run the following command to determine if the ksmtuned_use_nfs SELinux boolean is disabled: -$ getsebool ksmtuned_use_nfs +Run the following command to determine if the httpd_can_connect_zabbix SELinux boolean is disabled: +$ getsebool httpd_can_connect_zabbix If properly configured, the output should show the following: -ksmtuned_use_nfs --> off - Is it the case that ksmtuned_use_nfs is not disabled? +httpd_can_connect_zabbix --> off + Is it the case that httpd_can_connect_zabbix is not disabled? - - To check the group ownership of /etc/cron.daily, + + To check the ownership of /etc/gshadow, run the command: -$ ls -lL /etc/cron.daily -If properly configured, the output should indicate the following group-owner: +$ ls -lL /etc/gshadow +If properly configured, the output should indicate the following owner: root - Is it the case that /etc/cron.daily does not have a group owner of root? + Is it the case that /etc/gshadow does not have an owner of root? - - The following command will locate the mount points related to local devices: -$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) - -The following command will show files which do not belong to a valid group: -$ sudo find MOUNTPOINT -xdev -nogroup 2>/dev/null - -Replace MOUNTPOINT by the mount points listed by the fist command. + + Verify the hidepid=value option is configured for the /proc mount point, + run the following command: + $ sudo mount | grep '\s/proc\s' + . . . /proc . . . hidepid=value . . . -No files without a valid group should be located. - Is it the case that there is output? + Is it the case that the "/proc" file system does not have the "hidepid=value" option set? - - To check the group ownership of /etc/passwd, + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the group ownership of /etc/ssh/*.pub, run the command: -$ ls -lL /etc/passwd +$ ls -lL /etc/ssh/*.pub If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/passwd does not have a group owner of root? + Is it the case that /etc/ssh/*.pub does not have a group owner of root? - - To determine if the system is configured to audit successful calls -to the truncate system call, run the following command: -$ sudo grep "truncate" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that auditing of privileged command use is configured, run the following command +to search privileged commands in relevant partitions and check if they are covered by auditd +rules: - Is it the case that no line is returned? - - - - To verify the LDAP client backend demands a valid certificate from the server in -remote LDAP access sessions, run the following command: -$ sudo grep ldap_tls_reqcert /etc/sssd/sssd.conf -The output should return the following: -ldap_tls_reqcert = demand - Is it the case that the TLS reqcert is not set to demand? +FILTER_NODEV=$(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) +PARTITIONS=$(findmnt -n -l -k -it $FILTER_NODEV | grep -Pv "noexec|nosuid" | awk '{ print $1 }') +for PARTITION in $PARTITIONS; do + for PRIV_CMD in $(find "${PARTITION}" -xdev -perm /6000 -type f 2>/dev/null); do + grep -qr "${PRIV_CMD}" /etc/audit/rules.d /etc/audit/audit.rules && + printf "OK: ${PRIV_CMD}\n" || printf "WARNING - rule not found for: ${PRIV_CMD}\n" + done +done + +The output should not contain any WARNING. + Is it the case that any setuid or setgid programs doesn't have a line in the audit rules? - - The runtime status of the net.ipv6.conf.all.accept_ra kernel parameter can be queried + + The runtime status of the net.ipv6.conf.default.max_addresses kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra -0. +$ sysctl net.ipv6.conf.default.max_addresses +1. Is it the case that the correct value is not returned? - - Remote web authors should not be able to upload files to the Document Root -directory structure without virus checking and checking for malicious or mobile -code. - Is it the case that it is not? + + To check that the slapd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled slapd +Output should indicate the slapd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled slapd disabled + +Run the following command to verify slapd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active slapd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the slapd is masked, run the following command: +$ sudo systemctl show slapd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "slapd" is loaded and not masked? - - -Run the following command to determine if the selinuxuser_udp_server SELinux boolean is disabled: -$ getsebool selinuxuser_udp_server -If properly configured, the output should show the following: -selinuxuser_udp_server --> off - Is it the case that selinuxuser_udp_server is not disabled? + + Verify Red Hat Enterprise Linux 8 is configured to lock an account until released by an administrator +after unsuccessful logon +attempts with the command: + + +$ grep 'unlock_time =' /etc/security/faillock.conf +unlock_time = + Is it the case that the "unlock_time" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_unlock_time" />", +the line is missing, or commented out? - - To verify that SSSD's in-memory cache expires after a day, run the following command: -$ sudo grep memcache_timeout /etc/sssd/sssd.conf -If configured properly, output should be memcache_timeout = . - Is it the case that it does not exist or is not configured properly? + + The runtime status of the net.ipv4.conf.all.rp_filter parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.rp_filter +The output of the command should indicate either: +net.ipv4.conf.all.rp_filter = 1 +or: +net.ipv4.conf.all.rp_filter = 2 +The output of the command should not indicate: +net.ipv4.conf.all.rp_filter = 0 + +The preferable way how to assure the runtime compliance is to have +correct persistent configuration, and rebooting the system. + +The persistent sysctl parameter configuration is performed by specifying the appropriate +assignment in any file located in the /etc/sysctl.d directory. +Verify that there is not any existing incorrect configuration by executing the following command: +$ grep -r '^\s*net.ipv4.conf.all.rp_filter\s*=' /etc/sysctl.conf /etc/sysctl.d +The command should not find any assignments other than: +net.ipv4.conf.all.rp_filter = 1 +or: +net.ipv4.conf.all.rp_filter = 2 + +Conflicting assignments are not allowed. + Is it the case that the net.ipv4.conf.all.rp_filter is not set to 1 or 2 or is configured to be 0? - - To verify /etc/system-fips exists, run the following command: -ls -l /etc/system-fips -The output should be similar to the following: --rw-r--r--. 1 root root 36 Nov 26 11:31 /etc/system-fips - Is it the case that /etc/system-fips does not exist? + + The telnet package can be removed with the following command: $ sudo yum erase telnet + Is it the case that ? - - Run the following command to determine if the iptables package is installed: $ rpm -q iptables + + Run the following command to determine if the audispd-plugins package is installed: $ rpm -q audispd-plugins Is it the case that the package is not installed? - - Verify that there are no wireless interfaces configured on the system -with the following command: - -Note: This requirement is Not Applicable for systems that do not have physical wireless network radios. - -$ nmcli device status -DEVICE TYPE STATE CONNECTION -virbr0 bridge connected virbr0 -wlp7s0 wifi connected wifiSSID -enp6s0 ethernet disconnected -- -p2p-dev-wlp7s0 wifi-p2p disconnected -- -lo loopback unmanaged -- -virbr0-nic tun unmanaged -- - Is it the case that a wireless interface is configured and has not been documented and approved by the Information System Security Officer (ISSO)? - - - - To verify the audispd's syslog plugin is active, run the following command: -$ sudo grep active /etc/audit/plugins.d/syslog.conf -If the plugin is active, the output will show yes. - Is it the case that it is not activated? - - - - To verify that Audit Daemon is configured to write logs to the disk, run the -following command: -$ sudo grep write_logs /etc/audit/auditd.conf -The output should return the following: -write_logs = yes - Is it the case that write_logs isn't set to yes? + + +Run the following command to determine if the postgresql_selinux_transmit_client_label SELinux boolean is disabled: +$ getsebool postgresql_selinux_transmit_client_label +If properly configured, the output should show the following: +postgresql_selinux_transmit_client_label --> off + Is it the case that postgresql_selinux_transmit_client_label is not disabled? - - Verify that a separate file system/partition has been created for /tmp with the following command: - -$ mountpoint /tmp - - Is it the case that "/tmp is not a mountpoint" is returned? + + To ensure the splash screen is configured not to show user name, run the following command: +$ gsettings get org.gnome.desktop.screensaver show-full-name-in-top-bar +If properly configured, the output should be false. +To ensure that users cannot enable user name on the lock screen, run the following: +$ grep show-full-name-in-top-bar /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/show-full-name-in-top-bar + Is it the case that it is not set or configured properly? - - Using a non-privileged account, verify that users cannot modify or change -network settings with the nmcli command with the following command: -$ nmcli general permissions -The output should contain the following: -PERMISSION VALUE -org.freedesktop.NetworkManager.enable-disable-network auth -org.freedesktop.NetworkManager.enable-disable-wifi auth -org.freedesktop.NetworkManager.enable-disable-wwan auth -org.freedesktop.NetworkManager.enable-disable-wimax auth -org.freedesktop.NetworkManager.sleep-wake auth -org.freedesktop.NetworkManager.network-control auth -org.freedesktop.NetworkManager.wifi.share.protected auth -org.freedesktop.NetworkManager.wifi.share.open auth -org.freedesktop.NetworkManager.settings.modify.system auth -org.freedesktop.NetworkManager.settings.modify.own auth -org.freedesktop.NetworkManager.settings.modify.hostname auth -org.freedesktop.NetworkManager.settings.modify.global-dns auth -org.freedesktop.NetworkManager.reload auth -org.freedesktop.NetworkManager.checkpoint-rollback auth -org.freedesktop.NetworkManager.enable-disable-statistics auth -org.freedesktop.NetworkManager.enable-disable-connectivity-check auth -org.freedesktop.NetworkManager.wifi.scan auth + + Verify the nodev option is configured for the /var mount point, + run the following command: + $ sudo mount | grep '\s/var\s' + . . . /var . . . nodev . . . - Is it the case that non-privileged users can modify or change network settings? + Is it the case that the "/var" file system does not have the "nodev" option set? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open_by_handle_at system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + + If the system does not have SELinux enabled and enforcing a targeted policy, or if the +pam_faillock.so module is not configured for use, this requirement is not applicable. -$ sudo grep -r open_by_handle_at /etc/audit/rules.d +Verify the location of the non-default tally directory for the pam_faillock.so module with +the following command: -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +$ sudo grep -w dir /etc/security/faillock.conf -$ sudo grep open_by_handle_at /etc/audit/audit.rules +dir = /var/log/faillock -The output should be the following: +Check the security context type of the non-default tally directory with the following command: --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? - - - - The runtime status of the kernel.sysrq kernel parameter can be queried -by running the following command: -$ sysctl kernel.sysrq -0. +$ sudo ls -Zd /var/log/faillock - Is it the case that the correct value is not returned? - - - - To verify that McAfee VirusScan Enterprise for Linux is installed -and running, run the following command(s): -$ sudo systemctl status nails -$ rpm -q McAfeeVSEForLinux - Is it the case that virus scanning software is not installed or running? - - - - -Run the following command to determine if the nscd_use_shm SELinux boolean is enabled: -$ getsebool nscd_use_shm -If properly configured, the output should show the following: -nscd_use_shm --> on - Is it the case that nscd_use_shm is not enabled? +unconfined_u:object_r:faillog_t:s0 /var/log/faillock + Is it the case that the security context type of the non-default tally directory is not "faillog_t"? - + -Run the following command to determine if the mozilla_plugin_can_network_connect SELinux boolean is disabled: -$ getsebool mozilla_plugin_can_network_connect -If properly configured, the output should show the following: -mozilla_plugin_can_network_connect --> off - Is it the case that mozilla_plugin_can_network_connect is not disabled? - - - - If the system uses IPv6, this is not applicable. - -If the system is configured to disable the -ipv6 kernel module, it will contain a line -of the form: -options ipv6 disable=1 -Such lines may be inside any file in /etc/modprobe.d or the -deprecated/etc/modprobe.conf. This permits insertion of the IPv6 -kernel module (which other parts of the system expect to be present), but -otherwise keeps it inactive. Run the following command to search for such -lines in all files in /etc/modprobe.d and the deprecated -/etc/modprobe.conf: -$ grep -r ipv6 /etc/modprobe.conf /etc/modprobe.d - Is it the case that the ipv6 kernel module is not disabled? - - - - To ensure the GUI does not allow user administratrion capabilities to all users, -run the following command: -$ gsettings get org.gnome.desktop.lockdown user-administration-disabled -If properly configured, the output should be true. -To ensure that users cannot enable user administration, run the following: -$ grep user-administration /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/desktop/lockdown/user-administration-disabled - Is it the case that user administration is not configured or disabled? - - - - Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services - Is it the case that the iptables-services package is not installed? - - - - The runtime status of the kernel.randomize_va_space kernel parameter can be queried -by running the following command: -$ sysctl kernel.randomize_va_space -2. +To properly set the group owner of /etc/audit/, run the command: +$ sudo chgrp root /etc/audit/ - Is it the case that the correct value is not returned? +To properly set the group owner of /etc/audit/rules.d/, run the command: +$ sudo chgrp root /etc/audit/rules.d/ + Is it the case that ? - - To verify that only security updates will be automatically installed by dnf-automatic, run the following command: -$ sudo grep upgrade_type /etc/dnf/automatic.conf + + To verify if CustomLog is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i customlog /etc/httpd/conf/httpd.conf The output should return the following: -upgrade_type = security - Is it the case that the upgrade_type is not set to security? +CustomLog "logs/access_log" combined + Is it the case that it is not? - - To check the permissions of /boot/grub2/user.cfg, -run the command: -$ ls -l /boot/grub2/user.cfg -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /boot/grub2/user.cfg does not have unix mode -rw-------? + + To check if only local user are impacted by pam_faillock, run the following command: +$ grep local_users_only /etc/security/faillock.conf +The output should return local_users_only not commented. + Is it the case that local_users_only is not uncommented or configured correctly? - + -Run the following command to determine if the sanlock_use_samba SELinux boolean is disabled: -$ getsebool sanlock_use_samba +Run the following command to determine if the polipo_session_users SELinux boolean is disabled: +$ getsebool polipo_session_users If properly configured, the output should show the following: -sanlock_use_samba --> off - Is it the case that sanlock_use_samba is not disabled? +polipo_session_users --> off + Is it the case that polipo_session_users is not disabled? - - To check the group ownership of /etc/group-, + + To check the permissions of /var/log/messages, run the command: -$ ls -lL /etc/group- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/group- does not have a group owner of root? - - - - Run the following command to determine if the abrt-cli package is installed: -$ rpm -q abrt-cli - Is it the case that the package is installed? - - - - Inspect the mounts configured in /etc/exports. Each mount should specify a value -greater than UID_MAX and GID_MAX as defined in /etc/login.defs. - Is it the case that anonuid or anongid are not set to a value greater than UID_MAX (for anonuid) and GID_MAX (for anongid)? - - - - -Run the following command to determine if the boinc_execmem SELinux boolean is disabled: -$ getsebool boinc_execmem -If properly configured, the output should show the following: -boinc_execmem --> off - Is it the case that boinc_execmem is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SYN_COOKIES /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +$ ls -l /var/log/messages +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /var/log/messages does not have unix mode -rw-r-----? - + -Run the following command to determine if the spamassassin_can_network SELinux boolean is disabled: -$ getsebool spamassassin_can_network +Run the following command to determine if the samba_share_nfs SELinux boolean is disabled: +$ getsebool samba_share_nfs If properly configured, the output should show the following: -spamassassin_can_network --> off - Is it the case that spamassassin_can_network is not disabled? - - - - Verify that a separate file system/partition has been created for /var/tmp with the following command: - -$ mountpoint /var/tmp - - Is it the case that "/var/tmp is not a mountpoint" is returned? - - - - To verify all files and directories contained in interactive user home -directory, excluding local initialization files, have a mode of 0750, -run the following command: -$ sudo ls -lLR /home/USER - Is it the case that home directory files or folders have incorrect permissions? - - - - Verify that the system backups user data. - Is it the case that it is not? +samba_share_nfs --> off + Is it the case that samba_share_nfs is not disabled? - - To verify that is configured -as the smart card driver, run the following command: -$ grep force_card_driver /etc/opensc.conf -The output should return something similar to: -force_card_driver = ; - Is it the case that the smart card driver is not configured correctly? + + To check the permissions of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -l /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have unix mode -rw-------? - - Verify that a separate file system/partition has been created for /home with the following command: - -$ mountpoint /home - - Is it the case that "/home is not a mountpoint" is returned? + + To ensure that users cannot change session idle and lock settings, run the following: +$ grep 'lock-delay' /etc/dconf/db/local.d/locks/* +If properly configured, the output should return: +/org/gnome/desktop/screensaver/lock-delay + Is it the case that GNOME3 session settings are not locked or configured properly? - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* + + To determine if the system is configured to audit calls to the +clock_settime system call, run the following command: +$ sudo grep "clock_settime" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that the operating system protects against or limits the effects of DoS -attacks by ensuring implementation of rate-limiting measures -on impacted network interfaces, run the following command: -# grep 'net.ipv4.tcp_invalid_ratelimit' /etc/sysctl.conf /etc/sysctl.d/* -The command should output the following line: -/etc/sysctl.conf:net.ipv4.tcp_invalid_ratelimit = -The file where the line has been found can differ, but it must be either /etc/sysctl.conf -or a file located under the /etc/sysctl.d/ directory. - Is it the case that rate limiting of duplicate TCP acknowledgments is not configured? + + To check the permissions of /etc/audit/auditd.conf, +run the command: +$ ls -l /etc/audit/auditd.conf +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/audit/auditd.conf does not have unix mode -rw-r-----? - - Verify Red Hat Enterprise Linux 8 audits execution as another user. - -Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: - -$ sudo grep execve /etc/audit/audit.rules + + Verify Red Hat Enterprise Linux 8 defines default permissions for all authenticated users in such a way that the user can only read and modify their own files with the following command: -The output should be the following: +# grep -i umask /etc/login.defs --a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation --a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset-k user_emulation - Is it the case that the command does not return all lines, or the lines are commented out? +UMASK + Is it the case that the value for the "UMASK" parameter is not "<sub idref="var_accounts_user_umask" />", or the "UMASK" parameter is missing or is commented out? - + -Run the following command to determine if the telepathy_tcp_connect_generic_network_ports SELinux boolean is disabled: -$ getsebool telepathy_tcp_connect_generic_network_ports +Run the following command to determine if the sge_use_nfs SELinux boolean is disabled: +$ getsebool sge_use_nfs If properly configured, the output should show the following: -telepathy_tcp_connect_generic_network_ports --> off - Is it the case that telepathy_tcp_connect_generic_network_ports is not disabled? +sge_use_nfs --> off + Is it the case that sge_use_nfs is not disabled? - + -Run the following command to determine if the httpd_can_network_relay SELinux boolean is disabled: -$ getsebool httpd_can_network_relay +Run the following command to determine if the daemons_use_tcp_wrapper SELinux boolean is disabled: +$ getsebool daemons_use_tcp_wrapper If properly configured, the output should show the following: -httpd_can_network_relay --> off - Is it the case that httpd_can_network_relay is not disabled? +daemons_use_tcp_wrapper --> off + Is it the case that daemons_use_tcp_wrapper is not disabled? - - Verify the nodev option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . nodev . . . - - Is it the case that the "/var/log" file system does not have the "nodev" option set? + + To check that page poisoning is enabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't enable page poisoning. + Is it the case that page allocator poisoning is not enabled? - - Verify that Red Hat Enterprise Linux 8 is configured to boot to the command line: -$ systemctl get-default -multi-user.target - Is it the case that the system default target is not set to "multi-user.target" and the Information System Security Officer (ISSO) lacks a documented requirement for a graphical user interface? + + Only strong MACs should be used. To verify that only strong +MACs are in use, run the following command: +$ sudo grep -i macs /etc/ssh/sshd_config +The output should contain only those MACs which are strong, namely, + hash functions. + Is it the case that MACs option is commented out or not using strong hash algorithms? - - Shared libraries are stored in the following directories: -/lib -/lib64 -/usr/lib -/usr/lib64 + + The runtime status of the net.ipv4.conf.default.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.accept_redirects +0. -To find shared libraries that are group-writable or world-writable, -run the following command for each directory DIR which contains shared libraries: -$ sudo find -L DIR -perm /022 -type d - Is it the case that any of these files are group-writable or world-writable? + Is it the case that the correct value is not returned? - - To determine if the system is configured to audit calls to the -lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 is configured to lock an account after +unsuccessful logon attempts with the command: - Is it the case that no line is returned? - - - - To check the ownership of /etc/group-, -run the command: -$ ls -lL /etc/group- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/group- does not have an owner of root? + +$ grep 'deny =' /etc/security/faillock.conf +deny = . + Is it the case that the "deny" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_deny" />" +or less (but not "0"), is missing or commented out? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the renameat system call. + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42.rules +The output has to be exactly as follows: +## The purpose of these rules is to meet the requirements for Operating +## System Protection Profile (OSPP)v4.2. These rules depends on having +## the following rule files copied to /etc/audit/rules.d: +## +## 10-base-config.rules, 11-loginuid.rules, +## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, +## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, +## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, +## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, +## 30-ospp-v42-5-perm-change-failed.rules, +## 30-ospp-v42-5-perm-change-success.rules, +## 30-ospp-v42-6-owner-change-failed.rules, +## 30-ospp-v42-6-owner-change-success.rules +## +## original copies may be found in /usr/share/audit/sample-rules/ -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r renameat /etc/audit/rules.d +## User add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch passwd and +## shadow for writes +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +## User enable and disable. This is entirely handled by pam. -$ sudo grep renameat /etc/audit/audit.rules +## Group add delete modify. This is covered by pam. However, someone could +## open a file and directly create or modify a user, so we'll watch group and +## gshadow for writes +-a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify +-a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify +-a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify -The output should be the following: --a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? - - - - To check that the debug-shell service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled debug-shell -Output should indicate the debug-shell service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled debug-shell disabled +## Use of special rights for config changes. This would be use of setuid +## programs that relate to user accts. This is not all setuid apps because +## requirements are only for ones that affect system configuration. +-a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes +-a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes -Run the following command to verify debug-shell is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active debug-shell +## Privilege escalation via su or sudo. This is entirely handled by pam. -If the service is not running the command will return the following output: -inactive +## Watch for configuration changes to privilege escalation. +-a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes +-a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes -The service will also be masked, to check that the debug-shell is masked, run the following command: -$ sudo systemctl show debug-shell | grep "LoadState\|UnitFileState" +## Audit log access +-a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail +## Attempts to Alter Process and Session Initiation Information +-a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +-a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session -If the service is masked the command will return the following outputs: +## Attempts to modify MAC controls +-a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy -LoadState=masked +## Software updates. This is entirely handled by rpm. -UnitFileState=masked - Is it the case that the "debug-shell" is loaded and not masked? - - - - Run the following command to determine if the ypserv package is installed: -$ rpm -q ypserv - Is it the case that the package is installed? - - - - -Run the following command to determine if the virt_sandbox_use_sys_admin SELinux boolean is disabled: -$ getsebool virt_sandbox_use_sys_admin -If properly configured, the output should show the following: -virt_sandbox_use_sys_admin --> off - Is it the case that virt_sandbox_use_sys_admin is not disabled? - - - - -Run the following command to determine if the xguest_mount_media SELinux boolean is disabled: -$ getsebool xguest_mount_media -If properly configured, the output should show the following: -xguest_mount_media --> off - Is it the case that xguest_mount_media is not disabled? - - - - -Run the following command to determine if the polipo_use_cifs SELinux boolean is disabled: -$ getsebool polipo_use_cifs -If properly configured, the output should show the following: -polipo_use_cifs --> off - Is it the case that polipo_use_cifs is not disabled? - - - - To check the permissions of /boot/Sysem.map-*, -run the command: -$ ls -l /boot/Sysem.map-* -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that ? - - - - +## System start and shutdown. This is entirely handled by systemd -Run the following command to determine the current status of the -sssd service: -$ sudo systemctl is-active sssd -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_VSYSCALL_EMULATE /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - Check that Red Hat Enterprise Linux 8 has the packages for smart card support installed. +## Kernel Module loading. This is handled in 43-module-load.rules -Run the following command to determine if the openssl-pkcs11 package is installed: -$ rpm -q openssl-pkcs11 - Is it the case that smartcard software is not installed? - - - - -Run the following command to determine if the daemons_enable_cluster_mode SELinux boolean is disabled: -$ getsebool daemons_enable_cluster_mode -If properly configured, the output should show the following: -daemons_enable_cluster_mode --> off - Is it the case that daemons_enable_cluster_mode is not disabled? +## Application invocation. The requirements list an optional requirement +## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to +## state results from that policy. This would be handled entirely by +## that daemon. + Is it the case that the file does not exist or the content differs? - + -Run the following command to determine if the antivirus_use_jit SELinux boolean is disabled: -$ getsebool antivirus_use_jit +Run the following command to determine if the haproxy_connect_any SELinux boolean is disabled: +$ getsebool haproxy_connect_any If properly configured, the output should show the following: -antivirus_use_jit --> off - Is it the case that antivirus_use_jit is not disabled? - - - - To check the permissions of /etc/crontab, -run the command: -$ ls -l /etc/crontab -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/crontab does not have unix mode -rw-------? - - - - Verify all local interactive users on Red Hat Enterprise Linux 8 are assigned a home -directory upon creation with the following command: -$ grep -i create_home /etc/login.defs -CREATE_HOME yes - Is it the case that the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out? +haproxy_connect_any --> off + Is it the case that haproxy_connect_any is not disabled? - - To check the ownership of /etc/motd, -run the command: -$ ls -lL /etc/motd -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/motd does not have an owner of root? + + To determine if the system is configured to audit successful calls +to the fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To verify the sec option is configured for all NFS mounts, run the following command: -$ mount | grep "sec=" -All NFS mounts should show the sec=krb5:krb5i:krb5p setting in parentheses. -This is not applicable if NFS is not implemented. - Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? + + To verify that remote access methods are logging to rsyslog, +run the following command: +grep -rE '(auth.\*|authpriv.\*|daemon.\*)' /etc/rsyslog.* +The output should contain auth.*, authpriv.*, and daemon.* +pointing to a log file. + Is it the case that remote access methods are not logging to rsyslog? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HARDENED_USERCOPY_FALLBACK /boot/config.* + $ grep CONFIG_STRICT_KERNEL_WRX /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the pcp_read_generic_logs SELinux boolean is disabled: -$ getsebool pcp_read_generic_logs +Run the following command to determine if the nfs_export_all_rw SELinux boolean is enabled: +$ getsebool nfs_export_all_rw If properly configured, the output should show the following: -pcp_read_generic_logs --> off - Is it the case that pcp_read_generic_logs is not disabled? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes l1tf=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*l1tf=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*l1tf=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'l1tf=' -The command should not return any output. - Is it the case that l1tf mitigations are not configured appropriately? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes slub_debug=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slub_debug=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*slub_debug=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'slub_debug=' -The command should not return any output. - Is it the case that SLUB/SLAB poisoning is not enabled? +nfs_export_all_rw --> on + Is it the case that nfs_export_all_rw is not enabled? - - Run the following command to determine if the nftables package is installed: $ rpm -q nftables + + Run the following command to determine if the binutils package is installed: $ rpm -q binutils Is it the case that the package is not installed? - - Ensure that Red Hat Enterprise Linux 8 verifies correct operation of security functions. - -Check if "SELinux" is active and in "" mode with the following command: - -$ sudo getenforce - - Is it the case that SELINUX is not set to enforcing? - - - - To check the permissions of /etc/gshadow, -run the command: -$ ls -l /etc/gshadow -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/gshadow does not have unix mode ----------? + + Inspect /etc/default/grub for any instances of +systemd.confirm_spawn=(1|yes|true|on) in the kernel boot arguments. +Presence of a systemd.confirm_spawn=(1|yes|true|on) indicates +that interactive boot is enabled at boot time and verify that +GRUB_DISABLE_RECOVERY=true to disable recovery boot. + Is it the case that Interactive boot is enabled at boot time? - - To check that the autofs service is disabled in system boot configuration, + + To check that the rsyncd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled autofs -Output should indicate the autofs service has either not been installed, +$ sudo systemctl is-enabled rsyncd +Output should indicate the rsyncd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled autofs disabled +$ sudo systemctl is-enabled rsyncd disabled -Run the following command to verify autofs is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active autofs +Run the following command to verify rsyncd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rsyncd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the autofs is masked, run the following command: -$ sudo systemctl show autofs | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rsyncd is masked, run the following command: +$ sudo systemctl show rsyncd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "autofs" is loaded and not masked? - - - - -Run the following command to determine if the ftpd_use_cifs SELinux boolean is disabled: -$ getsebool ftpd_use_cifs -If properly configured, the output should show the following: -ftpd_use_cifs --> off - Is it the case that ftpd_use_cifs is not disabled? - - - - To determine whether the SSH service is configured to use strong entropy seed, -run $ sudo grep SSH_USE_STRONG_RNG /etc/sysconfig/sshd -If a line indicating that SSH_USE_STRONG_RNG is set to 32 is returned, -then the option is set correctly. - Is it the case that the SSH_USE_STRONG_RNG is not set to 32 in /etc/sysconfig/sshd? + Is it the case that the "rsyncd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -lsetxattr system call, run the following command: -$ sudo grep "lsetxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Run the following command to Verify that the sudoers security policy is configured to use the invoking user's password for privilege escalation: + sudo cvtsudoers -f sudoers /etc/sudoers | grep -E '^Defaults !?(rootpw|targetpw|runaspw)' +or if cvtsudoers not supported: + sudo find /etc/sudoers /etc/sudoers.d \( \! -name '*~' -a \! -name '*.*' \) -exec grep -E --with-filename '^[[:blank:]]*Defaults[[:blank:]](.*[[:blank:]])?!?\b(rootpw|targetpw|runaspw)' -- {} \; +If no results are returned, this is a finding. +If conflicting results are returned, this is a finding. +If "Defaults !targetpw" is not defined, this is a finding. +If "Defaults !rootpw" is not defined, this is a finding. +If "Defaults !runaspw" is not defined, this is a finding. + Is it the case that invoke user passwd when using sudo? - - To determine if the system is configured to audit calls to the -fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nodev option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . nodev . . . - Is it the case that no line is returned? + Is it the case that the "/var/log/audit" file system does not have the "nodev" option set? - - Verify the SELINUX on Red Hat Enterprise Linux 8 is using the policy with the following command: - -$ sestatus | grep policy - -Loaded policy name: - Is it the case that the loaded policy name is not "<sub idref="var_selinux_policy_name" />"? + + Verify that there are no shosts.equiv files on the system, run the following command: +$ find / -name shosts.equiv + Is it the case that shosts.equiv files exist? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes mce=0, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*mce=0.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*mce=0.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'mce=0' -The command should not return any output. - Is it the case that MCE tolerance is not set to zero? + + Run the following command to determine if the postfix package is installed: $ rpm -q postfix + Is it the case that the package is not installed? - - To ensure the login screen resets after a specified number of failures, -run the following command: -$ grep allowed-failures /etc/dconf/db/gdm.d/* -The output should be 3 or less. -To ensure that users cannot change or configure the resets after a specified -number of failures on the login screen, run the following: -$ grep allowed-failures /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/allowed-failures - Is it the case that allowed-failures is not equal to or less than the expected value? + + Run the following command to determine if the cyrus-imapd package is installed: +$ rpm -q cyrus-imapd + Is it the case that the package is installed? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules -The output has to be exactly as follows: -## Unsuccessful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change - Is it the case that the file does not exist or the content differs? + + Run the following command to determine if the squid package is installed: +$ rpm -q squid + Is it the case that the package is installed? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv4.conf.all.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.accept_source_route +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Run the following command to ensure postfix routes mail to this system: -$ grep relayhost /etc/postfix/main.cf -If properly configured, the output should show only . - Is it the case that it is not? + + To verify that BIND uses the system crypto policy, check out that the BIND config file +/etc/named.conf contains the include "/etc/crypto-policies/back-ends/bind.config"; +directive: +$ sudo grep 'include "/etc/crypto-policies/back-ends/bind.config";' /etc/named.conf +Verify that the directive is at the bottom of the options section of the config file. + Is it the case that BIND is installed and the BIND config file doesn't contain the +<pre>include "/etc/crypto-policies/back-ends/bind.config";</pre> directive? - - Inspect the password section of /etc/pam.d/system-auth -and ensure that the pam_unix.so module is configured to use the argument -sha512: - -$ sudo grep "^password.*pam_unix\.so.*sha512" /etc/pam.d/system-auth - -password sufficient pam_unix.so sha512 - Is it the case that "sha512" is missing, or is commented out? + + To check the permissions of /etc/at.allow, +run the command: +$ ls -l /etc/at.allow +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/at.allow does not have unix mode -rw-------? - - To determine if the system is configured to audit calls to the -rmdir system call, run the following command: -$ sudo grep "rmdir" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check if RekeyLimit is set correctly, run the +following command: - Is it the case that no line is returned? - - - - Run the following command to determine if the firewalld package is installed: $ rpm -q firewalld - Is it the case that the package is not installed? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECCOMP /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To ensure the user list is disabled, run the following command: -$ grep disable-user-list /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot enable displaying the user list, run the following: -$ grep disable-user-list /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/disable-user-list - Is it the case that disable-user-list has not been configured or is not disabled? - - - - -Run the following command to determine if the sanlock_use_fusefs SELinux boolean is disabled: -$ getsebool sanlock_use_fusefs -If properly configured, the output should show the following: -sanlock_use_fusefs --> off - Is it the case that sanlock_use_fusefs is not disabled? +$ sudo grep RekeyLimit /etc/ssh/sshd_config + +If configured properly, output should be +RekeyLimit + Is it the case that it is commented out or is not set? - - To determine how the SSH daemon's IgnoreUserKnownHosts option is set, run the following command: + + To check if authentication is required for emergency mode, run the following command: +$ grep sulogin /usr/lib/systemd/system/emergency.service +The output should be similar to the following, and the line must begin with +ExecStart and /usr/lib/systemd/systemd-sulogin-shell. + ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency -$ sudo grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config +Then, check if the emergency target requires the emergency service: +Run the following command: +$ sudo grep Requires /usr/lib/systemd/system/emergency.target +The output should be the following: +Requires=emergency.service -If a line indicating yes is returned, then the required value is set. +Then, check if there is no custom emergency target configured in systemd configuration. +Run the following command: +$ sudo grep -r emergency.target /etc/systemd/system/ +The output should be empty. - Is it the case that the required value is not set? +Then, check if there is no custom emergency service configured in systemd configuration. +Run the following command: +$ sudo grep -r emergency.service /etc/systemd/system/ +The output should be empty. + Is it the case that the output is different? - - -Run the following command to determine if the dhcpc_exec_iptables SELinux boolean is disabled: -$ getsebool dhcpc_exec_iptables -If properly configured, the output should show the following: -dhcpc_exec_iptables --> off - Is it the case that dhcpc_exec_iptables is not disabled? + + To ensure smart card authentication on the login screen is enabled, run the following command: +$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot disable smart card authentication on the login screen, run the following: +$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/enable-smartcard-authentication + Is it the case that enable-smartcard-authentication has not been configured or is disabled? - + -If the system is configured to prevent the loading of the atm kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the atm kernel module via blacklist keyword. - -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r atm /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? +Run the following command to determine if the user_exec_content SELinux boolean is enabled: +$ getsebool user_exec_content +If properly configured, the output should show the following: +user_exec_content --> on + Is it the case that user_exec_content is not enabled? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size. + + The runtime status of the kernel.kptr_restrict kernel parameter can be queried +by running the following command: +$ sysctl kernel.kptr_restrict +The output of the command should indicate either: +kernel.kptr_restrict = 1 +or: +kernel.kptr_restrict = 2 +The output of the command should not indicate: +kernel.kptr_restrict = 0 -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size with the following command: +The preferable way how to assure the runtime compliance is to have +correct persistent configuration, and rebooting the system. -$ sudo grep max_log_file_action /etc/audit/auditd.conf +The persistent kernel parameter configuration is performed by specifying the appropriate +assignment in any file located in the /etc/sysctl.d directory. +Verify that there is not any existing incorrect configuration by executing the following command: +$ grep -r '^\s*kernel.kptr_restrict\s*=' /etc/sysctl.conf /etc/sysctl.d +The command should not find any assignments other than: +kernel.kptr_restrict = 1 +or: +kernel.kptr_restrict = 2 -max_log_file_action = - Is it the case that the value of the "max_log_file_action" option is not "ROTATE", "SINGLE", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. If there is no evidence of appropriate action? +Conflicting assignments are not allowed. + Is it the case that the kernel.kptr_restrict is not set to 1 or 2 or is configured to be 0? - - -Run the following command to determine if the cobbler_use_nfs SELinux boolean is disabled: -$ getsebool cobbler_use_nfs -If properly configured, the output should show the following: -cobbler_use_nfs --> off - Is it the case that cobbler_use_nfs is not disabled? + + To check the group ownership of /etc/cron.hourly, +run the command: +$ ls -lL /etc/cron.hourly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.hourly does not have a group owner of root? - + To determine if the system is configured to audit successful calls -to the creat system call, run the following command: -$ sudo grep "creat" /etc/audit.* +to the lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the git_system_use_nfs SELinux boolean is disabled: -$ getsebool git_system_use_nfs -If properly configured, the output should show the following: -git_system_use_nfs --> off - Is it the case that git_system_use_nfs is not disabled? + + To determine if NOPASSWD or !authenticate have been configured for +sudo, run the following command: +$ sudo grep -ri "nopasswd\|\!authenticate" /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that nopasswd and/or !authenticate is enabled in sudo? @@ -374369,1240 +374421,999 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/cron.daily does not have unix mode -rwx------? - + -Run the following command to determine if the mpd_enable_homedirs SELinux boolean is disabled: -$ getsebool mpd_enable_homedirs +Run the following command to determine if the tftp_anon_write SELinux boolean is disabled: +$ getsebool tftp_anon_write If properly configured, the output should show the following: -mpd_enable_homedirs --> off - Is it the case that mpd_enable_homedirs is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEVKMEM /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine how the SSH daemon's StrictModes option is set, run the following command: - -$ sudo grep -i StrictModes /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - Verify that the system is integrated with a centralized authentication mechanism -such as as Active Directory, Kerberos, Directory Server, etc. that has -automated account mechanisms in place. - Is it the case that the system is not using a centralized authentication mechanism, or it is not automated? +tftp_anon_write --> off + Is it the case that tftp_anon_write is not disabled? - - To determine that AIDE is verifying ACLs, run the following command: -$ grep acl /etc/aide.conf -Verify that the acl option is added to the correct ruleset. - Is it the case that the acl option is missing or not added to the correct ruleset? + + +Run the following command to determine if the zebra_write_config SELinux boolean is disabled: +$ getsebool zebra_write_config +If properly configured, the output should show the following: +zebra_write_config --> off + Is it the case that zebra_write_config is not disabled? - - To check that the nftables service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled nftables -Output should indicate the nftables service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled nftables disabled - -Run the following command to verify nftables is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active nftables - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the nftables is masked, run the following command: -$ sudo systemctl show nftables | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked + + If the system uses IPv6, this is not applicable. -UnitFileState=masked - Is it the case that the "nftables" is loaded and not masked? - - - - Run the following command to determine if the setroubleshoot-server package is installed: -$ rpm -q setroubleshoot-server - Is it the case that the package is installed? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_CREDENTIALS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +If the system is configured to disable the +ipv6 kernel module, it will contain a line +of the form: +options ipv6 disable=1 +Such lines may be inside any file in /etc/modprobe.d or the +deprecated/etc/modprobe.conf. This permits insertion of the IPv6 +kernel module (which other parts of the system expect to be present), but +otherwise keeps it inactive. Run the following command to search for such +lines in all files in /etc/modprobe.d and the deprecated +/etc/modprobe.conf: +$ grep -r ipv6 /etc/modprobe.conf /etc/modprobe.d + Is it the case that the ipv6 kernel module is not disabled? - + -Run the following command to determine if the samba_create_home_dirs SELinux boolean is disabled: -$ getsebool samba_create_home_dirs +Run the following command to determine if the pppd_for_user SELinux boolean is disabled: +$ getsebool pppd_for_user If properly configured, the output should show the following: -samba_create_home_dirs --> off - Is it the case that samba_create_home_dirs is not disabled? +pppd_for_user --> off + Is it the case that pppd_for_user is not disabled? - + -Run the following command to determine if the mcelog_server SELinux boolean is disabled: -$ getsebool mcelog_server +Run the following command to determine if the mount_anyfile SELinux boolean is enabled: +$ getsebool mount_anyfile If properly configured, the output should show the following: -mcelog_server --> off - Is it the case that mcelog_server is not disabled? - - - - To check that the snmpd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled snmpd -Output should indicate the snmpd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled snmpd disabled - -Run the following command to verify snmpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active snmpd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the snmpd is masked, run the following command: -$ sudo systemctl show snmpd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "snmpd" is loaded and not masked? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes rng_core.default_quality=, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*rng_core.default_quality=.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*rng_core.default_quality=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'rng_core.default_quality=' -The command should not return any output. - Is it the case that trust on hardware random number generator is not configured appropriately? +mount_anyfile --> on + Is it the case that mount_anyfile is not enabled? - + To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To ensure sshd limits the users who can log in, run the following: -pre>$ sudo grep -rPi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$' /etc/ssh/sshd_config* -If properly configured, the output should be a list of usernames and/or -groups allowed to log in to this system. - Is it the case that sshd does not limit the users who can log in? - - - - -Run the following command to determine if the nfs_export_all_ro SELinux boolean is enabled: -$ getsebool nfs_export_all_ro -If properly configured, the output should show the following: -nfs_export_all_ro --> on - Is it the case that nfs_export_all_ro is not enabled? - - - - To determine that AIDE is configured for FIPS 140-2 file hashing, run the following command: -$ grep sha512 /etc/aide.conf -Verify that the sha512 option is added to the correct ruleset. - Is it the case that the sha512 option is missing or not added to the correct ruleset? + + To verify that the system will shutdown when auditd fails, +run the following command: +$ sudo grep "\-f " /etc/audit/audit.rules +The output should contain: +-f + Is it the case that the system is not configured to shutdown on auditd failures? - - Verify Red Hat Enterprise Linux 8 initiates a session lock after 15 minutes of inactivity. - -Check the value of the system inactivity timeout with the following command: + + First, check whether the password is defined in either /boot/grub2/user.cfg or +/boot/grub2/grub.cfg. +Run the following commands: +$ sudo grep '^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$' /boot/grub2/user.cfg +$ sudo grep '^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$' /boot/grub2/grub.cfg -$ grep -i lock-after-time /etc/tmux.conf -set -g lock-after-time 900 +Second, check that a superuser is defined in /boot/grub2/grub.cfg. +$ sudo grep '^[\s]*set[\s]+superusers=("?)[a-zA-Z_]+\1$' /boot/grub2/grub.cfg + Is it the case that it does not produce any output? + + + + To find world-writable directories that lack the sticky bit, run the following command: +$ sudo find / -type d \( -perm -0002 -a ! -perm -1000 \) -print 2>/dev/null +fixtext: |- +Configure all world-writable directories to have the sticky bit set to prevent unauthorized and unintended information transferred via shared system resources. -Then, verify that the /etc/tmux.conf file can be read by other users than root: +Set the sticky bit on all world-writable directories using the command, replace "[World-Writable Directory]" with any directory path missing the sticky bit: -$ sudo ls -al /etc/tmux.conf - Is it the case that "lock-after-time" is not set to "900" or less in the global tmux configuration file to enforce session lock after inactivity? +$ chmod a+t [World-Writable Directory] +srg_requirement: +A sticky bit must be set on all Red Hat Enterprise Linux 8 public directories to prevent unauthorized and unintended information transferred via shared system resources. + Is it the case that any world-writable directories are missing the sticky bit? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING_ZERO /boot/config.* + $ grep CONFIG_RANDOMIZE_BASE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_defrtr -0. + + +Run the following command to determine if the tor_can_network_relay SELinux boolean is disabled: +$ getsebool tor_can_network_relay +If properly configured, the output should show the following: +tor_can_network_relay --> off + Is it the case that tor_can_network_relay is not disabled? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "crontab" command with the following command: - Is it the case that the correct value is not returned? +$ sudo auditctl -l | grep crontab + +-a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -k privileged-crontab + Is it the case that the command does not return a line, or the line is commented out? - - To check the ownership of /etc/gshadow, + + To check the group ownership of /etc/cron.allow, run the command: -$ ls -lL /etc/gshadow -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/cron.allow +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/gshadow does not have an owner of root? + Is it the case that /etc/cron.allow does not have a group owner of root? - - + + The following command will locate the mount points related to local devices: +$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -Run the following command to determine the current status of the -fapolicyd service: -$ sudo systemctl is-active fapolicyd -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - The runtime status of the kernel.perf_event_paranoid kernel parameter can be queried -by running the following command: -$ sysctl kernel.perf_event_paranoid -2. +The following command will show files which do not belong to a valid user: +$ sudo find MOUNTPOINT -xdev -nouser 2>/dev/null - Is it the case that the correct value is not returned? +Replace MOUNTPOINT by the mount points listed by the fist command. + +No files without a valid user should be located. + Is it the case that files exist that are not owned by a valid user? - - Verify the audit tools are group-owned by "root" to prevent any unauthorized access, deletion, or modification. - -Check the group-owner of each audit tool by running the following command: - -$ sudo stat -c "%G %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules - -root /sbin/auditctl -root /sbin/aureport -root /sbin/ausearch -root /sbin/autrace -root /sbin/auditd -root /sbin/rsyslogd -root /sbin/augenrules - Is it the case that any audit tools are not group-owned by root? + + To ensure that users cannot change session idle and lock settings, run the following: +$ grep 'idle-delay' /etc/dconf/db/local.d/locks/* +If properly configured, the output should return: +/org/gnome/desktop/session/idle-delay + Is it the case that idle-delay is not locked? - + -Run the following command to determine if the httpd_unified SELinux boolean is disabled: -$ getsebool httpd_unified +Run the following command to determine if the mcelog_foreground SELinux boolean is disabled: +$ getsebool mcelog_foreground If properly configured, the output should show the following: -httpd_unified --> off - Is it the case that httpd_unified is not disabled? - - - - To verify that TLS is configured properly in -/etc/httpd/conf.modules.d/ssl.conf, run the following command: -$ grep -i "sslengine\|sslprotocol" /etc/httpd/conf.d/ssl.conf -The output should return the following: - -SSLEngine on -SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 - - Is it the case that it is not? - - - - To verify insecure file locking has been disabled, run the following command: -$ grep insecure_locks /etc/exports - Is it the case that there is output? +mcelog_foreground --> off + Is it the case that mcelog_foreground is not disabled? - + -Run the following command to determine if the conman_can_network SELinux boolean is disabled: -$ getsebool conman_can_network +Run the following command to determine if the mplayer_execstack SELinux boolean is disabled: +$ getsebool mplayer_execstack If properly configured, the output should show the following: -conman_can_network --> off - Is it the case that conman_can_network is not disabled? +mplayer_execstack --> off + Is it the case that mplayer_execstack is not disabled? - - To determine if the system is configured to audit successful calls -to the ftruncate system call, run the following command: -$ sudo grep "ftruncate" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the noexec option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . noexec . . . - Is it the case that no line is returned? + Is it the case that the "/boot" file system does not have the "noexec" option set? - - Verify that the system is not accepting "rsyslog" messages from other systems unless it is -documented as a log aggregation server. -Display the contents of the rsyslog configuration files: -find /etc -maxdepth 2 -regex '/etc/rsyslog\(\.conf\|\.d\/.*\.conf\)' -exec cat '{}' \; - -If any of the below lines are found, ask to see the documentation for the system being used -for log aggregation: - -If using legacy syntax: -$ModLoad imtcp -$InputTCPServerRun port -$ModLoad imudp -$UDPServerRun port -$ModLoad imrelp -$InputRELPServerRun port - -If using RainerScript syntax: -module(load="imtcp") -module(load="imudp") -input(type="imtcp" port="514") -input(type="imudp" port="514") + + The runtime status of the net.ipv4.conf.all.shared_media kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.shared_media +0. - Is it the case that rsyslog accepts remote messages and is not documented as a log aggregation system? + Is it the case that the correct value is not returned? - - Verify the noexec option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . noexec . . . - - Is it the case that the "/var/log/audit" file system does not have the "noexec" option set? + + +Run the following command to determine if the pcp_read_generic_logs SELinux boolean is disabled: +$ getsebool pcp_read_generic_logs +If properly configured, the output should show the following: +pcp_read_generic_logs --> off + Is it the case that pcp_read_generic_logs is not disabled? - - To check the permissions of /etc/shadow, -run the command: -$ ls -l /etc/shadow -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/shadow does not have unix mode ----------? + + +Run the following command to determine if the selinuxuser_rw_noexattrfile SELinux boolean is disabled: +$ getsebool selinuxuser_rw_noexattrfile +If properly configured, the output should show the following: +selinuxuser_rw_noexattrfile --> off + Is it the case that selinuxuser_rw_noexattrfile is not disabled? - - To obtain a listing of all users, their UIDs, and their shells, run the command: -$ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd -Identify the system accounts from this listing. These will primarily be the accounts with UID -numbers less than 1000, other than root. - Is it the case that any system account other than root has a login shell? + + +Run the following command to determine if the rsync_full_access SELinux boolean is disabled: +$ getsebool rsync_full_access +If properly configured, the output should show the following: +rsync_full_access --> off + Is it the case that rsync_full_access is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "gpasswd" command with the following command: + + Run the following command to determine if the usbguard package is installed: $ rpm -q usbguard + Is it the case that the package is not installed? + + + + Verify the operating system encrypts audit records off-loaded onto a different system +or media from the system being audited with the following commands: -$ sudo auditctl -l | grep gpasswd +$ sudo grep -i '$DefaultNetstreamDriver' /etc/rsyslog.conf /etc/rsyslog.d/*.conf --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-gpasswd - Is it the case that the command does not return a line, or the line is commented out? +The output should be: + +/etc/rsyslog.conf:$DefaultNetstreamDriver gtls + Is it the case that rsyslogd DefaultNetstreamDriver not set to gtls? - + -Run the following command to determine if the httpd_sys_script_anon_write SELinux boolean is disabled: -$ getsebool httpd_sys_script_anon_write +Run the following command to determine if the ssh_chroot_rw_homedirs SELinux boolean is disabled: +$ getsebool ssh_chroot_rw_homedirs If properly configured, the output should show the following: -httpd_sys_script_anon_write --> off - Is it the case that httpd_sys_script_anon_write is not disabled? - - - - Verify that Red Hat Enterprise Linux 8 enforces a minimum -character password length with the following command: - -$ grep minlen /etc/security/pwquality.conf - -minlen = - Is it the case that the command does not return a "minlen" value of "<sub idref="var_password_pam_minlen" />" or greater, does not return a line, or the line is commented out? +ssh_chroot_rw_homedirs --> off + Is it the case that ssh_chroot_rw_homedirs is not disabled? - - Make sure that the kernel is configured to trust the CPU RNG by following -commands. To check if the option was correctly configured at kernel compile -time, run the following command: -grep -q CONFIG_RANDOM_TRUST_CPU=y /boot/config-`uname -r` -If the command outputs: -CONFIG_RANDOM_TRUST_CPU=y, -it means that the option is compiled into the kernel. Make sure that the -option is not overridden through a boot parameter: -sudo grep 'kernelopts.*random\.trust_cpu=off.*' /boot/grub2/grubenv -The command should not return any output. If the option is not compiled into -the kernel, check that the option is configured through boot parameter. -Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes random.trust_cpu=on, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes pti=on, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*random.trust_cpu=on.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*pti=on.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*random.trust_cpu=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*pti=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'random.trust_cpu=on' +$ sudo grubby --info=ALL | grep args | grep -v 'pti=on' The command should not return any output. - Is it the case that the kernel is not configured to trust the CPU RNG? + Is it the case that Kernel page-table isolation is not enabled? - - To check that the sshd service is disabled in system boot configuration, + + To determine if the system is configured to audit account changes, run the following command: -$ sudo systemctl is-enabled sshd -Output should indicate the sshd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled sshd disabled - -Run the following command to verify sshd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active sshd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the sshd is masked, run the following command: -$ sudo systemctl show sshd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "sshd" is loaded and not masked? +auditctl -l | grep -E '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)' +If the system is configured to watch for account changes, lines should be returned for +each file specified (and with perm=wa for each). + Is it the case that the system is not configured to audit account changes? - - To verify that execution of the command is being audited, run the following command: -$ sudo grep "path=/usr/sbin/seunshare" /etc/audit/audit.rules /etc/audit/rules.d/* -The output should return something similar to: --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged - Is it the case that ? + + To ensure root may not directly login to the system over physical consoles, +run the following command: +cat /etc/securetty +If any output is returned, this is a finding. + Is it the case that the /etc/securetty file is not empty? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING_NO_SANITY /boot/config.* + $ grep CONFIG_SECURITY_DMESG_RESTRICT /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/lastlog" with the following command: - -$ sudo auditctl -l | grep /var/log/lastlog - --w /var/log/lastlog -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? - - - + -Run the following command to get the current configured value for deny_execmem -SELinux boolean: -$ getsebool deny_execmem -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that deny_execmem is not set as expected? +Run the following command to determine if the unconfined_login SELinux boolean is enabled: +$ getsebool unconfined_login +If properly configured, the output should show the following: +unconfined_login --> on + Is it the case that unconfined_login is not enabled? - - To check the permissions of /etc/cron.weekly, + + To check the group ownership of /var/log, run the command: -$ ls -l /etc/cron.weekly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.weekly does not have unix mode -rwx------? +$ ls -lL /var/log +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /var/log does not have a group owner of root? - - To verify the boot loader superuser account has been set, run the following -command: -sudo grep -A1 "superusers" /boot/efi/EFI/redhat/grub.cfg -The output should show the following: -set superusers="superusers-account" -export superusers -where superusers-account is the actual account name different from common names like root, -admin, or administrator and different from any other existing user name. - Is it the case that superuser account is not set or is set to an existing name or to a common name? + + +Run the following command to determine if the samba_export_all_rw SELinux boolean is disabled: +$ getsebool samba_export_all_rw +If properly configured, the output should show the following: +samba_export_all_rw --> off + Is it the case that samba_export_all_rw is not disabled? - + -Run the following command to determine if the selinuxuser_ping SELinux boolean is enabled: -$ getsebool selinuxuser_ping +Run the following command to determine if the spamd_enable_home_dirs SELinux boolean is enabled: +$ getsebool spamd_enable_home_dirs If properly configured, the output should show the following: -selinuxuser_ping --> on - Is it the case that selinuxuser_ping is not enabled? +spamd_enable_home_dirs --> on + Is it the case that spamd_enable_home_dirs is not enabled? - - To ensure the splash screen is configured not to show user name, run the following command: -$ gsettings get org.gnome.desktop.screensaver show-full-name-in-top-bar -If properly configured, the output should be false. -To ensure that users cannot enable user name on the lock screen, run the following: -$ grep show-full-name-in-top-bar /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/show-full-name-in-top-bar - Is it the case that it is not set or configured properly? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chcon" command with the following command: + +$ sudo auditctl -l | grep chcon + +-a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the httpd_can_connect_ldap SELinux boolean is disabled: -$ getsebool httpd_can_connect_ldap -If properly configured, the output should show the following: -httpd_can_connect_ldap --> off - Is it the case that httpd_can_connect_ldap is not disabled? + + The runtime status of the net.ipv6.conf.default.accept_ra_rtr_pref kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_rtr_pref +0. + + Is it the case that the correct value is not returned? - - To verify that tmux is not listed as allowed shell on the system -run the following command: -$ grep 'tmux$' /etc/shells -The output should be empty. - Is it the case that tmux is listed in /etc/shells? + + The runtime status of the net.ipv4.tcp_rfc1337 kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.tcp_rfc1337 +1. + + Is it the case that the correct value is not returned? - - To determine how the SSH daemon's LogLevel option is set, run the following command: + + Verify emergency accounts have been provisioned with an expiration date of 72 hours. -$ sudo grep -i LogLevel /etc/ssh/sshd_config +For every emergency account, run the following command to obtain its account aging and expiration information: -If a line indicating INFO is returned, then the required value is set. +$ sudo chage -l emergency_account_name - Is it the case that the required value is not set? +Verify each of these accounts has an expiration date set within 72 hours or as documented. + Is it the case that any emergency accounts have no expiration date set or do not expire within 72 hours? - + + To verify that there are no .shosts files +on the system, run the following command: +$ sudo find / -name '.shosts' + Is it the case that .shosts files exist? + + + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers" with the following command: + +$ sudo auditctl -l | grep /etc/sudoers + +-w /etc/sudoers -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? + + + -Run the following command to determine if the neutron_can_network SELinux boolean is disabled: -$ getsebool neutron_can_network +Run the following command to determine if the git_system_enable_homedirs SELinux boolean is disabled: +$ getsebool git_system_enable_homedirs If properly configured, the output should show the following: -neutron_can_network --> off - Is it the case that neutron_can_network is not disabled? +git_system_enable_homedirs --> off + Is it the case that git_system_enable_homedirs is not disabled? - - The runtime status of the net.ipv4.conf.default.shared_media kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.shared_media -0. + + Run the following command to determine if the crypto-policies package is installed: $ rpm -q crypto-policies + Is it the case that the package is not installed? + + + + Verify that a separate file system/partition has been created for /usr with the following command: - Is it the case that the correct value is not returned? +$ mountpoint /usr + + Is it the case that "/usr is not a mountpoint" is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "su" command with the following command: + + +If the system is configured to prevent the loading of the rds kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -$ sudo auditctl -l | grep su +These lines can also instruct the module loading system to ignore the rds kernel module via blacklist keyword. --a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -k privileged-su - Is it the case that the command does not return a line, or the line is commented out? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r rds /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - To ensure the user home directory is not group-writable or world-readable, run the following: -# ls -ld /home/USER - Is it the case that the user home directory is group-writable or world-readable? + + Inspect the file /etc/firewalld/firewalld.conf to determine +the default zone for the firewalld. It should be set to DefaultZone=drop: +$ sudo grep DefaultZone /etc/firewalld/firewalld.conf + Is it the case that the default zone is not set to DROP? - - To verify that a nftables table exists, run the following command: -$ sudo nft list tables -Output should include a list of nftables similar to: + + Verify that Red Hat Enterprise Linux 8 loads the driver with the following command: - table inet filter +$ grep card_drivers /etc/opensc.conf - Is it the case that a nftables table does not exist? +card_drivers = ; + Is it the case that "<sub idref="var_smartcard_drivers" />" is not listed as a card driver, or there is no line returned for "card_drivers"? + + + + +Run the following command to determine if the staff_use_svirt SELinux boolean is disabled: +$ getsebool staff_use_svirt +If properly configured, the output should show the following: +staff_use_svirt --> off + Is it the case that staff_use_svirt is not disabled? + + + + +Run the following command to determine if the selinuxuser_udp_server SELinux boolean is disabled: +$ getsebool selinuxuser_udp_server +If properly configured, the output should show the following: +selinuxuser_udp_server --> off + Is it the case that selinuxuser_udp_server is not disabled? + + + + Run the following command to determine if the chrony package is installed: $ rpm -q chrony + Is it the case that the package is not installed? + + + + Verify the pam_faillock.so module is present in the "/etc/pam.d/system-auth" file: + +$ sudo grep pam_faillock.so /etc/pam.d/system-auth + +auth required pam_faillock.so preauth +auth required pam_faillock.so authfail +account required pam_faillock.so + Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/system-auth" file with the "preauth" line listed before pam_unix.so? + + + + To check the group ownership of /etc/motd, +run the command: +$ ls -lL /etc/motd +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/motd does not have a group owner of root? - - To determine if the system is configured to audit calls to the -umount2 system call, run the following command: -$ sudo grep "umount2" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check the permissions of /etc/group-, +run the command: +$ ls -l /etc/group- +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/group- does not have unix mode -rw-r--r--? + + + + The runtime status of the net.ipv6.conf.all.autoconf kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.autoconf +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + -Run the following command to determine if the privoxy_connect_any SELinux boolean is disabled: -$ getsebool privoxy_connect_any +Run the following command to determine if the rsync_client SELinux boolean is disabled: +$ getsebool rsync_client If properly configured, the output should show the following: -privoxy_connect_any --> off - Is it the case that privoxy_connect_any is not disabled? +rsync_client --> off + Is it the case that rsync_client is not disabled? - - To verify that the installed operating system is supported or certified, run -the following command: - -The output should contain something similar to: -Red Hat Enterprise Linux 8 - Is it the case that the installed operating system is not FIPS 140-2 certified? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_HARDENED_USERCOPY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + - -Run the following command to determine the current status of the -firewalld service: -$ sudo systemctl is-active firewalld -If the service is running, it should return the following: active - Is it the case that the "firewalld" service is disabled, masked, or not started.? +Run the following command to determine if the racoon_read_shadow SELinux boolean is disabled: +$ getsebool racoon_read_shadow +If properly configured, the output should show the following: +racoon_read_shadow --> off + Is it the case that racoon_read_shadow is not disabled? - - To verify that auditing of privileged command use is configured, run the + + To verify that Audit Daemon is configured to write logs to the disk, run the following command: -$ sudo grep newuidmap /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? +$ sudo grep write_logs /etc/audit/auditd.conf +The output should return the following: +write_logs = yes + Is it the case that write_logs isn't set to yes? - - Verify the nodev option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . nodev . . . + + Verify that Red Hat Enterprise Linux 8 's INACTIVE conforms to site policy (no more than 30 days) with the following command: - Is it the case that the "/home" file system does not have the "nodev" option set? +$ sudo awk -F: '$7 > 30 {print $1 " " $7}' /etc/shadow + Is it the case that the value of INACTIVE is greater than the expected value or is -1? - - Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: - -$ sudo grep audit /etc/security/faillock.conf + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -audit - Is it the case that the "audit" option is not set, is missing or commented out? - - - - To verify all files and directories in a local interactive user's -home directory have a valid owner, run the following command: -$ sudo ls -lLR /home/USER - Is it the case that the user ownership is incorrect? + Is it the case that no line is returned? - + -Run the following command to determine if the samba_portmapper SELinux boolean is disabled: -$ getsebool samba_portmapper +Run the following command to determine if the httpd_ssi_exec SELinux boolean is disabled: +$ getsebool httpd_ssi_exec If properly configured, the output should show the following: -samba_portmapper --> off - Is it the case that samba_portmapper is not disabled? +httpd_ssi_exec --> off + Is it the case that httpd_ssi_exec is not disabled? - - To check that the rsyncd service is disabled in system boot configuration, + + To determine if NOPASSWD has been configured for the vdsm user for sudo, run the following command: -$ sudo systemctl is-enabled rsyncd -Output should indicate the rsyncd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rsyncd disabled - -Run the following command to verify rsyncd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rsyncd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the rsyncd is masked, run the following command: -$ sudo systemctl show rsyncd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: +$ sudo grep -ri nopasswd /etc/sudoers.d/ +The command should return output only for the vdsm user. + Is it the case that nopasswd is set for any users beyond vdsm? + + + + Verify that GRUB_DISABLE_RECOVERY is set to true in /etc/default/grub to disable recovery boot. +Run the following command: -LoadState=masked +$ sudo grep GRUB_DISABLE_RECOVERY /etc/default/grub + Is it the case that GRUB_DISABLE_RECOVERY is not set to true or is missing? + + + + The runtime status of the vm.mmap_min_addr kernel parameter can be queried +by running the following command: +$ sysctl vm.mmap_min_addr +65536. -UnitFileState=masked - Is it the case that the "rsyncd" is loaded and not masked? + Is it the case that the correct value is not returned? - - To check the permissions of /etc/cron.monthly, + + To check the group ownership of /etc/passwd-, run the command: -$ ls -l /etc/cron.monthly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.monthly does not have unix mode -rwx------? +$ ls -lL /etc/passwd- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/passwd- does not have a group owner of root? - - To check that the ypbind service is disabled in system boot configuration, + + To check that the dhcpd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled ypbind -Output should indicate the ypbind service has either not been installed, +$ sudo systemctl is-enabled dhcpd +Output should indicate the dhcpd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ypbind disabled +$ sudo systemctl is-enabled dhcpd disabled -Run the following command to verify ypbind is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ypbind +Run the following command to verify dhcpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active dhcpd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the ypbind is masked, run the following command: -$ sudo systemctl show ypbind | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the dhcpd is masked, run the following command: +$ sudo systemctl show dhcpd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "ypbind" is loaded and not masked? + Is it the case that the "dhcpd" is loaded and not masked? - - To determine if the system is configured to audit unsuccessful calls -to the removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify that a separate file system/partition has been created for /var/log/audit with the following command: - Is it the case that no line is returned? - - - - -Run the following command to determine if the selinuxuser_share_music SELinux boolean is disabled: -$ getsebool selinuxuser_share_music -If properly configured, the output should show the following: -selinuxuser_share_music --> off - Is it the case that selinuxuser_share_music is not disabled? - - - - The runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.drop_gratuitous_arp -1. +$ mountpoint /var/log/audit - Is it the case that the correct value is not returned? - - - - -Run the following command to determine if the exim_manage_user_files SELinux boolean is disabled: -$ getsebool exim_manage_user_files -If properly configured, the output should show the following: -exim_manage_user_files --> off - Is it the case that exim_manage_user_files is not disabled? + Is it the case that "/var/log/audit is not a mountpoint" is returned? - - To check that the oddjobd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled oddjobd -Output should indicate the oddjobd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled oddjobd disabled + + If FTP services are not installed, this is not applicable. -Run the following command to verify oddjobd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active oddjobd +To verify this configuration, run the following command: -If the service is not running the command will return the following output: -inactive +grep "banner_file" /etc/vsftpd/vsftpd.conf -The service will also be masked, to check that the oddjobd is masked, run the following command: -$ sudo systemctl show oddjobd | grep "LoadState\|UnitFileState" -If the service is masked the command will return the following outputs: +The output should show the value of banner_file is set to /etc/issue, an example of which is shown below: -LoadState=masked +$ sudo grep "banner_file" /etc/vsftpd/vsftpd.conf -UnitFileState=masked - Is it the case that the "oddjobd" is loaded and not masked? +banner_file=/etc/issue + Is it the case that it does not? - - -If the system is configured to prevent the loading of the dccp kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the dccp kernel module via blacklist keyword. + + The runtime status of the net.ipv6.conf.all.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_source_route +0. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r dccp /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Run the following command to check for duplicate group names: -Check that the operating system contains no duplicate group names for interactive users by running the following command: + + To verify the boot loader superuser account has been set, run the following +command: +sudo grep -A1 "superusers" /boot/efi/EFI/redhat/grub.cfg +The output should show the following: +set superusers="superusers-account" +export superusers +where superusers-account is the actual account name different from common names like root, +admin, or administrator and different from any other existing user name. + Is it the case that superuser account is not set or is set to an existing name or to a common name? + + + + The reviewed should make a note of the name of the account being used for +the web service. This information may be needed later in the SRR. There +may also be other server services running related to the web server in +support of a particular web application, these passwords must be entrusted +to the SA or Web Manager as well. - cut -d : -f 3 /etc/group | uniq -d +Query the SA or Web Manager to determine if they have the web service +password(s). -If output is produced, this is a finding. -Configure the operating system to contain no duplicate names for groups. -Edit the file "/etc/group" and provide each group that has a duplicate group id with a unique group id. - Is it the case that the system has duplicate group ids? +NOTE: For installations that run as a service, or without a password, +the SA or Web Manager having an Admin account on the system would meet +the intent of this check. + Is it the case that the web server password(s) are not entrusted to the SA or Web Manager? - - -If the system is configured to prevent the loading of the cfg80211 kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the cfg80211 kernel module via blacklist keyword. + + Verify the nosuid option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . nosuid . . . -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r cfg80211 /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the "/var/log" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_can_connect_zabbix SELinux boolean is disabled: -$ getsebool httpd_can_connect_zabbix +Run the following command to determine if the httpd_dontaudit_search_dirs SELinux boolean is disabled: +$ getsebool httpd_dontaudit_search_dirs If properly configured, the output should show the following: -httpd_can_connect_zabbix --> off - Is it the case that httpd_can_connect_zabbix is not disabled? +httpd_dontaudit_search_dirs --> off + Is it the case that httpd_dontaudit_search_dirs is not disabled? - - Run the following command to determine if the policycoreutils package is installed: $ rpm -q policycoreutils - Is it the case that the policycoreutils package is not installed? + + +Run the following command to determine if the xguest_connect_network SELinux boolean is disabled: +$ getsebool xguest_connect_network +If properly configured, the output should show the following: +xguest_connect_network --> off + Is it the case that xguest_connect_network is not disabled? - + -If the system is configured to prevent the loading of the bluetooth kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. +To properly set the owner of /var/log/httpd, run the command: +$ sudo chown root /var/log/httpd -These lines can also instruct the module loading system to ignore the bluetooth kernel module via blacklist keyword. +To properly set the owner of /var/log/httpd/*, run the command: +$ sudo chown root /var/log/httpd/* + Is it the case that ? + + + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r bluetooth /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - To check the status of the idle screen lock activation, run the following command: - -$ gsettings get org.gnome.desktop.screensaver lock-enabled -If properly configured, the output should be true. -To ensure that users cannot change how long until the screensaver locks, run the following: -$ grep lock-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled - Is it the case that screensaver locking is not enabled and/or has not been set or configured correctly? + + Verify all local interactive users on Red Hat Enterprise Linux 8 are assigned a home +directory upon creation with the following command: +$ grep -i create_home /etc/login.defs +CREATE_HOME yes + Is it the case that the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out? - - To verify the audispd plugin encrypts audit records off-loaded onto a different -system or media from the system being audited, run the following command: - -$ sudo grep -i transport /etc/audit/audisp-remote.conf -The output should return the following: -transport = KRB5 - Is it the case that audispd is not encrypting audit records when sent over the network? + + +Run the following command to determine if the fips_mode SELinux boolean is enabled: +$ getsebool fips_mode +If properly configured, the output should show the following: +fips_mode --> on + Is it the case that fips_mode is not enabled? - - To check the ownership of /boot/efi/EFI/redhat/user.cfg, + + To check the ownership of /var/log/messages, run the command: -$ ls -lL /boot/efi/EFI/redhat/user.cfg +$ ls -lL /var/log/messages If properly configured, the output should indicate the following owner: root - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have an owner of root? + Is it the case that /var/log/messages does not have an owner of root? - - To check the group ownership of /boot/grub2/grub.cfg, -run the command: -$ ls -lL /boot/grub2/grub.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/grub2/grub.cfg does not have a group owner of root? + + +Run the following command to determine if the xserver_object_manager SELinux boolean is disabled: +$ getsebool xserver_object_manager +If properly configured, the output should show the following: +xserver_object_manager --> off + Is it the case that xserver_object_manager is not disabled? - - Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. - -Determine the location of the tmux script with the following command: - -$ sudo grep tmux /etc/bashrc /etc/profile.d/* - -/etc/profile.d/tmux.sh: case "$name" in (sshd|login) exec tmux ;; esac - -Review the tmux script by using the following example: - -$ cat /etc/profile.d/tmux.sh - -if [ "$PS1" ]; then -parent=$(ps -o ppid= -p $$) -name=$(ps -o comm= -p $parent) -case "$name" in (sshd|login) exec tmux ;; esac -fi - -If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. - -Determine if tmux is currently running with the following command: + + The runtime status of the net.ipv4.conf.default.send_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.send_redirects +0. -$ sudo ps all | grep tmux | grep -v grep - Is it the case that the command does not produce output? - - - - To ensure screen locking on smartcard removal is enabled, run the following command: -$ grep removal-action /etc/dconf/db/local.d/* -The output should be 'lock-screen'. -To ensure that users cannot disable screen locking on smartcard removal, run the following: -$ grep removal-action /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/settings-daemon/peripherals/smartcard/removal-action - Is it the case that removal-action has not been configured? + Is it the case that the correct value is not returned? - - Verify that Red Hat Enterprise Linux 8 does not have unauthorized IP tunnels configured. - - -# yum list installed libreswan -libreswan.x86-64 3.20-5.el7_4 - - -If "libreswan" is installed, check to see if the "IPsec" service is active with the following command: - -# systemctl status ipsec -ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec -Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) -Active: inactive (dead) - - -If the "IPsec" service is active, check for configured IPsec connections (conn), perform the following: -grep -rni conn /etc/ipsec.conf /etc/ipsec.d/ -Verify any returned results for organizational approval. - Is it the case that the IPSec tunnels are not approved? + + To verify that there are no unauthorized local user accounts, run the following command: +$ less /etc/passwd +Inspect the results, and if unauthorized local user accounts exist, remove them by running +the following command: +$ sudo userdel unauthorized_user + Is it the case that there are unauthorized local user accounts on the system? - - To check the group ownership of /boot/efi/EFI/redhat/user.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/user.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have a group owner of root? + + To determine if LDAP is being used for authentication, use the following +command: +$ sudo grep -i useldapauth /etc/sysconfig/authconfig +The output should return: +USELDAPAUTH=yes + Is it the case that USELDAPAUTH=yes is not configured correctly in /etc/sysconfig/authconfig? - - To check the permissions of /boot/efi/EFI/redhat/user.cfg, -run the command: -$ ls -l /boot/efi/EFI/redhat/user.cfg -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /boot/efi/EFI/redhat/user.cfg does not have unix mode -rw-------? + + +Run the following command to determine if the daemons_enable_cluster_mode SELinux boolean is disabled: +$ getsebool daemons_enable_cluster_mode +If properly configured, the output should show the following: +daemons_enable_cluster_mode --> off + Is it the case that daemons_enable_cluster_mode is not disabled? - - Check that the symlink exists and target the correct Kerberos crypto policy, with the following command: -file /etc/krb5.conf.d/crypto-policies -If command ouput shows the following line, Kerberos is configured to use the system-wide crypto policy. -/etc/krb5.conf.d/crypto-policies: symbolic link to /etc/crypto-policies/back-ends/krb5.config - Is it the case that the symlink does not exist or points to a different target? + + To verify if LogFormat is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i logformat /etc/httpd/conf/httpd.conf +The output should contain the following: +LogFormat "a %A %h %H %l %m %s %t %u %U \"%{Referer}i\" \"%{User-Agent}i\"" combined + Is it the case that it is not? - - To check the permissions of /etc/ssh/*.pub, -run the command: -$ ls -l /etc/ssh/*.pub -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/ssh/*.pub does not have unix mode -rw-r--r--? + + To preclude access to the servers root directory, ensure the following +directive is in the httpd.conf file. This entry will also stop users +from setting up .htaccess files which can override security features +configured in /etc/httpd/conf/httpd.conf. +AllowOverride none + Is it the case that it is not? - - To verify the INACTIVE setting, run the following command: -$ grep "INACTIVE" /etc/default/useradd -The output should indicate the INACTIVE configuration option is set -to an appropriate integer as shown in the example below: -$ grep "INACTIVE" /etc/default/useradd -INACTIVE= - Is it the case that the value of INACTIVE is greater than the expected value or is -1? + + To determine how the SSH daemon's LogLevel option is set, run the following command: + +$ sudo grep -i LogLevel /etc/ssh/sshd_config + +If a line indicating VERBOSE is returned, then the required value is set. + + Is it the case that the required value is not set? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-success.rules -The output has to be exactly as follows: -## Successful permission change --a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change --a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-perm-change - Is it the case that the file does not exist or the content differs? + + If the system is not configured to audit time changes, this is a finding. +If the system is 64-bit only, this is not applicable +ocil: | +To determine if the system is configured to audit calls to the +stime system call, run the following command: +$ sudo grep "stime" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - + -Run the following command to determine if the smbd_anon_write SELinux boolean is disabled: -$ getsebool smbd_anon_write +Run the following command to determine if the httpd_mod_auth_pam SELinux boolean is disabled: +$ getsebool httpd_mod_auth_pam If properly configured, the output should show the following: -smbd_anon_write --> off - Is it the case that smbd_anon_write is not disabled? +httpd_mod_auth_pam --> off + Is it the case that httpd_mod_auth_pam is not disabled? - - Verify it by running the following command: -$ stat -c "%n %G" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules - -/sbin/auditctl root -/sbin/aureport root -/sbin/ausearch root -/sbin/autrace root -/sbin/auditd root -/sbin/audispd root -/sbin/augenrules root - - -If the command does not return all the above lines, the missing ones -need to be added. - -Run the following command to correct the permissions of the missing -entries: -$ sudo chown :root [audit_tool] - -Replace "[audit_tool]" with each audit tool not group-owned by root. - Is it the case that ? + + To verify if the OpenSSH server uses defined Crypto Policy, run: +$ grep 'CRYPTO_POLICY' /etc/crypto-policies/back-ends/opensshserver.config | tail -n 1 +and verify that the line matches +CRYPTO_POLICY='-oCiphers=aes256-ctr,aes128-ctr,aes256-cbc,aes128-cbc -oMACs=hmac-sha2-512,hmac-sha2-256 -oGSSAPIKeyExchange=no -oKexAlgorithms=ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 -oHostKeyAlgorithms=ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -oPubkeyAcceptedKeyTypes=rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256' + Is it the case that Crypto Policy for OpenSSH Server is not configured according to CC requirements? - + + Run the following command to determine if the rear package is installed: $ rpm -q rear + Is it the case that the package is not installed? + + + + Run the following command to determine if the abrt-addon-kerneloops package is installed: +$ rpm -q abrt-addon-kerneloops + Is it the case that the package is installed? + + + -Run the following command to determine if the httpd_enable_cgi SELinux boolean is disabled: -$ getsebool httpd_enable_cgi +Run the following command to determine if the use_fusefs_home_dirs SELinux boolean is disabled: +$ getsebool use_fusefs_home_dirs If properly configured, the output should show the following: -httpd_enable_cgi --> off - Is it the case that httpd_enable_cgi is not disabled? +use_fusefs_home_dirs --> off + Is it the case that use_fusefs_home_dirs is not disabled? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_VMAP_STACK /boot/config.* + $ grep CONFIG_DEBUG_CREDENTIALS /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - - -Run the following command to determine the current status of the -rsyslog service: -$ sudo systemctl is-active rsyslog -If the service is running, it should return the following: active - Is it the case that the "rsyslog" service is disabled, masked, or not started.? - - - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd with the following command: + + Inspect the list of enabled firewall ports and verify they are configured correctly by running +the following command: -$ sudo auditctl -l | grep -E '(/etc/shadow)' +$ sudo firewall-cmd --list-all --w /etc/shadow -p wa -k identity - Is it the case that command does not return a line, or the line is commented out? +Ask the System Administrator for the site or program Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA). Verify the services allowed by the firewall match the PPSM CLSA. + Is it the case that there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), or there are no firewall rules configured? - - -If the system is configured to prevent the loading of the sctp kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + The following command will locate the mount points related to local devices: +$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -These lines can also instruct the module loading system to ignore the sctp kernel module via blacklist keyword. +The following command will show files which do not belong to a valid group: +$ sudo find MOUNTPOINT -xdev -nogroup 2>/dev/null -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r sctp /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - The runtime status of the net.ipv6.conf.all.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_redirects -0. +Replace MOUNTPOINT by the mount points listed by the fist command. - Is it the case that the correct value is not returned? +No files without a valid group should be located. + Is it the case that there is output? - - To check that the acpid service is disabled in system boot configuration, + + To check that the cockpit service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled acpid -Output should indicate the acpid service has either not been installed, +$ sudo systemctl is-enabled cockpit +Output should indicate the cockpit service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled acpid disabled +$ sudo systemctl is-enabled cockpit disabled -Run the following command to verify acpid is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active acpid +Run the following command to verify cockpit is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cockpit If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the acpid is masked, run the following command: -$ sudo systemctl show acpid | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the cockpit is masked, run the following command: +$ sudo systemctl show cockpit | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "acpid" is loaded and not masked? + Is it the case that the "cockpit" is loaded and not masked? - - -Run the following command to determine if the secure_mode SELinux boolean is disabled: -$ getsebool secure_mode -If properly configured, the output should show the following: -secure_mode --> off - Is it the case that secure_mode is not disabled? + + Run the following command to determine if the openssh-clients package is installed: $ rpm -q openssh-clients + Is it the case that the package is not installed? - - The following command will discover and print world-writable directories that -are not owned by root. Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -uid +0 -print - Is it the case that there are world-writable directories not owned by root? + + Ensure that debug-shell service is not enabled with the following command: +sudo grep -L "^options\s+.*\bsystemd.debug-shell=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that enables the debug-shell. + Is it the case that the comand returns a line? - + -Run the following command to determine if the zoneminder_anon_write SELinux boolean is disabled: -$ getsebool zoneminder_anon_write +Run the following command to determine if the mozilla_plugin_can_network_connect SELinux boolean is disabled: +$ getsebool mozilla_plugin_can_network_connect If properly configured, the output should show the following: -zoneminder_anon_write --> off - Is it the case that zoneminder_anon_write is not disabled? +mozilla_plugin_can_network_connect --> off + Is it the case that mozilla_plugin_can_network_connect is not disabled? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +To ensure the login warning banner text is properly set, run the following: +$ grep banner-message-text /etc/dconf/db/gdm.d/* +If properly configured, the proper banner text will appear. +To ensure the login warning banner text is locked and cannot be changed by a user, run the following: +$ grep banner-message-text /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/banner-message-text. + Is it the case that it does not? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv4.conf.default.log_martians kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.log_martians +1. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the virt_sandbox_use_mknod SELinux boolean is disabled: -$ getsebool virt_sandbox_use_mknod -If properly configured, the output should show the following: -virt_sandbox_use_mknod --> off - Is it the case that virt_sandbox_use_mknod is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_SHA512 /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify that each web content directory exists on separate partitions, -run the following command: -$ grep `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` /etc/fstab -Each of the corresponding DocumentRoot entries should have a -corresponding entry in /etc/fstab. - Is it the case that it is not? + + Run the following command to determine if the abrt package is installed: +$ rpm -q abrt + Is it the case that the package is installed? - - To check that the certmonger service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled certmonger -Output should indicate the certmonger service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled certmonger disabled - -Run the following command to verify certmonger is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active certmonger - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the certmonger is masked, run the following command: -$ sudo systemctl show certmonger | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked + + To determine if the system is configured to audit successful calls +to the lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -UnitFileState=masked - Is it the case that the "certmonger" is loaded and not masked? - - - - -Run the following command to determine if the samba_domain_controller SELinux boolean is disabled: -$ getsebool samba_domain_controller -If properly configured, the output should show the following: -samba_domain_controller --> off - Is it the case that samba_domain_controller is not disabled? + Is it the case that no line is returned? - - To check that the rhsmcertd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rhsmcertd -Output should indicate the rhsmcertd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rhsmcertd disabled - -Run the following command to verify rhsmcertd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rhsmcertd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the rhsmcertd is masked, run the following command: -$ sudo systemctl show rhsmcertd | grep "LoadState\|UnitFileState" + + Verify Red Hat Enterprise Linux 8 notifies the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: -If the service is masked the command will return the following outputs: +$ sudo grep -w space_left_action /etc/audit/auditd.conf -LoadState=masked +space_left_action = -UnitFileState=masked - Is it the case that the "rhsmcertd" is loaded and not masked? - - - - To determine if requiretty has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\brequiretty\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that requiretty is not enabled in sudo? +If the value of the "space_left_action" is not set to "", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. + Is it the case that there is no evidence that real-time alerts are configured on the system? @@ -375614,346 +375425,314 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/http/conf.d/* does not have unix mode -rw-r-----? - - Run the following command to determine if the McAfeeTP package is installed: $ rpm -q McAfeeTP - Is it the case that the package is not installed? - - - - -Run the following command to determine if the lsmd_plugin_connect_any SELinux boolean is disabled: -$ getsebool lsmd_plugin_connect_any -If properly configured, the output should show the following: -lsmd_plugin_connect_any --> off - Is it the case that lsmd_plugin_connect_any is not disabled? + + To ensure that remote access connections are encrypted, run the following command: +$ gsettings get org.gnome.Vino require-encrpytion +If properly configured, the output should be true. +To ensure that users cannot disable encrypted remote connections, run the following: +$ grep require-encryption /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/Vino/require-encryption + Is it the case that remote access connections are not encrypted? - - -Run the following command to determine if the httpd_can_network_memcache SELinux boolean is disabled: -$ getsebool httpd_can_network_memcache -If properly configured, the output should show the following: -httpd_can_network_memcache --> off - Is it the case that httpd_can_network_memcache is not disabled? + + The runtime status of the net.ipv4.tcp_syncookies kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.tcp_syncookies +1. + + Is it the case that the correct value is not returned? - - To check the group ownership of /etc/issue.net, + + To check the permissions of /etc/ssh/*.pub, run the command: -$ ls -lL /etc/issue.net -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/issue.net does not have a group owner of root? +$ ls -l /etc/ssh/*.pub +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/ssh/*.pub does not have unix mode -rw-r--r--? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudo" command with the following command: - -$ sudo auditctl -l | grep sudo - --a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudo - Is it the case that the command does not return a line, or the line is commented out? + + To verify that only security updates will be automatically installed by dnf-automatic, run the following command: +$ sudo grep upgrade_type /etc/dnf/automatic.conf +The output should return the following: +upgrade_type = security + Is it the case that the upgrade_type is not set to security? - + -Run the following command to determine if the polipo_session_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool polipo_session_bind_all_unreserved_ports +Run the following command to determine if the saslauthd_read_shadow SELinux boolean is disabled: +$ getsebool saslauthd_read_shadow If properly configured, the output should show the following: -polipo_session_bind_all_unreserved_ports --> off - Is it the case that polipo_session_bind_all_unreserved_ports is not disabled? +saslauthd_read_shadow --> off + Is it the case that saslauthd_read_shadow is not disabled? - + -Run the following command to determine if the httpd_use_cifs SELinux boolean is disabled: -$ getsebool httpd_use_cifs +Run the following command to determine if the boinc_execmem SELinux boolean is disabled: +$ getsebool boinc_execmem If properly configured, the output should show the following: -httpd_use_cifs --> off - Is it the case that httpd_use_cifs is not disabled? - - - - To ensure LoginGraceTime is set correctly, run the following command: -$ sudo grep LoginGraceTime /etc/ssh/sshd_config -If properly configured, the output should be: -LoginGraceTime -If the option is set to a number greater than 0, then the unauthenticated session will be disconnected -after the configured number seconds. - Is it the case that it is commented out or not configured properly? - - - - To determine how the SSH daemon's LogLevel option is set, run the following command: - -$ sudo grep -i LogLevel /etc/ssh/sshd_config - -If a line indicating VERBOSE is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - Verify Red Hat Enterprise Linux 8 prevents the use of dictionary words for passwords with the following command: - -$ sudo grep dictcheck /etc/security/pwquality.conf /etc/pwquality.conf.d/*.conf - -/etc/security/pwquality.conf:dictcheck=1 - Is it the case that "dictcheck" does not have a value other than "0", or is commented out? +boinc_execmem --> off + Is it the case that boinc_execmem is not disabled? - + -Run the following command to determine if the httpd_mod_auth_ntlm_winbind SELinux boolean is disabled: -$ getsebool httpd_mod_auth_ntlm_winbind +Run the following command to determine if the mozilla_plugin_use_gps SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_gps If properly configured, the output should show the following: -httpd_mod_auth_ntlm_winbind --> off - Is it the case that httpd_mod_auth_ntlm_winbind is not disabled? - - - - Run the following command to determine if the bind package is installed: -$ rpm -q bind - Is it the case that the package is installed? - - - - To verify that McAfee Endpoint Security for Linux is -running, run the following command: -$ sudo ps -ef | grep -i mfetpd - Is it the case that virus scanning software is not running? - - - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep newgidmap /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? - - - - To check if MaxStartups is configured, run the following command: -$ sudo grep MaxStartups /etc/ssh/sshd_config -If configured, this command should output the configuration. - Is it the case that maxstartups is not configured? +mozilla_plugin_use_gps --> off + Is it the case that mozilla_plugin_use_gps is not disabled? - - Review the web site to determine if HTTP and HTTPs are used in accordance with -well known ports (e.g., 80 and 443) or those ports and services as registered -and approved for use by the DoD PPSM. + + Check to see if Online Certificate Status Protocol (OCSP) +is enabled and using the proper digest value on the system with the following command: +$ sudo grep certificate_verification /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf | grep -v "^#" +If configured properly, output should look like -To configure firewalld to allow http access, run the following command(s): -firewall-cmd --permanent --add-service=http -Then run the following command to load the newly created rule(s): -firewall-cmd --reload + certificate_verification = ocsp_dgst= -To configure firewalld to allow https access, run the following command(s): -firewall-cmd --permanent --add-service=https -Then run the following command to load the newly created rule(s): -firewall-cmd --reload - Is it the case that it is not? + Is it the case that certificate_verification in sssd is not configured? - - Verify the TFTP daemon is configured to operate in secure mode. - -Check if a TFTP server is installed with the following command: - -$ rpm -qa | grep tftp - - -If a TFTP server is not installed, this is Not Applicable. - - -If a TFTP server is installed, verify TFTP is configured by with -the -s option by running the following command: - -grep "server_args" /etc/xinetd.d/tftp -server_args = -s - Is it the case that '"server_args" line does not have a "-s" option, and a subdirectory is not assigned'? + + The rsh package can be removed with the following command: $ sudo yum erase rsh + Is it the case that ? - - - The runtime status of the kernel.perf_cpu_time_max_percent kernel parameter can be queried + + + The runtime status of the kernel.unprivileged_bpf_disabled kernel parameter can be queried by running the following command: -$ sysctl kernel.perf_cpu_time_max_percent +$ sysctl kernel.unprivileged_bpf_disabled 1. Is it the case that the correct value is not returned? - - Verify the hidepid=value option is configured for the /proc mount point, - run the following command: - $ sudo mount | grep '\s/proc\s' - . . . /proc . . . hidepid=value . . . - - Is it the case that the "/proc" file system does not have the "hidepid=value" option set? + + Run the following command to determine if the nftables package is installed: $ rpm -q nftables + Is it the case that the package is not installed? - - Check group owners of the system audit logs. + + The runtime status of the kernel.panic_on_oops kernel parameter can be queried +by running the following command: +$ sysctl kernel.panic_on_oops +1. -First, determine where the audit log file is located. + Is it the case that the correct value is not returned? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the ftruncate system call. -$ sudo grep -iw ^log_file /etc/audit/auditd.conf -log_file = /var/log/audit/audit.log +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -The log_file option specifies the audit log file path. -If the log_file option isn't defined, check all files within /var/log/audit directory. +$ sudo grep -r ftruncate /etc/audit/rules.d +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -Then, determine the audit log group by running the following command: -$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf +$ sudo grep ftruncate /etc/audit/audit.rules +The output should be the following: -Then, check that the audit log file is owned by the correct group. -Run the following command to display the owner of the audit log file: +-a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? + + + + To ensure ClientAliveInterval is set correctly, run the following command: -$ sudo stat -c "%n %G" log_file +$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveCountMax 0 -The audit log file must be owned by the log_group or by root if the log_group is not specified. - Is it the case that audit log files are owned by incorrect group? +In this case, the SSH timeout occurs precisely when +the ClientAliveInterval is set. + Is it the case that it is commented out or not configured properly? - + -Run the following command to determine if the xdm_write_home SELinux boolean is disabled: -$ getsebool xdm_write_home +Run the following command to determine if the guest_exec_content SELinux boolean is disabled: +$ getsebool guest_exec_content If properly configured, the output should show the following: -xdm_write_home --> off - Is it the case that xdm_write_home is not disabled? +guest_exec_content --> off + Is it the case that guest_exec_content is not disabled? - - To verify all squashing has been disabled, run the following command: -$ grep all_squash /etc/exports - Is it the case that there is output? + + Run the following command to determine if the libreswan package is installed: $ rpm -q libreswan + Is it the case that the package is not installed? - - To verify the operating system implements cryptography to protect the integrity of -remote ldap access sessions, run the following command: -$ sudo grep ldap_tls_cacertdir /etc/sssd/sssd.conf -The output should return the following with a correctly configured CA cert path: -ldap_tls_cacertdir /path/to/tls/cacert - Is it the case that the TLS CA cert is not configured? + + +Run the following command to determine if the polipo_session_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool polipo_session_bind_all_unreserved_ports +If properly configured, the output should show the following: +polipo_session_bind_all_unreserved_ports --> off + Is it the case that polipo_session_bind_all_unreserved_ports is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chsh" command with the following command: + + -$ sudo auditctl -l | grep chsh +Run the following command to determine the current status of the +crond service: +$ sudo systemctl is-active crond +If the service is running, it should return the following: active + Is it the case that ? + + + + To verify the openldap-servers package is not installed, run the +following command: +$ rpm -q openldap-servers +The output should show the following: +package openldap-servers is not installed + Is it the case that it does not? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfacl" command with the following command: --a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chsh +$ sudo auditctl -l | grep setfacl + +-a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod Is it the case that the command does not return a line, or the line is commented out? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_FORCE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/lastlog" with the following command: + +$ sudo auditctl -l | grep /var/log/lastlog + +-w /var/log/lastlog -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the psacct package is installed: $ rpm -q psacct - Is it the case that the package is not installed? + + Run the following command to ensure that /var/tmp is configured as a +polyinstantiated directory: +$ sudo grep /var/tmp /etc/security/namespace.conf +The output should return the following: +/var/tmp /var/tmp/tmp-inst/ level root,adm + Is it the case that is not configured? - - Verify the nosuid option is configured for the /dev/shm mount point, - run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . nosuid . . . + + Verify the site's network diagram and visually check the web server, to +ensure that the private web server is located on a separate controlled +access subnet and is not part of the public DMZ that houses the public +web servers. - Is it the case that the "/dev/shm" file system does not have the "nosuid" option set? +In addition, the private web server needs to be isolated via a controlled +access mechanism from the local general population lan. + Is it the case that the private web server is not on a separate controlled access subnet? - - - -Run the following command to determine the current status of the -pcscd service: -$ sudo systemctl is-active pcscd -If the service is running, it should return the following: active - Is it the case that the pcscd service is not enabled? + + Run the following command to determine if the sssd package is installed: $ rpm -q sssd + Is it the case that the package is not installed? - - Verify the audit log directories have a correct mode or less permissive mode. - -Find the location of the audit logs: - -$ sudo grep "^log_file" /etc/audit/auditd.conf - - - -Run the following command to check the mode of the system audit logs: - -$ sudo stat -c "%a %n" [audit_log_directory] + + To determine how the SSH daemon's PermitRootLogin option is set, run the following command: -Replace "[audit_log_directory]" to the correct audit log directory path, by default this location is "/var/log/audit". +$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config +If a line indicating no is returned, then the required value is set. -The correct permissions are 0700 - Is it the case that audit logs have a more permissive mode? + Is it the case that the required value is not set? - - To check the group ownership of /var/log, -run the command: -$ ls -lL /var/log -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /var/log does not have a group owner of root? + + +Run the following command to determine if the dbadm_manage_user_files SELinux boolean is disabled: +$ getsebool dbadm_manage_user_files +If properly configured, the output should show the following: +dbadm_manage_user_files --> off + Is it the case that dbadm_manage_user_files is not disabled? - - To check the group ownership of /etc/cron.d, -run the command: -$ ls -lL /etc/cron.d -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.d does not have a group owner of root? + + +Run the following command to determine if the rsync_anon_write SELinux boolean is disabled: +$ getsebool rsync_anon_write +If properly configured, the output should show the following: +rsync_anon_write --> off + Is it the case that rsync_anon_write is not disabled? - - To check the group ownership of /etc/cron.monthly, -run the command: -$ ls -lL /etc/cron.monthly -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.monthly does not have a group owner of root? + + Verify that local initialization files do not execute world-writable programs with the following command: + +Note: The example will be for a system that is configured to create user home directories in the "/home" directory. + +$ sudo find /home -perm -002 -type f -name ".[^.]*" -exec ls -ld {} \; + Is it the case that any local initialization files are found to reference world-writable files? - - Inspect the system to determine if intrusion detection software has been installed. -Verify this intrusion detection software is active. - Is it the case that no host-based intrusion detection tools are installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODIFY_LDT_SYSCALL /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the tftp_anon_write SELinux boolean is disabled: -$ getsebool tftp_anon_write +Run the following command to determine if the fenced_can_ssh SELinux boolean is disabled: +$ getsebool fenced_can_ssh If properly configured, the output should show the following: -tftp_anon_write --> off - Is it the case that tftp_anon_write is not disabled? +fenced_can_ssh --> off + Is it the case that fenced_can_ssh is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the mock_enable_homedirs SELinux boolean is disabled: +$ getsebool mock_enable_homedirs +If properly configured, the output should show the following: +mock_enable_homedirs --> off + Is it the case that mock_enable_homedirs is not disabled? + + + + Verify Red Hat Enterprise Linux 8 disables core dump backtraces by issuing the following command: + +$ grep -i process /etc/systemd/coredump.conf + +ProcessSizeMax=0 + Is it the case that the "ProcessSizeMax" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + + + Verify that Red Hat Enterprise Linux 8 has configured the minimum time period between password changes for each user account is one day or greater with the following command: + +$ sudo awk -F: '$4 < 1 {print $1 " " $4}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? + + + + To verify the number of rounds for the password hashing algorithm is configured, run the following command: +$ sudo grep rounds /etc/pam.d/system-auth +The output should show the following match: +password sufficient pam_unix.so sha512 rounds= + Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? @@ -375975,122 +375754,247 @@ If properly configured, the output should indicate the following permissions: Is it the case that /etc/security/opasswd does not have an owner of root and /etc/security/opasswd does not have a group owner of root and /etc/security/opasswd does not have unix mode 0600? - - To determine whether yum has been configured to disable -gpgcheck for any repos, inspect all files in -/etc/yum.repos.d and ensure the following does not appear in any -sections: -gpgcheck=0 -A value of 0 indicates that gpgcheck has been disabled for that repo. - Is it the case that GPG checking is disabled? - - - + -Run the following command to determine if the postgresql_selinux_unconfined_dbadm SELinux boolean is enabled: -$ getsebool postgresql_selinux_unconfined_dbadm +Run the following command to determine if the httpd_tty_comm SELinux boolean is disabled: +$ getsebool httpd_tty_comm If properly configured, the output should show the following: -postgresql_selinux_unconfined_dbadm --> on - Is it the case that postgresql_selinux_unconfined_dbadm is not enabled? +httpd_tty_comm --> off + Is it the case that httpd_tty_comm is not disabled? - - Verify that the SA and ISSO (at a minimum) are notified when the audit storage volume is full. + + Verify that a separate file system/partition has been created for /var with the following command: -Check which action Red Hat Enterprise Linux 8 takes when the audit storage volume is full with the following command: +$ mountpoint /var -$ sudo grep max_log_file_action /etc/audit/auditd.conf -max_log_file_action = - Is it the case that the value of the "max_log_file_action" option is set to "ignore", "rotate", or "suspend", or the line is commented out? + Is it the case that "/var is not a mountpoint" is returned? - + -Run the following command to determine if the xserver_object_manager SELinux boolean is disabled: -$ getsebool xserver_object_manager +Run the following command to determine if the varnishd_connect_any SELinux boolean is disabled: +$ getsebool varnishd_connect_any If properly configured, the output should show the following: -xserver_object_manager --> off - Is it the case that xserver_object_manager is not disabled? +varnishd_connect_any --> off + Is it the case that varnishd_connect_any is not disabled? - - To check the permissions of /etc/ssh/*_key, + + Verify it by running the following command: +$ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + +/sbin/auditctl root +/sbin/aureport root +/sbin/ausearch root +/sbin/autrace root +/sbin/auditd root +/sbin/audispd root +/sbin/augenrules root + + +If the command does not return all the above lines, the missing ones +need to be added. + +Run the following command to correct the permissions of the missing +entries: +$ sudo chown root [audit_tool] + +Replace "[audit_tool]" with each audit tool not owned by root. + Is it the case that ? + + + + Verify that Red Hat Enterprise Linux 8 is configured to take action in the event of allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: + +$ sudo grep admin_space_left_action /etc/audit/auditd.conf + +admin_space_left_action = single + +If the value of the "admin_space_left_action" is not set to "single", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. + Is it the case that there is no evidence that real-time alerts are configured on the system? + + + + To check the permissions of /etc/cron.hourly, run the command: -$ ls -l /etc/ssh/*_key +$ ls -l /etc/cron.hourly If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/ssh/*_key does not have unix mode -rw-------? +-rwx------ + Is it the case that /etc/cron.hourly does not have unix mode -rwx------? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes ipv6.disable=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*ipv6.disable=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*ipv6.disable=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'ipv6.disable=1' -The command should not return any output. - Is it the case that IPv6 is not disabled? + + To determine if passwd_timeout has been configured for sudo, run the following command: +$ sudo grep -ri '^Defaults.*passwd_timeout=' /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that passwd_timeout is not set with the appropriate value for sudo? - - To verify all local initialization files for interactive users are owned by the -primary user, run the following command: -$ sudo ls -al /home/USER/.* -The user initialization files should be owned by USER. - Is it the case that they are not? + + Run the following command to ensure postfix accepts mail messages from only the local system: +$ grep inet_interfaces /etc/postfix/main.cf +If properly configured, the output should show only . + Is it the case that it does not? - + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + -Run the following command to determine if the httpd_anon_write SELinux boolean is disabled: -$ getsebool httpd_anon_write +Run the following command to determine if the sanlock_use_fusefs SELinux boolean is disabled: +$ getsebool sanlock_use_fusefs If properly configured, the output should show the following: -httpd_anon_write --> off - Is it the case that httpd_anon_write is not disabled? +sanlock_use_fusefs --> off + Is it the case that sanlock_use_fusefs is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the creat system call. + + To determine if the system is configured to audit calls to the +fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the truncate system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r creat /etc/audit/rules.d +$ sudo grep -r truncate /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep creat /etc/audit/audit.rules +$ sudo grep truncate /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access Is it the case that the command does not return a line, or the line is commented out? - - To preclude access to the servers root directory, ensure the following -directive is in the httpd.conf file. This entry will also stop users -from setting up .htaccess files which can override security features -configured in /etc/httpd/conf/httpd.conf. -AllowOverride none + + To determine if the system is configured to audit calls to the +mount system call, run the following command: +$ sudo grep "mount" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_TABLE_ISOLATION /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the permissions of /etc/shadow-, +run the command: +$ ls -l /etc/shadow- +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/shadow- does not have unix mode ----------? + + + + To ensure screen locking on smartcard removal is enabled, run the following command: +$ grep removal-action /etc/dconf/db/local.d/* +The output should be 'lock-screen'. +To ensure that users cannot disable screen locking on smartcard removal, run the following: +$ grep removal-action /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/settings-daemon/peripherals/smartcard/removal-action + Is it the case that removal-action has not been configured? + + + + +Run the following command to determine if the swift_can_network SELinux boolean is disabled: +$ getsebool swift_can_network +If properly configured, the output should show the following: +swift_can_network --> off + Is it the case that swift_can_network is not disabled? + + + + To verify that no .java and .jpp files exist, run the +following command: +find / -name *.java -o -name *.jpp +The output should not return any .java or .jpp files Is it the case that it is not? - - The runtime status of the fs.protected_symlinks kernel parameter can be queried -by running the following command: -$ sysctl fs.protected_symlinks -1. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_update" command with the following command: - Is it the case that the correct value is not returned? +$ sudo auditctl -l | grep unix_update + +-a always,exit -F path=/usr/bin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_update + Is it the case that the command does not return a line, or the line is commented out? + + + + To verify the nodev option is configured for non-root local partitions, run the following command: +$ sudo mount | grep '^/dev\S* on /\S' | grep --invert-match 'nodev' +The output shows local non-root partitions mounted without the nodev option, and there should be no output at all. + + Is it the case that some mounts appear among output lines? + + + + Verify the value of the "minclass" option in "/etc/security/pwquality.conf" with the following command: + +$ grep minclass /etc/security/pwquality.conf + +minclass = + Is it the case that the value of "minclass" is set to less than "<sub idref="var_password_pam_minclass" />" or is commented out? + + + + Verify an anti-virus solution is installed on the system. The anti-virus solution may be +bundled with an approved host-based security solution. + Is it the case that there is no anti-virus solution installed on the system? + + + + To check the ownership of /etc/cron.monthly, +run the command: +$ ls -lL /etc/cron.monthly +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.monthly does not have an owner of root? + + + + Verify that there are no wireless interfaces configured on the system +with the following command: + +Note: This requirement is Not Applicable for systems that do not have physical wireless network radios. + +$ nmcli device status +DEVICE TYPE STATE CONNECTION +virbr0 bridge connected virbr0 +wlp7s0 wifi connected wifiSSID +enp6s0 ethernet disconnected -- +p2p-dev-wlp7s0 wifi-p2p disconnected -- +lo loopback unmanaged -- +virbr0-nic tun unmanaged -- + Is it the case that a wireless interface is configured and has not been documented and approved by the Information System Security Officer (ISSO)? @@ -376104,1782 +376008,2055 @@ If the command does not return results or an error is returned, ask the SA to in Is it the case that there is no evidence that unauthorized peripherals are being blocked before establishing a connection? - - Verify the value of the "maxrepeat" option in "/etc/security/pwquality.conf" with the following command: - -$ grep maxrepeat /etc/security/pwquality.conf + + +To properly set the permissions of /etc/audit/, run the command: +$ sudo chmod 0640 /etc/audit/ -maxrepeat = - Is it the case that the value of "maxrepeat" is set to more than "<sub idref="var_password_pam_maxrepeat" />" or is commented out? +To properly set the permissions of /etc/audit/rules.d/, run the command: +$ sudo chmod 0640 /etc/audit/rules.d/ + Is it the case that ? - - Verify that the ipv6 loopback interface has required rules in order: -$ iptables -L INPUT -v -n - Is it the case that ipv6 loopback traffic is not configured? + + The runtime status of the kernel.core_uses_pid kernel parameter can be queried +by running the following command: +$ sysctl kernel.core_uses_pid +0. + Is it the case that the returned line does not have a value of 0? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers" with the following command: + + Run the following command to determine if the abrt-plugin-rhtsupport package is installed: +$ rpm -q abrt-plugin-rhtsupport + Is it the case that the package is installed? + + + + Verify file systems that are used for removable media are mounted with the "nodev" option with the following command: -$ sudo auditctl -l | grep /etc/sudoers +$ sudo more /etc/fstab --w /etc/sudoers -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? +UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 + Is it the case that a file system found in "/etc/fstab" refers to removable media and it does not have the "nodev" option set? - + + To verify the boot loader superuser password has been set, run the following command: +$ sudo grep "^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$" /boot/efi/EFI/redhat/user.cfg +The output should be similar to: +GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.C4E08AC72FBFF7E837FD267BFAD7AEB3D42DDC +2C99F2A94DD5E2E75C2DC331B719FE55D9411745F82D1B6CFD9E927D61925F9BBDD1CFAA0080E0 +916F7AB46E0D.1302284FCCC52CD73BA3671C6C12C26FF50BA873293B24EE2A96EE3B57963E6D7 +0C83964B473EC8F93B07FE749AA6710269E904A9B08A6BBACB00A2D242AD828 + Is it the case that no password is set? + + + + To check if the system motd banner is compliant, +run the following command: +$ cat /etc/motd + Is it the case that it does not display the required banner? + + + -Run the following command to determine if the gssd_read_tmp SELinux boolean is enabled: -$ getsebool gssd_read_tmp +Run the following command to determine if the ftpd_anon_write SELinux boolean is disabled: +$ getsebool ftpd_anon_write If properly configured, the output should show the following: -gssd_read_tmp --> on - Is it the case that gssd_read_tmp is not enabled? +ftpd_anon_write --> off + Is it the case that ftpd_anon_write is not disabled? - - If the system is not using TLS, set the ldap_id_use_start_tls option -in /etc/sssd/sssd.conf to true. - Is it the case that the 'ldap_id_use_start_tls' option is not set to 'true'? + + To check the group ownership of /etc/ssh/*_key, +run the command: +$ ls -lL /etc/ssh/*_key +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/ssh/*_key does not have a group owner of root? - - To ensure logs are sent to a remote host, examine the file -/etc/rsyslog.conf. -If using UDP, a line similar to the following should be present: - *.* @ -If using TCP, a line similar to the following should be present: - *.* @@ -If using RELP, a line similar to the following should be present: - *.* :omrelp: - Is it the case that no evidence that the audit logs are being off-loaded to another system or media? + + +Run the following command to determine if the piranha_lvs_can_network_connect SELinux boolean is disabled: +$ getsebool piranha_lvs_can_network_connect +If properly configured, the output should show the following: +piranha_lvs_can_network_connect --> off + Is it the case that piranha_lvs_can_network_connect is not disabled? - - -Verify that the shadow password suite configuration is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. - -Check the hashing algorithm that is being used to hash passwords with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "usermod" command with the following command: -$ sudo grep -i ENCRYPT_METHOD /etc/login.defs +$ sudo auditctl -l | grep usermod -ENCRYPT_METHOD - Is it the case that ENCRYPT_METHOD is not set to <sub idref="var_password_hashing_algorithm" />? +-a always,exit -F path=/usr/bin/usermod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-usermod + Is it the case that the command does not return a line, or the line is commented out? - - To check the permissions of /etc/http/conf, -run the command: -$ ls -l /etc/http/conf -If properly configured, the output should indicate the following permissions: --rwxr-x--- - Is it the case that ? + + To check that the psacct service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled psacct +Output should indicate the psacct service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled psacct disabled + +Run the following command to verify psacct is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active psacct + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the psacct is masked, run the following command: +$ sudo systemctl show psacct | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "psacct" is loaded and not masked? - - Display the contents of the file /etc/systemd/logind.conf: -cat /etc/systemd/logind.conf -Ensure that there is a section [login] which contains the -configuration StopIdleSessionSec=. - Is it the case that the option is not configured? + + To check if compression is enabled or set correctly, run the +following command: +$ sudo grep Compression /etc/ssh/sshd_config +If configured properly, output should be no or delayed. + Is it the case that it is commented out, or is not set to no or delayed? - - To find world-writable files, run the following command: -$ sudo find / -xdev -type f -perm -002 - Is it the case that there is output? + + System executables are stored in the following directories by default: +/bin +/sbin +/usr/bin +/usr/sbin +/usr/local/bin +/usr/local/sbin +To find system executables directories that are group-writable or +world-writable, run the following command for each directory DIR +which contains system executables: +$ sudo find -L DIR -perm /022 -type d + Is it the case that any of these files are group-writable or world-writable? - - Verify the nodev option is configured for the /tmp mount point, - run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . nodev . . . - - Is it the case that the "/tmp" file system does not have the "nodev" option set? + + To check that SELinux is not disabled at boot time; +Check that no boot entry disables selinux: +sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that disables SELinux. + Is it the case that SELinux is disabled at boot time? - - To determine if the system is configured to audit calls to the -removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + + Verify the operating system requires re-authentication +when using the "sudo" command to elevate privileges, run the following command: +sudo grep -ri '^Defaults.*timestamp_timeout' /etc/sudoers /etc/sudoers.d +The output should be: +/etc/sudoers:Defaults timestamp_timeout=0 or "timestamp_timeout" is set to a positive number. +If conflicting results are returned, this is a finding. + Is it the case that timestamp_timeout is not set with the appropriate value for sudo? + + + + Run the following command to determine open ports: +# ss -4tuln +Run the following command to determine firewall rules: +# iptables -L INPUT -v -n +For each port identified in the audit which does not have a firewall +rule, add rule for accepting or denying inbound connections +# iptables -A INPUT -p --dport -m state --state NEW -j ACCEPT + Is it the case that open ports are denied connection? + + + + Run the following command to determine if the freeradius package is installed: $ rpm -q freeradius + Is it the case that the package is installed? + + + -Run the following command to determine if the httpd_tty_comm SELinux boolean is disabled: -$ getsebool httpd_tty_comm +Run the following command to determine if the httpd_can_connect_ldap SELinux boolean is disabled: +$ getsebool httpd_can_connect_ldap If properly configured, the output should show the following: -httpd_tty_comm --> off - Is it the case that httpd_tty_comm is not disabled? +httpd_can_connect_ldap --> off + Is it the case that httpd_can_connect_ldap is not disabled? - - To check the ownership of /etc/ssh/sshd_config, -run the command: -$ ls -lL /etc/ssh/sshd_config -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/ssh/sshd_config does not have an owner of root? + + Verify the audit tools are owned by "root" to prevent any unauthorized access, deletion, or modification. + +Check the owner of each audit tool by running the following command: + +$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + +root /sbin/auditctl +root /sbin/aureport +root /sbin/ausearch +root /sbin/autrace +root /sbin/auditd +root /sbin/rsyslogd +root /sbin/augenrules + Is it the case that any audit tools are not owned by root? - - To check the group ownership of /etc/passwd-, -run the command: -$ ls -lL /etc/passwd- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/passwd- does not have a group owner of root? + + Run the following command to determine if the subscription-manager package is installed: $ rpm -q subscription-manager + Is it the case that the package is not installed? - + + Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. + +Determine the location of the tmux script with the following command: + +$ sudo grep tmux /etc/bashrc /etc/profile.d/* + +/etc/profile.d/tmux.sh: case "$name" in (sshd|login) exec tmux ;; esac + +Review the tmux script by using the following example: + +$ cat /etc/profile.d/tmux.sh + +if [ "$PS1" ]; then +parent=$(ps -o ppid= -p $$) +name=$(ps -o comm= -p $parent) +case "$name" in (sshd|login) exec tmux ;; esac +fi + +If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. + +Determine if tmux is currently running with the following command: + +$ sudo ps all | grep tmux | grep -v grep + Is it the case that the command does not produce output? + + + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STACKPROTECTOR /boot/config.* + $ grep CONFIG_UNMAP_KERNEL_AT_EL0 /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - -Run the following command to determine if the postfix_local_write_mail_spool SELinux boolean is enabled: -$ getsebool postfix_local_write_mail_spool -If properly configured, the output should show the following: -postfix_local_write_mail_spool --> on - Is it the case that postfix_local_write_mail_spool is not enabled? + + Verify the nosuid option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . nosuid . . . + + Is it the case that the "/boot" file system does not have the "nosuid" option set? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "kmod" command with the following command: + + Verify that the system is not accepting "rsyslog" messages from other systems unless it is +documented as a log aggregation server. +Display the contents of the rsyslog configuration files: +find /etc -maxdepth 2 -regex '/etc/rsyslog\(\.conf\|\.d\/.*\.conf\)' -exec cat '{}' \; -$ sudo auditctl -l | grep kmod +If any of the below lines are found, ask to see the documentation for the system being used +for log aggregation: --a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-kmod - Is it the case that the command does not return a line, or the line is commented out? +If using legacy syntax: +$ModLoad imtcp +$InputTCPServerRun port +$ModLoad imudp +$UDPServerRun port +$ModLoad imrelp +$InputRELPServerRun port + +If using RainerScript syntax: +module(load="imtcp") +module(load="imudp") +input(type="imtcp" port="514") +input(type="imudp" port="514") + + Is it the case that rsyslog accepts remote messages and is not documented as a log aggregation system? - - To check the password warning age, run the command: -$ grep PASS_WARN_AGE /etc/login.defs -The DoD requirement is 7. - Is it the case that it is not set to the required value? + + Verify the audit system prevents unauthorized changes with the following command: + +$ sudo grep "^\s*[^#]" /etc/audit/audit.rules | tail -1 +-e 2 + + Is it the case that the audit system is not set to be immutable by adding the "-e 2" option to the end of "/etc/audit/audit.rules"? - - Run the following command to determine if the net-snmp package is installed: -$ rpm -q net-snmp - Is it the case that the package is installed? + + To check that the rdisc service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled rdisc +Output should indicate the rdisc service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rdisc disabled + +Run the following command to verify rdisc is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rdisc + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the rdisc is masked, run the following command: +$ sudo systemctl show rdisc | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "rdisc" is loaded and not masked? - + -Run the following command to determine if the use_fusefs_home_dirs SELinux boolean is disabled: -$ getsebool use_fusefs_home_dirs +Run the following command to determine if the mozilla_plugin_use_spice SELinux boolean is disabled: +$ getsebool mozilla_plugin_use_spice If properly configured, the output should show the following: -use_fusefs_home_dirs --> off - Is it the case that use_fusefs_home_dirs is not disabled? +mozilla_plugin_use_spice --> off + Is it the case that mozilla_plugin_use_spice is not disabled? - - -Run the following command to determine if the unconfined_chrome_sandbox_transition SELinux boolean is enabled: -$ getsebool unconfined_chrome_sandbox_transition -If properly configured, the output should show the following: -unconfined_chrome_sandbox_transition --> on - Is it the case that unconfined_chrome_sandbox_transition is not enabled? + + Run the following command to determine if the rsyslog-gnutls package is installed: +$ rpm -q rsyslog-gnutls + Is it the case that the package is installed? - - -If the system is configured to prevent the loading of the tipc kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + To check that the certmonger service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled certmonger +Output should indicate the certmonger service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled certmonger disabled -These lines can also instruct the module loading system to ignore the tipc kernel module via blacklist keyword. +Run the following command to verify certmonger is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active certmonger + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the certmonger is masked, run the following command: +$ sudo systemctl show certmonger | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "certmonger" is loaded and not masked? + + + + To determine if the system is configured to audit calls to the +fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r tipc /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Inspect /etc/audit/audisp-remote.conf and locate the following line to -determine if the system is configured to perform a correct action according to the policy: -$ sudo grep -i network_failure_action /etc/audit/audisp-remote.conf -The output should return: -network_failure_action = - Is it the case that the system is not configured to switch to single user mode for corrective action? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECCOMP /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to ensure the default FORWARD policy is DROP: -grep ":FORWARD" /etc/sysconfig/iptables -The output should be similar to the following: -$ sudo grep ":FORWARD" /etc/sysconfig/iptables -:FORWARD DROP [0:0 - Is it the case that the default policy for the FORWARD chain is not set to DROP? + + + +Run the following command to determine the current status of the +ufw service: +$ sudo systemctl is-active ufw +If the service is running, it should return the following: active + Is it the case that the service is not enabled? - - Run the following command to determine if the talk package is installed: -$ rpm -q talk - Is it the case that the package is installed? + + +Run the following command to determine if the cron_system_cronjob_use_shares SELinux boolean is disabled: +$ getsebool cron_system_cronjob_use_shares +If properly configured, the output should show the following: +cron_system_cronjob_use_shares --> off + Is it the case that cron_system_cronjob_use_shares is not disabled? - - To check if pam_namespace.so is required for user login, run the following command: -$ grep pam_namespace.so /etc/pam.d/login -The output should return the following uncommented: -session required pam_namespace.so - Is it the case that pam_namespace.so is not required or is commented out? + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. + +Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: + +$ sudo grep disk_error_action /etc/audit/auditd.conf + +disk_error_action = + +If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. + Is it the case that there is no evidence of appropriate action? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open system call with O_CREAT flag. + + To check that the dovecot service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled dovecot +Output should indicate the dovecot service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled dovecot disabled -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: +Run the following command to verify dovecot is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active dovecot -$ sudo grep -r open /etc/audit/rules.d +If the service is not running the command will return the following output: +inactive -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +The service will also be masked, to check that the dovecot is masked, run the following command: +$ sudo systemctl show dovecot | grep "LoadState\|UnitFileState" -$ sudo grep open /etc/audit/audit.rules +If the service is masked the command will return the following outputs: -The output should be the following: +LoadState=masked --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine if the system is configured to audit accesses to -/var/log/audit directory, run the following command: -$ sudo grep "dir=/var/log/audit" /etc/audit/audit.rules -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? +UnitFileState=masked + Is it the case that the "dovecot" is loaded and not masked? - - To ensure the system is configured to ignore the Ctrl-Alt-Del sequence, -run the following command: -$ gsettings get org.gnome.settings-daemon.plugins.media-keys logout -$ grep logout /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/settings-daemon/plugins/media-keys/logout - Is it the case that GNOME3 is configured to reboot when Ctrl-Alt-Del is pressed? + + To check the group ownership of /usr/bin/sudo, +run the command: +$ ls -lL /usr/bin/sudo +If properly configured, the output should indicate the following group-owner: + + Is it the case that /usr/bin/sudo does not have a group owner of <sub idref="var_sudo_dedicated_group" />? - + -Run the following command to determine if the samba_run_unconfined SELinux boolean is disabled: -$ getsebool samba_run_unconfined +Run the following command to determine if the postgresql_can_rsync SELinux boolean is disabled: +$ getsebool postgresql_can_rsync If properly configured, the output should show the following: -samba_run_unconfined --> off - Is it the case that samba_run_unconfined is not disabled? +postgresql_can_rsync --> off + Is it the case that postgresql_can_rsync is not disabled? - - To determine if the system is configured to audit successful calls -to the open system call, run the following command: -$ sudo grep "open" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Run the following command to determine if the xinetd package is installed: +$ rpm -q xinetd + Is it the case that the package is installed? - + -Run the following command to determine if the git_cgi_use_cifs SELinux boolean is disabled: -$ getsebool git_cgi_use_cifs -If properly configured, the output should show the following: -git_cgi_use_cifs --> off - Is it the case that git_cgi_use_cifs is not disabled? + + +To determine if firewalld is configured to allow access + +on port 22/tcp, run the following command(s): + firewall-cmd --list-ports + + +to ssh + firewall-cmd --list-services + +If firewalld is configured to allow access through the firewall, something similar to the following will be output: + +If it is a service: +ssh + + +If it is a port: +22/tcp + + Is it the case that sshd service is not enabled in the proper firewalld zone? - - Review the contents of the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf -files to ensure appropriate logging is set. In addition, run the following command: -ls -l /var/log/ -and verify that the log files are logging information - Is it the case that no logging is configured? + + The runtime status of the kernel.dmesg_restrict kernel parameter can be queried +by running the following command: +$ sysctl kernel.dmesg_restrict +1. + + Is it the case that the correct value is not returned? - + -Run the following command to determine if the virt_rw_qemu_ga_data SELinux boolean is disabled: -$ getsebool virt_rw_qemu_ga_data +Run the following command to determine if the logging_syslogd_run_nagios_plugins SELinux boolean is disabled: +$ getsebool logging_syslogd_run_nagios_plugins If properly configured, the output should show the following: -virt_rw_qemu_ga_data --> off - Is it the case that virt_rw_qemu_ga_data is not disabled? - - - - To determine that AIDE is verifying extended file attributes, run the following command: -$ grep xattrs /etc/aide.conf -Verify that the xattrs option is added to the correct ruleset. - Is it the case that the xattrs option is missing or not added to the correct ruleset? +logging_syslogd_run_nagios_plugins --> off + Is it the case that logging_syslogd_run_nagios_plugins is not disabled? - + -Run the following command to determine if the ftpd_connect_all_unreserved SELinux boolean is disabled: -$ getsebool ftpd_connect_all_unreserved +Run the following command to determine if the openvpn_can_network_connect SELinux boolean is disabled: +$ getsebool openvpn_can_network_connect If properly configured, the output should show the following: -ftpd_connect_all_unreserved --> off - Is it the case that ftpd_connect_all_unreserved is not disabled? +openvpn_can_network_connect --> off + Is it the case that openvpn_can_network_connect is not disabled? - - To verify that binaries cannot be directly executed from removable media, run the following command: -$ grep -v noexec /etc/fstab -The resulting output will show partitions which do not have the noexec flag. Verify all partitions -in the output are not removable media. - Is it the case that removable media partitions are present? + + To check that virtual syscalls are disabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls. + Is it the case that vsyscalls are enabled? - - Verify the noexec option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . noexec . . . + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-keysign" command with the following command: - Is it the case that the "/boot" file system does not have the "noexec" option set? +$ sudo auditctl -l | grep ssh-keysign + +-a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-keysign + Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the mailx package is installed: $ rpm -q mailx - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PANIC_TIMEOUT /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - The following command will locate the mount points related to local devices: -$ findmnt -n -l -k -it $(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) - -The following command will show files which do not belong to a valid user: -$ sudo find MOUNTPOINT -xdev -nouser 2>/dev/null - -Replace MOUNTPOINT by the mount points listed by the fist command. + + To verify that the DConf User profile is configured correctly, run the following +command: -No files without a valid user should be located. - Is it the case that files exist that are not owned by a valid user? +$ cat /etc/dconf/profile/user +The output should show the following: +user-db:user +system-db:local +system-db:site +system-db:distro + Is it the case that DConf User profile does not exist or is not configured correctly? - - To check if pam_pwquality.so is enabled in password-auth, run the following command: -$ grep pam_pwquality /etc/pam.d/password-auth -The output should be similar to the following: -password requisite pam_pwquality.so - Is it the case that pam_pwquality.so is not enabled in password-auth? + + + +Run the following command to determine the current status of the +ntpd service: +$ sudo systemctl is-active ntpd +If the service is running, it should return the following: active + Is it the case that ? - - Run the following command to determine if the dovecot package is installed: -$ rpm -q dovecot - Is it the case that the package is installed? + + +Run the following command to determine if the dbadm_read_user_files SELinux boolean is disabled: +$ getsebool dbadm_read_user_files +If properly configured, the output should show the following: +dbadm_read_user_files --> off + Is it the case that dbadm_read_user_files is not disabled? - - To determine if the system is configured to audit successful calls -to the lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - The ftp package can be removed with the following command: $ sudo yum erase ftp - Is it the case that ? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfacl" command with the following command: - -$ sudo auditctl -l | grep setfacl - --a always,exit -F path=/usr/bin/setfacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? - - - + -Run the following command to determine if the sge_domain_can_network_connect SELinux boolean is disabled: -$ getsebool sge_domain_can_network_connect +Run the following command to determine if the ssh_sysadm_login SELinux boolean is disabled: +$ getsebool ssh_sysadm_login If properly configured, the output should show the following: -sge_domain_can_network_connect --> off - Is it the case that sge_domain_can_network_connect is not disabled? +ssh_sysadm_login --> off + Is it the case that ssh_sysadm_login is not disabled? - - Run the following command to determine if the cyrus-imapd package is installed: -$ rpm -q cyrus-imapd - Is it the case that the package is installed? + + To view the root user's PATH, run the following command: +$ sudo env | grep PATH +If correctly configured, the PATH must: use vendor default settings, +have no empty entries, and have no entries beginning with a character +other than a slash (/). + Is it the case that any of these conditions are not met? - - To check the ownership of /var/log, -run the command: -$ ls -lL /var/log -If properly configured, the output should indicate the following owner: -root - Is it the case that /var/log does not have an owner of root? + + To ensure the GUI does not allow user administratrion capabilities to all users, +run the following command: +$ gsettings get org.gnome.desktop.lockdown user-administration-disabled +If properly configured, the output should be true. +To ensure that users cannot enable user administration, run the following: +$ grep user-administration /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/desktop/lockdown/user-administration-disabled + Is it the case that user administration is not configured or disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "crontab" command with the following command: + + The following command will list which files on the system have permissions different from what +is expected by the RPM database: +$ rpm -Va | awk '{ if (substr($0,2,1)=="M") print $NF }' + Is it the case that there is output? + + + + Ensure that CGI backup scripts are not left on the production web server. +This check is limited to CGI/interactive content and not static HTML. -$ sudo auditctl -l | grep crontab +Search for backup copies of CGI scripts on the web server or ask the Web +Administrator if they keep backup copies of CGI scripts on the web server. --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -k privileged-crontab - Is it the case that the command does not return a line, or the line is commented out? +Common backup file extensions are: *.bak, *.old, *.temp, *.tmp, *.backup, +*.??0. This would also apply to .jsp files. + +On Red Hat Enterprise Linux, run the following commands to find backup +scripts: +find / name "*.bak" -print +find / name "*.*" -print +find / name "*.old" -print + Is it the case that If fileos with these extensions have no relationship with web activity, +such as backup batch file for operating system utility, and they are +not accessible by the web application, this is not a finding. + +If files with these extensions are found in either the document +directory or the home directory of the web server, this is +a finding. + +If files with these extensions are stored in a repository (not in the +document root) as backups for the web server? - + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_COMPAT_VDSO /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes spec_store_bypass_disable=, +in /etc/default/grub. If it includes spectre_v2=on, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spec_store_bypass_disable=.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spectre_v2=on.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*spec_store_bypass_disable=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*spectre_v2=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'spec_store_bypass_disable=' +$ sudo grubby --info=ALL | grep args | grep -v 'spectre_v2=on' The command should not return any output. - Is it the case that SSB is not configured appropriately? + Is it the case that spectre_v2 mitigation is not enforced? - + -Run the following command to determine if the tor_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool tor_bind_all_unreserved_ports +Run the following command to determine if the named_tcp_bind_http_port SELinux boolean is disabled: +$ getsebool named_tcp_bind_http_port If properly configured, the output should show the following: -tor_bind_all_unreserved_ports --> off - Is it the case that tor_bind_all_unreserved_ports is not disabled? +named_tcp_bind_http_port --> off + Is it the case that named_tcp_bind_http_port is not disabled? - - The runtime status of the net.ipv4.conf.all.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_source_route -0. - - Is it the case that the correct value is not returned? + + To determine if negation is used to define commands users are allowed to execute using sudo, run the following command: +$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,!\n][^,\n]+,)*\s*(?:\([^\)]+\))?\s*(?!\s*\()(!\S+).*' /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that /etc/sudoers file contains rules that define the set of allowed commands using negation? - - Verify that sshd isn't configured to ignore the system wide cryptographic policy. + + To verify whether audispd plugin off-loads audit records onto a different +system or media from the system being audited, run the following command: -Check that the CRYPTO_POLICY variable is not set or is commented out in the -/etc/sysconfig/sshd. +$ sudo grep -i remote_server /etc/audit/audisp-remote.conf -Run the following command: +The output should return something similar to where REMOTE_SYSTEM +is an IP address or hostname: +remote_server = REMOTE_SYSTEM -$ sudo grep CRYPTO_POLICY /etc/sysconfig/sshd - Is it the case that the CRYPTO_POLICY variable is set or is not commented out in the /etc/sysconfig/sshd? +Determine which partition the audit records are being written to with the +following command: + +$ sudo grep log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log + +Check the size of the partition that audit records are written to with the +following command and verify whether it is sufficiently large: + +$ sudo df -h /var/log/audit/ +/dev/sda2 24G 10.4G 13.6G 43% /var/log/audit + Is it the case that audispd is not sending logs to a remote system and the local partition has inadequate space? - - Run the following command to determine if the libselinux package is installed: $ rpm -q libselinux - Is it the case that the package is not installed? + + Run the following command to determine if the tuned package is installed: +$ rpm -q tuned + Is it the case that the package is installed? - + + To ensure LoginGraceTime is set correctly, run the following command: +$ sudo grep LoginGraceTime /etc/ssh/sshd_config +If properly configured, the output should be: +LoginGraceTime +If the option is set to a number greater than 0, then the unauthenticated session will be disconnected +after the configured number seconds. + Is it the case that it is commented out or not configured properly? + + + -Run the following command to determine if the pcp_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool pcp_bind_all_unreserved_ports +Run the following command to determine if the logwatch_can_network_connect_mail SELinux boolean is disabled: +$ getsebool logwatch_can_network_connect_mail If properly configured, the output should show the following: -pcp_bind_all_unreserved_ports --> off - Is it the case that pcp_bind_all_unreserved_ports is not disabled? +logwatch_can_network_connect_mail --> off + Is it the case that logwatch_can_network_connect_mail is not disabled? - - To check the permissions of /etc/passwd-, -run the command: -$ ls -l /etc/passwd- -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/passwd- does not have unix mode -rw-r--r--? + + To check for virtual console entries which permit root login, run the +following command: +$ sudo grep ^vc/[0-9] /etc/securetty +If any output is returned, then root logins over virtual console devices is permitted. + Is it the case that root login over virtual console devices is permitted? - + -Run the following command to determine if the spamd_enable_home_dirs SELinux boolean is enabled: -$ getsebool spamd_enable_home_dirs +Run the following command to determine if the git_cgi_use_cifs SELinux boolean is disabled: +$ getsebool git_cgi_use_cifs If properly configured, the output should show the following: -spamd_enable_home_dirs --> on - Is it the case that spamd_enable_home_dirs is not enabled? +git_cgi_use_cifs --> off + Is it the case that git_cgi_use_cifs is not disabled? - - To verify that OpenSSL uses the system crypto policy, check out that the OpenSSL config file -/etc/pki/tls/openssl.cnf contains the [ crypto_policy ] section with the -.include /etc/crypto-policies/back-ends/opensslcnf.config directive: + + Verify Red Hat Enterprise Linux 8 security patches and updates are installed and up to date. +Updates are required to be applied with a frequency determined by organizational policy. -$ sudo grep '\.include\s* /etc/crypto-policies/back-ends/opensslcnf.config$' /etc/pki/tls/openssl.cnf. - Is it the case that the OpenSSL config file doesn't contain the whole section, -or the section doesn't contain the <pre>.include /etc/crypto-policies/back-ends/opensslcnf.config</pre> directive? - - - - If network services are using the xinetd service, this is not applicable. -To check that the xinetd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled xinetd -Output should indicate the xinetd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled xinetd disabled +Obtain the list of available package security updates from Red Hat. The URL for updates is https://access.redhat.com/errata-search/. +It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. -Run the following command to verify xinetd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active xinetd -If the service is not running the command will return the following output: -inactive +Check that the available package security updates have been installed on the system with the following command: -The service will also be masked, to check that the xinetd is masked, run the following command: -$ sudo systemctl show xinetd | grep "LoadState\|UnitFileState" +$ sudo yum history list | more -If the service is masked the command will return the following outputs: +Loaded plugins: langpacks, product-id, subscription-manager +ID | Command line | Date and time | Action(s) | Altered +------------------------------------------------------------------------------- +70 | install aide | 2020-03-05 10:58 | Install | 1 +69 | update -y | 2020-03-04 14:34 | Update | 18 EE +68 | install vlc | 2020-02-21 17:12 | Install | 21 +67 | update -y | 2020-02-21 17:04 | Update | 7 EE -LoadState=masked -UnitFileState=masked - Is it the case that the "xinetd" is loaded and not masked? - - - - Run the following command to determine if the usbguard package is installed: $ rpm -q usbguard - Is it the case that the package is not installed? +Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. + Is it the case that Red Hat Enterprise Linux 8 is in non-compliance with the organizational patching policy? - - To check the ownership of /var/log/messages, -run the command: -$ ls -lL /var/log/messages -If properly configured, the output should indicate the following owner: -root - Is it the case that /var/log/messages does not have an owner of root? + + +Run the following command to determine if the global_ssp SELinux boolean is disabled: +$ getsebool global_ssp +If properly configured, the output should show the following: +global_ssp --> off + Is it the case that global_ssp is not disabled? - - Verify the nosuid option is configured for the /tmp mount point, - run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . nosuid . . . + + Verify that Red Hat Enterprise Linux 8 enforces a minimum -character password length with the following command: - Is it the case that the "/tmp" file system does not have the "nosuid" option set? - - - - To check the group ownership of /boot/grub2/user.cfg, -run the command: -$ ls -lL /boot/grub2/user.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/grub2/user.cfg does not have a group owner of root? - - - - To verify that kernel parameter 'crypto.fips_enabled' is set properly, run the following command: -sysctl crypto.fips_enabled -The output should contain the following: -crypto.fips_enabled = 1 - Is it the case that crypto.fips_enabled is not 1? +$ grep minlen /etc/security/pwquality.conf + +minlen = + Is it the case that the command does not return a "minlen" value of "<sub idref="var_password_pam_minlen" />" or greater, does not return a line, or the line is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_ACPI_CUSTOM_METHOD /boot/config.* + $ grep CONFIG_SECURITY /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - To ensure the X Windows package group is removed, run the following command: -$ rpm -qi xorg-x11-server-common -The output should be: -package xorg-x11-server-common is not installed - Is it the case that the X Windows package group or xorg-x11-server-common has not be removed? + + +Run the following command to determine if the use_samba_home_dirs SELinux boolean is disabled: +$ getsebool use_samba_home_dirs +If properly configured, the output should show the following: +use_samba_home_dirs --> off + Is it the case that use_samba_home_dirs is not disabled? - - The runtime status of the kernel.modules_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.modules_disabled -1. + + To verify the operating system prevents non-privileged users from executing +privileged functions to include disabling, circumventing, or altering +implemented security safeguards/countermeasures, run the following +command: +$ sudo semanage login -l +All administrators must be mapped to the sysadm_u or staff_u +users with the appropriate domains (sysadm_t and staff_t). - Is it the case that the correct value is not returned? +All authorized non-administrative +users must be mapped to the user_u role or the appropriate domain +(user_t). + Is it the case that non-admin users are not confined correctly? - - Run the following command to check the mode of the httpd log -directory: -$ ls -l /var/log/ | grep httpd -Log directory must be mode 0700 or less permissive. - Is it the case that it is more permissive? + + The group-owner of all log files written by rsyslog should be +root. +These log files are determined by the second part of each Rule line in +/etc/rsyslog.conf and typically all appear in /var/log. +To see the group-owner of a given log file, run the following command: +$ ls -l LOGFILE + Is it the case that the group-owner is not correct? - + + To verify that each web content directory has an index.html file, +run the following command: +$ sudo find `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` -name index.html +The output should return an index.html file for every +DocumentRoot that is set. + Is it the case that it is not? + + + -Run the following command to determine if the virt_use_execmem SELinux boolean is disabled: -$ getsebool virt_use_execmem +Run the following command to determine if the glance_api_can_network SELinux boolean is disabled: +$ getsebool glance_api_can_network If properly configured, the output should show the following: -virt_use_execmem --> off - Is it the case that virt_use_execmem is not disabled? +glance_api_can_network --> off + Is it the case that glance_api_can_network is not disabled? - - To ensure ClientAliveInterval is set correctly, run the following command: -$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config -If properly configured, the output should be: -ClientAliveCountMax -For SSH earlier than v8.2, a ClientAliveCountMax value of 0 causes a timeout precisely when -the ClientAliveInterval is set. Starting with v8.2, a value of 0 disables the timeout -functionality completely. -If the option is set to a number greater than 0, then the session will be disconnected after -ClientAliveInterval * ClientAliveCountMax seconds without receiving a keep alive message. - Is it the case that it is commented out or not configured properly? + + To check the permissions of /boot/Sysem.map-*, +run the command: +$ ls -l /boot/Sysem.map-* +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that ? - - To verify that the log_config_module exists in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep log_config_module /etc/httpd/conf/httpd.conf -The output should return: -<IfModule log_config_module> - Is it the case that it is not? + + To check the permissions of /etc/issue, +run the command: +$ ls -l /etc/issue +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/issue does not have unix mode -rw-r--r--? - - - -Run the following command to determine the current status of the -chronyd service: -$ sudo systemctl is-active chronyd -If the service is running, it should return the following: active - Is it the case that the chronyd process is not running? + + Run the following command to determine if the telnet-server package is installed: +$ rpm -q telnet-server + Is it the case that the package is installed? - - Verify that rules for unsuccessful calls of the open_by_handle_at syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + +If the system is configured to prevent the loading of the cramfs kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - If the system is 64 bit then also add the following lines: +These lines can also instruct the module loading system to ignore the cramfs kernel module via blacklist keyword. - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? - - - - The ypbind package can be removed with the following command: $ sudo yum erase ypbind - Is it the case that ? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r cramfs /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - -Run the following command to determine if the httpd_ssi_exec SELinux boolean is disabled: -$ getsebool httpd_ssi_exec -If properly configured, the output should show the following: -httpd_ssi_exec --> off - Is it the case that httpd_ssi_exec is not disabled? + + Verify the umask setting is configured correctly in the /etc/profile file +or scripts within /etc/profile.d directory with the following command: +$ grep "umask" /etc/profile* +umask + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", +or the "umask" parameter is missing or is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_ARM64_SW_TTBR0_PAN /boot/config.* + $ grep CONFIG_HARDENED_USERCOPY_FALLBACK /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the krb5-server package is installed: $ rpm -q krb5-server - Is it the case that the package is installed? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "userhelper" command with the following command: + +$ sudo auditctl -l | grep userhelper + +-a always,exit -F path=/usr/bin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -k privileged-userhelper + Is it the case that the command does not return a line, or the line is commented out? - - To check that the ntpdate service is disabled in system boot configuration, + + +Run the following command to determine if the daemons_dump_core SELinux boolean is disabled: +$ getsebool daemons_dump_core +If properly configured, the output should show the following: +daemons_dump_core --> off + Is it the case that daemons_dump_core is not disabled? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the openat system call. + +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? + + + + To check that the rpcsvcgssd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled ntpdate -Output should indicate the ntpdate service has either not been installed, +$ sudo systemctl is-enabled rpcsvcgssd +Output should indicate the rpcsvcgssd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ntpdate disabled +$ sudo systemctl is-enabled rpcsvcgssd disabled -Run the following command to verify ntpdate is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ntpdate +Run the following command to verify rpcsvcgssd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rpcsvcgssd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the ntpdate is masked, run the following command: -$ sudo systemctl show ntpdate | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rpcsvcgssd is masked, run the following command: +$ sudo systemctl show rpcsvcgssd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "ntpdate" is loaded and not masked? + Is it the case that the "rpcsvcgssd" is loaded and not masked? - - -Run the following command to determine if the openvpn_enable_homedirs SELinux boolean is disabled: -$ getsebool openvpn_enable_homedirs -If properly configured, the output should show the following: -openvpn_enable_homedirs --> off - Is it the case that openvpn_enable_homedirs is not disabled? + + Verify Red Hat Enterprise Linux 8 disables network management of the chrony daemon with the following command: +$ grep -w cmdport /etc/chrony.conf +cmdport 0 + Is it the case that the "cmdport" option is not set to "0", is commented out, or is missing? - - Verify the system commands contained in the following directories are group-owned by "root", or a required system account, with the following command: + + Verify that yum verifies the signature of local packages prior to install with the following command: -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ! -group root -exec ls -l {} \; - Is it the case that any system commands are returned and is not group-owned by a required system account? +$ grep localpkg_gpgcheck /etc/yum.conf + +localpkg_gpgcheck=1 + +If "localpkg_gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. + Is it the case that there is no process to validate certificates for local packages that is approved by the organization? - - To determine if the system is configured to audit calls to the -renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the lremovexattr system call, run the following command: +$ sudo grep "lremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To ensure the gdm package group is removed, run the following command: -$ rpm -qi gdm -The output should be: -package gdm is not installed - Is it the case that gdm has not been removed? + + To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: + +$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To verify the nodev option is configured for all NFS mounts, run -the following command: -$ mount | grep nfs -All NFS mounts should show the nodev setting in parentheses. This -is not applicable if NFS is not implemented. - Is it the case that the setting does not show? + + To determine if use_pty has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\buse_pty\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that use_pty is not enabled in sudo? - - To check the ownership of /etc/cron.d, -run the command: -$ ls -lL /etc/cron.d -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.d does not have an owner of root? + + +Run the following command to determine if the git_system_use_cifs SELinux boolean is disabled: +$ getsebool git_system_use_cifs +If properly configured, the output should show the following: +git_system_use_cifs --> off + Is it the case that git_system_use_cifs is not disabled? - - To check the permissions of /etc/ssh/sshd_config, -run the command: -$ ls -l /etc/ssh/sshd_config -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/ssh/sshd_config does not have unix mode -rw-------? + + +Run the following command to determine if the httpd_graceful_shutdown SELinux boolean is enabled: +$ getsebool httpd_graceful_shutdown +If properly configured, the output should show the following: +httpd_graceful_shutdown --> on + Is it the case that httpd_graceful_shutdown is not enabled? - - To determine how the SSH daemon's PermitEmptyPasswords option is set, run the following command: + + To verify the number of rounds for the password hashing algorithm is configured, run the following command: +$ sudo grep rounds /etc/pam.d/password-auth +The output should show the following match: +password sufficient pam_unix.so sha512 rounds= + Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + + + To determine how the SSH daemon's HostbasedAuthentication option is set, run the following command: -$ sudo grep -i PermitEmptyPasswords /etc/ssh/sshd_config +$ sudo grep -i HostbasedAuthentication /etc/ssh/sshd_config If a line indicating no is returned, then the required value is set. Is it the case that the required value is not set? - - Run the following command to check if the line is present: -grep pam_wheel /etc/pam.d/su -The output should contain the following line: -auth required pam_wheel.so use_uid - Is it the case that the line is not in the file or it is commented? + + To verify that McAfee Endpoint Security for Linux is +running, run the following command: +$ sudo ps -ef | grep -i mfetpd + Is it the case that virus scanning software is not running? - - To verify that there are no .shosts files -on the system, run the following command: -$ sudo find / -name '.shosts' - Is it the case that .shosts files exist? + + Storing logs remotely protects the integrity of the data from local attacks. +Run the following command to verify that journald is forwarding logs to a remote host. + +grep "^\sForwardToSyslog" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf + + +and it should return + +ForwardToSyslog=yes + + Is it the case that is commented out or not configured correctly? - - To verify the audispd plugin off-loads audit records onto a different system or -media from the system being audited, run the following command: -$ sudo grep -i remote_server /etc/audit/audisp-remote.conf -The output should return something similar to -remote_server = - Is it the case that audispd is not sending logs to a remote system? + + +Run the following command to determine if the samba_domain_controller SELinux boolean is disabled: +$ getsebool samba_domain_controller +If properly configured, the output should show the following: +samba_domain_controller --> off + Is it the case that samba_domain_controller is not disabled? - + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open_by_handle_at system call with O_CREAT flag. + +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r open_by_handle_at /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? + + + + To verify that a nftables table exists, run the following command: +$ sudo nft list tables +Output should include a list of nftables similar to: + + table inet filter + + Is it the case that a nftables table does not exist? + + + + To check the permissions of /etc/crontab, +run the command: +$ ls -l /etc/crontab +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/crontab does not have unix mode -rw-------? + + + -Run the following command to determine if the irc_use_any_tcp_ports SELinux boolean is disabled: -$ getsebool irc_use_any_tcp_ports + +Run the following command to determine the current status of the +usbguard service: +$ sudo systemctl is-active usbguard +If the service is running, it should return the following: active + Is it the case that the service is not enabled? + + + + +Run the following command to determine if the selinuxuser_share_music SELinux boolean is disabled: +$ getsebool selinuxuser_share_music If properly configured, the output should show the following: -irc_use_any_tcp_ports --> off - Is it the case that irc_use_any_tcp_ports is not disabled? +selinuxuser_share_music --> off + Is it the case that selinuxuser_share_music is not disabled? - - Inspect the list of enabled firewall ports and verify they are configured correctly by running -the following command: - -$ sudo firewall-cmd --list-all + + To determine if the system is configured to audit calls to the +removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -Ask the System Administrator for the site or program Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA). Verify the services allowed by the firewall match the PPSM CLSA. - Is it the case that there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), or there are no firewall rules configured? + Is it the case that no line is returned? - - To verify if the OpenSSH server uses defined ciphers in the Crypto Policy, run: -$ grep -Po '(-oCiphers=\S+)' /etc/crypto-policies/back-ends/opensshserver.config -and verify that the line matches: --oCiphers= - Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? + + To obtain a list of all users and the content of their shadow password field, run the command: +$ sudo readarray -t systemaccounts +Verify if all accounts are locked. + Is it the case that system accounts are not locked? - - Run the following command to determine if the geolite2-city package is installed: -$ rpm -q geolite2-city - Is it the case that the package is installed? + + Run the following command to ensure the TMOUT value is configured for all users +on the system: + +$ sudo grep TMOUT /etc/profile /etc/profile.d/*.sh + +The output should return the following: +TMOUT= + Is it the case that value of TMOUT is not less than or equal to expected setting? + + + + To determine if the system is configured to audit successful calls +to the chown system call, run the following command: +$ sudo grep "chown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine if the system is configured to audit account changes, -run the following command: -auditctl -l | grep -E '(/etc/passwd|/etc/shadow|/etc/group|/etc/gshadow|/etc/security/opasswd)' -If the system is configured to watch for account changes, lines should be returned for -each file specified (and with perm=wa for each). - Is it the case that the system is not configured to audit account changes? + + Verify the system commands contained in the following directories are owned by "root" with the following command: + +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin ! -user root -exec ls -l {} \; + Is it the case that any system commands are found to not be owned by root? - - To ensure TLS is configured with trust certificates, run the following command: -$ grep cert /etc/nslcd.conf - Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + To ensure the user list is disabled, run the following command: +$ grep disable-user-list /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot enable displaying the user list, run the following: +$ grep disable-user-list /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/disable-user-list + Is it the case that disable-user-list has not been configured or is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the ftruncate system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r ftruncate /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + + To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: -$ sudo grep ftruncate /etc/audit/audit.rules +$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config -The output should be the following: +If a line indicating yes is returned, then the required value is set. --a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the required value is not set? - - Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/password-auth file -and is configured to prohibit password reuse for a minimum of -generations. - -Verify the "/etc/pam.d/password-auth" file with the following command: + + To check if the system login banner is compliant, +run the following command: +$ cat /etc/issue + Is it the case that it does not display the required banner? + + + + Storing logs with compression can help avoid filling the system disk. +Run the following command to verify that journald is compressing logs. -$ grep pam_pwhistory.so /etc/pam.d/password-auth -password pam_pwhistory.so use_authtok remember= +grep "^\sCompress" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf -Verify the "/etc/security/pwhistory.conf" file using the following command: +and it should return -$ grep remember /etc/security/pwhistory.conf -remember = +Compress=yes -The pam_pwhistory.so "remember" option must be configured only in one file. - Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in -/etc/pam.d/password-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set -with a value less than "<sub idref="var_password_pam_remember" />"? + Is it the case that is commented out or not configured correctly? - + + +Run the following command to determine if the virt_use_samba SELinux boolean is disabled: +$ getsebool virt_use_samba +If properly configured, the output should show the following: +virt_use_samba --> off + Is it the case that virt_use_samba is not disabled? + + + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLUB_DEBUG /boot/config.* + $ grep CONFIG_DEBUG_FS /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - The document, DoDI 8500.01, establishes the policy on the use of DoD -information systems. It requires the use of a standard Notice and Consent Banner -and standard text to be included in user agreements. The banner should be set -to the following: - Is it the case that it is not display the required banner? + + To check the permissions of /etc/issue.net, +run the command: +$ ls -l /etc/issue.net +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/issue.net does not have unix mode -rw-r--r--? - - -If the system is configured to prevent the loading of the mac80211 kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the mac80211 kernel module via blacklist keyword. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "gpasswd" command with the following command: -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r mac80211 /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - -To properly set the permissions of /etc/audit/, run the command: -$ sudo chmod 0640 /etc/audit/ +$ sudo auditctl -l | grep gpasswd -To properly set the permissions of /etc/audit/rules.d/, run the command: -$ sudo chmod 0640 /etc/audit/rules.d/ - Is it the case that ? +-a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-gpasswd + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the virt_use_xserver SELinux boolean is disabled: -$ getsebool virt_use_xserver -If properly configured, the output should show the following: -virt_use_xserver --> off - Is it the case that virt_use_xserver is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes spec_store_bypass_disable=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spec_store_bypass_disable=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*spec_store_bypass_disable=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'spec_store_bypass_disable=' +The command should not return any output. + Is it the case that SSB is not configured appropriately? - - To ensure that users cannot change session idle and lock settings, run the following: -$ grep 'lock-delay' /etc/dconf/db/local.d/locks/* -If properly configured, the output should return: -/org/gnome/desktop/screensaver/lock-delay - Is it the case that GNOME3 session settings are not locked or configured properly? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chacl" command with the following command: + +$ sudo auditctl -l | grep chacl + +-a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit attempts to -alter time via the /etc/localtime file, run the following -command: -$ sudo auditctl -l | grep "watch=/etc/localtime" -If the system is configured to audit this activity, it will return a line. - Is it the case that the system is not configured to audit time changes? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "umount" command with the following command: + +$ sudo auditctl -l | grep umount + +-a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-umount + Is it the case that the command does not return a line, or the line is commented out? - - To verify that root's primary group is zero run the following command: - - grep '^root:' /etc/passwd | cut -d : -f 4 + + To determine how the SSH daemon's StrictModes option is set, run the following command: -The command should return: +$ sudo grep -i StrictModes /etc/ssh/sshd_config -0 +If a line indicating yes is returned, then the required value is set. - Is it the case that root has a primary gid not equal to zero? + Is it the case that the required value is not set? - + -Run the following command to determine if the zebra_write_config SELinux boolean is disabled: -$ getsebool zebra_write_config +Run the following command to determine if the antivirus_can_scan_system SELinux boolean is enabled: +$ getsebool antivirus_can_scan_system If properly configured, the output should show the following: -zebra_write_config --> off - Is it the case that zebra_write_config is not disabled? +antivirus_can_scan_system --> on + Is it the case that antivirus_can_scan_system is not enabled? - - The tftp package can be removed with the following command: $ sudo yum erase tftp - Is it the case that ? + + To determine if the system is configured to audit successful calls +to the unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the ownership of /etc/passwd, -run the command: -$ ls -lL /etc/passwd -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/passwd does not have an owner of root? + + Run the following command to determine if the krb5-workstation package is installed: +$ rpm -q krb5-workstation + Is it the case that the package is installed? - + -Run the following command to determine if the virt_use_fusefs SELinux boolean is disabled: -$ getsebool virt_use_fusefs +Run the following command to determine if the httpd_can_network_connect SELinux boolean is disabled: +$ getsebool httpd_can_network_connect If properly configured, the output should show the following: -virt_use_fusefs --> off - Is it the case that virt_use_fusefs is not disabled? +httpd_can_network_connect --> off + Is it the case that httpd_can_network_connect is not disabled? - - -Check if SSSD allows cached authentications with the following command: + + Verify that Red Hat Enterprise Linux 8 does not have unauthorized IP tunnels configured. -$ sudo grep cache_credentials /etc/sssd/sssd.conf -cache_credentials = true -If "cache_credentials" is set to "false" or is missing no further checks are required. +# yum list installed libreswan +libreswan.x86-64 3.20-5.el7_4 -To verify that SSSD expires offline credentials, run the following command: -$ sudo grep offline_credentials_expiration /etc/sssd/sssd.conf -If configured properly, output should be -offline_credentials_expiration = 1 - Is it the case that it does not exist or is not configured properly? - - - - -If the system is configured to prevent the loading of the cramfs kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the cramfs kernel module via blacklist keyword. +If "libreswan" is installed, check to see if the "IPsec" service is active with the following command: -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r cramfs /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - -Run the following command to determine if the httpd_can_network_connect_cobbler SELinux boolean is disabled: -$ getsebool httpd_can_network_connect_cobbler -If properly configured, the output should show the following: -httpd_can_network_connect_cobbler --> off - Is it the case that httpd_can_network_connect_cobbler is not disabled? +# systemctl status ipsec +ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec +Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) +Active: inactive (dead) + + +If the "IPsec" service is active, check for configured IPsec connections (conn), perform the following: +grep -rni conn /etc/ipsec.conf /etc/ipsec.d/ +Verify any returned results for organizational approval. + Is it the case that the IPSec tunnels are not approved? - - Verify it by running the following command: -$ stat -c "%n %U" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules + + To check that the sysstat service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled sysstat +Output should indicate the sysstat service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled sysstat disabled -/sbin/auditctl root -/sbin/aureport root -/sbin/ausearch root -/sbin/autrace root -/sbin/auditd root -/sbin/audispd root -/sbin/augenrules root +Run the following command to verify sysstat is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active sysstat +If the service is not running the command will return the following output: +inactive -If the command does not return all the above lines, the missing ones -need to be added. +The service will also be masked, to check that the sysstat is masked, run the following command: +$ sudo systemctl show sysstat | grep "LoadState\|UnitFileState" -Run the following command to correct the permissions of the missing -entries: -$ sudo chown root [audit_tool] +If the service is masked the command will return the following outputs: -Replace "[audit_tool]" with each audit tool not owned by root. - Is it the case that ? - - - - The runtime status of the net.ipv6.conf.default.autoconf kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.autoconf -0. +LoadState=masked - Is it the case that the correct value is not returned? +UnitFileState=masked + Is it the case that the "sysstat" is loaded and not masked? - - -Run the following command to determine if the httpd_run_preupgrade SELinux boolean is disabled: -$ getsebool httpd_run_preupgrade -If properly configured, the output should show the following: -httpd_run_preupgrade --> off - Is it the case that httpd_run_preupgrade is not disabled? + + To check the permissions of /usr/bin/sudo, +run the command: +$ ls -l /usr/bin/sudo +If properly configured, the output should indicate the following permissions: +---s--x--- + Is it the case that /usr/bin/sudo does not have unix mode ---s--x---? - + -Run the following command to determine if the wine_mmap_zero_ignore SELinux boolean is disabled: -$ getsebool wine_mmap_zero_ignore +Run the following command to determine if the httpd_can_network_connect_cobbler SELinux boolean is disabled: +$ getsebool httpd_can_network_connect_cobbler If properly configured, the output should show the following: -wine_mmap_zero_ignore --> off - Is it the case that wine_mmap_zero_ignore is not disabled? +httpd_can_network_connect_cobbler --> off + Is it the case that httpd_can_network_connect_cobbler is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-agent" command with the following command: - -$ sudo auditctl -l | grep ssh-agent + + Verify the noexec option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . noexec . . . --a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent - Is it the case that the command does not return a line, or the line is commented out? - - - - To find the location of the AIDE database file, run the following command: -$ sudo ls -l DBDIR/database_file_name - Is it the case that there is no database file? - - - - To verify that FIPS mode is enabled properly, run the following command: -fips-mode-setup --check -The output should contain the following: -FIPS mode is enabled. -To verify that the cryptographic policy has been configured correctly, run the -following command: -$ update-crypto-policies --show -The output should return . - Is it the case that FIPS mode is not enabled? + Is it the case that the "/var/log" file system does not have the "noexec" option set? - - The following command will list which files on the system have file hashes different from what -is expected by the RPM database. -$ rpm -Va --noconfig | awk '$1 ~ /..5/' - Is it the case that there is output? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_IA32_EMULATION /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the sendmail package is installed: -$ rpm -q sendmail - Is it the case that the package is installed? + + Verify the nosuid option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . nosuid . . . + + Is it the case that the "/tmp" file system does not have the "nosuid" option set? - - Run the following command to determine if the logrotate package is installed: $ rpm -q logrotate - Is it the case that the package is not installed? + + Verify the nosuid option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . nosuid . . . + + Is it the case that the "/var/log/audit" file system does not have the "nosuid" option set? - + -Run the following command to determine if the samba_load_libgfapi SELinux boolean is disabled: -$ getsebool samba_load_libgfapi +Run the following command to determine if the logrotate_use_nfs SELinux boolean is disabled: +$ getsebool logrotate_use_nfs If properly configured, the output should show the following: -samba_load_libgfapi --> off - Is it the case that samba_load_libgfapi is not disabled? - - - - Verify Red Hat Enterprise Linux 8 for PKI-based authentication has valid certificates by constructing a -certification path (which includes status information) to an accepted trust anchor. - -Check that the system has a valid DoD root CA installed with the following command: - -$ sudo openssl x509 -text -in /etc/sssd/pki/sssd_auth_ca_db.pem - -Certificate: -Data: -Version: 3 (0x2) -Serial Number: 1 (0x1) -Signature Algorithm: sha256WithRSAEncryption -Issuer: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 -Validity -Not Before: Mar 20 18:46:41 2012 GMT -Not After : Dec 30 18:46:41 2029 GMT -Subject: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 -Subject Public Key Info: -Public Key Algorithm: rsaEncryption - Is it the case that root CA file is not a DoD-issued certificate with a valid date and installed in the /etc/sssd/pki/sssd_auth_ca_db.pem location? +logrotate_use_nfs --> off + Is it the case that logrotate_use_nfs is not disabled? - - Run the following command to determine if the nginx package is installed: -$ rpm -q nginx + + Run the following command to determine if the libreport-plugin-logger package is installed: +$ rpm -q libreport-plugin-logger Is it the case that the package is installed? - - -Run the following command to determine if the ftpd_full_access SELinux boolean is disabled: -$ getsebool ftpd_full_access -If properly configured, the output should show the following: -ftpd_full_access --> off - Is it the case that ftpd_full_access is not disabled? + + To check the permissions of /etc/http/conf/*, +run the command: +$ ls -l /etc/http/conf/* +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/http/conf/* does not have unix mode -rw-r-----? - - Verify the site's network diagram and visually check the web server, to -ensure that the private web server is located on a separate controlled -access subnet and is not part of the public DMZ that houses the public -web servers. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_chkpwd" command with the following command: -In addition, the private web server needs to be isolated via a controlled -access mechanism from the local general population lan. - Is it the case that the private web server is not on a separate controlled access subnet? - - - - To check the ownership of /etc/cron.weekly, -run the command: -$ ls -lL /etc/cron.weekly -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.weekly does not have an owner of root? +$ sudo auditctl -l | grep unix_chkpwd + +-a always,exit -F path=/usr/bin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_chkpwd + Is it the case that the command does not return a line, or the line is commented out? - + To determine if the system is configured to audit calls to the -lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit/audit.* +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - If the system is not configured to audit time changes, this is a finding. -If the system is 64-bit only, this is not applicable -ocil: | -To determine if the system is configured to audit calls to the -stime system call, run the following command: -$ sudo grep "stime" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - Is it the case that no line is returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PROC_KCORE /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the selinuxuser_postgresql_connect_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_postgresql_connect_enabled +If properly configured, the output should show the following: +selinuxuser_postgresql_connect_enabled --> off + Is it the case that selinuxuser_postgresql_connect_enabled is not disabled? - - To check which SSH protocol version is allowed, check version of -openssh-server with following command: -$ rpm -qi openssh-server | grep Version -Versions equal to or higher than 7.4 have deprecated the RhostsRSAAuthentication option. -If version is lower than 7.4, run the following command to check configuration: -To determine how the SSH daemon's RhostsRSAAuthentication option is set, run the following command: - -$ sudo grep -i RhostsRSAAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? + + To verify that SSSD is configured to run as user sssd, run the following command: +$ sudo grep -r '\buser\b' /etc/sssd +If configured properly, output should similar to /etc/sssd/conf.d/ospp.conf:user = sssd. +Sanity of SSSD configuration in general can be checked using $ sudo sssctl config-check + Is it the case that it does not exist or is not configured properly? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the truncate system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r truncate /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep truncate /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? + + Review the contents of the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf +files to ensure appropriate logging is set. In addition, run the following command: +ls -l /var/log/ +and verify that the log files are logging information + Is it the case that no logging is configured? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes audit_backlog_limit=8192, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit_backlog_limit=8192.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*audit_backlog_limit=8192.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'audit_backlog_limit=8192' -The command should not return any output. - Is it the case that audit backlog limit is not configured? + + Inspect the file /etc/sysconfig/iptables to determine +the default policy for the INPUT chain. It should be set to DROP: +$ sudo grep ":INPUT" /etc/sysconfig/iptables + Is it the case that the default policy for the INPUT chain is not set to DROP? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RETPOLINE /boot/config.* + $ grep CONFIG_SECURITY_YAMA /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers.d/" with the following command: - -$ sudo auditctl -l | grep/etc/sudoers.d - --w /etc/sudoers.d/ -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + + To verify the boot loader superuser account has been set, run the following +command: +sudo grep -A1 "superusers" /boot/grub2/grub.cfg +The output should show the following: +set superusers="superusers-account" +export superusers +where superusers-account is the actual account name different from common names like root, +admin, or administrator and different from any other existing user name. + Is it the case that superuser account is not set or is set to root, admin, administrator or any other existing user name? - - Verify file systems that are used for removable media are mounted with the "nodev" option with the following command: - -$ sudo more /etc/fstab - -UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 - Is it the case that a file system found in "/etc/fstab" refers to removable media and it does not have the "nodev" option set? + + +Run the following command to determine if the dhcpd_use_ldap SELinux boolean is disabled: +$ getsebool dhcpd_use_ldap +If properly configured, the output should show the following: +dhcpd_use_ldap --> off + Is it the case that dhcpd_use_ldap is not disabled? - - If the system uses IPv6, this is not applicable. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chage" command with the following command: -If the system is configured to prevent the usage of the ipv6 on -network interfaces, it will contain a line of the form: -net.ipv6.conf.default.disable_ipv6 = 1 -Such lines may be inside any file in the /etc/sysctl.d directory. -This permits insertion of the IPv6 kernel module (which other parts of the -system expect to be present), but otherwise keeps network interfaces -from using IPv6. Run the following command to search for such lines in all -files in /etc/sysctl.d: -$ grep -r ipv6 /etc/sysctl.d - Is it the case that the ipv6 support is disabled by default on network interfaces? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes vsyscall=none, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*vsyscall=none.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*vsyscall=none.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'vsyscall=none' -The command should not return any output. - Is it the case that vsyscalls are enabled? +$ sudo auditctl -l | grep chage + +-a always,exit -F path=/usr/bin/chage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chage + Is it the case that the command does not return a line, or the line is commented out? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_LIST /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + +Run the following command to determine if the wine_mmap_zero_ignore SELinux boolean is disabled: +$ getsebool wine_mmap_zero_ignore +If properly configured, the output should show the following: +wine_mmap_zero_ignore --> off + Is it the case that wine_mmap_zero_ignore is not disabled? - - To check that no password hashes are stored in -/etc/passwd, run the following command: -awk '!/\S:x|\*/ {print}' /etc/passwd -If it produces any output, then a password hash is -stored in /etc/passwd. - Is it the case that any stored hashes are found in /etc/passwd? + + To verify that all user initialization files have a mode of 0740 or +less permissive, run the following command: +$ sudo find /home -type f -name '\.*' \( -perm -0002 -o -perm -0020 \) +There should be no output. + Is it the case that they are not 0740 or more permissive? - - -Run the following command to determine if the ftpd_use_passive_mode SELinux boolean is disabled: -$ getsebool ftpd_use_passive_mode -If properly configured, the output should show the following: -ftpd_use_passive_mode --> off - Is it the case that ftpd_use_passive_mode is not disabled? + + To verify .netrc file in interactive user home directory is +not group or world accessible", run the following command: +$ sudo ls -lLR /home/USER/.netrc + Is it the case that the group and world permissions are incorrect? - - Verify the usrquota option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . usrquota . . . + + To verify that the installed operating system is supported, run +the following command: - Is it the case that the "/home" file system does not have the "usrquota" option set? +$ grep -i "red hat" /etc/redhat-release + +Red Hat Enterprise Linux 8 + Is it the case that the installed operating system is not supported? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the sanlock_use_nfs SELinux boolean is disabled: -$ getsebool sanlock_use_nfs -If properly configured, the output should show the following: -sanlock_use_nfs --> off - Is it the case that sanlock_use_nfs is not disabled? + + To determine if the system is configured to audit unsuccessful calls +to the fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the mcelog_client SELinux boolean is disabled: -$ getsebool mcelog_client -If properly configured, the output should show the following: -mcelog_client --> off - Is it the case that mcelog_client is not disabled? + + Run the following command to determine if the McAfeeTP package is installed: $ rpm -q McAfeeTP + Is it the case that the package is not installed? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BUG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/gshadow-, +run the command: +$ ls -lL /etc/gshadow- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/gshadow- does not have an owner of root? - - Check that no boot image file is specified in /etc/zipl.conf: -grep -R "^image\s*=" /etc/zipl.conf -No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL. - Is it the case that a non BLS boot entry is configured? + + To verify Certmap is enabled in SSSD, run the following command: +$ sudo cat /etc/sssd/sssd.conf +If configured properly, output should contain section like the following + +[certmap/testing.test/rule_name] +matchrule =<SAN>.*EDIPI@mil +maprule = (userCertificate;binary={cert!bin}) +domains = testing.test + + Is it the case that Certmap is not configured in SSSD? - - Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: + + Verify that a separate file system/partition has been created for /srv with the following command: -$ sudo grep -w space_left /etc/audit/auditd.conf +$ mountpoint /srv -space_left = % - Is it the case that the value of the "space_left" keyword is not set to <sub idref="var_auditd_space_left_percentage" />% of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. If the "space_left" value is not configured to the correct value? + Is it the case that "/srv is not a mountpoint" is returned? - - -Run the following command to determine if the nfsd_anon_write SELinux boolean is disabled: -$ getsebool nfsd_anon_write -If properly configured, the output should show the following: -nfsd_anon_write --> off - Is it the case that nfsd_anon_write is not disabled? + + To check the group ownership of /etc/gshadow, +run the command: +$ ls -lL /etc/gshadow +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/gshadow does not have a group owner of root? - + -Run the following command to determine if the xdm_exec_bootloader SELinux boolean is disabled: -$ getsebool xdm_exec_bootloader +Run the following command to determine if the squid_use_tproxy SELinux boolean is disabled: +$ getsebool squid_use_tproxy If properly configured, the output should show the following: -xdm_exec_bootloader --> off - Is it the case that xdm_exec_bootloader is not disabled? +squid_use_tproxy --> off + Is it the case that squid_use_tproxy is not disabled? - - To check that the avahi-daemon service is disabled in system boot configuration, + + Run the following command to determine if the setroubleshoot-plugins package is installed: +$ rpm -q setroubleshoot-plugins + Is it the case that the package is installed? + + + + Locate the directories containing the CGI scripts. These directories should be +language-specific (e.g., PERL, ASP, JS, JSP, etc.). Examine the file permissions +on the directories using the following command: +ls -l directories +Anonymous FTP users must not have access to these directories. + Is it the case that it is not? + + + + To check that the vsftpd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled avahi-daemon -Output should indicate the avahi-daemon service has either not been installed, +$ sudo systemctl is-enabled vsftpd +Output should indicate the vsftpd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled avahi-daemon disabled +$ sudo systemctl is-enabled vsftpd disabled -Run the following command to verify avahi-daemon is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active avahi-daemon +Run the following command to verify vsftpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active vsftpd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the avahi-daemon is masked, run the following command: -$ sudo systemctl show avahi-daemon | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the vsftpd is masked, run the following command: +$ sudo systemctl show vsftpd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "avahi-daemon" is loaded and not masked? + Is it the case that the "vsftpd" is loaded and not masked? - - Run the following command to Verify that the sudoers security policy is configured to use the invoking user's password for privilege escalation: - sudo cvtsudoers -f sudoers /etc/sudoers | grep -E '^Defaults !?(rootpw|targetpw|runaspw)' -or if cvtsudoers not supported: - sudo find /etc/sudoers /etc/sudoers.d \( \! -name '*~' -a \! -name '*.*' \) -exec grep -E --with-filename '^[[:blank:]]*Defaults[[:blank:]](.*[[:blank:]])?!?\b(rootpw|targetpw|runaspw)' -- {} \; -If no results are returned, this is a finding. -If conflicting results are returned, this is a finding. -If "Defaults !targetpw" is not defined, this is a finding. -If "Defaults !rootpw" is not defined, this is a finding. -If "Defaults !runaspw" is not defined, this is a finding. - Is it the case that invoke user passwd when using sudo? + + To ensure the MaxAuthTries parameter is set, run the following command: +$ sudo grep MaxAuthTries /etc/ssh/sshd_config +If properly configured, output should be: +MaxAuthTries + Is it the case that it is commented out or not configured properly? - + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STRICT_MODULE_RWX /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + -Run the following command to determine if the mysql_connect_any SELinux boolean is disabled: -$ getsebool mysql_connect_any +Run the following command to determine if the secadm_exec_content SELinux boolean is enabled: +$ getsebool secadm_exec_content If properly configured, the output should show the following: -mysql_connect_any --> off - Is it the case that mysql_connect_any is not disabled? +secadm_exec_content --> on + Is it the case that secadm_exec_content is not enabled? - - Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server - Is it the case that the package is installed? + + Verify the noexec option is configured for the /var mount point, + run the following command: + $ sudo mount | grep '\s/var\s' + . . . /var . . . noexec . . . + + Is it the case that the "/var" file system does not have the "noexec" option set? - - Run the following command to determine if the vsftpd package is installed: -$ rpm -q vsftpd - Is it the case that the package is installed? + + To check the ownership of /var/log, +run the command: +$ ls -lL /var/log +If properly configured, the output should indicate the following owner: +root + Is it the case that /var/log does not have an owner of root? - + -Run the following command to determine if the kerberos_enabled SELinux boolean is enabled: -$ getsebool kerberos_enabled +Run the following command to determine if the httpd_run_preupgrade SELinux boolean is disabled: +$ getsebool httpd_run_preupgrade If properly configured, the output should show the following: -kerberos_enabled --> on - Is it the case that kerberos_enabled is not enabled? +httpd_run_preupgrade --> off + Is it the case that httpd_run_preupgrade is not disabled? - - Verify that Red Hat Enterprise Linux 8 disables the use of user namespaces with the following commands: + + +Run the following command to determine if the xserver_execmem SELinux boolean is disabled: +$ getsebool xserver_execmem +If properly configured, the output should show the following: +xserver_execmem --> off + Is it the case that xserver_execmem is not disabled? + + + + Check group owners of the system audit logs. -Note: User namespaces are used primarily for Linux containers. If containers are in use, this requirement is not applicable. +First, determine where the audit log file is located. -The runtime status of the user.max_user_namespaces kernel parameter can be queried -by running the following command: -$ sysctl user.max_user_namespaces -0. +$ sudo grep -iw ^log_file /etc/audit/auditd.conf +log_file = /var/log/audit/audit.log - Is it the case that the correct value is not returned? +The log_file option specifies the audit log file path. +If the log_file option isn't defined, check all files within /var/log/audit directory. + + +Then, determine the audit log group by running the following command: +$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf + + +Then, check that the audit log file is owned by the correct group. +Run the following command to display the owner of the audit log file: + +$ sudo stat -c "%n %G" log_file + + +The audit log file must be owned by the log_group or by root if the log_group is not specified. + Is it the case that audit log files are owned by incorrect group? - - To obtain a list of all users and the content of their shadow password field, run the command: -$ sudo readarray -t systemaccounts -Verify if all accounts are locked. - Is it the case that system accounts are not locked? + + Run the following command to determine if the httpd package is installed: +$ rpm -q httpd + Is it the case that the package is installed? - - -Run the following command to determine if the mailman_use_fusefs SELinux boolean is disabled: -$ getsebool mailman_use_fusefs -If properly configured, the output should show the following: -mailman_use_fusefs --> off - Is it the case that mailman_use_fusefs is not disabled? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd with the following command: + +$ sudo auditctl -l | grep -E '(/etc/shadow)' + +-w /etc/shadow -p wa -k identity + Is it the case that command does not return a line, or the line is commented out? - - To check if the system motd banner is compliant, -run the following command: -$ cat /etc/motd - Is it the case that it does not display the required banner? + + To determine how the SSH daemon's PermitUserEnvironment option is set, run the following command: + +$ sudo grep -i PermitUserEnvironment /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine if the system is configured to audit calls to the -rename system call, run the following command: -$ sudo grep "rename" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_ALL /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + The runtime status of the kernel.pid_max kernel parameter can be queried +by running the following command: +$ sysctl kernel.pid_max +65536. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the mount_anyfile SELinux boolean is enabled: -$ getsebool mount_anyfile -If properly configured, the output should show the following: -mount_anyfile --> on - Is it the case that mount_anyfile is not enabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEVKMEM /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - System executables are stored in the following directories by default: -/bin -/sbin -/usr/bin -/usr/local/bin -/usr/local/sbin -/usr/sbin -For each of these directories, run the following command to find files -not owned by root: -$ sudo find -L DIR/ ! -user root -type d -exec chown root {} \; - Is it the case that any system executables directories are found to not be owned by root? + + To check the group ownership of /boot/grub2/grub.cfg, +run the command: +$ ls -lL /boot/grub2/grub.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/grub2/grub.cfg does not have a group owner of root? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudoedit" command with the following command: + +$ sudo auditctl -l | grep sudoedit + +-a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudoedit + Is it the case that the command does not return a line, or the line is commented out? - - To verify the boot loader superuser password has been set, run the following command: -$ sudo grep "^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$" /boot/efi/EFI/redhat/user.cfg -The output should be similar to: -GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.C4E08AC72FBFF7E837FD267BFAD7AEB3D42DDC -2C99F2A94DD5E2E75C2DC331B719FE55D9411745F82D1B6CFD9E927D61925F9BBDD1CFAA0080E0 -916F7AB46E0D.1302284FCCC52CD73BA3671C6C12C26FF50BA873293B24EE2A96EE3B57963E6D7 -0C83964B473EC8F93B07FE749AA6710269E904A9B08A6BBACB00A2D242AD828 - Is it the case that no password is set? + + +Run the following command to determine if the gluster_anon_write SELinux boolean is disabled: +$ getsebool gluster_anon_write +If properly configured, the output should show the following: +gluster_anon_write --> off + Is it the case that gluster_anon_write is not disabled? - + -Run the following command to determine if the httpd_enable_ftp_server SELinux boolean is disabled: -$ getsebool httpd_enable_ftp_server +Run the following command to determine if the virt_read_qemu_ga_data SELinux boolean is disabled: +$ getsebool virt_read_qemu_ga_data If properly configured, the output should show the following: -httpd_enable_ftp_server --> off - Is it the case that httpd_enable_ftp_server is not disabled? +virt_read_qemu_ga_data --> off + Is it the case that virt_read_qemu_ga_data is not disabled? - - Verify that Red Hat Enterprise Linux 8 's INACTIVE conforms to site policy (no more than 30 days) with the following command: + + To determine if the system is configured to audit calls to the +unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -$ sudo awk -F: '$7 > 30 {print $1 " " $7}' /etc/shadow - Is it the case that the value of INACTIVE is greater than the expected value or is -1? + Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity rules for the root account. + + Verify that the default umask for all local interactive users is "077". -Check if root user is required to use complex passwords with the following command: +Identify the locations of all local interactive user home directories by looking at the "/etc/passwd" file. -$ grep enforce_for_root /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +Check all local interactive user initialization files for interactive users with the following command: -/etc/security/pwquality.conf:enforce_for_root - Is it the case that "enforce_for_root" is commented or missing? +Note: The example is for a system that is configured to create users home directories in the "/home" directory. + +# grep -ri umask /home/ + +/home/smithj/.bash_history:grep -i umask /etc/bashrc /etc/csh.cshrc /etc/profile +/home/smithj/.bash_history:grep -i umask /etc/login.defs + Is it the case that any local interactive user initialization files are found to have a umask statement that sets a value less restrictive than "077"? - - -Run the following command to determine if the user_exec_content SELinux boolean is enabled: -$ getsebool user_exec_content -If properly configured, the output should show the following: -user_exec_content --> on - Is it the case that user_exec_content is not enabled? + + Run the following command to determine if the aide package is installed: $ rpm -q aide + Is it the case that the package is not installed? - - To verify the assigned home directory of all interactive users is group- -owned by that users primary GID, run the following command: -# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) - Is it the case that the group ownership is incorrect? + + Verify the nosuid option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . nosuid . . . + + Is it the case that the "/home" file system does not have the "nosuid" option set? - - Verify the value of the "minclass" option in "/etc/security/pwquality.conf" with the following command: - -$ grep minclass /etc/security/pwquality.conf + + -minclass = - Is it the case that the value of "minclass" is set to less than "<sub idref="var_password_pam_minclass" />" or is commented out? +Run the following command to determine the current status of the +auditd service: +$ sudo systemctl is-active auditd +If the service is running, it should return the following: active + Is it the case that the auditd service is not running? - + + To verify that rsyslog's Forwarding Output Module has CA certificate +configured for its TLS connections to remote server, run the following command: +$ grep DefaultNetstreamDriverCAFile /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should include record similar to +global(DefaultNetstreamDriverCAFile="/etc/pki/tls/cert.pem") +where the path to the CA file (/etc/pki/tls/cert.pem in case above) must point to the correct CA certificate. + Is it the case that CA certificate for rsyslog remote logging via TLS is not set? + + + + Run the following command to determine if the pcsc-lite package is installed: $ rpm -q pcsc-lite + Is it the case that the package is not installed? + + + -Run the following command to determine if the global_ssp SELinux boolean is disabled: -$ getsebool global_ssp +Run the following command to determine if the smbd_anon_write SELinux boolean is disabled: +$ getsebool smbd_anon_write If properly configured, the output should show the following: -global_ssp --> off - Is it the case that global_ssp is not disabled? +smbd_anon_write --> off + Is it the case that smbd_anon_write is not disabled? - + -Run the following command to determine if the ksmtuned_use_cifs SELinux boolean is disabled: -$ getsebool ksmtuned_use_cifs +Run the following command to determine if the git_session_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool git_session_bind_all_unreserved_ports If properly configured, the output should show the following: -ksmtuned_use_cifs --> off - Is it the case that ksmtuned_use_cifs is not disabled? +git_session_bind_all_unreserved_ports --> off + Is it the case that git_session_bind_all_unreserved_ports is not disabled? - - To determine if the system is configured to audit successful calls -to the fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit.* + + To determine if the system is configured to audit calls to the +create_module system call, run the following command: +$ sudo grep "create_module" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes page_poison=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*page_poison=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*page_poison=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'page_poison=1' -The command should not return any output. - Is it the case that page allocator poisoning is not enabled? + + To verify /etc/system-fips exists, run the following command: +ls -l /etc/system-fips +The output should be similar to the following: +-rw-r--r--. 1 root root 36 Nov 26 11:31 /etc/system-fips + Is it the case that /etc/system-fips does not exist? - - -Run the following command to determine if the guest_exec_content SELinux boolean is disabled: -$ getsebool guest_exec_content -If properly configured, the output should show the following: -guest_exec_content --> off - Is it the case that guest_exec_content is not disabled? + + Run the following command to determine if the libcap-ng-utils package is installed: $ rpm -q libcap-ng-utils + Is it the case that the package is not installed? - - Run the following command to ensure postfix accepts mail messages from only the local system: -$ grep inet_interfaces /etc/postfix/main.cf -If properly configured, the output should show only . - Is it the case that it does not? + + Verify that the system is integrated with a centralized authentication mechanism +such as as Active Directory, Kerberos, Directory Server, etc. that has +automated account mechanisms in place. + Is it the case that the system is not using a centralized authentication mechanism, or it is not automated? - - Run the following command to determine if the openscap-scanner package is installed: $ rpm -q openscap-scanner - Is it the case that the package is not installed? + + Verify the operating system audits activities performed during nonlocal +maintenance and diagnostic sessions. Run the following command: +$ sudo auditctl -l | grep sudo.log +-w /var/log/sudo.log -p wa -k maintenance + + Is it the case that Audit rule is not present? - - Locate the directories containing the CGI scripts. These directories should be -language-specific (e.g., PERL, ASP, JS, JSP, etc.). Examine the file permissions -on the directories using the following command: -ls -l directories -Anonymous FTP users must not have access to these directories. - Is it the case that it is not? + + Verify Red Hat Enterprise Linux 8 is securely comparing internal information system clocks at a regular interval with an NTP server with the following command: +$ sudo grep maxpoll /etc/ntp.conf /etc/chrony.conf +server [ntp.server.name] iburst maxpoll . + Is it the case that "maxpoll" has not been set to the value of "<sub idref="var_time_service_set_maxpoll" />", is commented out, or is missing? - - To ensure ClientAliveInterval is set correctly, run the following command: - -$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config - -If properly configured, the output should be: -ClientAliveCountMax 0 + + To check for legacy lines in /etc/passwd, run the following command: + grep '^\+' /etc/passwd +The command should not return any output. + Is it the case that the file contains legacy lines? + + + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules +The output has to be exactly as follows: +## Unsuccessful file access (any other opens) This has to go last. +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access +-a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access + Is it the case that the file does not exist or the content differs? + + + + +Run the following command to determine if the mmap_low_allowed SELinux boolean is disabled: +$ getsebool mmap_low_allowed +If properly configured, the output should show the following: +mmap_low_allowed --> off + Is it the case that mmap_low_allowed is not disabled? + + + + In order to be sure that the databases are up-to-date, run the +dconf update +command as the administrator. + Is it the case that The system-wide dconf databases are up-to-date with regards to respective keyfiles? + + + + -In this case, the SSH timeout occurs precisely when -the ClientAliveInterval is set. - Is it the case that it is commented out or not configured properly? +Run the following command to determine the current status of the +cron service: +$ sudo systemctl is-active cron +If the service is running, it should return the following: active + Is it the case that ? - - To check the permissions of /etc/gshadow-, -run the command: -$ ls -l /etc/gshadow- -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/gshadow- does not have unix mode ----------? + + To verify that Linux Audit logging is enabled for the USBGuard daemon, +run the following command: +$ sudo grep AuditBackend /etc/usbguard/usbguard-daemon.conf +The output should be +AuditBackend=LinuxAudit + Is it the case that AuditBackend is not set to LinuxAudit? @@ -377892,683 +378069,770 @@ If a line indicating yes is returned, then the required value is set. Is it the case that the required value is not set? - - To ensure a login warning banner is enabled, run the following: -$ grep banner-message-enable /etc/dconf/db/gdm.d/* -If properly configured, the output should be true. -To ensure a login warning banner is locked and cannot be changed by a user, run the following: -$ grep banner-message-enable /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/banner-message-enable. - Is it the case that it is not? - - - - Verify emergency accounts have been provisioned with an expiration date of 72 hours. - -For every emergency account, run the following command to obtain its account aging and expiration information: - -$ sudo chage -l emergency_account_name - -Verify each of these accounts has an expiration date set within 72 hours or as documented. - Is it the case that any emergency accounts have no expiration date set or do not expire within 72 hours? + + To find the location of the AIDE database file, run the following command: +$ sudo ls -l DBDIR/database_file_name + Is it the case that there is no database file? - - To check the group ownership of /etc/group, -run the command: -$ ls -lL /etc/group -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/group does not have a group owner of root? + + +Run the following command to determine if the openvpn_enable_homedirs SELinux boolean is disabled: +$ getsebool openvpn_enable_homedirs +If properly configured, the output should show the following: +openvpn_enable_homedirs --> off + Is it the case that openvpn_enable_homedirs is not disabled? - + -Run the following command to determine if the mozilla_plugin_bind_unreserved_ports SELinux boolean is disabled: -$ getsebool mozilla_plugin_bind_unreserved_ports +Run the following command to determine if the puppetmaster_use_db SELinux boolean is disabled: +$ getsebool puppetmaster_use_db If properly configured, the output should show the following: -mozilla_plugin_bind_unreserved_ports --> off - Is it the case that mozilla_plugin_bind_unreserved_ports is not disabled? +puppetmaster_use_db --> off + Is it the case that puppetmaster_use_db is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-3-access-failed.rules -The output has to be exactly as follows: -## Unsuccessful file access (any other opens) This has to go last. --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-access - Is it the case that the file does not exist or the content differs? + + To determine if the system is configured to audit successful calls +to the openat system call, run the following command: +$ sudo grep "openat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify that yum verifies the signature of packages from a repository prior to install with the following command: - -$ grep gpgcheck /etc/yum.conf + + +Run the following command to determine if the polipo_use_nfs SELinux boolean is disabled: +$ getsebool polipo_use_nfs +If properly configured, the output should show the following: +polipo_use_nfs --> off + Is it the case that polipo_use_nfs is not disabled? + + + + Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: -gpgcheck=1 +$ sudo grep audit /etc/security/faillock.conf -If "gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. - Is it the case that there is no process to validate certificates that is approved by the organization? +audit + Is it the case that the "audit" option is not set, is missing or commented out? - - -Run the following command to determine if the nis_enabled SELinux boolean is disabled: -$ getsebool nis_enabled -If properly configured, the output should show the following: -nis_enabled --> off - Is it the case that nis_enabled is not disabled? + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 limits the number of concurrent sessions to -"" for all -accounts and/or account types with the following command: -$ grep -r -s maxlogins /etc/security/limits.conf /etc/security/limits.d/*.conf -/etc/security/limits.conf:* hard maxlogins 10 -This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. - Is it the case that the "maxlogins" item is missing, commented out, or the value is set greater -than "<sub idref="var_accounts_max_concurrent_login_sessions" />" and -is not documented with the Information System Security Officer (ISSO) as an -operational requirement for all domains that have the "maxlogins" item -assigned'? + + Run the following command to determine if the pigz package is installed: +$ rpm -q pigz + Is it the case that the package is installed? - - Run the following command to determine the current status of the dnf-automatic timer: $ sudo systemctl is-active dnf-automatic.timer If the timer is running, it should return the following: active - Is it the case that the dnf-automatic.timer is not enabled? + + To verify all files and directories contained in interactive user home +directory, excluding local initialization files, have a mode of 0750, +run the following command: +$ sudo ls -lLR /home/USER + Is it the case that home directory files or folders have incorrect permissions? - - To ensure that users cannot disable the screensaver idle inactivity setting, run the following: -$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled - Is it the case that idle-activation-enabled is not locked? + + To verify that the audit system collects unauthorized file accesses, run the following commands: +$ sudo grep EACCES /etc/audit/audit.rules +$ sudo grep EPERM /etc/audit/audit.rules + Is it the case that 32-bit and 64-bit system calls to creat, open, openat, open_by_handle_at, truncate, and ftruncate are not audited during EACCES and EPERM? - - To check the ownership of /boot/grub2/grub.cfg, + + To check the ownership of /etc/shadow, run the command: -$ ls -lL /boot/grub2/grub.cfg +$ ls -lL /etc/shadow If properly configured, the output should indicate the following owner: root - Is it the case that /boot/grub2/grub.cfg does not have an owner of root? + Is it the case that /etc/shadow does not have an owner of root? - - Inspect the file /etc/firewalld/firewalld.conf to determine -the default zone for the firewalld. It should be set to DefaultZone=drop: -$ sudo grep DefaultZone /etc/firewalld/firewalld.conf - Is it the case that the default zone is not set to DROP? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one lower-case character. + +Check the value for "lcredit" with the following command: + +$ sudo grep lcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:lcredit = -1 + Is it the case that the value of "lcredit" is a positive number or is commented out? - - Verify Red Hat Enterprise Linux 8 enforces a delay of at least seconds between console logon prompts following a failed logon attempt with the following command: - -$ sudo grep -i "FAIL_DELAY" /etc/login.defs -FAIL_DELAY - Is it the case that the value of "FAIL_DELAY" is not set to "<sub idref="var_accounts_fail_delay" />" or greater, or the line is commented out? + + Run the following command to determine if the cups package is installed: +$ rpm -q cups + Is it the case that the package is installed? - - To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: + + +Run the following command to determine if the xguest_use_bluetooth SELinux boolean is disabled: +$ getsebool xguest_use_bluetooth +If properly configured, the output should show the following: +xguest_use_bluetooth --> off + Is it the case that xguest_use_bluetooth is not disabled? + + + + Check that AIDE is properly configured to protect the integrity of the +audit tools by running the following command: -$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config +# sudo cat /etc/aide.conf | grep /usr/sbin/au -If a line indicating yes is returned, then the required value is set. +/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512 +/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512 - Is it the case that the required value is not set? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "reboot" command with the following command: -$ sudo auditctl -l | grep reboot --a always,exit -F path=/reboot -F perm=x -F auid>=1000 -F auid!=unset -k privileged-reboot - Is it the case that the command does not return a line, or the line is commented out? +/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512 + + +If AIDE is configured properly to protect the integrity of the audit tools, +all lines listed above will be returned from the command. + +If one or more lines are missing, this is a finding. + Is it the case that integrity checks of the audit tools are missing or incomplete? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "restorecon" command with the following command: + + Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: -$ sudo auditctl -l | grep restorecon +$ sudo grep audit /etc/security/faillock.conf --a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -k privileged-restorecon - Is it the case that the command does not return a line, or the line is commented out? +audit + Is it the case that the "audit" option is not set, is missing or commented out? - - -Run the following command to determine if the zabbix_can_network SELinux boolean is disabled: -$ getsebool zabbix_can_network -If properly configured, the output should show the following: -zabbix_can_network --> off - Is it the case that zabbix_can_network is not disabled? + + To verify all files and directories in interactive user home directory are +group-owned by a group the user is a member of, run the +following command: +$ sudo ls -lLR /home/USER + Is it the case that the group ownership is incorrect? - - To check the permissions of /etc/shadow-, -run the command: -$ ls -l /etc/shadow- -If properly configured, the output should indicate the following permissions: ----------- - Is it the case that /etc/shadow- does not have unix mode ----------? + + Verify Red Hat Enterprise Linux 8 is configured to lock the root account after +unsuccessful logon attempts with the command: + + +$ grep even_deny_root /etc/security/faillock.conf +even_deny_root + Is it the case that the "even_deny_root" option is not set, is missing or commented out? - - To ensure all GIDs referenced in /etc/passwd are defined in /etc/group, -run the following command: -$ sudo pwck -qr -There should be no output. - Is it the case that GIDs referenced in /etc/passwd are returned as not defined in /etc/group? + + To determine if the system is configured to audit unsuccessful calls +to the fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To view the root user's PATH, run the following command: -$ sudo env | grep PATH -If correctly configured, the PATH must: use vendor default settings, -have no empty entries, and have no entries beginning with a character -other than a slash (/). - Is it the case that any of these conditions are not met? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes slab_nomerge=yes, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slab_nomerge=yes.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*slab_nomerge=yes.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'slab_nomerge=yes' +The command should not return any output. + Is it the case that merging of slabs with similar size is enabled? - - Verify the nosuid option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . nosuid . . . + + - Is it the case that the "/home" file system does not have the "nosuid" option set? +Run the following command to determine the current status of the +pcscd service: +$ sudo systemctl is-active pcscd +If the service is running, it should return the following: active + Is it the case that the pcscd service is not enabled? - - Run the following command to determine if the rsyslog package is installed: $ rpm -q rsyslog - Is it the case that the package is not installed? + + To check the ownership of /etc/cron.hourly, +run the command: +$ ls -lL /etc/cron.hourly +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.hourly does not have an owner of root? - - The runtime status of the net.ipv4.conf.all.send_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.send_redirects -0. + + If the system uses IPv6, this is not applicable. - Is it the case that the correct value is not returned? +If the system is configured to prevent the usage of the ipv6 on +network interfaces, it will contain a line of the form: +net.ipv6.conf.default.disable_ipv6 = 1 +Such lines may be inside any file in the /etc/sysctl.d directory. +This permits insertion of the IPv6 kernel module (which other parts of the +system expect to be present), but otherwise keeps network interfaces +from using IPv6. Run the following command to search for such lines in all +files in /etc/sysctl.d: +$ grep -r ipv6 /etc/sysctl.d + Is it the case that the ipv6 support is disabled by default on network interfaces? - - Verify the noexec option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . noexec . . . + + To check that the httpd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled httpd +Output should indicate the httpd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled httpd disabled - Is it the case that the "/var/log" file system does not have the "noexec" option set? +Run the following command to verify httpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active httpd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the httpd is masked, run the following command: +$ sudo systemctl show httpd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "httpd" is loaded and not masked? - - To determine if the system is configured to audit successful calls -to the removexattr system call, run the following command: -$ sudo grep "removexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To verify all local initialization files for interactive users are owned by the +primary user, run the following command: +$ sudo ls -al /home/USER/.* +The user initialization files should be owned by USER. + Is it the case that they are not? - - -Run the following command to determine if the logadm_exec_content SELinux boolean is enabled: -$ getsebool logadm_exec_content -If properly configured, the output should show the following: -logadm_exec_content --> on - Is it the case that logadm_exec_content is not enabled? + + Verify Red Hat Enterprise Linux 8 for PKI-based authentication has valid certificates by constructing a +certification path (which includes status information) to an accepted trust anchor. + +Check that the system has a valid DoD root CA installed with the following command: + +$ sudo openssl x509 -text -in /etc/sssd/pki/sssd_auth_ca_db.pem + +Certificate: +Data: +Version: 3 (0x2) +Serial Number: 1 (0x1) +Signature Algorithm: sha256WithRSAEncryption +Issuer: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 +Validity +Not Before: Mar 20 18:46:41 2012 GMT +Not After : Dec 30 18:46:41 2029 GMT +Subject: C = US, O = U.S. Government, OU = DoD, OU = PKI, CN = DoD Root CA 3 +Subject Public Key Info: +Public Key Algorithm: rsaEncryption + Is it the case that root CA file is not a DoD-issued certificate with a valid date and installed in the /etc/sssd/pki/sssd_auth_ca_db.pem location? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RANDOMIZE_BASE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that Audit Daemon is configured to resolve all uid, gid, syscall, +architecture, and socket address information before writing the event to disk, +run the following command: +$ sudo grep log_format /etc/audit/auditd.conf +The output should return the following: +log_format = ENRICHED + Is it the case that log_format isn't set to ENRICHED? - - -Run the following command to determine if the git_cgi_use_nfs SELinux boolean is disabled: -$ getsebool git_cgi_use_nfs -If properly configured, the output should show the following: -git_cgi_use_nfs --> off - Is it the case that git_cgi_use_nfs is not disabled? + + The following command will list which files on the system have ownership different from what +is expected by the RPM database: +$ rpm -Va | rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }' + Is it the case that there is output? - - To check the permissions of /etc/at.allow, -run the command: -$ ls -l /etc/at.allow -If properly configured, the output should indicate the following permissions: --rw------- - Is it the case that /etc/at.allow does not have unix mode -rw-------? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-5-perm-change-failed.rules +The output has to be exactly as follows: +## Unsuccessful permission change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b32 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change +-a always,exit -F arch=b64 -S chmod,fchmod,fchmodat,setxattr,lsetxattr,fsetxattr,removexattr,lremovexattr,fremovexattr -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-perm-change + Is it the case that the file does not exist or the content differs? - - Verify that Red Hat Enterprise Linux 8 loads the driver with the following command: + + Verify the NX (no-execution) bit flag is set on the system. -$ grep card_drivers /etc/opensc.conf +Check that the no-execution bit flag is set with the following commands: -card_drivers = ; - Is it the case that "<sub idref="var_smartcard_drivers" />" is not listed as a card driver, or there is no line returned for "card_drivers"? - - - - To verify that BIND uses the system crypto policy, check out that the BIND config file -/etc/named.conf contains the include "/etc/crypto-policies/back-ends/bind.config"; -directive: -$ sudo grep 'include "/etc/crypto-policies/back-ends/bind.config";' /etc/named.conf -Verify that the directive is at the bottom of the options section of the config file. - Is it the case that BIND is installed and the BIND config file doesn't contain the -<pre>include "/etc/crypto-policies/back-ends/bind.config";</pre> directive? +$ sudo dmesg | grep NX + +[ 0.000000] NX (Execute Disable) protection: active + +If "dmesg" does not show "NX (Execute Disable) protection" active, check the cpuinfo settings with the following command: + +$ sudo grep flags /proc/cpuinfo +flags : fpu vme de pse tsc ms nx rdtscp lm constant_ts + +The output should contain the "nx" flag. + Is it the case that NX is disabled? - - The following command will discover and print world-writable directories that -are not group owned by a system account, given the assumption that only system -accounts have a gid lower than 1000. Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -gid +999 -print - Is it the case that there is output? + + To check if pam_pwquality.so is enabled in password-auth, run the following command: +$ grep pam_pwquality /etc/pam.d/password-auth +The output should be similar to the following: +password requisite pam_pwquality.so + Is it the case that pam_pwquality.so is not enabled in password-auth? - - -Run the following command to determine if the named_write_master_zones SELinux boolean is disabled: -$ getsebool named_write_master_zones -If properly configured, the output should show the following: -named_write_master_zones --> off - Is it the case that named_write_master_zones is not disabled? + + To determine if the system is configured to audit calls to the +openat system call, run the following command: +$ sudo grep "openat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + -Run the following command to determine if the virt_use_usb SELinux boolean is disabled: -$ getsebool virt_use_usb +Run the following command to determine if the telepathy_connect_all_ports SELinux boolean is disabled: +$ getsebool telepathy_connect_all_ports If properly configured, the output should show the following: -virt_use_usb --> off - Is it the case that virt_use_usb is not disabled? +telepathy_connect_all_ports --> off + Is it the case that telepathy_connect_all_ports is not disabled? - - Verify the system-wide shared library directories are group-owned by "root" with the following command: + + To verify that TLS is configured properly in +/etc/httpd/conf.modules.d/ssl.conf, run the following command: +$ grep -i "sslengine\|sslprotocol" /etc/httpd/conf.d/ssl.conf +The output should return the following: -$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -group root -type d -exec stat -c "%n %G" '{}' \; +SSLEngine on +SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 -If any system-wide shared library directory is returned and is not group-owned by a required system account, this is a finding. - Is it the case that any system-wide shared library directory is returned and is not group-owned by a required system account? + Is it the case that it is not? - - The runtime status of the kernel.core_pattern kernel parameter can be queried -by running the following command: -$ sysctl kernel.core_pattern -|/bin/false. - - Is it the case that the returned line does not have a value of "|/bin/false", or a line is not -returned and the need for core dumps is not documented with the Information -System Security Officer (ISSO) as an operational requirement? + + +Run the following command to determine if the tor_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool tor_bind_all_unreserved_ports +If properly configured, the output should show the following: +tor_bind_all_unreserved_ports --> off + Is it the case that tor_bind_all_unreserved_ports is not disabled? - - To verify that Linux Audit logging is enabled for the USBGuard daemon, + + If network services are using the xinetd service, this is not applicable. + +To check that the xinetd service is disabled in system boot configuration, run the following command: -$ sudo grep AuditBackend /etc/usbguard/usbguard-daemon.conf -The output should be -AuditBackend=LinuxAudit - Is it the case that AuditBackend is not set to LinuxAudit? - - - - The group-owner of all log files written by rsyslog should be -root. -These log files are determined by the second part of each Rule line in -/etc/rsyslog.conf and typically all appear in /var/log. -To see the group-owner of a given log file, run the following command: -$ ls -l LOGFILE - Is it the case that the group-owner is not correct? - - - - To determine if NOPASSWD or !authenticate have been configured for -sudo, run the following command: -$ sudo grep -ri "nopasswd\|\!authenticate" /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that nopasswd and/or !authenticate is enabled in sudo? +$ sudo systemctl is-enabled xinetd +Output should indicate the xinetd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled xinetd disabled + +Run the following command to verify xinetd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active xinetd + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the xinetd is masked, run the following command: +$ sudo systemctl show xinetd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "xinetd" is loaded and not masked? - - To verify the number of rounds for the password hashing algorithm is configured, run the following command: -$ sudo grep rounds /etc/pam.d/password-auth -The output should show the following match: -password sufficient pam_unix.so sha512 rounds= - Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + Run the following command to determine if the audit package is installed: $ rpm -q audit + Is it the case that the audit package is not installed? - - To determine how the SSH daemon's Banner option is set, run the following command: - -$ sudo grep -i Banner /etc/ssh/sshd_config - -If a line indicating /etc/issue is returned, then the required value is set. - - Is it the case that the required value is not set? + + To ensure the system is configured to mask the Ctrl-Alt-Del sequence, Check +that the ctrl-alt-del.target is masked and not active with the following +command: +sudo systemctl status ctrl-alt-del.target +The output should indicate that the target is masked and not active. It +might resemble following output: +ctrl-alt-del.target +Loaded: masked (/dev/null; bad) +Active: inactive (dead) + Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed? - - Verify that a separate file system/partition has been created for /var/log/audit with the following command: - -$ mountpoint /var/log/audit - - Is it the case that "/var/log/audit is not a mountpoint" is returned? + + Run the following command and verify that time sources are only configured with server directive: +# grep -E "^(server|pool)" /etc/chrony.conf +A line with the appropriate server should be returned, any line returned starting with pool is a finding. + Is it the case that an authoritative remote time server is not configured or configured with pool directive? - + -Run the following command to determine if the kdumpgui_run_bootloader SELinux boolean is disabled: -$ getsebool kdumpgui_run_bootloader +Run the following command to determine if the glance_use_fusefs SELinux boolean is disabled: +$ getsebool glance_use_fusefs If properly configured, the output should show the following: -kdumpgui_run_bootloader --> off - Is it the case that kdumpgui_run_bootloader is not disabled? +glance_use_fusefs --> off + Is it the case that glance_use_fusefs is not disabled? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_KEXEC /boot/config.* + $ grep CONFIG_SLAB_FREELIST_RANDOM /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Verify the umask setting is configured correctly in the /etc/bashrc file with the following command: - -$ sudo grep "umask" /etc/bashrc + + To check the permissions of /boot/efi/EFI/redhat/grub.cfg, run the command: +$ sudo ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following +permissions: -rwx------ + Is it the case that it does not? + + + + To determine if the system is configured to audit unsuccessful calls +to the fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -umask - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? + Is it the case that no line is returned? - - To ensure smart card authentication on the login screen is enabled, run the following command: -$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot disable smart card authentication on the login screen, run the following: -$ grep enable-smartcard-authentication /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/enable-smartcard-authentication - Is it the case that enable-smartcard-authentication has not been configured or is disabled? + + Run the following command to determine the current status of the dnf-automatic timer: $ sudo systemctl is-active dnf-automatic.timer If the timer is running, it should return the following: active + Is it the case that the dnf-automatic.timer is not enabled? - - -Run the following command to determine if the httpd_read_user_content SELinux boolean is disabled: -$ getsebool httpd_read_user_content -If properly configured, the output should show the following: -httpd_read_user_content --> off - Is it the case that httpd_read_user_content is not disabled? + + Verify that a separate file system/partition has been created for /boot with the following command: + +$ mountpoint /boot + + Is it the case that "/boot is not a mountpoint" is returned? - - Determine where the audit logs are stored with the following command: + + To check that the quota_nld service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled quota_nld +Output should indicate the quota_nld service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled quota_nld disabled -$ sudo grep -iw log_file /etc/audit/auditd.conf +Run the following command to verify quota_nld is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active quota_nld -log_file = /var/log/audit/audit.log +If the service is not running the command will return the following output: +inactive -Determine the owner of the audit log directory by using the output of the above command -(default: "/var/log/audit/"). Run the following command with the correct audit log directory -path: +The service will also be masked, to check that the quota_nld is masked, run the following command: +$ sudo systemctl show quota_nld | grep "LoadState\|UnitFileState" -$ sudo ls -ld /var/log/audit +If the service is masked the command will return the following outputs: -drwx------ 2 root root 23 Jun 11 11:56 /var/log/audit +LoadState=masked -The audit log directory must be owned by "root" - Is it the case that the directory is not owned by root? +UnitFileState=masked + Is it the case that the "quota_nld" is loaded and not masked? - - To determine if env_reset has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\benv_reset\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that env_reset is not enabled in sudo? + + +Run the following command to determine if the virt_sandbox_use_audit SELinux boolean is enabled: +$ getsebool virt_sandbox_use_audit +If properly configured, the output should show the following: +virt_sandbox_use_audit --> on + Is it the case that virt_sandbox_use_audit is not enabled? - - Verify that a separate file system/partition has been created for /boot with the following command: - -$ mountpoint /boot - - Is it the case that "/boot is not a mountpoint" is returned? + + To verify that web content directories should not be shared anonymously over +remote filesystems such as nfs and smb, inspect each instance +of DocumentRoot and serverRoot and verify that no entry in +/etc/fstab exists or no remote filesystem process is running for +any instance. +$ ps -ef | grep "nfs\|smb" + Is it the case that it is not? - - To check the ownership of /etc/cron.allow, -run the command: -$ ls -lL /etc/cron.allow -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.allow does not have an owner of root? + + To check on the age of McAfee virus definition files, run the following command: +$ sudo cd /opt/NAI/LinuxShield/engine/dat +$ sudo ls -la avvscan.dat avvnames.dat avvclean.dat + Is it the case that signatures are out of date? - - To check the ownership of /etc/shells, + + To check the permissions of /etc/cron.weekly, run the command: -$ ls -lL /etc/shells -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shells does not have an owner of root? +$ ls -l /etc/cron.weekly +If properly configured, the output should indicate the following permissions: +-rwx------ + Is it the case that /etc/cron.weekly does not have unix mode -rwx------? - - -Run the following command to determine if the dbadm_manage_user_files SELinux boolean is disabled: -$ getsebool dbadm_manage_user_files -If properly configured, the output should show the following: -dbadm_manage_user_files --> off - Is it the case that dbadm_manage_user_files is not disabled? + + To ensure the user home directory is not group-writable or world-readable, run the following: +# ls -ld /home/USER + Is it the case that the user home directory is group-writable or world-readable? - + -Run the following command to determine if the mcelog_exec_scripts SELinux boolean is enabled: -$ getsebool mcelog_exec_scripts +Run the following command to determine if the selinuxuser_mysql_connect_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_mysql_connect_enabled If properly configured, the output should show the following: -mcelog_exec_scripts --> on - Is it the case that mcelog_exec_scripts is not enabled? - - - - Run the following command to determine if the quagga package is installed: -$ rpm -q quagga - Is it the case that the package is installed? +selinuxuser_mysql_connect_enabled --> off + Is it the case that selinuxuser_mysql_connect_enabled is not disabled? - - Verify an anti-virus solution is installed on the system. The anti-virus solution may be -bundled with an approved host-based security solution. - Is it the case that there is no anti-virus solution installed on the system? + + +Run the following command to determine if the httpd_run_stickshift SELinux boolean is disabled: +$ getsebool httpd_run_stickshift +If properly configured, the output should show the following: +httpd_run_stickshift --> off + Is it the case that httpd_run_stickshift is not disabled? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/tallylog" with the following command: - -$ sudo auditctl -l | grep /var/log/tallylog - --w /var/log/tallylog -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? + + To determine if !authenticate has not been configured for sudo, run the following command: +$ sudo grep -r \!authenticate /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that !authenticate is specified in the sudo config files? - + -Run the following command to determine if the smartmon_3ware SELinux boolean is disabled: -$ getsebool smartmon_3ware +Run the following command to determine if the irssi_use_full_network SELinux boolean is disabled: +$ getsebool irssi_use_full_network If properly configured, the output should show the following: -smartmon_3ware --> off - Is it the case that smartmon_3ware is not disabled? +irssi_use_full_network --> off + Is it the case that irssi_use_full_network is not disabled? - - To verify that the DConf User profile is configured correctly, run the following -command: + + Verify that the interactive user account passwords are using a strong +password hash with the following command: -$ cat /etc/dconf/profile/user -The output should show the following: -user-db:user -system-db:local -system-db:site -system-db:distro - Is it the case that DConf User profile does not exist or is not configured correctly? - - - - To verify that HBSS ACCM is installed, run the following command(s): -$ sudo ls /opt/McAfee/accm/bin/accm - Is it the case that the HBSS ACCM module is not installed? +$ sudo cut -d: -f2 /etc/shadow + +$6$kcOnRq/5$NUEYPuyL.wghQwWssXRcLRFiiru7f5JPV6GaJhNC2aK5F3PZpE/BCCtwrxRc/AInKMNX3CdMw11m9STiql12f/ + +Password hashes ! or * indicate inactive accounts not +available for logon and are not evaluated. + Is it the case that any interactive user password hash does not begin with "$6"? - - The runtime status of the net.ipv4.conf.all.forwarding kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.forwarding -0. -The ability to forward packets is only appropriate for routers. - Is it the case that IP forwarding value is "1" and the system is not router? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one special character with the following command: + +$ sudo grep ocredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +ocredit = + Is it the case that value of "ocredit" is a positive number or is commented out? - - To verify that Samba clients using mount.cifs must use packet signing, run the following command: -$ grep sec /etc/fstab -The output should show either krb5i or ntlmv2i in use. - Is it the case that it does not? + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep '\bat\b' /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? - - To verify the number of rounds for the password hashing algorithm is configured, run the following command: -$ sudo grep rounds /etc/pam.d/system-auth -The output should show the following match: -password sufficient pam_unix.so sha512 rounds= - Is it the case that rounds is not set to <sub idref="var_password_pam_unix_rounds" /> or is commented out? + + To ensure a login warning banner is enabled, run the following: +$ grep banner-message-enable /etc/dconf/db/gdm.d/* +If properly configured, the output should be true. +To ensure a login warning banner is locked and cannot be changed by a user, run the following: +$ grep banner-message-enable /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/banner-message-enable. + Is it the case that it is not? - - Run the following command to determine if the freeradius package is installed: $ rpm -q freeradius - Is it the case that the package is installed? + + To determine how the SSH daemon's IgnoreRhosts option is set, run the following command: + +$ sudo grep -i IgnoreRhosts /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - To determine if the system is configured to audit unsuccessful calls -to the setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To check the status of the idle screen lock activation, run the following command: - Is it the case that no line is returned? +$ gsettings get org.gnome.desktop.screensaver lock-enabled +If properly configured, the output should be true. +To ensure that users cannot change how long until the screensaver locks, run the following: +$ grep lock-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled + Is it the case that screensaver locking is not enabled and/or has not been set or configured correctly? - - To determine if the system is configured to audit calls to the -unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Verify that DNS servers have been configured properly, perform the following: +$ sudo grep nameserver /etc/resolv.conf + Is it the case that less than two lines are returned that are not commented out? - - Verify that Promiscuous mode of an interface is disabled, run the following command: -$ ip link | grep PROMISC - Is it the case that any network device is in promiscuous mode? + + +Run the following command to determine if the ftpd_use_fusefs SELinux boolean is disabled: +$ getsebool ftpd_use_fusefs +If properly configured, the output should show the following: +ftpd_use_fusefs --> off + Is it the case that ftpd_use_fusefs is not disabled? - + -Run the following command to determine if the ssh_chroot_rw_homedirs SELinux boolean is disabled: -$ getsebool ssh_chroot_rw_homedirs +Run the following command to determine if the ksmtuned_use_cifs SELinux boolean is disabled: +$ getsebool ksmtuned_use_cifs If properly configured, the output should show the following: -ssh_chroot_rw_homedirs --> off - Is it the case that ssh_chroot_rw_homedirs is not disabled? +ksmtuned_use_cifs --> off + Is it the case that ksmtuned_use_cifs is not disabled? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one upper-case character. - -Check the value for "ucredit" with the following command: + + To ensure that XDMCP is disabled in /etc/gdm/custom.conf, run the following command: +grep -Pzo "\[xdmcp\]\nEnable=false" /etc/gdm/custom.conf +The output should return the following: -$ sudo grep ucredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +[xdmcp] +Enable=false -ucredit = -1 - Is it the case that the value of "ucredit" is a positive number or is commented out? + Is it the case that the Enable is not set to false or is missing in the xdmcp section of the /etc/gdm/custom.conf gdm configuration file? - + + To check the group ownership of /boot/efi/EFI/redhat/user.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/user.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/efi/EFI/redhat/user.cfg does not have a group owner of root? + + + -Run the following command to determine if the httpd_dbus_sssd SELinux boolean is disabled: -$ getsebool httpd_dbus_sssd +Run the following command to determine if the gluster_export_all_ro SELinux boolean is disabled: +$ getsebool gluster_export_all_ro If properly configured, the output should show the following: -httpd_dbus_sssd --> off - Is it the case that httpd_dbus_sssd is not disabled? +gluster_export_all_ro --> off + Is it the case that gluster_export_all_ro is not disabled? - - To check that virtual syscalls are disabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\bvsyscall=none\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't disable virtual syscalls. - Is it the case that vsyscalls are enabled? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules +The output has to be exactly as follows: +## Successful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete + Is it the case that the file does not exist or the content differs? - - Verify the nosuid option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . nosuid . . . - - Is it the case that the "/boot" file system does not have the "nosuid" option set? + + The file permissions for all log files written by rsyslog should +be set to 640, or more restrictive. These log files are determined by the +second part of each Rule line in /etc/rsyslog.conf and typically +all appear in /var/log. To see the permissions of a given log +file, run the following command: +$ ls -l LOGFILE +The permissions should be 640, or more restrictive. + Is it the case that the permissions are not correct? - - -Run the following command to get the current configured value for secure_mode_insmod -SELinux boolean: -$ getsebool secure_mode_insmod -The expected cofiguration is . -"on" means true, and "off" means false - Is it the case that secure_mode_insmod is not set as expected? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING_ZERO /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 audits the execution of privileged functions. + + +Verify that the shadow password suite configuration is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. -Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: +Check the hashing algorithm that is being used to hash passwords with the following command: -$ sudo grep execve /etc/audit/audit.rules +$ sudo grep -i ENCRYPT_METHOD /etc/login.defs -The output should be the following: +ENCRYPT_METHOD + Is it the case that ENCRYPT_METHOD is not set to <sub idref="var_password_hashing_algorithm" />? + + + + Verify that a separate file system/partition has been created for /home with the following command: +$ mountpoint /home --a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid --a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid --a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid - Is it the case that the command does not return all lines, or the lines are commented out? + Is it the case that "/home is not a mountpoint" is returned? - - Verify the value of the "maxclassrepeat" option in "/etc/security/pwquality.conf" with the following command: - -$ grep maxclassrepeat /etc/security/pwquality.conf + + To check the ownership of /etc/crontab, +run the command: +$ ls -lL /etc/crontab +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/crontab does not have an owner of root? + + + + To verify that SSSD expires known SSH host keys, run the following command: +$ sudo grep ssh_known_hosts_timeout /etc/sssd/sssd.conf +If configured properly, output should be +ssh_known_hosts_timeout = + Is it the case that it does not exist or is not configured properly? + + + + To determine if the system is configured to audit calls to the +chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -maxclassrepeat = - Is it the case that the value of "maxclassrepeat" is set to "0", more than "<sub idref="var_password_pam_maxclassrepeat" />" or is commented out? + Is it the case that no line is returned? @@ -378578,229 +378842,133 @@ The command should return a matching output. Is it the case that noexec is not enabled in sudo? - - -Run the following command to determine if the cron_can_relabel SELinux boolean is disabled: -$ getsebool cron_can_relabel -If properly configured, the output should show the following: -cron_can_relabel --> off - Is it the case that cron_can_relabel is not disabled? - - - - To verify the boot loader superuser account has been set, run the following -command: -sudo grep -A1 "superusers" /boot/grub2/grub.cfg -The output should show the following: -set superusers="superusers-account" -export superusers -where superusers-account is the actual account name different from common names like root, -admin, or administrator and different from any other existing user name. - Is it the case that superuser account is not set or is set to root, admin, administrator or any other existing user name? + + Verify that Red Hat Enterprise Linux 8 set the days of warning before a password expires to + or more for users with a +password: + +$ sudo awk -F: '$6 || $6 == "" {print $1}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? - - Interview the SA or web administrator to see where the public web server -is logically located in the data center. Review the site network diagram -to see how the web server is connected to the LAN. Visually check the web -server hardware connections to see if it conforms to the site network -diagram. - Is it the case that the web server is not isolated in an accredited DoD DMZ Extension? + + To check the ownership of /etc/motd, +run the command: +$ ls -lL /etc/motd +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/motd does not have an owner of root? - + -Run the following command to determine if the staff_use_svirt SELinux boolean is disabled: -$ getsebool staff_use_svirt -If properly configured, the output should show the following: -staff_use_svirt --> off - Is it the case that staff_use_svirt is not disabled? - - - - Open browser window and browse to the appropriate site. Before entry to the -site, you should be presented with the server's PKI credentials. Review -these credentials for authenticity. +To check that the telnet service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig telnet --list +Output should indicate the telnet service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig telnet --list -For DoD, find an entry which cites: +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. -Issuer: -CN = -DOD CLASS 3 CA-3 -OU = PKI -OU = DoD -O = U.S. Government -C = US +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. - Is it the case that it is not? - - - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-2-modify-failed.rules -The output has to be exactly as follows: -## Unsuccessful file modifications (open for write or truncate) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b32 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification --a always,exit -F arch=b64 -S truncate,ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-modification - Is it the case that the file does not exist or the content differs? - - - - To verify that acquiring, saving, and processing core dumps is disabled, run the -following command: -$ systemctl status systemd-coredump.socket -The output should be similar to: -● systemd-coredump.socket - Loaded: masked (Reason: Unit systemd-coredump.socket is masked.) - Active: inactive (dead) ... +telnet off - Is it the case that unit systemd-coredump.socket is not masked or running? - - - - Only FIPS-approved key exchange algorithms must be used. To verify that only FIPS-approved -key exchange algorithms are in use, run the following command: -$ sudo grep -i kexalgorithms /etc/crypto-policies/back-ends/opensshserver.config -The output should contain only following algorithms (or a subset) in the exact order: -CRYPTO_POLICY='-oKexAlgorithms=ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512' - Is it the case that KexAlgorithms option is commented out, contains non-approved algorithms, or the FIPS-approved algorithms are not in the exact order? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postdrop" command with the following command: +To check that the telnet socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled telnet +Output should indicate the telnet socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled telnetdisabled -$ sudo auditctl -l | grep postdrop +Run the following command to verify telnet is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active telnet --a always,exit -F path=/usr/bin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postdrop - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine if the system is configured to audit successful calls -to the chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit.* -If the system is configured to audit this activity, it will return a line. +If the socket is not running the command will return the following output: +inactive - Is it the case that no line is returned? +The socket will also be masked, to check that the telnet is masked, run the following command: +$ sudo systemctl show telnet | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - - To check that the httpd service is disabled in system boot configuration, + + To check that the autofs service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled httpd -Output should indicate the httpd service has either not been installed, +$ sudo systemctl is-enabled autofs +Output should indicate the autofs service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled httpd disabled +$ sudo systemctl is-enabled autofs disabled -Run the following command to verify httpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active httpd +Run the following command to verify autofs is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active autofs If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the httpd is masked, run the following command: -$ sudo systemctl show httpd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the autofs is masked, run the following command: +$ sudo systemctl show autofs | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "httpd" is loaded and not masked? - - - - -Run the following command to determine if the exim_read_user_files SELinux boolean is disabled: -$ getsebool exim_read_user_files -If properly configured, the output should show the following: -exim_read_user_files --> off - Is it the case that exim_read_user_files is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STRICT_KERNEL_WRX /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + Is it the case that the "autofs" is loaded and not masked? - + -Run the following command to determine if the gluster_anon_write SELinux boolean is disabled: -$ getsebool gluster_anon_write +Run the following command to determine if the mcelog_exec_scripts SELinux boolean is enabled: +$ getsebool mcelog_exec_scripts If properly configured, the output should show the following: -gluster_anon_write --> off - Is it the case that gluster_anon_write is not disabled? +mcelog_exec_scripts --> on + Is it the case that mcelog_exec_scripts is not enabled? - + To determine if the system is configured to audit successful calls -to the fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit.* +to the fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify Certmap is enabled in SSSD, run the following command: -$ sudo cat /etc/sssd/sssd.conf -If configured properly, output should contain section like the following - -[certmap/testing.test/rule_name] -matchrule =<SAN>.*EDIPI@mil -maprule = (userCertificate;binary={cert!bin}) -domains = testing.test - - Is it the case that Certmap is not configured in SSSD? - - - - -Run the following command to determine if the httpd_can_sendmail SELinux boolean is disabled: -$ getsebool httpd_can_sendmail -If properly configured, the output should show the following: -httpd_can_sendmail --> off - Is it the case that httpd_can_sendmail is not disabled? - - - - To verify if the OpenSSH client uses defined Cipher suite in the Crypto Policy, run: -$ grep -i ciphers /etc/crypto-policies/back-ends/openssh.config -and verify that the line matches: -Ciphers - Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - - - To determine if the system is configured to audit calls to the -init_module system call, run the following command: -$ sudo grep "init_module" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -chown system call, run the following command: -$ sudo grep "chown" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nodev option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . nodev . . . - Is it the case that no line is returned? + Is it the case that the "/dev/shm" file system does not have the "nodev" option set? + + + + Only FIPS-approved MACs should be used. To verify that only FIPS-approved +MACs are in use, run the following command: +$ sudo grep -i macs /etc/ssh/sshd_config +The output should contain only those MACs which are FIPS-approved. Any use of other +ciphers or algorithms will result in the module entering the non-FIPS mode of +operation. + Is it the case that MACs option is commented out or not using FIPS-approved hash algorithms? @@ -378813,567 +378981,445 @@ If the service is running, it should return the following: active Is it the case that ? - - To check the ownership of /etc/ssh/*_key, + + To check the group ownership of /etc/crontab, run the command: -$ ls -lL /etc/ssh/*_key -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/crontab +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/ssh/*_key does not have an owner of root? - - - - Run the following command to determine the current status of the logrotate timer: $ sudo systemctl is-active logrotate.timer If the timer is running, it should return the following: active - Is it the case that logrotate timer is not enabled? - - - - -Run the following command to determine if the selinuxuser_direct_dri_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_direct_dri_enabled -If properly configured, the output should show the following: -selinuxuser_direct_dri_enabled --> off - Is it the case that selinuxuser_direct_dri_enabled is not disabled? - - - - -Run the following command to determine if the fenced_can_ssh SELinux boolean is disabled: -$ getsebool fenced_can_ssh -If properly configured, the output should show the following: -fenced_can_ssh --> off - Is it the case that fenced_can_ssh is not disabled? + Is it the case that /etc/crontab does not have a group owner of root? - + -Run the following command to determine if the gluster_export_all_ro SELinux boolean is disabled: -$ getsebool gluster_export_all_ro +Run the following command to determine if the rsync_export_all_ro SELinux boolean is disabled: +$ getsebool rsync_export_all_ro If properly configured, the output should show the following: -gluster_export_all_ro --> off - Is it the case that gluster_export_all_ro is not disabled? +rsync_export_all_ro --> off + Is it the case that rsync_export_all_ro is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BINFMT_MISC /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To ensure sshd limits the users who can log in, run the following: +pre>$ sudo grep -rPi '^\h*(allow|deny)(users|groups)\h+\H+(\h+.*)?$' /etc/ssh/sshd_config* +If properly configured, the output should be a list of usernames and/or +groups allowed to log in to this system. + Is it the case that sshd does not limit the users who can log in? - - First, check whether the password is defined in either /boot/grub2/user.cfg or -/boot/grub2/grub.cfg. -Run the following commands: -$ sudo grep '^[\s]*GRUB2_PASSWORD=grub\.pbkdf2\.sha512.*$' /boot/grub2/user.cfg -$ sudo grep '^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$' /boot/grub2/grub.cfg - + + The file /etc/at.deny should not exist. +This can be checked by running the following -Second, check that a superuser is defined in /boot/grub2/grub.cfg. -$ sudo grep '^[\s]*set[\s]+superusers=("?)[a-zA-Z_]+\1$' /boot/grub2/grub.cfg - Is it the case that it does not produce any output? - - - - -Run the following command to determine if the httpd_use_fusefs SELinux boolean is disabled: -$ getsebool httpd_use_fusefs -If properly configured, the output should show the following: -httpd_use_fusefs --> off - Is it the case that httpd_use_fusefs is not disabled? - - - - -Run the following command to determine if the git_cgi_enable_homedirs SELinux boolean is disabled: -$ getsebool git_cgi_enable_homedirs -If properly configured, the output should show the following: -git_cgi_enable_homedirs --> off - Is it the case that git_cgi_enable_homedirs is not disabled? - - - - Run the following command to determine if the libreport-plugin-logger package is installed: -$ rpm -q libreport-plugin-logger - Is it the case that the package is installed? - - - - To check if authentication is required for emergency mode, run the following command: -$ grep sulogin /usr/lib/systemd/system/emergency.service -The output should be similar to the following, and the line must begin with -ExecStart and /usr/lib/systemd/systemd-sulogin-shell. - ExecStart=-/usr/lib/systemd/systemd-sulogin-shell emergency +stat /etc/at.deny -Then, check if the emergency target requires the emergency service: -Run the following command: -$ sudo grep Requires /usr/lib/systemd/system/emergency.target -The output should be the following: -Requires=emergency.service +and the output should be -Then, check if there is no custom emergency target configured in systemd configuration. -Run the following command: -$ sudo grep -r emergency.target /etc/systemd/system/ -The output should be empty. +stat: cannot stat `/etc/at.deny': No such file or directory -Then, check if there is no custom emergency service configured in systemd configuration. -Run the following command: -$ sudo grep -r emergency.service /etc/systemd/system/ -The output should be empty. - Is it the case that the output is different? - - - - -Run the following command to determine if the selinuxuser_execheap SELinux boolean is disabled: -$ getsebool selinuxuser_execheap -If properly configured, the output should show the following: -selinuxuser_execheap --> off - Is it the case that selinuxuser_execheap is not disabled? + Is it the case that the file /etc/at.deny exists? - - Run the following command to check if the group exists: -grep /etc/group -The output should contain the following line: -:x: - Is it the case that group exists and has no user members? + + To verify that cryptography policy has been configured correctly, run the +following command: +$ update-crypto-policies --show +The output should return . +Run the command to check if the policy is correctly applied: +$ update-crypto-policies --is-applied +The output should be The configured policy is applied. +Moreover, check if settings for selected crypto policy are as expected. +List all libraries for which it holds that their crypto policies do not have symbolic link in /etc/crypto-policies/back-ends. +$ ls -l /etc/crypto-policies/back-ends/ | grep '^[^l]' | tail -n +2 | awk -F' ' '{print $NF}' | awk -F'.' '{print $1}' | sort +Subsequently, check if matching libraries have drop in files in the /etc/crypto-policies/local.d directory. +$ ls /etc/crypto-policies/local.d/ | awk -F'-' '{print $1}' | uniq | sort +Outputs of two previous commands should match. + Is it the case that cryptographic policy is not configured or is configured incorrectly? - - -Run the following command to determine if the authlogin_radius SELinux boolean is disabled: -$ getsebool authlogin_radius -If properly configured, the output should show the following: -authlogin_radius --> off - Is it the case that authlogin_radius is not disabled? + + Run the following command and verify remote server is configured properly: +# grep -E "^(server|pool)" /etc/chrony.conf + Is it the case that a remote time server is not configured? - - Verify the system commands contained in the following directories are owned by "root" with the following command: + + Verify that interactive users on the system have a home directory assigned with the following command: -$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/libexec /usr/local/bin /usr/local/sbin ! -user root -exec ls -l {} \; - Is it the case that any system commands are found to not be owned by root? - - - - To verify if the OpenSSL uses defined Crypto Policy, run: -$ grep 'Ciphersuites' /etc/crypto-policies/back-ends/opensslcnf.config | tail -n 1 -and verify that the line matches -Ciphersuites = TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256 - Is it the case that Crypto Policy for OpenSSL is not configured according to CC requirements? +$ sudo awk -F: '($3>=1000)&&($7 !~ /nologin/){print $1, $3, $6}' /etc/passwd + +Inspect the output and verify that all interactive users (normally users with a UID greater than 1000) have a home directory defined. + Is it the case that users home directory is not defined? - - Run the following command to determine open ports: -# ss -4tuln -Run the following command to determine firewall rules: -# iptables -L INPUT -v -n -For each port identified in the audit which does not have a firewall -rule, add rule for accepting or denying inbound connections -# iptables -A INPUT -p --dport -m state --state NEW -j ACCEPT - Is it the case that open ports are denied connection? + + To determine if the system is configured to audit calls to the +umount2 system call, run the following command: +$ sudo grep "umount2" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify the "/etc/security/faillock.conf" file is configured to log user name information when unsuccessful logon attempts occur: + + To verify that null passwords cannot be used, run the following command: -$ sudo grep audit /etc/security/faillock.conf +$ grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth -audit - Is it the case that the "audit" option is not set, is missing or commented out? - - - - To determine if the system is configured to audit changes to its network configuration, -run the following command: -auditctl -l | grep -E '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)' -If the system is configured to watch for network configuration changes, a line should be returned for -each file specified (and perm=wa should be indicated for each). - Is it the case that the system is not configured to audit changes of the network configuration? - - - - To verify the sec option is configured for all NFS mounts, run the following command: -$ grep "sec=" /etc/exports -All configured NFS exports should show the sec=krb5:krb5i:krb5p setting in parentheses. -This is not applicable if NFS is not implemented. - Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? +If this produces any output, it may be possible to log into accounts +with empty passwords. Remove any instances of the nullok option to +prevent logins with empty passwords. + Is it the case that NULL passwords can be used? - - -Run the following command to determine if the glance_use_fusefs SELinux boolean is disabled: -$ getsebool glance_use_fusefs -If properly configured, the output should show the following: -glance_use_fusefs --> off - Is it the case that glance_use_fusefs is not disabled? + + To verify the operating system implements cryptography to protect the integrity of +remote ldap access sessions, run the following command: +$ sudo grep ldap_tls_cacertdir /etc/sssd/sssd.conf +The output should return the following with a correctly configured CA cert path: +ldap_tls_cacertdir /path/to/tls/cacert + Is it the case that the TLS CA cert is not configured? - - The rsh package can be removed with the following command: $ sudo yum erase rsh - Is it the case that ? + + To determine how the SSH daemon's PermitEmptyPasswords option is set, run the following command: + +$ sudo grep -i PermitEmptyPasswords /etc/ssh/sshd_config + +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - + -Run the following command to determine if the tmpreaper_use_nfs SELinux boolean is disabled: -$ getsebool tmpreaper_use_nfs +Run the following command to determine if the ftpd_use_cifs SELinux boolean is disabled: +$ getsebool ftpd_use_cifs If properly configured, the output should show the following: -tmpreaper_use_nfs --> off - Is it the case that tmpreaper_use_nfs is not disabled? +ftpd_use_cifs --> off + Is it the case that ftpd_use_cifs is not disabled? - - -Run the following command to determine if the postgresql_can_rsync SELinux boolean is disabled: -$ getsebool postgresql_can_rsync -If properly configured, the output should show the following: -postgresql_can_rsync --> off - Is it the case that postgresql_can_rsync is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to boot to the command line: +$ systemctl get-default +multi-user.target + Is it the case that the system default target is not set to "multi-user.target" and the Information System Security Officer (ISSO) lacks a documented requirement for a graphical user interface? - - To determine if the system is configured to audit successful calls -to the lremovexattr system call, run the following command: -$ sudo grep "lremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify the audispd plugin encrypts audit records off-loaded onto a different +system or media from the system being audited, run the following command: - Is it the case that no line is returned? - - - - Run the following command to determine if the libreport-plugin-rhtsupport package is installed: -$ rpm -q libreport-plugin-rhtsupport - Is it the case that the package is installed? +$ sudo grep -i transport /etc/audit/audisp-remote.conf +The output should return the following: +transport = KRB5 + Is it the case that audispd is not encrypting audit records when sent over the network? - - Inspect each <Directory> instance and verify that either -FollowSymLinks does not exist, or -Options SymLinksIfOwnerMatchDisable is configured properly. - Is it the case that it is not? + + Verify the nodev option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . nodev . . . + + Is it the case that the "/home" file system does not have the "nodev" option set? - - The runtime status of the net.ipv4.conf.default.rp_filter kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.rp_filter -1. + + Verify the system-wide shared library files are group-owned by "root" with the following command: - Is it the case that the correct value is not returned? +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -group root -exec ls -l {} \; + Is it the case that any system wide shared library file is returned and is not group-owned by a required system account? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42.rules -The output has to be exactly as follows: -## The purpose of these rules is to meet the requirements for Operating -## System Protection Profile (OSPP)v4.2. These rules depends on having -## the following rule files copied to /etc/audit/rules.d: -## -## 10-base-config.rules, 11-loginuid.rules, -## 30-ospp-v42-1-create-failed.rules, 30-ospp-v42-1-create-success.rules, -## 30-ospp-v42-2-modify-failed.rules, 30-ospp-v42-2-modify-success.rules, -## 30-ospp-v42-3-access-failed.rules, 30-ospp-v42-3-access-success.rules, -## 30-ospp-v42-4-delete-failed.rules, 30-ospp-v42-4-delete-success.rules, -## 30-ospp-v42-5-perm-change-failed.rules, -## 30-ospp-v42-5-perm-change-success.rules, -## 30-ospp-v42-6-owner-change-failed.rules, -## 30-ospp-v42-6-owner-change-success.rules -## -## original copies may be found in /usr/share/audit/sample-rules/ - - -## User add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch passwd and -## shadow for writes --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/passwd -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b32 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F arch=b64 -S open -F a1&03 -F path=/etc/shadow -F auid>=1000 -F auid!=unset -F key=user-modify - -## User enable and disable. This is entirely handled by pam. - -## Group add delete modify. This is covered by pam. However, someone could -## open a file and directly create or modify a user, so we'll watch group and -## gshadow for writes --a always,exit -F path=/etc/passwd -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/shadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=user-modify --a always,exit -F path=/etc/group -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify --a always,exit -F path=/etc/gshadow -F perm=wa -F auid>=1000 -F auid!=unset -F key=group-modify - - -## Use of special rights for config changes. This would be use of setuid -## programs that relate to user accts. This is not all setuid apps because -## requirements are only for ones that affect system configuration. --a always,exit -F path=/usr/sbin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/usernetctl -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newuidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/gpasswd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/newgidmap -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/umount -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/crontab -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes --a always,exit -F path=/usr/bin/at -F perm=x -F auid>=1000 -F auid!=unset -F key=special-config-changes + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group" with the following command: -## Privilege escalation via su or sudo. This is entirely handled by pam. +$ sudo auditctl -l | grep -E '(/etc/group)' -## Watch for configuration changes to privilege escalation. --a always,exit -F path=/etc/sudoers -F perm=wa -F key=special-config-changes --a always,exit -F dir=/etc/sudoers.d/ -F perm=wa -F key=special-config-changes +-w /etc/group -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open system call. -## Audit log access --a always,exit -F dir=/var/log/audit/ -F perm=r -F auid>=1000 -F auid!=unset -F key=access-audit-trail -## Attempts to Alter Process and Session Initiation Information --a always,exit -F path=/var/run/utmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/btmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session --a always,exit -F path=/var/log/wtmp -F perm=wa -F auid>=1000 -F auid!=unset -F key=session +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -## Attempts to modify MAC controls --a always,exit -F dir=/etc/selinux/ -F perm=wa -F auid>=1000 -F auid!=unset -F key=MAC-policy +$ sudo grep -r open /etc/audit/rules.d -## Software updates. This is entirely handled by rpm. +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -## System start and shutdown. This is entirely handled by systemd +$ sudo grep open /etc/audit/audit.rules -## Kernel Module loading. This is handled in 43-module-load.rules +The output should be the following: -## Application invocation. The requirements list an optional requirement -## FPT_SRP_EXT.1 Software Restriction Policies. This event is intended to -## state results from that policy. This would be handled entirely by -## that daemon. - Is it the case that the file does not exist or the content differs? +-a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - - The file /etc/cron.deny should not exist. -This can be checked by runnig the following + + To check that the screen locks immediately when activated, run the following command: +$ gsettings get org.gnome.desktop.screensaver lock-delay +If properly configured, the output should be 'uint32 '. + Is it the case that the screensaver lock delay is missing, or is set to a value greater than <sub idref="var_screensaver_lock_delay" />? + + + + To check the group ownership of /boot/grub2/user.cfg, +run the command: +$ ls -lL /boot/grub2/user.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/grub2/user.cfg does not have a group owner of root? + + + + To check that the oddjobd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled oddjobd +Output should indicate the oddjobd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled oddjobd disabled -stat /etc/cron.deny +Run the following command to verify oddjobd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active oddjobd -and the output should be +If the service is not running the command will return the following output: +inactive -stat: cannot stat `/etc/cron.deny': No such file or directory +The service will also be masked, to check that the oddjobd is masked, run the following command: +$ sudo systemctl show oddjobd | grep "LoadState\|UnitFileState" - Is it the case that the file /etc/cron.deny exists? - - - - To determine if the system is configured to audit calls to the -mount system call, run the following command: -$ sudo grep "mount" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. +If the service is masked the command will return the following outputs: - Is it the case that no line is returned? +LoadState=masked + +UnitFileState=masked + Is it the case that the "oddjobd" is loaded and not masked? - - Run the following command to determine if the audit package is installed: $ rpm -q audit - Is it the case that the audit package is not installed? + + Run the following command to determine if the openldap-clients package is installed: +$ rpm -q openldap-clients + Is it the case that the package is installed? - - To verify that no .java and .jpp files exist, run the -following command: -find / -name *.java -o -name *.jpp -The output should not return any .java or .jpp files - Is it the case that it is not? + + +Run the following command to determine if the lsmd_plugin_connect_any SELinux boolean is disabled: +$ getsebool lsmd_plugin_connect_any +If properly configured, the output should show the following: +lsmd_plugin_connect_any --> off + Is it the case that lsmd_plugin_connect_any is not disabled? - + -Run the following command to determine if the xserver_execmem SELinux boolean is disabled: -$ getsebool xserver_execmem +Run the following command to determine if the httpd_unified SELinux boolean is disabled: +$ getsebool httpd_unified If properly configured, the output should show the following: -xserver_execmem --> off - Is it the case that xserver_execmem is not disabled? +httpd_unified --> off + Is it the case that httpd_unified is not disabled? - - To verify that auditing of privileged command use is configured, run the following command -to search privileged commands in relevant partitions and check if they are covered by auditd -rules: + + Verify Red Hat Enterprise Linux 8 audits execution as another user. -FILTER_NODEV=$(awk '/nodev/ { print $2 }' /proc/filesystems | paste -sd,) -PARTITIONS=$(findmnt -n -l -k -it $FILTER_NODEV | grep -Pv "noexec|nosuid" | awk '{ print $1 }') -for PARTITION in $PARTITIONS; do - for PRIV_CMD in $(find "${PARTITION}" -xdev -perm /6000 -type f 2>/dev/null); do - grep -qr "${PRIV_CMD}" /etc/audit/rules.d /etc/audit/audit.rules && - printf "OK: ${PRIV_CMD}\n" || printf "WARNING - rule not found for: ${PRIV_CMD}\n" - done -done +Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: -The output should not contain any WARNING. - Is it the case that any setuid or setgid programs doesn't have a line in the audit rules? +$ sudo grep execve /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S execve -C euid!=uid -F auid!=unset -k user_emulation +-a always,exit -F arch=b64 -S execve -C euid!=uid -F auid!=unset-k user_emulation + Is it the case that the command does not return all lines, or the lines are commented out? - + + Verify that only the "root" account has a UID "0" assignment with the +following command: +$ awk -F: '$3 == 0 {print $1}' /etc/passwd +root + Is it the case that any accounts other than "root" have a UID of "0"? + + + -To ensure the login warning banner text is properly set, run the following: -$ grep banner-message-text /etc/dconf/db/gdm.d/* -If properly configured, the proper banner text will appear. -To ensure the login warning banner text is locked and cannot be changed by a user, run the following: -$ grep banner-message-text /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/banner-message-text. - Is it the case that it does not? +Run the following command to determine if the polipo_connect_all_unreserved SELinux boolean is disabled: +$ getsebool polipo_connect_all_unreserved +If properly configured, the output should show the following: +polipo_connect_all_unreserved --> off + Is it the case that polipo_connect_all_unreserved is not disabled? - - Verify the noexec option is configured for the /tmp mount point, + + To check the system for the existence of any .forward files, +run the following command: +$ sudo find /home -xdev -name .forward + Is it the case that any .forward files exist? + + + + Verify the usrquota option is configured for the /home mount point, run the following command: - $ sudo mount | grep '\s/tmp\s' - . . . /tmp . . . noexec . . . + $ sudo mount | grep '\s/home\s' + . . . /home . . . usrquota . . . - Is it the case that the "/tmp" file system does not have the "noexec" option set? + Is it the case that the "/home" file system does not have the "usrquota" option set? - + +Run the following command to determine if the mozilla_plugin_bind_unreserved_ports SELinux boolean is disabled: +$ getsebool mozilla_plugin_bind_unreserved_ports +If properly configured, the output should show the following: +mozilla_plugin_bind_unreserved_ports --> off + Is it the case that mozilla_plugin_bind_unreserved_ports is not disabled? + + + + Storing logs with persistent storage ensures they are available after a reboot or system crash. +Run the command below to verify that logs are being persistently stored to disk. +grep "^\sStorage" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf -To determine if firewalld is configured to allow access - -on port 22/tcp, run the following command(s): - firewall-cmd --list-ports - - -to ssh - firewall-cmd --list-services - -If firewalld is configured to allow access through the firewall, something similar to the following will be output: - -If it is a service: -ssh +and it should return -If it is a port: -22/tcp +Storage=persistent - Is it the case that sshd service is not enabled in the proper firewalld zone? + Is it the case that is commented out or not configured correctly? - - -Run the following command to determine if the swift_can_network SELinux boolean is disabled: -$ getsebool swift_can_network -If properly configured, the output should show the following: -swift_can_network --> off - Is it the case that swift_can_network is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to prevent unrestricted mail relaying, +run the following command: +$ sudo postconf -n smtpd_client_restrictions + Is it the case that the "smtpd_client_restrictions" parameter contains any entries other than "permit_mynetworks" and "reject"? - - Verify that local initialization files do not execute world-writable programs with the following command: - -Note: The example will be for a system that is configured to create user home directories in the "/home" directory. - -$ sudo find /home -perm -002 -type f -name ".[^.]*" -exec ls -ld {} \; - Is it the case that any local initialization files are found to reference world-writable files? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEFAULT_MMAP_MIN_ADDR /boot/config.* + + For each kernel installed, a line with value "65536" should be returned. + + Is it the case that the kernel was not built with the required value? - - To verify if LogLevel is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i loglevel /etc/httpd/conf/httpd.conf -The command should return the following: -LogLevel warn - Is it the case that it is not? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudo" command with the following command: + +$ sudo auditctl -l | grep sudo + +-a always,exit -F path=/usr/bin/sudo -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudo + Is it the case that the command does not return a line, or the line is commented out? - - To verify the openldap-servers package is not installed, run the -following command: -$ rpm -q openldap-servers -The output should show the following: -package openldap-servers is not installed - Is it the case that it does not? + + To check the group ownership of /etc/issue.net, +run the command: +$ ls -lL /etc/issue.net +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/issue.net does not have a group owner of root? - - To check that SELinux is not disabled at boot time; -Check that no boot entry disables selinux: -sudo grep -L "^options\s+.*\bselinux=0\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that disables SELinux. - Is it the case that SELinux is disabled at boot time? + + To check the group ownership of /etc/at.allow, +run the command: +$ ls -lL /etc/at.allow +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/at.allow does not have a group owner of root? - - To determine if the system is configured to audit unsuccessful calls -to the fchmodat system call, run the following command: -$ sudo grep "fchmodat" /etc/audit.* + + To determine if the system is configured to audit calls to the +fchownat system call, run the following command: +$ sudo grep "fchownat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + Run the following command to determine the current status of the -chronyd service: -$ sudo systemctl is-active chronyd -If the service is running, it should return the following: active - - -Run the following command to determine the current status of the -ntpd service: -$ sudo systemctl is-active ntpd +postfix service: +$ sudo systemctl is-active postfix If the service is running, it should return the following: active - Is it the case that ? + Is it the case that the system is not a cross domain solution and the service is not enabled? - - In order to be sure that the databases are up-to-date, run the -dconf update -command as the administrator. - Is it the case that The system-wide dconf databases are up-to-date with regards to respective keyfiles? + + +Run the following command to determine if the entropyd_use_audio SELinux boolean is disabled: +$ getsebool entropyd_use_audio +If properly configured, the output should show the following: +entropyd_use_audio --> off + Is it the case that entropyd_use_audio is not disabled? - - The runtime status of the net.ipv6.conf.default.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_redirects -0. + + Verify Red Hat Enterprise Linux 8 removes all software components after updated versions have been installed. - Is it the case that the correct value is not returned? + +$ grep clean_requirements_on_remove /etc/yum.conf +clean_requirements_on_remove=1 + Is it the case that '"clean_requirements_on_remove" is not set to "1"'? - - -Run the following command to determine if the httpd_builtin_scripting SELinux boolean is disabled: -$ getsebool httpd_builtin_scripting -If properly configured, the output should show the following: -httpd_builtin_scripting --> off - Is it the case that httpd_builtin_scripting is not disabled? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "kmod" command with the following command: + +$ sudo auditctl -l | grep kmod + +-a always,exit -F path=/usr/bin/kmod -F perm=x -F auid>=1000 -F auid!=unset -k privileged-kmod + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the ownership of /var/log/syslog, +run the command: +$ ls -lL /var/log/syslog +If properly configured, the output should indicate the following owner: +syslog + Is it the case that /var/log/syslog does not have an owner of syslog? - - To determine if the system is configured to audit unsuccessful calls -to the lchown system call, run the following command: -$ sudo grep "lchown" /etc/audit.* + + To determine if the system is configured to audit calls to the +chown system call, run the following command: +$ sudo grep "chown" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? + + + + To check the ownership of /etc/shells, +run the command: +$ ls -lL /etc/shells +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/shells does not have an owner of root? + + + + The runtime status of the net.ipv6.conf.all.forwarding kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.forwarding +0. +The ability to forward packets is only appropriate for routers. + Is it the case that IP forwarding value is "1" and the system is not router? @@ -379385,287 +379431,665 @@ BrowseAllow none Is it the case that printer browsing is not disabled? - - The runtime status of the net.ipv4.tcp_rfc1337 kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.tcp_rfc1337 -1. + + To ensure the screensaver is configured to be blank, run the following command: +$ gsettings get org.gnome.desktop.screensaver picture-uri +If properly configured, the output should be ''. - Is it the case that the correct value is not returned? +To ensure that users cannot set the screensaver background, run the following: +$ grep picture-uri /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/picture-uri + Is it the case that it is not set or configured properly? - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes audit=1, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit=1.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*audit=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'audit=1' -The command should not return any output. - Is it the case that auditing is not enabled at boot time? + + +Run the following command to determine if the webadm_manage_user_files SELinux boolean is disabled: +$ getsebool webadm_manage_user_files +If properly configured, the output should show the following: +webadm_manage_user_files --> off + Is it the case that webadm_manage_user_files is not disabled? - - The runtime status of the fs.suid_dumpable kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.log_martians kernel parameter can be queried by running the following command: -$ sysctl fs.suid_dumpable -0. +$ sysctl net.ipv4.conf.all.log_martians +1. Is it the case that the correct value is not returned? - - The runtime status of the net.ipv4.conf.all.route_localnet kernel parameter can be queried + + The runtime status of the net.ipv4.conf.default.shared_media kernel parameter can be queried by running the following command: -$ sysctl net.ipv4.conf.all.route_localnet +$ sysctl net.ipv4.conf.default.shared_media 0. Is it the case that the correct value is not returned? - - The runtime status of the net.ipv6.conf.all.max_addresses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.max_addresses -1. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the mpd_use_cifs SELinux boolean is disabled: +$ getsebool mpd_use_cifs +If properly configured, the output should show the following: +mpd_use_cifs --> off + Is it the case that mpd_use_cifs is not disabled? - - The runtime status of the net.ipv4.conf.all.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.accept_redirects -0. - - Is it the case that the correct value is not returned? + + Make sure that /boot/bootmap is newer than /boot/loader/entries/*.conf +and /etc/zipl.conf: +find /boot/loader/entries/*.conf /etc/zipl.conf -newer /boot/bootmap +No line should be returned, if a line is returned /boot/bootmap is outdated and needs to be regenerated. + Is it the case that the bootmap is outdated? - - Run the following command to determine if the fapolicyd package is installed: $ rpm -q fapolicyd - Is it the case that the fapolicyd package is not installed? + + Run the following command to determine if the geolite2-city package is installed: +$ rpm -q geolite2-city + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: - -$ sudo grep disk_error_action /etc/audit/auditd.conf - -disk_error_action = - -If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. - Is it the case that there is no evidence of appropriate action? + + For each private key stored on the system, use the following command: +$ sudo ssh-keygen -y -f /path/to/file +If the contents of the key are displayed, this is a finding. + Is it the case that no ssh private key is accessible without a passcode? - - Verify that rules for unsuccessful calls of the open syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + +Run the following command to determine if the sanlock_use_samba SELinux boolean is disabled: +$ getsebool sanlock_use_samba +If properly configured, the output should show the following: +sanlock_use_samba --> off + Is it the case that sanlock_use_samba is not disabled? + + + + +Run the following command to determine if the httpd_can_check_spam SELinux boolean is disabled: +$ getsebool httpd_can_check_spam +If properly configured, the output should show the following: +httpd_can_check_spam --> off + Is it the case that httpd_can_check_spam is not disabled? + + + + +If the system is configured to prevent the loading of the iwlmvm kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - If the system is 64 bit then also add the following lines: +These lines can also instruct the module loading system to ignore the iwlmvm kernel module via blacklist keyword. - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r iwlmvm /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - To determine if the system is configured to audit unsuccessful calls -to the fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify the sec option is configured for all NFS mounts, run the following command: +$ mount | grep "sec=" +All NFS mounts should show the sec=krb5:krb5i:krb5p setting in parentheses. +This is not applicable if NFS is not implemented. + Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? + + + + To ensure the failed password attempt policy is configured correctly, run the following command: - Is it the case that no line is returned? +$ grep fail_interval /etc/security/faillock.conf +The output should show fail_interval = <interval-in-seconds> where interval-in-seconds is or greater. + Is it the case that the "fail_interval" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_fail_interval" />" +or less (but not "0"), the line is commented out, or the line is missing? - - Inspect the password section of /etc/pam.d/password-auth -and ensure that the pam_unix.so module includes the argument -sha512: -$ grep sha512 /etc/pam.d/password-auth - Is it the case that it does not? + + Verify the umask setting is configured correctly in the /etc/bashrc file with the following command: + +$ sudo grep "umask" /etc/bashrc + +umask + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? - + -Run the following command to determine if the glance_api_can_network SELinux boolean is disabled: -$ getsebool glance_api_can_network +Run the following command to determine if the abrt_handle_event SELinux boolean is disabled: +$ getsebool abrt_handle_event If properly configured, the output should show the following: -glance_api_can_network --> off - Is it the case that glance_api_can_network is not disabled? +abrt_handle_event --> off + Is it the case that abrt_handle_event is not disabled? - + -Run the following command to determine if the varnishd_connect_any SELinux boolean is disabled: -$ getsebool varnishd_connect_any +Run the following command to determine if the selinuxuser_tcp_server SELinux boolean is disabled: +$ getsebool selinuxuser_tcp_server If properly configured, the output should show the following: -varnishd_connect_any --> off - Is it the case that varnishd_connect_any is not disabled? +selinuxuser_tcp_server --> off + Is it the case that selinuxuser_tcp_server is not disabled? - - - -Run the following command to determine the current status of the -crond service: -$ sudo systemctl is-active crond -If the service is running, it should return the following: active - Is it the case that ? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_KEY /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check the permissions of /var/log/syslog, -run the command: -$ ls -l /var/log/syslog -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /var/log/syslog does not have unix mode -rw-r-----? + + Run the following command to determine if the libselinux package is installed: $ rpm -q libselinux + Is it the case that the package is not installed? - - Verify the operating system routinely checks the baseline configuration for unauthorized changes. + + System executables are stored in the following directories by default: +/bin +/sbin +/usr/bin +/usr/local/bin +/usr/local/sbin +/usr/sbin +For each of these directories, run the following command to find files +not owned by root: +$ sudo find -L DIR/ ! -user root -type d -exec chown root {} \; + Is it the case that any system executables directories are found to not be owned by root? + + + + To verify all files and directories in a local interactive user's +home directory have a valid owner, run the following command: +$ sudo ls -lLR /home/USER + Is it the case that the user ownership is incorrect? + + + + To check that the sshd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled sshd +Output should indicate the sshd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled sshd disabled -To determine that periodic AIDE execution has been scheduled, run the following command: -$ grep aide /etc/crontab -The output should return something similar to the following: -05 4 * * * root /usr/sbin/aide --check +Run the following command to verify sshd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active sshd -NOTE: The usage of special cron times, such as @daily or @weekly, is acceptable. - Is it the case that AIDE is not configured to scan periodically? +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the sshd is masked, run the following command: +$ sudo systemctl show sshd | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "sshd" is loaded and not masked? - - To check the group ownership of /etc/cron.weekly, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes iommu=force, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*iommu=force.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*iommu=force.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'iommu=force' +The command should not return any output. + Is it the case that I/OMMU is not activated? + + + + To determine if the system is configured to audit successful calls +to the rename system call, run the following command: +$ sudo grep "rename" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + +Run the following command to determine if the daemons_use_tty SELinux boolean is disabled: +$ getsebool daemons_use_tty +If properly configured, the output should show the following: +daemons_use_tty --> off + Is it the case that daemons_use_tty is not disabled? + + + + Run the following command to determine if the geolite2-country package is installed: +$ rpm -q geolite2-country + Is it the case that the package is installed? + + + + Check the root home directory for a .mozilla directory. If +one exists, ensure browsing is limited to local service administration. + Is it the case that this is not the case? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STACKPROTECTOR_STRONG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + To check the group ownership of /etc/shadow, run the command: -$ ls -lL /etc/cron.weekly +$ ls -lL /etc/shadow If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/cron.weekly does not have a group owner of root? + Is it the case that /etc/shadow does not have a group owner of root? - - Run the following command to determine if the tftp-server package is installed: -$ rpm -q tftp-server + + Run the following command to determine if the abrt-plugin-sosreport package is installed: +$ rpm -q abrt-plugin-sosreport Is it the case that the package is installed? - - To verify if CustomLog is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i customlog /etc/httpd/conf/httpd.conf -The output should return the following: -CustomLog "logs/access_log" combined - Is it the case that it is not? + + To verify if the OpenSSH Client uses defined Crypto Policy, run: +$ cat /etc/ssh/ssh_config.d/02-ospp.conf +and verify that the line matches +Match final all +RekeyLimit 512M 1h +GSSAPIAuthentication no +Ciphers aes256-ctr,aes256-cbc,aes128-ctr,aes128-cbc +PubkeyAcceptedKeyTypes ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 +MACs hmac-sha2-512,hmac-sha2-256 +KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 + Is it the case that Crypto Policy for OpenSSH Client is not configured according to CC requirements? - - To check that the slapd service is disabled in system boot configuration, + + To determine if the system is configured to audit changes to its SELinux +configuration files, run the following command: +$ sudo auditctl -l | grep "dir=/usr/share/selinux" +If the system is configured to watch for changes to its SELinux +configuration, a line should be returned (including +perm=wa indicating permissions that are watched). + Is it the case that the system is not configured to audit attempts to change the MAC policy? + + + + The runtime status of the net.ipv4.conf.default.secure_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.secure_redirects +0. + + Is it the case that the correct value is not returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_GCC_PLUGIN_LATENT_ENTROPY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + +Run the following command to determine if the ksmtuned_use_nfs SELinux boolean is disabled: +$ getsebool ksmtuned_use_nfs +If properly configured, the output should show the following: +ksmtuned_use_nfs --> off + Is it the case that ksmtuned_use_nfs is not disabled? + + + + To check the current idle time-out value, run the following command: +$ gsettings get org.gnome.desktop.session idle-delay +If properly configured, the output should be 'uint32 '. +To ensure that users cannot change the screensaver inactivity timeout setting, run the following: +$ grep idle-delay /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/session/idle-delay + Is it the case that idle-delay is set to 0 or a value greater than <sub idref="inactivity_timeout_value" />? + + + + To ensure logs are sent to a remote host, examine the file +/etc/rsyslog.conf. +If using UDP, a line similar to the following should be present: + *.* @ +If using TCP, a line similar to the following should be present: + *.* @@ +If using RELP, a line similar to the following should be present: + *.* :omrelp: + Is it the case that no evidence that the audit logs are being off-loaded to another system or media? + + + + +Run the following command to determine if the httpd_enable_cgi SELinux boolean is disabled: +$ getsebool httpd_enable_cgi +If properly configured, the output should show the following: +httpd_enable_cgi --> off + Is it the case that httpd_enable_cgi is not disabled? + + + + To check the system for the existence of any .netrc files, run the following command: -$ sudo systemctl is-enabled slapd -Output should indicate the slapd service has either not been installed, +$ sudo find /home -xdev -name .netrc + Is it the case that any .netrc files exist? + + + + To check that the tftp service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled tftp +Output should indicate the tftp service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled slapd disabled +$ sudo systemctl is-enabled tftp disabled -Run the following command to verify slapd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active slapd +Run the following command to verify tftp is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active tftp If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the slapd is masked, run the following command: -$ sudo systemctl show slapd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the tftp is masked, run the following command: +$ sudo systemctl show tftp | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "slapd" is loaded and not masked? + Is it the case that the "tftp" is loaded and not masked? - + + Inspect /etc/audit/audisp-remote.conf and locate the following line to +determine if the system is configured to perform a correct action according to the policy: +$ sudo grep -i network_failure_action /etc/audit/audisp-remote.conf +The output should return: +network_failure_action = + Is it the case that the system is not configured to switch to single user mode for corrective action? + + + + Verify the operating system is not configured to bypass password requirements for privilege +escalation. Check the configuration of the "/etc/pam.d/sudo" file with the following command: +$ sudo grep pam_succeed_if /etc/pam.d/sudo + Is it the case that system is configured to bypass password requirements for privilege escalation? + + + + Review the web site to determine if HTTP and HTTPs are used in accordance with +well known ports (e.g., 80 and 443) or those ports and services as registered +and approved for use by the DoD PPSM. + +To configure firewalld to allow http access, run the following command(s): +firewall-cmd --permanent --add-service=http +Then run the following command to load the newly created rule(s): +firewall-cmd --reload + +To configure firewalld to allow https access, run the following command(s): +firewall-cmd --permanent --add-service=https +Then run the following command to load the newly created rule(s): +firewall-cmd --reload + Is it the case that it is not? + + + +Run the following command to determine if the virt_use_sanlock SELinux boolean is disabled: +$ getsebool virt_use_sanlock +If properly configured, the output should show the following: +virt_use_sanlock --> off + Is it the case that virt_use_sanlock is not disabled? + + + + Run the following command to check if the line is present: +grep pam_wheel /etc/pam.d/su +The output should contain the following line: +auth required pam_wheel.so use_uid group= + Is it the case that the line is not in the file or it is commented? + + + + To ensure all GIDs referenced in /etc/passwd are defined in /etc/group, +run the following command: +$ sudo pwck -qr +There should be no output. + Is it the case that GIDs referenced in /etc/passwd are returned as not defined in /etc/group? + + + + Verify the audit tools are group-owned by "root" to prevent any unauthorized access, deletion, or modification. -Run the following command to determine the current status of the -auditd service: -$ sudo systemctl is-active auditd -If the service is running, it should return the following: active - Is it the case that the auditd service is not running? +Check the group-owner of each audit tool by running the following command: + +$ sudo stat -c "%G %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + +root /sbin/auditctl +root /sbin/aureport +root /sbin/ausearch +root /sbin/autrace +root /sbin/auditd +root /sbin/rsyslogd +root /sbin/augenrules + Is it the case that any audit tools are not group-owned by root? - - Verify file systems that are used for removable media are mounted with the "nosuid" option with the following command: + + To verify that repo_gpgcheck is configured properly, run the following +command: +$ grep repo_gpgcheck /etc/yum.conf +The output should return something similar to: +repo_gpgcheck=1 + Is it the case that gpgcheck is not enabled or configured correctly to verify repository metadata? + + + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open system call with O_CREAT flag. -$ sudo more /etc/fstab +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: -UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 - Is it the case that file system found in "/etc/fstab" refers to removable media and it does not have the "nosuid" option set? +$ sudo grep -r open /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - + + The runtime status of the net.ipv6.conf.default.accept_ra_pinfo kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_pinfo +0. + + Is it the case that the correct value is not returned? + + + -If the system is configured to prevent the loading of the iwlmvm kernel module, +If the system is configured to prevent the loading of the sctp kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the iwlmvm kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the sctp kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r iwlmvm /etc/modprobe.conf /etc/modprobe.d +$ grep -r sctp /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Enter the following commands: - -grep Action /etc/httpd/conf/httpd.conf -grep AddHandler /etc/httpd/conf/httpd.conf - Is it the case that either of these exist and they configure csh, or any other shell as a viewer for documents? + + Run the following command to determine if the iprutils package is installed: +$ rpm -q iprutils + Is it the case that the package is installed? - - Verify that the default umask for all local interactive users is "077". - -Identify the locations of all local interactive user home directories by looking at the "/etc/passwd" file. - -Check all local interactive user initialization files for interactive users with the following command: - -Note: The example is for a system that is configured to create users home directories in the "/home" directory. + + Run the following command to ensure the default FORWARD policy is DROP: +grep ":FORWARD" /etc/sysconfig/iptables +The output should be similar to the following: +$ sudo grep ":FORWARD" /etc/sysconfig/iptables +:FORWARD DROP [0:0 + Is it the case that the default policy for the FORWARD chain is not set to DROP? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "init" command with the following command: -# grep -ri umask /home/ +$ sudo auditctl -l | grep init -/home/smithj/.bash_history:grep -i umask /etc/bashrc /etc/csh.cshrc /etc/profile -/home/smithj/.bash_history:grep -i umask /etc/login.defs - Is it the case that any local interactive user initialization files are found to have a umask statement that sets a value less restrictive than "077"? +-a always,exit -F path=/init -F perm=x -F auid>=1000 -F auid!=unset -k privileged-init + Is it the case that the command does not return a line, or the line is commented out? - + + Run the following command to determine if the cron package is installed: +$ rpm -q cron + Is it the case that the package is installed? + + + + To check for legacy lines in /etc/shadow, run the following command: + grep '^\+' /etc/shadow +The command should not return any output. + Is it the case that the file contains legacy lines? + + + + +Run the following command to determine if the nfs_export_all_ro SELinux boolean is enabled: +$ getsebool nfs_export_all_ro +If properly configured, the output should show the following: +nfs_export_all_ro --> on + Is it the case that nfs_export_all_ro is not enabled? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + To determine if the system is configured to audit successful calls -to the unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit.* +to the truncate system call, run the following command: +$ sudo grep "truncate" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? + + + + To ensure the system is configured to ignore the Ctrl-Alt-Del sequence, +run the following command: +$ gsettings get org.gnome.settings-daemon.plugins.media-keys logout +$ grep logout /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/settings-daemon/plugins/media-keys/logout + Is it the case that GNOME3 is configured to reboot when Ctrl-Alt-Del is pressed? + + + + Run the following command to determine if the vsftpd package is installed: +$ rpm -q vsftpd + Is it the case that the package is installed? + + + + To verify that acquiring, saving, and processing core dumps is disabled, run the +following command: +$ systemctl status systemd-coredump.socket +The output should be similar to: +● systemd-coredump.socket + Loaded: masked (Reason: Unit systemd-coredump.socket is masked.) + Active: inactive (dead) ... + + Is it the case that unit systemd-coredump.socket is not masked or running? + + + + To verify that rsyslog's Forwarding Output Module is configured +to use TLS for logging to remote server, run the following command: +$ grep omfwd /etc/rsyslog.conf /etc/rsyslog.d/*.conf +The output should include record similar to +action(type="omfwd" protocol="tcp" Target="<remote system>" port="6514" + StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name" streamdriver.CheckExtendedKeyPurpose="on") + +where the <remote system> present in the configuration line above must be a valid IP address or a host name of the remote logging server. + Is it the case that omfwd is not configured with gtls and AuthMode? + + + + +Run the following command to determine if the httpd_manage_ipa SELinux boolean is disabled: +$ getsebool httpd_manage_ipa +If properly configured, the output should show the following: +httpd_manage_ipa --> off + Is it the case that httpd_manage_ipa is not disabled? + + + + To check the group ownership of /var/log/syslog, +run the command: +$ ls -lL /var/log/syslog +If properly configured, the output should indicate the following group-owner: +adm + Is it the case that /var/log/syslog does not have a group owner of adm? + + + + +Run the following command to determine if the gpg_web_anon_write SELinux boolean is disabled: +$ getsebool gpg_web_anon_write +If properly configured, the output should show the following: +gpg_web_anon_write --> off + Is it the case that gpg_web_anon_write is not disabled? + + + + +Run the following command to determine if the fcron_crond SELinux boolean is disabled: +$ getsebool fcron_crond +If properly configured, the output should show the following: +fcron_crond --> off + Is it the case that fcron_crond is not disabled? + + + + Run the following command to ensure postfix routes mail to this system: +$ grep relayhost /etc/postfix/main.cf +If properly configured, the output should show only . + Is it the case that it is not? @@ -379676,361 +380100,415 @@ export SSH_USE_STRONG_RNG=32 Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - To determine if the system is configured to audit successful calls -to the chown system call, run the following command: -$ sudo grep "chown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + To check the ownership of /etc/cron.daily, +run the command: +$ ls -lL /etc/cron.daily +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.daily does not have an owner of root? - - -To properly set the group owner of /etc/audit/, run the command: -$ sudo chgrp root /etc/audit/ + + To determine how the SSH daemon's X11UseLocalhost option is set, run the following command: -To properly set the group owner of /etc/audit/rules.d/, run the command: -$ sudo chgrp root /etc/audit/rules.d/ - Is it the case that ? +$ sudo grep -i X11UseLocalhost /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + Is it the case that the display proxy is listening on wildcard address? - - To ensure LDAP is configured to use TLS for all transactions, run the following command: -$ grep start_tls /etc/pam_ldap.conf -The result should contain: -ssl start_tls - Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + To determine if umask has been configured for sudo with the appropriate value, +run the following command: +$ sudo grep -ri '^Defaults.*umask=' /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that umask is not set with the appropriate value for sudo? - - The runtime status of the vm.mmap_min_addr kernel parameter can be queried -by running the following command: -$ sysctl vm.mmap_min_addr -65536. + + - Is it the case that the correct value is not returned? +Run the following command to determine the current status of the +fapolicyd service: +$ sudo systemctl is-active fapolicyd +If the service is running, it should return the following: active + Is it the case that the service is not enabled? - - Run the following command to determine if the rsh-server package is installed: -$ rpm -q rsh-server - Is it the case that the package is installed? + + Check that the symlink exists and target the correct Kerberos crypto policy, with the following command: +file /etc/krb5.conf.d/crypto-policies +If command ouput shows the following line, Kerberos is configured to use the system-wide crypto policy. +/etc/krb5.conf.d/crypto-policies: symbolic link to /etc/crypto-policies/back-ends/krb5.config + Is it the case that the symlink does not exist or points to a different target? - - To check the group ownership of /etc/gshadow-, -run the command: -$ ls -lL /etc/gshadow- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/gshadow- does not have a group owner of root? + + To verify the assigned home directory of all interactive users is group- +owned by that users primary GID, run the following command: +# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) + Is it the case that the group ownership is incorrect? - - To check the group ownership of /etc/crontab, -run the command: -$ ls -lL /etc/crontab -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/crontab does not have a group owner of root? + + Run the following command to determine if the gssproxy package is installed: +$ rpm -q gssproxy + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 is configured to limit the "pwquality" retry option to . - + + Run the following command to determine if the sendmail package is installed: +$ rpm -q sendmail + Is it the case that the package is installed? + + + + The runtime status of the kernel.perf_cpu_time_max_percent kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_cpu_time_max_percent +1. -Check for the use of the "pwquality" retry option in the pwquality.conf file with the following command: -$ grep retry /etc/security/pwquality.conf - Is it the case that the value of "retry" is set to "0" or greater than "<sub idref="var_password_pam_retry" />", or is missing? + Is it the case that the correct value is not returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_HIBERNATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To determine if the system is configured to audit successful calls +to the fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEFAULT_MMAP_MIN_ADDR /boot/config.* - - For each kernel installed, a line with value "65536" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the ownership of /etc/ssh/sshd_config, +run the command: +$ ls -lL /etc/ssh/sshd_config +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/ssh/sshd_config does not have an owner of root? - - Verify the nodev option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . nodev . . . - - Is it the case that the "/boot" file system does not have the "nodev" option set? + + To check if pam_pwquality.so is enabled in system-auth, run the following command: +$ grep pam_pwquality /etc/pam.d/system-auth +The output should be similar to the following: +password requisite pam_pwquality.so + Is it the case that pam_pwquality.so is not enabled in system-auth? - + -Run the following command to determine if the rsync_anon_write SELinux boolean is disabled: -$ getsebool rsync_anon_write -If properly configured, the output should show the following: -rsync_anon_write --> off - Is it the case that rsync_anon_write is not disabled? +If the system is configured to prevent the loading of the atm kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the atm kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r atm /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_chkpwd" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setsebool" command with the following command: -$ sudo auditctl -l | grep unix_chkpwd +$ sudo auditctl -l | grep setsebool --a always,exit -F path=/usr/bin/unix_chkpwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_chkpwd +-a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -k privileged Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the staff_exec_content SELinux boolean is enabled: -$ getsebool staff_exec_content +Run the following command to determine if the sge_domain_can_network_connect SELinux boolean is disabled: +$ getsebool sge_domain_can_network_connect If properly configured, the output should show the following: -staff_exec_content --> on - Is it the case that staff_exec_content is not enabled? - - - - To ensure that wireless network notification is disabled, run the following command: -$ gsettings get org.gnome.nm-applet suppress-wireless-networks-available -If properly configured, the output should be true. -To ensure that users cannot enable wireless notification, run the following: -$ grep wireless-networks-available /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/nm-applet/suppress-wireless-networks-available - Is it the case that wireless network notification is enabled and not disabled? +sge_domain_can_network_connect --> off + Is it the case that sge_domain_can_network_connect is not disabled? - - Verify the NX (no-execution) bit flag is set on the system. - -Check that the no-execution bit flag is set with the following commands: + + To verify the password reuse setting is compliant, run the following command: +$ grep remember /etc/pam.d/system-auth +The output should show the following at the end of the line: +remember= -$ sudo dmesg | grep NX -[ 0.000000] NX (Execute Disable) protection: active +In newer systems, the pam_pwhistory PAM module options can also be set in +"/etc/security/pwhistory.conf" file. Use the following command to verify: +$ grep remember /etc/security/pwhistory.conf +remember = -If "dmesg" does not show "NX (Execute Disable) protection" active, check the cpuinfo settings with the following command: +The pam_pwhistory remember option must be configured only in one file. + Is it the case that the value of remember is not equal to or greater than the expected value? + + + + To verify that a remote NTP service is configured for time synchronization, +open the following file: -$ sudo grep flags /proc/cpuinfo -flags : fpu vme de pse tsc ms nx rdtscp lm constant_ts +/etc/chrony.conf in the case the system in question is +configured to use the chronyd as the NTP daemon (default setting) +/etc/ntp.conf in the case the system in question is configured +to use the ntpd as the NTP daemon -The output should contain the "nx" flag. - Is it the case that NX is disabled? +In the file, there should be a section similar to the following: +server ntpserver + Is it the case that this is not the case? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_SG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/http/conf.modules.d/*, +run the command: +$ ls -l /etc/http/conf.modules.d/* +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/http/conf.modules.d/* does not have unix mode -rw-r-----? - - Verify that core dumps are disabled for all users, run the following command: -$ grep core /etc/security/limits.conf -* hard core 0 - Is it the case that the "core" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core"? + + +Run the following command to determine if the postgresql_selinux_unconfined_dbadm SELinux boolean is enabled: +$ getsebool postgresql_selinux_unconfined_dbadm +If properly configured, the output should show the following: +postgresql_selinux_unconfined_dbadm --> on + Is it the case that postgresql_selinux_unconfined_dbadm is not enabled? - + -Run the following command to determine if the samba_enable_home_dirs SELinux boolean is disabled: -$ getsebool samba_enable_home_dirs +Run the following command to determine if the httpd_can_sendmail SELinux boolean is disabled: +$ getsebool httpd_can_sendmail If properly configured, the output should show the following: -samba_enable_home_dirs --> off - Is it the case that samba_enable_home_dirs is not disabled? +httpd_can_sendmail --> off + Is it the case that httpd_can_sendmail is not disabled? - - Verify Red Hat Enterprise Linux 8 is securely comparing internal information system clocks at a regular interval with an NTP server with the following command: -$ sudo grep maxpoll /etc/ntp.conf /etc/chrony.conf -server [ntp.server.name] iburst maxpoll . - Is it the case that "maxpoll" has not been set to the value of "<sub idref="var_time_service_set_maxpoll" />", is commented out, or is missing? + + Run the following command to check the mode of the system audit logs: +$ sudo grep -iw log_file /etc/audit/auditd.conf +log_file=/var/log/audit/audit.log +$ sudo stat -c "%n %a" /var/log/audit/* +$ sudo ls -l /var/log/audit +Audit logs must be mode 0640 or less permissive. + Is it the case that any permissions are more permissive? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: - -$ sudo grep disk_error_action /etc/audit/auditd.conf - -disk_error_action = HALT - -If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. - Is it the case that there is no evidence of appropriate action? + + Run the following command to determine if the cronie-anacron package is installed: +$ rpm -q cronie-anacron + Is it the case that the package is installed? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_COMPAT_BRK /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /boot/grub2/user.cfg, +run the command: +$ ls -l /boot/grub2/user.cfg +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /boot/grub2/user.cfg does not have unix mode -rw-------? - - Verify the noauto option is configured for the /boot mount point, - run the following command: - $ sudo mount | grep '\s/boot\s' - . . . /boot . . . noauto . . . + + To determine if env_reset has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\benv_reset\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that env_reset is not enabled in sudo? + + + + +Run the following command to determine if the httpd_sys_script_anon_write SELinux boolean is disabled: +$ getsebool httpd_sys_script_anon_write +If properly configured, the output should show the following: +httpd_sys_script_anon_write --> off + Is it the case that httpd_sys_script_anon_write is not disabled? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "restorecon" command with the following command: - Is it the case that the "/boot" file system does not have the "noauto" option set? +$ sudo auditctl -l | grep restorecon + +-a always,exit -F path=/usr/sbin/restorecon -F perm=x -F auid>=1000 -F auid!=unset -k privileged-restorecon + Is it the case that the command does not return a line, or the line is commented out? - - To verify if ErrorLog is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i errorlog /etc/httpd/conf/httpd.conf -The output should return the following: -ErrorLog "logs/error_log" - Is it the case that it is not? + + To verify that McAfee HIPS is installed, run the following command(s): +$ rpm -q MFEhiplsm + Is it the case that the HBSS HIPS module is not installed? - - To check the minimum password length, run the command: -$ grep PASS_MIN_LEN /etc/login.defs -The DoD requirement is 15. - Is it the case that it is not set to the required value? + + +Run the following command to determine if the selinuxuser_execheap SELinux boolean is disabled: +$ getsebool selinuxuser_execheap +If properly configured, the output should show the following: +selinuxuser_execheap --> off + Is it the case that selinuxuser_execheap is not disabled? - - Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep -w admin_space_left /etc/audit/auditd.conf - -admin_space_left = % - -If the value of the "admin_space_left" keyword is not set to % of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is taking action if the allocated storage is about to reach capacity. - Is it the case that the "admin_space_left" value is not configured to the correct value? + + To verify that SSSD's in-memory cache expires after a day, run the following command: +$ sudo grep memcache_timeout /etc/sssd/sssd.conf +If configured properly, output should be memcache_timeout = . + Is it the case that it does not exist or is not configured properly? - - Verify the system-wide shared library directories are owned by "root" with the following command: + + The runtime status of the fs.suid_dumpable kernel parameter can be queried +by running the following command: +$ sysctl fs.suid_dumpable +0. -$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -user root -type d -exec stat -c "%n %U" '{}' \; - Is it the case that any system-wide shared library directory is not owned by root? + Is it the case that the correct value is not returned? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: + + If IPv6 is disabled, this is not applicable. -$ sudo auditctl -l | grep +Inspect the file /etc/sysconfig/ip6tables to determine +the default policy for the INPUT chain. It should be set to DROP: +$ sudo grep ":INPUT" /etc/sysconfig/ip6tables + Is it the case that the default policy for the INPUT chain is not set to DROP? + + + + Verify the noexec option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . noexec . . . --w -p wa -k logins - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the "/tmp" file system does not have the "noexec" option set? - - -Run the following command to determine if the xend_run_qemu SELinux boolean is enabled: -$ getsebool xend_run_qemu -If properly configured, the output should show the following: -xend_run_qemu --> on - Is it the case that xend_run_qemu is not enabled? + + To determine if the system is configured to audit calls to the +rename system call, run the following command: +$ sudo grep "rename" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the samba_share_fusefs SELinux boolean is disabled: -$ getsebool samba_share_fusefs -If properly configured, the output should show the following: -samba_share_fusefs --> off - Is it the case that samba_share_fusefs is not disabled? + + To check the group ownership of /etc/cron.monthly, +run the command: +$ ls -lL /etc/cron.monthly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.monthly does not have a group owner of root? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine how many logs the system is configured to retain after rotation: -$ sudo grep num_logs /etc/audit/auditd.conf -num_logs = 5 - Is it the case that the system log file retention has not been properly configured? + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlinkat system call. + +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r unlinkat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep unlinkat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete + Is it the case that the command does not return a line, or the line is commented out? - - To verify that the interface(s) follow site policy for zone assignment run the -following command: -$ sudo nmcli -t connection show | awk -F: '{if($4){print $4}}' | while read INT; -do firewall-cmd --get-active-zones | grep -B1 $INT; done -If your have to assign an interface to the appropriate zone run the following command: -$ sudo firewall-cmd --zone= --change-interface= - Is it the case that Your system accepts all incoming packets for unnecessary services and ports? + + To check the permissions of /var/log/syslog, +run the command: +$ ls -l /var/log/syslog +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /var/log/syslog does not have unix mode -rw-r-----? - - Run the following command to determine if the pcsc-lite package is installed: $ rpm -q pcsc-lite - Is it the case that the package is not installed? + + Verify that the files and directories of each instance of Alias, +ScriptAlias, and ScriptAliasMatch that exist +have the correct file and directory permissions applied. + Is it the case that it is not? - - To verify that automatic logins are disabled, run the following command: -$ grep -Pzoi "^\[daemon]\\nautomaticlogin.*" /etc/gdm/custom.conf -The output should show the following: -[daemon] -AutomaticLoginEnable=false - Is it the case that GDM allows users to automatically login? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-1-create-success.rules +The output has to be exactly as follows: +## Successful file creation (open with O_CREAT) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create +-a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create + Is it the case that the file does not exist or the content differs? - - The following command will list which files on the system have permissions different from what -is expected by the RPM database: -$ rpm -Va | awk '{ if (substr($0,2,1)=="M") print $NF }' - Is it the case that there is output? + + +Run the following command to determine if the ftpd_full_access SELinux boolean is disabled: +$ getsebool ftpd_full_access +If properly configured, the output should show the following: +ftpd_full_access --> off + Is it the case that ftpd_full_access is not disabled? - - Inspect /etc/audit/auditd.conf and locate the following line to -determine how much data the system will retain in each audit log file: -$ sudo grep max_log_file /etc/audit/auditd.conf -max_log_file = 6 - Is it the case that the system audit data threshold has not been properly configured? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfiles" command with the following command: + +$ sudo auditctl -l | grep setfiles + +-a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update + Is it the case that the command does not return a line, or the line is commented out? - - To verify the assigned home directory of all interactive user home directories -have a mode of 0750 or less permissive, run the following command: -$ sudo ls -l /home -Inspect the output for any directories with incorrect permissions. - Is it the case that they are more permissive? + + Run the following command to determine if the tar package is installed: $ rpm -q tar + Is it the case that the package is not installed? - - To ensure the default password is not set, run the following command: -$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep -E 'public|private' -There should be no output. - Is it the case that the default SNMP passwords public and private have not been changed or removed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_BUG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the krb5-workstation package is installed: -$ rpm -q krb5-workstation - Is it the case that the package is installed? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-2-modify-success.rules +The output has to be exactly as follows: +## Successful file modifications (open for write or truncate) +-a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S open -F a1&01003 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b32 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification +-a always,exit -F arch=b64 -S truncate,ftruncate -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-modification + Is it the case that the file does not exist or the content differs? - - Determine if there is a process for the uploading of files to the web site. -This process should include the requirement for the use of a secure encrypted -logon and secure encrypted connection. If the remote users are uploading files -without utilizing approved encryption methods, this is a finding. - Is it the case that it is not? + + +Run the following command to determine if the httpd_use_nfs SELinux boolean is disabled: +$ getsebool httpd_use_nfs +If properly configured, the output should show the following: +httpd_use_nfs --> off + Is it the case that httpd_use_nfs is not disabled? - + To determine if the system is configured to audit successful calls to the openat system call, run the following command: $ sudo grep "openat" /etc/audit.* @@ -380039,1467 +380517,1371 @@ If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - -Run the following command to determine if the telepathy_connect_all_ports SELinux boolean is disabled: -$ getsebool telepathy_connect_all_ports -If properly configured, the output should show the following: -telepathy_connect_all_ports --> off - Is it the case that telepathy_connect_all_ports is not disabled? + + To check the group ownership of /etc/cron.weekly, +run the command: +$ ls -lL /etc/cron.weekly +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.weekly does not have a group owner of root? - - To check that audit is enabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't enable audit. - Is it the case that auditing is not enabled at boot time? + + The following command will discover and print world-writable directories that are not owned by +a system account, given the assumption that only system accounts have a uid lower than 500. +Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -uid +1000 -print + Is it the case that there is output? - - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postqueue" command with the following command: -Run the following command to determine the current status of the -nftables service: -$ sudo systemctl is-active nftables -If the service is running, it should return the following: active - Is it the case that the "nftables" service is disabled, masked, or not started.? +$ sudo auditctl -l | grep postqueue + +-a always,exit -F path=/usr/bin/postqueue -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postqueue + Is it the case that the command does not return a line, or the line is commented out? - - Verify the operating system encrypts audit records off-loaded onto a different system -or media from the system being audited with the following commands: + + Determine if there is a process for the uploading of files to the web site. +This process should include the requirement for the use of a secure encrypted +logon and secure encrypted connection. If the remote users are uploading files +without utilizing approved encryption methods, this is a finding. + Is it the case that it is not? + + + + To check that the mdmonitor service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled mdmonitor +Output should indicate the mdmonitor service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled mdmonitor disabled -$ sudo grep -i '$ActionSendStreamDriverMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf +Run the following command to verify mdmonitor is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active mdmonitor -The output should be: +If the service is not running the command will return the following output: +inactive -/etc/rsyslog.conf:$ActionSendStreamDriverMode 1 - Is it the case that rsyslogd ActionSendStreamDriverMode is not set to 1? +The service will also be masked, to check that the mdmonitor is masked, run the following command: +$ sudo systemctl show mdmonitor | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "mdmonitor" is loaded and not masked? - - Run the following command: -# grep ^\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf -Verify the output matches: -$FileCreateMode 0640 -Should a site policy dictate less restrictive permissions, ensure to follow -said policy. - Is it the case that $FileCreateMode is not set or is more permissive than 0640? + + The following command will discover and print world-writable directories that +are not owned by root. Run it once for each local partition PART: +$ sudo find PART -xdev -type d -perm -0002 -uid +0 -print + Is it the case that there are world-writable directories not owned by root? - + + Verify that the SA and ISSO (at a minimum) are notified when the audit storage volume is full. + +Check which action Red Hat Enterprise Linux 8 takes when the audit storage volume is full with the following command: + +$ sudo grep max_log_file_action /etc/audit/auditd.conf +max_log_file_action = + Is it the case that the value of the "max_log_file_action" option is set to "ignore", "rotate", or "suspend", or the line is commented out? + + + -Run the following command to determine if the postgresql_selinux_transmit_client_label SELinux boolean is disabled: -$ getsebool postgresql_selinux_transmit_client_label +Run the following command to determine if the virt_sandbox_use_mknod SELinux boolean is disabled: +$ getsebool virt_sandbox_use_mknod If properly configured, the output should show the following: -postgresql_selinux_transmit_client_label --> off - Is it the case that postgresql_selinux_transmit_client_label is not disabled? +virt_sandbox_use_mknod --> off + Is it the case that virt_sandbox_use_mknod is not disabled? - - Run the following command to determine if the samba package is installed: -$ rpm -q samba - Is it the case that the package is installed? + + To verify the home directory ownership, run the following command: +# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) + Is it the case that the user ownership is incorrect? - - To verify the local initialization files of all local interactive users are group- -owned by the appropriate user, inspect the primary group of the respective -users in /etc/passwd and verify all initialization files under the -respective users home directory. Check the group owner of all local interactive users -initialization files. - Is it the case that they are not? + + The runtime status of the net.ipv6.conf.all.accept_ra kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra +0. + + Is it the case that the correct value is not returned? - + +To check that the systemd-journal-remote.socket socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled systemd-journal-remote.socket +Output should indicate the systemd-journal-remote.socket socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled systemd-journal-remote.socketdisabled -Run the following command to determine the current status of the -syslog-ng service: -$ sudo systemctl is-active syslog-ng -If the service is running, it should return the following: active - Is it the case that the "syslog-ng" service is disabled, masked, or not started.? +Run the following command to verify systemd-journal-remote.socket is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active systemd-journal-remote.socket + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the systemd-journal-remote.socket is masked, run the following command: +$ sudo systemctl show systemd-journal-remote.socket | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the systemd-journal-remote socket is not masked? - - Verify that Red Hat Enterprise Linux 8 has configured the minimum time period between password changes for each user account is one day or greater with the following command: + + Run the following command to check if the line is present: +grep pam_wheel /etc/pam.d/su +The output should contain the following line: +auth required pam_wheel.so use_uid + Is it the case that the line is not in the file or it is commented? + + + + Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: -$ sudo awk -F: '$4 < 1 {print $1 " " $4}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? +$ sudo grep -w space_left /etc/audit/auditd.conf + +space_left = % + Is it the case that the value of the "space_left" keyword is not set to <sub idref="var_auditd_space_left_percentage" />% of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. If the "space_left" value is not configured to the correct value? - - Run the following command to see what the max sessions number is: -$ sudo grep MaxSessions /etc/ssh/sshd_config -If properly configured, the output should be: -MaxSessions - Is it the case that MaxSessions is not configured or not configured correctly? + + To ensure that WIFI connections caanot be created, run the following command: +$ gsettings get org.gnome.nm-applet disable-wifi-create +If properly configured, the output should be true. +To ensure that users cannot enable WIFI connection creation, run the following: +$ grep wifi-create /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/nm-applet/disable-wifi-create + Is it the case that WIFI connections can be created through GNOME? - + -Run the following command to determine if the zarafa_setrlimit SELinux boolean is disabled: -$ getsebool zarafa_setrlimit +Run the following command to determine if the minidlna_read_generic_user_content SELinux boolean is disabled: +$ getsebool minidlna_read_generic_user_content If properly configured, the output should show the following: -zarafa_setrlimit --> off - Is it the case that zarafa_setrlimit is not disabled? +minidlna_read_generic_user_content --> off + Is it the case that minidlna_read_generic_user_content is not disabled? - - Run the following command to determine if the sssd package is installed: $ rpm -q sssd - Is it the case that the package is not installed? + + To check the permissions of /etc/ssh/*_key, +run the command: +$ ls -l /etc/ssh/*_key +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/ssh/*_key does not have unix mode -rw-------? - - Run the following command to check if the line is present: -grep pam_wheel /etc/pam.d/su -The output should contain the following line: -auth required pam_wheel.so use_uid group= - Is it the case that the line is not in the file or it is commented? + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Ensure there are no unconfined daemons running on the system, -the following command should produce no output: -$ sudo ps -eZ | grep "unconfined_service_t" - Is it the case that There are unconfined daemons running on the system? + + +Run the following command to determine if the zabbix_can_network SELinux boolean is disabled: +$ getsebool zabbix_can_network +If properly configured, the output should show the following: +zabbix_can_network --> off + Is it the case that zabbix_can_network is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the openat system call. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the renameat system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r openat /etc/audit/rules.d +$ sudo grep -r renameat /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep openat /etc/audit/audit.rules +$ sudo grep renameat /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete Is it the case that the command does not return a line, or the line is commented out? - - - -Run the following command to determine the current status of the -cron service: -$ sudo systemctl is-active cron -If the service is running, it should return the following: active - Is it the case that ? - - - - -Run the following command to determine if the selinuxuser_execmod SELinux boolean is enabled: -$ getsebool selinuxuser_execmod -If properly configured, the output should show the following: -selinuxuser_execmod --> on - Is it the case that selinuxuser_execmod is not enabled? - - - - - -Run the following command to determine the current status of the -ufw service: -$ sudo systemctl is-active ufw -If the service is running, it should return the following: active - Is it the case that the service is not enabled? - - - - Verify Red Hat Enterprise Linux 8 is configured to lock an account after -unsuccessful logon attempts with the command: + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd" with the following command: +$ sudo auditctl -l | grep -E '(/etc/passwd)' -$ grep 'deny =' /etc/security/faillock.conf -deny = . - Is it the case that the "deny" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_deny" />" -or less (but not "0"), is missing or commented out? - - - - -Run the following command to determine if the virt_sandbox_use_audit SELinux boolean is enabled: -$ getsebool virt_sandbox_use_audit -If properly configured, the output should show the following: -virt_sandbox_use_audit --> on - Is it the case that virt_sandbox_use_audit is not enabled? +-w /etc/passwd -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SLAB_MERGE_DEFAULT /boot/config.* + $ grep CONFIG_RETPOLINE /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - - Is it the case that the package is not installed? - - - - -Run the following command to determine if the httpd_can_connect_ftp SELinux boolean is disabled: -$ getsebool httpd_can_connect_ftp -If properly configured, the output should show the following: -httpd_can_connect_ftp --> off - Is it the case that httpd_can_connect_ftp is not disabled? - - - - Run the following command to determine if the geolite2-country package is installed: -$ rpm -q geolite2-country - Is it the case that the package is installed? - - - - -Run the following command to determine if the virt_use_samba SELinux boolean is disabled: -$ getsebool virt_use_samba -If properly configured, the output should show the following: -virt_use_samba --> off - Is it the case that virt_use_samba is not disabled? - - - - To determine if the system is configured to audit successful calls -to the fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/var/log/tallylog" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep /var/log/tallylog + +-w /var/log/tallylog -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - The runtime status of the net.ipv6.conf.default.max_addresses kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.max_addresses -1. - - Is it the case that the correct value is not returned? + + To verify that kernel parameter 'crypto.fips_enabled' is set properly, run the following command: +sysctl crypto.fips_enabled +The output should contain the following: +crypto.fips_enabled = 1 + Is it the case that crypto.fips_enabled is not 1? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "userhelper" command with the following command: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "semanage" command with the following command: -$ sudo auditctl -l | grep userhelper +$ sudo auditctl -l | grep semanage --a always,exit -F path=/usr/bin/userhelper -F perm=x -F auid>=1000 -F auid!=unset -k privileged-userhelper +-a always,exit -F path=/usr/sbin/semanage -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update Is it the case that the command does not return a line, or the line is commented out? - - To determine if the users are allowed to run commands as root, run the following commands: -$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*[^\(\s]' /etc/sudoers /etc/sudoers.d/ -and -$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*\([\w\s]*\b(root|ALL)\b[\w\s]*\)' /etc/sudoers /etc/sudoers.d/ -Both commands should return no output. - Is it the case that /etc/sudoers file contains rules that allow non-root users to run commands as root? + + To ensure write permissions are disabled for group and other + for each element in root's path, run the following command: +# ls -ld DIR + Is it the case that group or other write permissions exist? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow" with the following command: - -$ sudo auditctl -l | grep -E '(/etc/gshadow)' - --w /etc/gshadow -p wa -k identity - -If the command does not return a line, or the line is commented out, this is a finding. - Is it the case that the system is not configured to audit account changes? + + To verify the nosuid option is configured for all NFS mounts, run +the following command: +$ mount | grep nfs +All NFS mounts should show the nosuid setting in parentheses. This +is not applicable if NFS is not implemented. + Is it the case that the setting does not show? - - -Run the following command to determine if the cluster_can_network_connect SELinux boolean is disabled: -$ getsebool cluster_can_network_connect -If properly configured, the output should show the following: -cluster_can_network_connect --> off - Is it the case that cluster_can_network_connect is not disabled? + + To ensure that the GUI power settings are not active, run the following command: +$ gsettings get org.gnome.settings-daemon.plugins.power active +If properly configured, the output should be false. +To ensure that users cannot enable the power settings, run the following: +$ grep power /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/settings-daemon/plugins/power/active + Is it the case that power settings are enabled and are not disabled? - - The runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.arp_ignore -. - - Is it the case that the correct value is not returned? + + To ensure ClientAliveInterval is set correctly, run the following command: +$ sudo grep ClientAliveCountMax /etc/ssh/sshd_config +If properly configured, the output should be: +ClientAliveCountMax +For SSH earlier than v8.2, a ClientAliveCountMax value of 0 causes a timeout precisely when +the ClientAliveInterval is set. Starting with v8.2, a value of 0 disables the timeout +functionality completely. +If the option is set to a number greater than 0, then the session will be disconnected after +ClientAliveInterval * ClientAliveCountMax seconds without receiving a keep alive message. + Is it the case that it is commented out or not configured properly? - - To check that the cups service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled cups -Output should indicate the cups service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cups disabled - -Run the following command to verify cups is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cups - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the cups is masked, run the following command: -$ sudo systemctl show cups | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "cups" is loaded and not masked? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEBUG_WX /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - The runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter can be queried + + The runtime status of the net.ipv4.conf.all.accept_local kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.router_solicitations +$ sysctl net.ipv4.conf.all.accept_local 0. Is it the case that the correct value is not returned? - - Verify the nodev option is configured for the /var/log/audit mount point, - run the following command: - $ sudo mount | grep '\s/var/log/audit\s' - . . . /var/log/audit . . . nodev . . . - - Is it the case that the "/var/log/audit" file system does not have the "nodev" option set? + + The existence of the file /etc/hosts.equiv or a file named +.rhosts inside a user home directory indicates the presence +of an Rsh trust relationship. + Is it the case that these files exist? - - To verify ExecShield is enabled on 64-bit Red Hat Enterprise Linux 8 systems, -run the following command: -$ dmesg | grep '[NX|DX]*protection' -The output should not contain 'disabled by kernel command line option'. -Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes noexec=off, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*noexec=off.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*noexec=off.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'noexec=off' -The command should not return any output. - Is it the case that ExecShield is not supported by the hardware, is not enabled, or has been disabled by the kernel configuration.? + + To determine if the system is configured to audit calls to the +fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 disables core dump backtraces by issuing the following command: - -$ grep -i process /etc/systemd/coredump.conf - -ProcessSizeMax=0 - Is it the case that the "ProcessSizeMax" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling automount-open +If properly configured, the output for automount-openshould be false. +To ensure that users cannot enable automount opening in GNOME3, run the following: +$ grep 'automount-open' /etc/dconf/db/local.d/locks/* +If properly configured, the output for automount-open should be /org/gnome/desktop/media-handling/automount-open + Is it the case that GNOME automounting is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -$ sudo cat /etc/audit/rules.d/11-loginuid.rules -The output has to be exactly as follows: -## Make the loginuid immutable. This prevents tampering with the auid. ---loginuid-immutable - Is it the case that the file does not exist or the content differs? + + Run the following command to verify that SSH client is configured to use 32 bytes of entropy: +grep SSH_USE_STRONG_RNG /etc/profile.d/cc-ssh-strong-rng.csh +It should return the following output: +setenv SSH_USE_STRONG_RNG 32. + Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - To determine how the SSH daemon's HostbasedAuthentication option is set, run the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open_by_handle_at system call with O_TRUNC_WRITE flag. -$ sudo grep -i HostbasedAuthentication /etc/ssh/sshd_config +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: -If a line indicating no is returned, then the required value is set. +$ sudo grep -r open_by_handle_at /etc/audit/rules.d - Is it the case that the required value is not set? +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - Make sure that the kernel is not disabling SMAP with the following -commands. -grep -q nosmap /boot/config-`uname -r` -If the command returns a line, it means that SMAP is being disabled. - Is it the case that the kernel is configured to disable SMAP? + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - Run the following command to ensure that /var/tmp is configured as a -polyinstantiated directory: -$ sudo grep /var/tmp /etc/security/namespace.conf -The output should return the following: -/var/tmp /var/tmp/tmp-inst/ level root,adm - Is it the case that is not configured? + + To determine if the system is configured to audit calls to the +init_module system call, run the following command: +$ sudo grep "init_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +finit_module system call, run the following command: +$ sudo grep "finit_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +delete_module system call, run the following command: +$ sudo grep "delete_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To check for virtual console entries which permit root login, run the -following command: -$ sudo grep ^vc/[0-9] /etc/securetty -If any output is returned, then root logins over virtual console devices is permitted. - Is it the case that root login over virtual console devices is permitted? + + Inspect all instances of DocumentRoot and Alias. No +robots.txt file should exist. + Is it the case that it is not? - - Verify the nodev option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . nodev . . . - - Is it the case that the "/var" file system does not have the "nodev" option set? + + Run the following command to determine if the rpcbind package is installed: +$ rpm -q rpcbind + Is it the case that the package is installed? - - -Run the following command to determine if the container_connect_any SELinux boolean is disabled: -$ getsebool container_connect_any -If properly configured, the output should show the following: -container_connect_any --> off - Is it the case that container_connect_any is not disabled? + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling autorun-never +If properly configured, the output for autorun-nevershould be true. +To ensure that users cannot enable autorun in GNOME3, run the following: +$ grep 'autorun-never' /etc/dconf/db/local.d/locks/* +If properly configured, the output for autorun-never should be /org/gnome/desktop/media-handling/autorun-never + Is it the case that GNOME autorun is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open system call with O_TRUNC_WRITE flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + + Verify the nodev option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . nodev . . . -$ sudo grep open /etc/audit/audit.rules + Is it the case that the "/var/tmp" file system does not have the "nodev" option set? + + + + The owner of all log files written by rsyslog should be -The output should be the following: +root. --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +These log files are determined by the second part of each Rule line in +/etc/rsyslog.conf and typically all appear in /var/log. +To see the owner of a given log file, run the following command: +$ ls -l LOGFILE + Is it the case that the owner is not correct? - - Run the following command to determine open ports: -# ss -6tuln -Run the following command to determine firewall rules: -# ip6tables -L INPUT -v -n -For each port identified in the audit which does not have a firewall -rule, add rule for accepting or denying inbound connections -# ip6tables -A INPUT -p \ --dport \ -m state --state NEW -j ACCEPT - Is it the case that open ports are denied connection? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes l1tf=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*l1tf=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*l1tf=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'l1tf=' +The command should not return any output. + Is it the case that l1tf mitigations are not configured appropriately? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the ftruncate system call, run the following command: +$ sudo grep "ftruncate" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setsebool" command with the following command: - -$ sudo auditctl -l | grep setsebool - --a always,exit -F path=/usr/sbin/setsebool -F perm=x -F auid>=1000 -F auid!=unset -k privileged - Is it the case that the command does not return a line, or the line is commented out? + + +Run the following command to determine if the samba_run_unconfined SELinux boolean is disabled: +$ getsebool samba_run_unconfined +If properly configured, the output should show the following: +samba_run_unconfined --> off + Is it the case that samba_run_unconfined is not disabled? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-4-delete-success.rules -The output has to be exactly as follows: -## Successful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-delete - Is it the case that the file does not exist or the content differs? + + +Run the following command to determine if the zoneminder_anon_write SELinux boolean is disabled: +$ getsebool zoneminder_anon_write +If properly configured, the output should show the following: +zoneminder_anon_write --> off + Is it the case that zoneminder_anon_write is not disabled? - + -Run the following command to determine if the dbadm_read_user_files SELinux boolean is disabled: -$ getsebool dbadm_read_user_files +Run the following command to determine if the mailman_use_fusefs SELinux boolean is disabled: +$ getsebool mailman_use_fusefs If properly configured, the output should show the following: -dbadm_read_user_files --> off - Is it the case that dbadm_read_user_files is not disabled? +mailman_use_fusefs --> off + Is it the case that mailman_use_fusefs is not disabled? - - The following command will list which files on the system have ownership different from what -is expected by the RPM database: -$ rpm -Va | rpm -Va --nofiledigest | awk '{ if (substr($0,6,1)=="U" || substr($0,7,1)=="G") print $NF }' - Is it the case that there is output? + + To verify that smart cards are enabled in SSSD, run the following command: +$ sudo grep pam_cert_auth /etc/sssd/sssd.conf +If configured properly, output should be +pam_cert_auth = True + + +To verify that smart cards are enabled in PAM files, run the following command: +$ sudo grep -e "auth.*pam_sss\.so.*\(allow_missing_name\|try_cert_auth\)" /etc/pam.d/smartcard-auth /etc/pam.d/system-auth +If configured properly, output should be + +/etc/pam.d/smartcard-auth:auth sufficient pam_sss.so allow_missing_name +/etc/pam.d/system-auth:auth [success=done authinfo_unavail=ignore ignore=ignore default=die] pam_sss.so try_cert_auth + + Is it the case that smart cards are not enabled in SSSD? - + -Run the following command to determine if the mozilla_plugin_use_spice SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_spice +Run the following command to determine if the kdumpgui_run_bootloader SELinux boolean is disabled: +$ getsebool kdumpgui_run_bootloader If properly configured, the output should show the following: -mozilla_plugin_use_spice --> off - Is it the case that mozilla_plugin_use_spice is not disabled? - - - - Run the following command to determine if the crypto-policies package is installed: $ rpm -q crypto-policies - Is it the case that the package is not installed? +kdumpgui_run_bootloader --> off + Is it the case that kdumpgui_run_bootloader is not disabled? - - To ensure that the system prevents messages from being shown when three unsuccessful logon -attempts occur, run the following command: -$ grep silent /etc/security/faillock.conf -The output should show silent. - Is it the case that the system shows messages when three unsuccessful logon attempts occur? + + To ensure the X Windows package group is removed, run the following command: +$ rpm -qi xorg-x11-server-common +The output should be: +package xorg-x11-server-common is not installed + Is it the case that the X Windows package group or xorg-x11-server-common has not be removed? - + -Run the following command to determine if the httpd_can_check_spam SELinux boolean is disabled: -$ getsebool httpd_can_check_spam +Run the following command to determine if the xdm_bind_vnc_tcp_port SELinux boolean is disabled: +$ getsebool xdm_bind_vnc_tcp_port If properly configured, the output should show the following: -httpd_can_check_spam --> off - Is it the case that httpd_can_check_spam is not disabled? +xdm_bind_vnc_tcp_port --> off + Is it the case that xdm_bind_vnc_tcp_port is not disabled? - - To verify that Audit Daemon is configured to include local events, run the -following command: -$ sudo grep local_events /etc/audit/auditd.conf -The output should return the following: -local_events = yes - Is it the case that local_events isn't set to yes? + + Run the following command to determine if the ypserv package is installed: +$ rpm -q ypserv + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chacl" command with the following command: - -$ sudo auditctl -l | grep chacl - --a always,exit -F path=/usr/bin/chacl -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? + + To verify insecure file locking has been disabled, run the following command: +$ grep insecure_locks /etc/exports + Is it the case that there is output? - - The runtime status of the net.ipv4.conf.all.arp_filter kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.arp_filter -. + + To determine if the system is configured to audit successful calls +to the renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the correct value is not returned? + Is it the case that no line is returned? - - Run the following command to determine if the audispd-plugins package is installed: $ rpm -q audispd-plugins - Is it the case that the package is not installed? + + The following command will list which files on the system have file hashes different from what +is expected by the RPM database. +$ rpm -Va --noconfig | awk '$1 ~ /..5/' + Is it the case that there is output? - - Verify that a separate file system/partition has been created for /var with the following command: - -$ mountpoint /var - - Is it the case that "/var is not a mountpoint" is returned? + + To verify if LogLevel is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i loglevel /etc/httpd/conf/httpd.conf +The command should return the following: +LogLevel warn + Is it the case that it is not? - - Storing logs with persistent storage ensures they are available after a reboot or system crash. -Run the command below to verify that logs are being persistently stored to disk. - -grep "^\sStorage" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf - - -and it should return + + Verify that a separate file system/partition has been created for /var/tmp with the following command: -Storage=persistent +$ mountpoint /var/tmp - Is it the case that is commented out or not configured correctly? + Is it the case that "/var/tmp is not a mountpoint" is returned? - + -Determine the audit log group by running the following command: - -$ sudo grep -P '^[ ]*log_group[ ]+=.*$' /etc/audit/auditd.conf +Verify that the libuser is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. -Then, check that all directories within the /var/log/audit directory are owned by the group specified as log_group or by root if the log_group is not specified. -Run the following command: +Check the hashing algorithm that is being used to hash passwords with the following command: -$ sudo find /var/log/audit -type d -printf "%p %g\n" +$ sudo grep -i crypt_style /etc/libuser.conf -All listed directories must be owned by the log_group or by root if the log_group is not specified. - Is it the case that there is a directory owned by different group? +crypt_style = sha512 + Is it the case that crypt_style is not set to sha512? - - To check that the sysstat service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled sysstat -Output should indicate the sysstat service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled sysstat disabled + + Verify that the IPSec service uses the system crypto policy. -Run the following command to verify sysstat is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active sysstat +If the ipsec service is not installed is not applicable. -If the service is not running the command will return the following output: -inactive +Check to see if the "IPsec" service is active with the following command: -The service will also be masked, to check that the sysstat is masked, run the following command: -$ sudo systemctl show sysstat | grep "LoadState\|UnitFileState" +$ systemctl status ipsec -If the service is masked the command will return the following outputs: +ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec +Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) +Active: inactive (dead) -LoadState=masked +If the "IPsec" service is active, check to see if it is using the system crypto policy with the following command: -UnitFileState=masked - Is it the case that the "sysstat" is loaded and not masked? - - - - The runtime status of the net.ipv4.conf.default.accept_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.accept_redirects -0. +$ sudo grep include /etc/ipsec.conf /etc/ipsec.d/*.conf - Is it the case that the correct value is not returned? +/etc/ipsec.conf:include /etc/crypto-policies/back-ends/libreswan.config + Is it the case that the "IPsec" service is active and the ipsec configuration file does not contain does not contain <tt>include /etc/crypto-policies/back-ends/libreswan.config</tt>? - - Verify the audit system is configured to take an appropriate action when the internal event queue is full: -$ sudo grep -i overflow_action /etc/audit/auditd.conf + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "poweroff" command with the following command: -The output should contain overflow_action = syslog +$ sudo auditctl -l | grep poweroff -If the value of the "overflow_action" option is not set to syslog, -single, halt or the line is commented out, ask the System Administrator -to indicate how the audit logs are off-loaded to a different system or media. - Is it the case that auditd overflow action is not set correctly? +-a always,exit -F path=/poweroff -F perm=x -F auid>=1000 -F auid!=unset -k privileged-poweroff + Is it the case that the command does not return a line, or the line is commented out? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlinkat system call. + + Verify "firewalld" is configured to employ a deny-all, allow-by-exception policy for allowing connections to other systems with the following commands: -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: +$ sudo firewall-cmd --state -$ sudo grep -r unlinkat /etc/audit/rules.d +running -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +$ sudo firewall-cmd --get-active-zones -$ sudo grep unlinkat /etc/audit/audit.rules +[custom] +interfaces: ens33 -The output should be the following: +$ sudo firewall-cmd --info-zone=[custom] | grep target --a always,exit -F arch=b32 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlinkat -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? +target: DROP + Is it the case that no zones are active on the interfaces or if the target is set to a different option other than "DROP"? - - The runtime status of the kernel.pid_max kernel parameter can be queried -by running the following command: -$ sysctl kernel.pid_max -65536. + + Verify that Red Hat Enterprise Linux 8 enforces a -day maximum password lifetime for new user accounts by running the following command: - Is it the case that the correct value is not returned? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_NOTIFIERS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +$ grep -i pass_max_days /etc/login.defs + +PASS_MAX_DAYS + Is it the case that the "PASS_MAX_DAYS" parameter value is greater than "<sub idref="var_accounts_maximum_age_login_defs" />", or commented out? - + -Run the following command to determine if the httpd_enable_homedirs SELinux boolean is disabled: -$ getsebool httpd_enable_homedirs +Run the following command to determine if the exim_can_connect_db SELinux boolean is disabled: +$ getsebool exim_can_connect_db If properly configured, the output should show the following: -httpd_enable_homedirs --> off - Is it the case that httpd_enable_homedirs is not disabled? - - - - Ensure that debug-shell service is not enabled with the following command: -grep systemd\.debug-shell=1 /boot/grub2/grubenv /etc/default/grub -If the command returns a line, it means that debug-shell service is being enabled. - Is it the case that the comand returns a line? +exim_can_connect_db --> off + Is it the case that exim_can_connect_db is not disabled? - + -Run the following command to determine if the condor_tcp_network_connect SELinux boolean is disabled: -$ getsebool condor_tcp_network_connect +Run the following command to determine if the auditadm_exec_content SELinux boolean is enabled: +$ getsebool auditadm_exec_content If properly configured, the output should show the following: -condor_tcp_network_connect --> off - Is it the case that condor_tcp_network_connect is not disabled? - - - - Verify the noexec option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . noexec . . . - - Is it the case that the "/var/tmp" file system does not have the "noexec" option set? - - - - The runtime status of the net.ipv4.conf.default.log_martians kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.log_martians -1. - - Is it the case that the correct value is not returned? +auditadm_exec_content --> on + Is it the case that auditadm_exec_content is not enabled? - - To verify the nodev option is configured for non-root local partitions, run the following command: -$ sudo mount | grep '^/dev\S* on /\S' | grep --invert-match 'nodev' -The output shows local non-root partitions mounted without the nodev option, and there should be no output at all. - - Is it the case that some mounts appear among output lines? + + To determine if the system is configured to make login UIDs immutable, run +one of the following commands. +If the auditd daemon is configured to use the +augenrules program to read audit rules during daemon startup (the +default), run the following: +sudo grep immutable /etc/audit/rules.d/*.rules +If the auditd daemon is configured to use the auditctl +utility to read audit rules during daemon startup, run the following command: +sudo grep immutable /etc/audit/audit.rules +The following line should be returned: +--loginuid-immutable + Is it the case that the system is not configured to make login UIDs immutable? - - -Run the following command to determine if the pppd_for_user SELinux boolean is disabled: -$ getsebool pppd_for_user -If properly configured, the output should show the following: -pppd_for_user --> off - Is it the case that pppd_for_user is not disabled? + + Run the following command to determine if the mailx package is installed: $ rpm -q mailx + Is it the case that the package is not installed? - - To check the ownership of /etc/shadow, -run the command: -$ ls -lL /etc/shadow -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shadow does not have an owner of root? + + Run the following command to determine if the systemd-journal-remote package is installed: $ rpm -q systemd-journal-remote + Is it the case that the package is not installed? - - To determine if the system is configured to audit calls to the -unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the creat system call, run the following command: +$ sudo grep "creat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that HBSS PA is installed, run the following command(s): -$ sudo ls /opt/McAfee/auditengine/bin/auditmanager - Is it the case that the HBSS PA module is not installed? + + Check the system partitions to determine if they are encrypted with the following command: +blkid + +Output will be similar to: +/dev/sda1: UUID=" ab12c3de-4f56-789a-8f33-3850cc8ce3a2 +" TYPE="crypto_LUKS" +/dev/sda2: UUID=" bc98d7ef-6g54-321h-1d24-9870de2ge1a2 +" TYPE="crypto_LUKS" + +The boot partition and pseudo-file systems, such as /proc, /sys, and tmpfs, +are not required to use disk encryption and are not a finding. + Is it the case that partitions do not have a type of crypto_LUKS? - + + Determine where the audit logs are stored with the following command: + +$ sudo grep -iw log_file /etc/audit/auditd.conf + +log_file = /var/log/audit/audit.log + +Determine the owner of the audit log directory by using the output of the above command +(default: "/var/log/audit/"). Run the following command with the correct audit log directory +path: + +$ sudo ls -ld /var/log/audit + +drwx------ 2 root root 23 Jun 11 11:56 /var/log/audit + +The audit log directory must be owned by "root" + Is it the case that the directory is not owned by root? + + + -Run the following command to determine if the use_lpd_server SELinux boolean is disabled: -$ getsebool use_lpd_server +Run the following command to determine if the zarafa_setrlimit SELinux boolean is disabled: +$ getsebool zarafa_setrlimit If properly configured, the output should show the following: -use_lpd_server --> off - Is it the case that use_lpd_server is not disabled? +zarafa_setrlimit --> off + Is it the case that zarafa_setrlimit is not disabled? - - Verify the operating system requires re-authentication -when using the "sudo" command to elevate privileges, run the following command: -sudo grep -ri '^Defaults.*timestamp_timeout' /etc/sudoers /etc/sudoers.d -The output should be: -/etc/sudoers:Defaults timestamp_timeout=0 or "timestamp_timeout" is set to a positive number. -If conflicting results are returned, this is a finding. - Is it the case that timestamp_timeout is not set with the appropriate value for sudo? + + Verify that rules for unsuccessful calls of the openat syscall are in the order shown below. + + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. + + -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + + If the system is 64 bit then also add the following lines: + + -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? - - To check if the installed Operating System is 64-bit, run the following command: -$ uname -m -The output should be one of the following: x86_64, aarch64, ppc64le or s390x. -If the output is i686 or i386 the operating system is 32-bit. -Check if the installed CPU supports 64-bit operating systems by running the following command: -$ lscpu | grep "CPU op-mode" -If the output contains 64bit, the CPU supports 64-bit operating systems. - Is it the case that the installed operating sytem is 32-bit but the CPU supports operation in 64-bit? + + Verify "nftables" is configured to allow rate limits on any connection to the system with the following command: + +Verify "firewalld" has "nftables" set as the default backend: + +$ sudo grep -i firewallbackend /etc/firewalld/firewalld.conf + +# FirewallBackend +FirewallBackend=nftables + Is it the case that the "nftables" is not set as the "firewallbackend"? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: + + -$ sudo auditctl -l | grep -E '(/etc/security/opasswd)' +Run the following command to determine the current status of the +chronyd service: +$ sudo systemctl is-active chronyd +If the service is running, it should return the following: active --w /etc/security/opasswd -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + +Run the following command to determine the current status of the +ntpd service: +$ sudo systemctl is-active ntpd +If the service is running, it should return the following: active + Is it the case that ? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_BUG_ON_DATA_CORRUPTION /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify the audispd's syslog plugin is active, run the following command: +$ sudo grep active /etc/audit/plugins.d/syslog.conf +If the plugin is active, the output will show yes. + Is it the case that it is not activated? - - The runtime status of the net.ipv4.tcp_syncookies kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.tcp_syncookies -1. + + Verify the system-wide shared library directories are group-owned by "root" with the following command: - Is it the case that the correct value is not returned? +$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -group root -type d -exec stat -c "%n %G" '{}' \; + +If any system-wide shared library directory is returned and is not group-owned by a required system account, this is a finding. + Is it the case that any system-wide shared library directory is returned and is not group-owned by a required system account? - - To verify if the OpenSSH Client uses defined Crypto Policy, run: -$ cat /etc/ssh/ssh_config.d/02-ospp.conf -and verify that the line matches -Match final all -RekeyLimit 512M 1h -GSSAPIAuthentication no -Ciphers aes256-ctr,aes256-cbc,aes128-ctr,aes128-cbc -PubkeyAcceptedKeyTypes ssh-rsa,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256 -MACs hmac-sha2-512,hmac-sha2-256 -KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group14-sha1 - Is it the case that Crypto Policy for OpenSSH Client is not configured according to CC requirements? + + Run the following command to determine if the dovecot package is installed: +$ rpm -q dovecot + Is it the case that the package is installed? - - To verify that SSSD expires known SSH host keys, run the following command: -$ sudo grep ssh_known_hosts_timeout /etc/sssd/sssd.conf -If configured properly, output should be -ssh_known_hosts_timeout = - Is it the case that it does not exist or is not configured properly? + + To verify if GnuTLS uses defined DoD-approved TLS Crypto Policy, run: +$ sudo grep +'+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' +/etc/crypto-policies/back-ends/gnutls.config and verify that a match exists. + Is it the case that cryptographic policy for gnutls is not configured or is configured incorrectly? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the openat system call with O_TRUNC_WRITE flag. + + Verify Red Hat Enterprise Linux 8 use the "pam_pwhistory.so" module in the /etc/pam.d/password-auth file +and is configured to prohibit password reuse for a minimum of +generations. -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: +Verify the "/etc/pam.d/password-auth" file with the following command: -$ sudo grep -r openat /etc/audit/rules.d +$ grep pam_pwhistory.so /etc/pam.d/password-auth +password pam_pwhistory.so use_authtok remember= -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep openat /etc/audit/audit.rules +Verify the "/etc/security/pwhistory.conf" file using the following command: -The output should be the following: +$ grep remember /etc/security/pwhistory.conf +remember = --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +The pam_pwhistory.so "remember" option must be configured only in one file. + Is it the case that the pam_pwhistory.so module is not used, the "remember" module option is not set in +/etc/pam.d/password-auth or in /etc/security/pwhistory.conf, or is set in both files, or is set +with a value less than "<sub idref="var_password_pam_remember" />"? - - Verify the system-wide shared library files are owned by "root" with the following command: - -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -user root -exec ls -l {} \; - Is it the case that any system wide shared library file is not owned by root? + + +Run the following command to determine if the httpd_dbus_avahi SELinux boolean is disabled: +$ getsebool httpd_dbus_avahi +If properly configured, the output should show the following: +httpd_dbus_avahi --> off + Is it the case that httpd_dbus_avahi is not disabled? - + + To ensure the system is configured to ignore the Ctrl-Alt-Del setting, +enter the following command: +$ sudo grep -i ctrlaltdelburstaction /etc/systemd/system.conf +The output should return: +CtrlAltDelBurstAction=none + Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed more than 7 times in 2 seconds.? + + + Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes pti=on, +in /etc/default/grub. If it includes audit_backlog_limit=8192, then the parameter will be configured for newly installed kernels. First check if the GRUB recovery is enabled: $ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*pti=on.*' /etc/default/grub +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit_backlog_limit=8192.*' /etc/default/grub If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*pti=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +$ sudo grep 'GRUB_CMDLINE_LINUX.*audit_backlog_limit=8192.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'pti=on' +$ sudo grubby --info=ALL | grep args | grep -v 'audit_backlog_limit=8192' The command should not return any output. - Is it the case that Kernel page-table isolation is not enabled? + Is it the case that audit backlog limit is not configured? - + -Run the following command to determine if the mozilla_read_content SELinux boolean is disabled: -$ getsebool mozilla_read_content +Run the following command to determine if the use_nfs_home_dirs SELinux boolean is disabled: +$ getsebool use_nfs_home_dirs If properly configured, the output should show the following: -mozilla_read_content --> off - Is it the case that mozilla_read_content is not disabled? +use_nfs_home_dirs --> off + Is it the case that use_nfs_home_dirs is not disabled? - - Run the following command and verify remote server is configured properly: -# grep -E "^(server|pool)" /etc/chrony.conf - Is it the case that a remote time server is not configured? + + +Run the following command to determine if the virt_sandbox_use_sys_admin SELinux boolean is disabled: +$ getsebool virt_sandbox_use_sys_admin +If properly configured, the output should show the following: +virt_sandbox_use_sys_admin --> off + Is it the case that virt_sandbox_use_sys_admin is not disabled? - - Check that AIDE is properly configured to protect the integrity of the -audit tools by running the following command: - -# sudo cat /etc/aide.conf | grep /usr/sbin/au - -/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512 -/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512 - - - -/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512 - + + Verify file systems that are used for removable media are mounted with the "nosuid" option with the following command: -If AIDE is configured properly to protect the integrity of the audit tools, -all lines listed above will be returned from the command. +$ sudo more /etc/fstab -If one or more lines are missing, this is a finding. - Is it the case that integrity checks of the audit tools are missing or incomplete? - - - - Run the following command to verify that SSH client is configured to use 32 bytes of entropy: -grep SSH_USE_STRONG_RNG /etc/profile.d/cc-ssh-strong-rng.csh -It should return the following output: -setenv SSH_USE_STRONG_RNG 32. - Is it the case that SSH client is not configured to use 32 bytes of entropy or more? - - - - -Run the following command to determine if the mmap_low_allowed SELinux boolean is disabled: -$ getsebool mmap_low_allowed -If properly configured, the output should show the following: -mmap_low_allowed --> off - Is it the case that mmap_low_allowed is not disabled? +UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid,nodev,noexec 0 0 + Is it the case that file system found in "/etc/fstab" refers to removable media and it does not have the "nosuid" option set? - + -Run the following command to determine if the tor_can_network_relay SELinux boolean is disabled: -$ getsebool tor_can_network_relay +Run the following command to determine if the mpd_use_nfs SELinux boolean is disabled: +$ getsebool mpd_use_nfs If properly configured, the output should show the following: -tor_can_network_relay --> off - Is it the case that tor_can_network_relay is not disabled? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_X86_VSYSCALL_EMULATION /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STRICT_MODULE_RWX /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? +mpd_use_nfs --> off + Is it the case that mpd_use_nfs is not disabled? - - -To check that the rsh service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig rsh --list -Output should indicate the rsh service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig rsh --list - -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. - -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. + + Verify the TFTP daemon is configured to operate in secure mode. -rsh off +Check if a TFTP server is installed with the following command: -To check that the rsh socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled rsh -Output should indicate the rsh socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rshdisabled +$ rpm -qa | grep tftp -Run the following command to verify rsh is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rsh -If the socket is not running the command will return the following output: -inactive +If a TFTP server is not installed, this is Not Applicable. -The socket will also be masked, to check that the rsh is masked, run the following command: -$ sudo systemctl show rsh | grep "LoadState\|UnitFileState" -If the socket is masked the command will return the following outputs: +If a TFTP server is installed, verify TFTP is configured by with +the -s option by running the following command: -LoadState=masked +grep "server_args" /etc/xinetd.d/tftp +server_args = -s + Is it the case that '"server_args" line does not have a "-s" option, and a subdirectory is not assigned'? + + + + Verify the nosuid option is configured for the /boot/efi mount point, + run the following command: + $ sudo mount | grep '\s/boot/efi\s' + . . . /boot/efi . . . nosuid . . . -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that the "/boot/efi" file system does not have the "nosuid" option set? - - To check that the saslauthd service is disabled in system boot configuration, + + To check that the atd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled saslauthd -Output should indicate the saslauthd service has either not been installed, +$ sudo systemctl is-enabled atd +Output should indicate the atd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled saslauthd disabled +$ sudo systemctl is-enabled atd disabled -Run the following command to verify saslauthd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active saslauthd +Run the following command to verify atd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active atd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the saslauthd is masked, run the following command: -$ sudo systemctl show saslauthd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the atd is masked, run the following command: +$ sudo systemctl show atd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "saslauthd" is loaded and not masked? - - - - To verify if SSLVerifyClient is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i sslverifyclient /etc/httpd/conf/httpd.conf -The command should return the following: -SSLVerifyClient require - Is it the case that it is not? - - - - -Run the following command to determine if the virt_read_qemu_ga_data SELinux boolean is disabled: -$ getsebool virt_read_qemu_ga_data -If properly configured, the output should show the following: -virt_read_qemu_ga_data --> off - Is it the case that virt_read_qemu_ga_data is not disabled? + Is it the case that the "atd" is loaded and not masked? - - To determine if the system is configured to audit calls to the -delete_module system call, run the following command: -$ sudo grep "delete_module" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/security/opasswd" with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep + +-w -p wa -k logins + Is it the case that the command does not return a line, or the line is commented out? - - -Run the following command to determine if the openshift_use_nfs SELinux boolean is disabled: -$ getsebool openshift_use_nfs -If properly configured, the output should show the following: -openshift_use_nfs --> off - Is it the case that openshift_use_nfs is not disabled? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine how many logs the system is configured to retain after rotation: +$ sudo grep num_logs /etc/audit/auditd.conf +num_logs = 5 + Is it the case that the system log file retention has not been properly configured? - - To check that the dhcpd service is disabled in system boot configuration, + + To check that the ypserv service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled dhcpd -Output should indicate the dhcpd service has either not been installed, +$ sudo systemctl is-enabled ypserv +Output should indicate the ypserv service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled dhcpd disabled +$ sudo systemctl is-enabled ypserv disabled -Run the following command to verify dhcpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active dhcpd +Run the following command to verify ypserv is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ypserv If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the dhcpd is masked, run the following command: -$ sudo systemctl show dhcpd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the ypserv is masked, run the following command: +$ sudo systemctl show ypserv | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "dhcpd" is loaded and not masked? + Is it the case that the "ypserv" is loaded and not masked? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pam_timestamp_check" command with the following command: - -$ sudo auditctl -l | grep pam_timestamp_check - --a always,exit -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pam_timestamp_check - Is it the case that the command does not return a line, or the line is commented out? + + To verify the LDAP client backend demands a valid certificate from the server in +remote LDAP access sessions, run the following command: +$ sudo grep ldap_tls_reqcert /etc/sssd/sssd.conf +The output should return the following: +ldap_tls_reqcert = demand + Is it the case that the TLS reqcert is not set to demand? - - To verify that each web content directory has an index.html file, -run the following command: -$ sudo find `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` -name index.html -The output should return an index.html file for every -DocumentRoot that is set. + + To verify if ErrorLog is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i errorlog /etc/httpd/conf/httpd.conf +The output should return the following: +ErrorLog "logs/error_log" Is it the case that it is not? - - Run the following command to determine if the tar package is installed: $ rpm -q tar - Is it the case that the package is not installed? + + To verify that is configured +as the smart card driver, run the following command: +$ grep force_card_driver /etc/opensc.conf +The output should return something similar to: +force_card_driver = ; + Is it the case that the smart card driver is not configured correctly? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd" with the following command: - -$ sudo auditctl -l | grep -E '(/etc/passwd)' - --w /etc/passwd -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? + + +Run the following command to determine if the collectd_tcp_network_connect SELinux boolean is disabled: +$ getsebool collectd_tcp_network_connect +If properly configured, the output should show the following: +collectd_tcp_network_connect --> off + Is it the case that collectd_tcp_network_connect is not disabled? - - To determine if the system is configured to audit calls to the -fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine how the SSH daemon's PermitRootLogin option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config + +If a line indicating prohibit-password is returned, then the required value is set. + Is it the case that it is commented out or not configured properly? - - To check the permissions of /etc/http/conf/*, -run the command: -$ ls -l /etc/http/conf/* -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/http/conf/* does not have unix mode -rw-r-----? + + +Run the following command to determine if the cobbler_anon_write SELinux boolean is disabled: +$ getsebool cobbler_anon_write +If properly configured, the output should show the following: +cobbler_anon_write --> off + Is it the case that cobbler_anon_write is not disabled? - - -If the system is configured to prevent the loading of the firewire-core kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + + Verify it by running the following command: +$ stat -c "%n %G" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules -These lines can also instruct the module loading system to ignore the firewire-core kernel module via blacklist keyword. +/sbin/auditctl root +/sbin/aureport root +/sbin/ausearch root +/sbin/autrace root +/sbin/auditd root +/sbin/audispd root +/sbin/augenrules root -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r firewire-core /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? - - - - The runtime status of the fs.protected_hardlinks kernel parameter can be queried -by running the following command: -$ sysctl fs.protected_hardlinks -1. - Is it the case that the correct value is not returned? - - - - -If the system is configured to prevent the loading of the rds kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. +If the command does not return all the above lines, the missing ones +need to be added. -These lines can also instruct the module loading system to ignore the rds kernel module via blacklist keyword. +Run the following command to correct the permissions of the missing +entries: +$ sudo chown :root [audit_tool] -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r rds /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? +Replace "[audit_tool]" with each audit tool not group-owned by root. + Is it the case that ? - - To determine if the system is configured to audit calls to the -open system call, run the following command: -$ sudo grep "open" /etc/audit/audit.* + + To determine if the system is configured to audit successful calls +to the fremovexattr system call, run the following command: +$ sudo grep "fremovexattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + -Run the following command to determine if the httpd_dbus_avahi SELinux boolean is disabled: -$ getsebool httpd_dbus_avahi +Run the following command to determine if the httpd_can_network_connect_db SELinux boolean is disabled: +$ getsebool httpd_can_network_connect_db If properly configured, the output should show the following: -httpd_dbus_avahi --> off - Is it the case that httpd_dbus_avahi is not disabled? +httpd_can_network_connect_db --> off + Is it the case that httpd_can_network_connect_db is not disabled? - - -Run the following command to determine if the xserver_clients_write_xshm SELinux boolean is disabled: -$ getsebool xserver_clients_write_xshm -If properly configured, the output should show the following: -xserver_clients_write_xshm --> off - Is it the case that xserver_clients_write_xshm is not disabled? + + The runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra_rtr_pref +0. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the collectd_tcp_network_connect SELinux boolean is disabled: -$ getsebool collectd_tcp_network_connect -If properly configured, the output should show the following: -collectd_tcp_network_connect --> off - Is it the case that collectd_tcp_network_connect is not disabled? + + Inspect the system to determine if intrusion detection software has been installed. +Verify this intrusion detection software is active. + Is it the case that no host-based intrusion detection tools are installed? - - To check the ownership of /etc/crontab, + + Verify the nosuid option is configured for the /var/tmp mount point, + run the following command: + $ sudo mount | grep '\s/var/tmp\s' + . . . /var/tmp . . . nosuid . . . + + Is it the case that the "/var/tmp" file system does not have the "nosuid" option set? + + + + To check the permissions of /etc/passwd, run the command: -$ ls -lL /etc/crontab -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/crontab does not have an owner of root? +$ ls -l /etc/passwd +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/passwd does not have unix mode -rw-r--r--? - - To check that the vsftpd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled vsftpd -Output should indicate the vsftpd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled vsftpd disabled - -Run the following command to verify vsftpd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active vsftpd - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the vsftpd is masked, run the following command: -$ sudo systemctl show vsftpd | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: + + Check whether the maximum time period for existing passwords is restricted to days with the following commands: -LoadState=masked +$ sudo awk -F: '$5 > 60 {print $1 " " $5}' /etc/shadow -UnitFileState=masked - Is it the case that the "vsftpd" is loaded and not masked? +$ sudo awk -F: '$5 <= 0 {print $1 " " $5}' /etc/shadow + Is it the case that any results are returned that are not associated with a system account? - - To ensure there are no read-write users, run the following command: -$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep 'rwuser' -There should be no output. - Is it the case that there are users who can write to SNMP values? + + To determine if requiretty has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults.*\brequiretty\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that requiretty is not enabled in sudo? - - To determine if the system is configured to audit successful calls -to the renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the noauto option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . noauto . . . - Is it the case that no line is returned? + Is it the case that the "/boot" file system does not have the "noauto" option set? - - To check on the age of McAfee virus definition files, run the following command: -$ sudo cd /opt/NAI/LinuxShield/engine/dat -$ sudo ls -la avvscan.dat avvnames.dat avvclean.dat - Is it the case that signatures are out of date? + + +Run the following command to determine if the conman_can_network SELinux boolean is disabled: +$ getsebool conman_can_network +If properly configured, the output should show the following: +conman_can_network --> off + Is it the case that conman_can_network is not disabled? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the open_by_handle_at system call with O_CREAT flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r open_by_handle_at /etc/audit/rules.d + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: -$ sudo grep open_by_handle_at /etc/audit/audit.rules +$ sudo grep disk_full_action /etc/audit/auditd.conf -The output should be the following: +disk_full_action = --a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? +If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. + Is it the case that there is no evidence of appropriate action? - - Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services - Is it the case that the iptables-services package is installed? + + To check the permissions of /etc/shells, +run the command: +$ ls -l /etc/shells +If properly configured, the output should indicate the following permissions: +0644 + Is it the case that /etc/shells does not have unix mode 0644? - - - -Run the following command to determine the current status of the -iptables service: -$ sudo systemctl is-active iptables -If the service is running, it should return the following: active - Is it the case that ? + + To verify that McAfee Runtime Libraries (MFErt) and Linux Agent (MFEcma) +are installed, run the following command(s): +$ rpm -q MFEcma +$ rpm -q MFErt + Is it the case that the HBSS HIPS module is not installed? - - To determine if the system is configured to audit calls to the -fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + The runtime status of the net.ipv6.conf.all.accept_ra_defrtr kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.accept_ra_defrtr +0. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - - Check to see if Online Certificate Status Protocol (OCSP) -is enabled and using the proper digest value on the system with the following command: -$ sudo grep certificate_verification /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf | grep -v "^#" -If configured properly, output should look like - - certificate_verification = ocsp_dgst= + + Verify that rules for unsuccessful calls of the open_by_handle_at syscall are in the order shown below. - Is it the case that certificate_verification in sssd is not configured? - - - - To check that the rhnsd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rhnsd -Output should indicate the rhnsd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rhnsd disabled + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. -Run the following command to verify rhnsd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rhnsd + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -If the service is not running the command will return the following output: -inactive + If the system is 64 bit then also add the following lines: -The service will also be masked, to check that the rhnsd is masked, run the following command: -$ sudo systemctl show rhnsd | grep "LoadState\|UnitFileState" + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open_by_handle_at -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_BUG_ON_DATA_CORRUPTION /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Run the following command to determine if the bind package is installed: +$ rpm -q bind + Is it the case that the package is installed? + + + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow" with the following command: -If the service is masked the command will return the following outputs: +$ sudo auditctl -l | grep -E '(/etc/gshadow)' -LoadState=masked +-w /etc/gshadow -p wa -k identity -UnitFileState=masked - Is it the case that the "rhnsd" is loaded and not masked? +If the command does not return a line, or the line is commented out, this is a finding. + Is it the case that the system is not configured to audit account changes? - + -Run the following command to determine if the selinuxuser_postgresql_connect_enabled SELinux boolean is disabled: -$ getsebool selinuxuser_postgresql_connect_enabled +Run the following command to determine if the smartmon_3ware SELinux boolean is disabled: +$ getsebool smartmon_3ware If properly configured, the output should show the following: -selinuxuser_postgresql_connect_enabled --> off - Is it the case that selinuxuser_postgresql_connect_enabled is not disabled? +smartmon_3ware --> off + Is it the case that smartmon_3ware is not disabled? - - To determine how the SSH daemon's X11UseLocalhost option is set, run the following command: - -$ sudo grep -i X11UseLocalhost /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - Is it the case that the display proxy is listening on wildcard address? + + Run the following command to determine if the net-snmp package is installed: +$ rpm -q net-snmp + Is it the case that the package is installed? - - The file /etc/at.deny should not exist. -This can be checked by running the following - -stat /etc/at.deny - -and the output should be - -stat: cannot stat `/etc/at.deny': No such file or directory - - Is it the case that the file /etc/at.deny exists? + + +Run the following command to determine if the cron_userdomain_transition SELinux boolean is enabled: +$ getsebool cron_userdomain_transition +If properly configured, the output should show the following: +cron_userdomain_transition --> on + Is it the case that cron_userdomain_transition is not enabled? - - To check that the smb service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled smb -Output should indicate the smb service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled smb disabled - -Run the following command to verify smb is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active smb - -If the service is not running the command will return the following output: -inactive + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_PAGE_POISONING_NO_SANITY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify the noexec option is configured for the /var/log/audit mount point, + run the following command: + $ sudo mount | grep '\s/var/log/audit\s' + . . . /var/log/audit . . . noexec . . . -The service will also be masked, to check that the smb is masked, run the following command: -$ sudo systemctl show smb | grep "LoadState\|UnitFileState" + Is it the case that the "/var/log/audit" file system does not have the "noexec" option set? + + + + Make sure that the kernel is not disabling SMEP with the following +commands. +grep -q nosmep /boot/config-`uname -r` +If the command returns a line, it means that SMEP is being disabled. + Is it the case that the kernel is configured to disable SMEP? + + + + Verify that yum verifies the signature of packages from a repository prior to install with the following command: -If the service is masked the command will return the following outputs: +$ grep gpgcheck /etc/yum.conf -LoadState=masked +gpgcheck=1 -UnitFileState=masked - Is it the case that the "smb" is loaded and not masked? +If "gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. + Is it the case that there is no process to validate certificates that is approved by the organization? - - To ensure that users cannot change how long until the screensaver locks, run the following: -$ grep lock-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled - Is it the case that screensaver locking is not locked? + + Verify the audit tools are protected from unauthorized access, deletion, or modification by checking the permissive mode. + +Check the octal permission of each audit tool by running the following command: + +$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules + Is it the case that any of these files have more permissive permissions than 0755? - - Run the following command to see if there are some keytabs -that would potentially allow the use of Kerberos by system daemons. -$ ls -la /etc/*.keytab -The expected result is -ls: cannot access '/etc/*.keytab': No such file or directory - Is it the case that a keytab file is present on the system? + + The ypbind package can be removed with the following command: $ sudo yum erase ypbind + Is it the case that ? - - The runtime status of the net.ipv6.conf.all.forwarding kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.forwarding -0. -The ability to forward packets is only appropriate for routers. - Is it the case that IP forwarding value is "1" and the system is not router? + + To verify the system is not configured to use a boot loader on removable media, +check that the grub configuration file has the set root command in each menu +entry with the following commands: +$ sudo grep -cw menuentry /boot/efi/EFI/redhat/grub.cfg +Note that the -c option for the grep command will print +only the count of menuentry occurrences. This number should match +the number of occurrences reported by the following command: +$ sudo grep "set root='hd0" /boot/efi/EFI/redhat/grub.cfg +The output should return something similar to: +set root='hd0,msdos1' +usb0, cd, fd0, etc. are some examples of removeable +media which should not exist in the lines: +set root='hd0,msdos1' + Is it the case that it is not? - - To check the ownership of /etc/gshadow-, + + To check the ownership of /etc/ssh/*_key, run the command: -$ ls -lL /etc/gshadow- +$ ls -lL /etc/ssh/*_key If properly configured, the output should indicate the following owner: root - Is it the case that /etc/gshadow- does not have an owner of root? + Is it the case that /etc/ssh/*_key does not have an owner of root? - - Inspect the file /etc/sysconfig/iptables to determine -the default policy for the INPUT chain. It should be set to DROP: -$ sudo grep ":INPUT" /etc/sysconfig/iptables - Is it the case that the default policy for the INPUT chain is not set to DROP? + + Make sure that the kernel is not disabling SMAP with the following +commands. +grep -q nosmap /boot/config-`uname -r` +If the command returns a line, it means that SMAP is being disabled. + Is it the case that the kernel is configured to disable SMAP? @@ -381527,168 +381909,139 @@ UnitFileState=masked Is it the case that the "kdump" is loaded and not masked? - + - -Run the following command to determine the current status of the -ntp service: -$ sudo systemctl is-active ntp -If the service is running, it should return the following: active - Is it the case that ? - - - - To verify all files and directories in interactive user home directory are -group-owned by a group the user is a member of, run the -following command: -$ sudo ls -lLR /home/USER - Is it the case that the group ownership is incorrect? - - - - To check the group ownership of /etc/ssh/*_key, -run the command: -$ ls -lL /etc/ssh/*_key -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/*_key does not have a group owner of root? +Run the following command to determine if the httpd_builtin_scripting SELinux boolean is disabled: +$ getsebool httpd_builtin_scripting +If properly configured, the output should show the following: +httpd_builtin_scripting --> off + Is it the case that httpd_builtin_scripting is not disabled? - + -Run the following command to determine if the daemons_use_tcp_wrapper SELinux boolean is disabled: -$ getsebool daemons_use_tcp_wrapper +Run the following command to determine if the httpd_can_connect_ftp SELinux boolean is disabled: +$ getsebool httpd_can_connect_ftp If properly configured, the output should show the following: -daemons_use_tcp_wrapper --> off - Is it the case that daemons_use_tcp_wrapper is not disabled? +httpd_can_connect_ftp --> off + Is it the case that httpd_can_connect_ftp is not disabled? - - To check that the zebra service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled zebra -Output should indicate the zebra service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled zebra disabled - -Run the following command to verify zebra is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active zebra - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the zebra is masked, run the following command: -$ sudo systemctl show zebra | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "newgrp" command with the following command: -LoadState=masked +$ sudo auditctl -l | grep newgrp -UnitFileState=masked - Is it the case that the "zebra" is loaded and not masked? +-a always,exit -F path=/usr/bin/newgrp -F perm=x -F auid>=1000 -F auid!=unset -k privileged-newgrp + Is it the case that the command does not return a line, or the line is commented out? - - Verify that a separate file system/partition has been created for /var/log with the following command: - -$ mountpoint /var/log - - Is it the case that "/var/log is not a mountpoint" is returned? + + To check the ownership of /etc/cron.d, +run the command: +$ ls -lL /etc/cron.d +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/cron.d does not have an owner of root? - - If the system does not have SELinux enabled and enforcing a targeted policy, or if the -pam_faillock.so module is not configured for use, this requirement is not applicable. - -Verify the location of the non-default tally directory for the pam_faillock.so module with -the following command: - -$ sudo grep -w dir /etc/security/faillock.conf - -dir = /var/log/faillock - -Check the security context type of the non-default tally directory with the following command: - -$ sudo ls -Zd /var/log/faillock - -unconfined_u:object_r:faillog_t:s0 /var/log/faillock - Is it the case that the security context type of the non-default tally directory is not "faillog_t"? + + +Run the following command to determine if the authlogin_nsswitch_use_ldap SELinux boolean is disabled: +$ getsebool authlogin_nsswitch_use_ldap +If properly configured, the output should show the following: +authlogin_nsswitch_use_ldap --> off + Is it the case that authlogin_nsswitch_use_ldap is not disabled? - - The runtime status of the net.ipv4.conf.default.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.accept_source_route -0. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the prosody_bind_http_port SELinux boolean is disabled: +$ getsebool prosody_bind_http_port +If properly configured, the output should show the following: +prosody_bind_http_port --> off + Is it the case that prosody_bind_http_port is not disabled? - + -Run the following command to determine if the git_session_bind_all_unreserved_ports SELinux boolean is disabled: -$ getsebool git_session_bind_all_unreserved_ports +Run the following command to determine if the cluster_manage_all_files SELinux boolean is disabled: +$ getsebool cluster_manage_all_files If properly configured, the output should show the following: -git_session_bind_all_unreserved_ports --> off - Is it the case that git_session_bind_all_unreserved_ports is not disabled? +cluster_manage_all_files --> off + Is it the case that cluster_manage_all_files is not disabled? - - To check the ownership of /etc/issue, + + Verify the value of the "difok" option in "/etc/security/pwquality.conf" with the following command: + +$ sudo grep difok /etc/security/pwquality.conf + +difok = + Is it the case that the value of "difok" is set to less than "<sub idref="var_password_pam_difok" />", or is commented out? + + + + To check the ownership of /etc/cron.weekly, run the command: -$ ls -lL /etc/issue +$ ls -lL /etc/cron.weekly If properly configured, the output should indicate the following owner: root - Is it the case that /etc/issue does not have an owner of root? - - - - Run the following command to determine if the talk-server package is installed: -$ rpm -q talk-server - Is it the case that the package is installed? + Is it the case that /etc/cron.weekly does not have an owner of root? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_HASH /boot/config.* + $ grep CONFIG_REFCOUNT_FULL /boot/config.* - For each kernel installed, a line with value "" should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Find the list of alias maps used by the Postfix mail server: -$ sudo postconf alias_maps -Query the Postfix alias maps for an alias for the postmaster user: -$ sudo postmap -q postmaster hash:/etc/aliases -The output should return root. - Is it the case that the alias is not set or is not root? + + To ensure that system location tracking is not active, run the following command: +$ gsettings get org.gnome.system.location enabled +$ gsettings get org.gnome.clocks geolocation +If properly configured, the output should be false. +To ensure that users cannot enable system location tracking, run the following: +$ grep location /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/system/location/enabled and /org/gnome/clocks/geolocation. + Is it the case that geolocation is enabled and not disabled? - - Verify Red Hat Enterprise Linux 8 disables the chrony daemon from acting as a server with the following command: -$ grep -w port /etc/chrony.conf -port 0 - Is it the case that the "port" option is not set to "0", is commented out, or is missing? + + Verify that temporary accounts have been provisioned with an expiration date +of 72 hours. For every temporary account, run the following command to +obtain its account aging and expiration information: +$ sudo chage -l temporary_account_name +Verify each of these accounts has an expiration date set within 72 hours or +as documented. + Is it the case that any temporary accounts have no expiration date set or do not expire within 72 hours? - + + Run the following command to determine if the nss-tools package is installed: $ rpm -q nss-tools + Is it the case that the package is not installed? + + + -Run the following command to determine if the abrt_handle_event SELinux boolean is disabled: -$ getsebool abrt_handle_event +Run the following command to determine if the ssh_keysign SELinux boolean is disabled: +$ getsebool ssh_keysign If properly configured, the output should show the following: -abrt_handle_event --> off - Is it the case that abrt_handle_event is not disabled? +ssh_keysign --> off + Is it the case that ssh_keysign is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_RANDOMIZE_MEMORY /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/gshadow, +run the command: +$ ls -l /etc/gshadow +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/gshadow does not have unix mode ----------? @@ -381711,388 +382064,468 @@ The output has to be exactly as follows: Is it the case that the file does not exist or the content differs? - - To determine if the system is configured to audit calls to the -settimeofday system call, run the following command: -$ sudo grep "settimeofday" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To check that the snmpd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled snmpd +Output should indicate the snmpd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled snmpd disabled - Is it the case that no line is returned? - - - - Verify it by running the following command: -$ stat -c "%n %a" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/audispd /sbin/augenrules +Run the following command to verify snmpd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active snmpd -/sbin/auditctl 755 -/sbin/aureport 755 -/sbin/ausearch 755 -/sbin/autrace 755 -/sbin/auditd 755 -/sbin/audispd 755 -/sbin/augenrules 755 +If the service is not running the command will return the following output: +inactive +The service will also be masked, to check that the snmpd is masked, run the following command: +$ sudo systemctl show snmpd | grep "LoadState\|UnitFileState" -If the command does not return all the above lines, the missing ones -need to be added. +If the service is masked the command will return the following outputs: -Run the following command to correct the permissions of the missing -entries: -$ sudo chmod 0755 [audit_tool] +LoadState=masked -Replace "[audit_tool]" with the audit tool that does not have the -correct permissions. - Is it the case that ? - - - - Run the following command to determine if the telnet-server package is installed: -$ rpm -q telnet-server - Is it the case that the package is installed? - - - - Run the following command to determine if the openldap-clients package is installed: -$ rpm -q openldap-clients - Is it the case that the package is installed? +UnitFileState=masked + Is it the case that the "snmpd" is loaded and not masked? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECURITY_WRITABLE_HOOKS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To obtain a listing of all users, their UIDs, and their shells, run the command: +$ awk -F: '{print $1 ":" $3 ":" $7}' /etc/passwd +Identify the system accounts from this listing. These will primarily be the accounts with UID +numbers less than 1000, other than root. + Is it the case that any system account other than root has a login shell? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-3-access-success.rules -The output has to be exactly as follows: -## Successful file access (any other opens) This has to go last. -## These next two are likely to result in a whole lot of events --a always,exit -F arch=b32 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access --a always,exit -F arch=b64 -S open,openat,openat2,open_by_handle_at -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-access - Is it the case that the file does not exist or the content differs? + + To determine if the users are allowed to run commands as root, run the following commands: +$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*[^\(\s]' /etc/sudoers /etc/sudoers.d/ +and +$ sudo grep -PR '^\s*((?!root\b)[\w]+)\s*(\w+)\s*=\s*(.*,)?\s*\([\w\s]*\b(root|ALL)\b[\w\s]*\)' /etc/sudoers /etc/sudoers.d/ +Both commands should return no output. + Is it the case that /etc/sudoers file contains rules that allow non-root users to run commands as root? - - To determine how the SSH daemon's X11Forwarding option is set, run the following command: - -$ sudo grep -i X11Forwarding /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? + + +Run the following command to determine if the cron_can_relabel SELinux boolean is disabled: +$ getsebool cron_can_relabel +If properly configured, the output should show the following: +cron_can_relabel --> off + Is it the case that cron_can_relabel is not disabled? - - Verify the pam_faillock.so module is present in the "/etc/pam.d/password-auth" file: + + Only strong KEX algorithms should be used. To verify that only strong +KexAlgorithms are in use, run the following command: +$ sudo grep -i kexalgorithms /etc/ssh/sshd_config +The output should contain only those KexAlgorithms which are strong, namely, -$ sudo grep pam_faillock.so /etc/pam.d/password-auth - -auth required pam_faillock.so preauth -auth required pam_faillock.so authfail -account required pam_faillock.so - Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/password-auth" file with the "preauth" line listed before pam_unix.so? + Is it the case that KexAlgorithms option is commented out or not using strong hash algorithms? - - Run the following command and verify that time sources are only configured with server directive: -# grep -E "^(server|pool)" /etc/chrony.conf -A line with the appropriate server should be returned, any line returned starting with pool is a finding. - Is it the case that an authoritative remote time server is not configured or configured with pool directive? + + To check the permissions of /etc/gshadow-, +run the command: +$ ls -l /etc/gshadow- +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/gshadow- does not have unix mode ----------? - + -Run the following command to determine if the sge_use_nfs SELinux boolean is disabled: -$ getsebool sge_use_nfs +Run the following command to determine if the git_cgi_enable_homedirs SELinux boolean is disabled: +$ getsebool git_cgi_enable_homedirs If properly configured, the output should show the following: -sge_use_nfs --> off - Is it the case that sge_use_nfs is not disabled? +git_cgi_enable_homedirs --> off + Is it the case that git_cgi_enable_homedirs is not disabled? - - To determine if the system is configured to audit successful calls -to the rename system call, run the following command: -$ sudo grep "rename" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pt_chown" command with the following command: - Is it the case that no line is returned? +$ sudo auditctl -l | grep pt_chown + +-a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pt_chown + Is it the case that the command does not return a line, or the line is commented out? - - To check that the quota_nld service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled quota_nld -Output should indicate the quota_nld service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled quota_nld disabled + + Verify Red Hat Enterprise Linux 8 takes action when allocated audit record storage volume reaches 95 percent of the repository maximum audit record storage capacity with the following command: -Run the following command to verify quota_nld is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active quota_nld +$ sudo grep -w admin_space_left /etc/audit/auditd.conf -If the service is not running the command will return the following output: -inactive +admin_space_left = % -The service will also be masked, to check that the quota_nld is masked, run the following command: -$ sudo systemctl show quota_nld | grep "LoadState\|UnitFileState" +If the value of the "admin_space_left" keyword is not set to % of the storage volume allocated to audit logs, or if the line is commented out, ask the System Administrator to indicate how the system is taking action if the allocated storage is about to reach capacity. + Is it the case that the "admin_space_left" value is not configured to the correct value? + + + + To verify that McAfee VirusScan Enterprise for Linux is installed +and running, run the following command(s): +$ sudo systemctl status nails +$ rpm -q McAfeeVSEForLinux + Is it the case that virus scanning software is not installed or running? + + + + Verify the audit log directories have a correct mode or less permissive mode. -If the service is masked the command will return the following outputs: +Find the location of the audit logs: -LoadState=masked +$ sudo grep "^log_file" /etc/audit/auditd.conf -UnitFileState=masked - Is it the case that the "quota_nld" is loaded and not masked? - - - - To determine how the SSH daemon's PrintLastLog option is set, run the following command: -$ sudo grep -i PrintLastLog /etc/ssh/sshd_config -If a line indicating yes is returned, then the required value is set. +Run the following command to check the mode of the system audit logs: - Is it the case that the required value is not set? - - - - To verify all accounts have unique names, run the following command: -$ sudo getent passwd | awk -F: '{ print $1}' | uniq -d -No output should be returned. - Is it the case that a line is returned? +$ sudo stat -c "%a %n" [audit_log_directory] + +Replace "[audit_log_directory]" to the correct audit log directory path, by default this location is "/var/log/audit". + + +The correct permissions are 0700 + Is it the case that audit logs have a more permissive mode? - + -Run the following command to determine if the ftpd_connect_db SELinux boolean is disabled: -$ getsebool ftpd_connect_db +Run the following command to determine if the gitosis_can_sendmail SELinux boolean is disabled: +$ getsebool gitosis_can_sendmail If properly configured, the output should show the following: -ftpd_connect_db --> off - Is it the case that ftpd_connect_db is not disabled? +gitosis_can_sendmail --> off + Is it the case that gitosis_can_sendmail is not disabled? - - To verify that SSSD is configured for PAM services, run the following command: -$ sudo grep services /etc/sssd/sssd.conf -If configured properly, output should be similar to -services = pam - Is it the case that it does not exist or 'pam' is not added to the 'services' option under the 'sssd' section? + + To verify that USB hubs will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +One of the output lines should be +allow with-interface match-all { 09:00:* } + Is it the case that USB devices of class 9 are not authorized? - - To determine if the system is configured to audit unsuccessful calls -to the fremovexattr system call, run the following command: -$ sudo grep "fremovexattr" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that the Dracut FIPS module is enabled, run the following command: +grep "add_dracutmodules" /etc/dracut.conf.d/40-fips.conf +The output should look like this: +add_dracutmodules+=" fips " + Is it the case that the Dracut FIPS module is not enabled? + + + + The runtime status of the net.ipv4.conf.all.send_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.send_redirects +0. + + Is it the case that the correct value is not returned? + + + + +Run the following command to determine if the virt_use_usb SELinux boolean is disabled: +$ getsebool virt_use_usb +If properly configured, the output should show the following: +virt_use_usb --> off + Is it the case that virt_use_usb is not disabled? + + + + +If the system is configured to prevent the loading of the firewire-core kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. + +These lines can also instruct the module loading system to ignore the firewire-core kernel module via blacklist keyword. +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r firewire-core /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - Verify users are provided with feedback on when account accesses last occurred with the following command: + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLAB_FREELIST_HARDENED /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "postdrop" command with the following command: -$ sudo grep pam_lastlog /etc/pam.d/postlogin +$ sudo auditctl -l | grep postdrop -session [default=1] pam_lastlog.so showfailed - Is it the case that "pam_lastlog.so" is not properly configured in "/etc/pam.d/postlogin" file? +-a always,exit -F path=/usr/bin/postdrop -F perm=x -F auid>=1000 -F auid!=unset -k privileged-postdrop + Is it the case that the command does not return a line, or the line is commented out? - - Inspect /etc/audit/audisp-remote.conf and locate the following line to -determine if the system is configured to either send to syslog, switch to single user mode, -or halt when the disk is full: -$ sudo grep -i disk_full_action /etc/audit/audisp-remote.conf -The output should return something similar to: -disk_full_action = single -Acceptable values also include syslog and halt. - Is it the case that the system is not configured to switch to single user mode for corrective action? + + +Run the following command to determine if the xserver_clients_write_xshm SELinux boolean is disabled: +$ getsebool xserver_clients_write_xshm +If properly configured, the output should show the following: +xserver_clients_write_xshm --> off + Is it the case that xserver_clients_write_xshm is not disabled? - - Run the following command to determine if the cronie-anacron package is installed: -$ rpm -q cronie-anacron - Is it the case that the package is installed? + + To verify that FIPS mode is enabled properly, run the following command: +fips-mode-setup --check +The output should contain the following: +FIPS mode is enabled. +To verify that the cryptographic policy has been configured correctly, run the +following command: +$ update-crypto-policies --show +The output should return . + Is it the case that FIPS mode is not enabled? - + -Run the following command to determine if the cron_system_cronjob_use_shares SELinux boolean is disabled: -$ getsebool cron_system_cronjob_use_shares +Run the following command to determine if the xdm_write_home SELinux boolean is disabled: +$ getsebool xdm_write_home If properly configured, the output should show the following: -cron_system_cronjob_use_shares --> off - Is it the case that cron_system_cronjob_use_shares is not disabled? +xdm_write_home --> off + Is it the case that xdm_write_home is not disabled? - + -Run the following command to determine if the selinuxuser_rw_noexattrfile SELinux boolean is disabled: -$ getsebool selinuxuser_rw_noexattrfile +Run the following command to determine if the nis_enabled SELinux boolean is disabled: +$ getsebool nis_enabled If properly configured, the output should show the following: -selinuxuser_rw_noexattrfile --> off - Is it the case that selinuxuser_rw_noexattrfile is not disabled? +nis_enabled --> off + Is it the case that nis_enabled is not disabled? - - Inspect /proc/cmdline for any instances of selinux=0 -in the kernel boot arguments. Presence of selinux=0 indicates -that SELinux is disabled at boot time. - -If it would be disabled anywhere, make sure to enable it via a -MachineConfig object. - Is it the case that SELinux is disabled at boot time? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLUB_DEBUG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + + Run the following command to determine if the libpwquality package is installed: +$ rpm -q libpwquality + Is it the case that the package is not installed? + + + -Run the following command to determine if the xguest_exec_content SELinux boolean is disabled: -$ getsebool xguest_exec_content +Run the following command to determine if the condor_tcp_network_connect SELinux boolean is disabled: +$ getsebool condor_tcp_network_connect If properly configured, the output should show the following: -xguest_exec_content --> off - Is it the case that xguest_exec_content is not disabled? +condor_tcp_network_connect --> off + Is it the case that condor_tcp_network_connect is not disabled? - - To determine if the system is configured to audit successful calls -to the fchownat system call, run the following command: -$ sudo grep "fchownat" /etc/audit.* + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - + + To determine if the system is configured to audit changes to its SELinux +configuration files, run the following command: +$ sudo auditctl -l | grep "dir=/etc/selinux" +If the system is configured to watch for changes to its SELinux +configuration, a line should be returned (including +perm=wa indicating permissions that are watched). + Is it the case that the system is not configured to audit attempts to change the MAC policy? + + + + To ensure disable and restart on the login screen are disabled, run the following command: +$ grep disable-restart-buttons /etc/dconf/db/gdm.d/* +The output should be true. +To ensure that users cannot enable disable and restart on the login screen, run the following: +$ grep disable-restart-buttons /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/disable-restart-buttons + Is it the case that disable-restart-buttons has not been configured or is not disabled? + + + -Run the following command to determine if the openvpn_run_unconfined SELinux boolean is disabled: -$ getsebool openvpn_run_unconfined +Run the following command to determine if the login_console_enabled SELinux boolean is enabled: +$ getsebool login_console_enabled If properly configured, the output should show the following: -openvpn_run_unconfined --> off - Is it the case that openvpn_run_unconfined is not disabled? +login_console_enabled --> on + Is it the case that login_console_enabled is not enabled? - + + To check if UsePrivilegeSeparation is enabled or set correctly, run the +following command: +$ sudo grep UsePrivilegeSeparation /etc/ssh/sshd_config +If configured properly, output should be . + Is it the case that it is commented out or is not enabled? + + + -To check that the telnet service is disabled in system boot configuration with xinetd, run the following command: -$ chkconfig telnet --list -Output should indicate the telnet service has either not been installed, or has been disabled, as shown in the example below: -$ chkconfig telnet --list +Run the following command to determine if the cluster_can_network_connect SELinux boolean is disabled: +$ getsebool cluster_can_network_connect +If properly configured, the output should show the following: +cluster_can_network_connect --> off + Is it the case that cluster_can_network_connect is not disabled? + + + + Verify the Red Hat Enterprise Linux 8 "fapolicyd" employs a deny-all, permit-by-exception policy. -Note: This output shows SysV services only and does not include native -systemd services. SysV configuration data might be overridden by native -systemd configuration. +Check that "fapolicyd" is in enforcement mode with the following command: -If you want to list systemd services use 'systemctl list-unit-files'. -To see services enabled on particular target use -'systemctl list-dependencies [target]'. +$ sudo grep permissive /etc/fapolicyd/fapolicyd.conf -telnet off +permissive = 0 -To check that the telnet socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled telnet -Output should indicate the telnet socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled telnetdisabled +Check that fapolicyd employs a deny-all policy on system mounts with the following commands: -Run the following command to verify telnet is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active telnet +For RHEL 8.5 systems and older: +$ sudo tail /etc/fapolicyd/fapolicyd.rules -If the socket is not running the command will return the following output: -inactive +For RHEL 8.6 systems and newer: +$ sudo tail /etc/fapolicyd/compiled.rules -The socket will also be masked, to check that the telnet is masked, run the following command: -$ sudo systemctl show telnet | grep "LoadState\|UnitFileState" +allow exe=/usr/bin/python3.7 : ftype=text/x-python +deny_audit perm=any pattern=ld_so : all +deny perm=any all : all + Is it the case that fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception policy? + + + + Ensure that Red Hat Enterprise Linux 8 verifies correct operation of security functions. -If the socket is masked the command will return the following outputs: +Check if "SELinux" is active and in "" mode with the following command: -LoadState=masked +$ sudo getenforce -UnitFileState=masked - Is it the case that service and/or socket are running? + Is it the case that SELINUX is not set to enforcing? - - To determine if the system is configured to make login UIDs immutable, run -one of the following commands. -If the auditd daemon is configured to use the -augenrules program to read audit rules during daemon startup (the -default), run the following: -sudo grep immutable /etc/audit/rules.d/*.rules -If the auditd daemon is configured to use the auditctl -utility to read audit rules during daemon startup, run the following command: -sudo grep immutable /etc/audit/audit.rules -The following line should be returned: ---loginuid-immutable - Is it the case that the system is not configured to make login UIDs immutable? + + Verify Red Hat Enterprise Linux 8 enforces 24 hours/1 day as the minimum password lifetime for new user accounts. + +Check for the value of "PASS_MIN_DAYS" in "/etc/login.defs" with the following command: + +$ grep -i pass_min_days /etc/login.defs + +PASS_MIN_DAYS + Is it the case that the "PASS_MIN_DAYS" parameter value is not "<sub idref="var_accounts_minimum_age_login_defs" />" or greater, or is commented out? - - To determine that periodic AIDE execution has been scheduled, run the following command: - -$ grep aide /etc/crontab -The output should return something similar to the following: -05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost -The email address that the notifications are sent to can be changed by overriding -. - Is it the case that AIDE has not been configured or has not been configured to notify personnel of scan details? + + +Run the following command to determine if the unconfined_mozilla_plugin_transition SELinux boolean is enabled: +$ getsebool unconfined_mozilla_plugin_transition +If properly configured, the output should show the following: +unconfined_mozilla_plugin_transition --> on + Is it the case that unconfined_mozilla_plugin_transition is not enabled? - - To determine whether OpenSSL is wrapped by a shell function that ensures that every invocation -uses a SP800-90A compliant entropy source, -make sure that the /etc/profile.d/openssl-rand.sh file contents exactly match those -that are included in the rule's description. - Is it the case that there is no <tt>/etc/profile.d/openssl-rand.sh</tt> file, or its contents don't match those in the description? + + To verify if the mod_perl is installed, run the following command: +$ rpm -qa | grep mod_perl +If the mod_perl module is installed, verify that PerlSwitches -T +is enabled in /etc/httpd/conf.d/perl.conf by running the following +command: +$ grep -i "PerlSwitches -T" /etc/httpd/conf.d/perl.conf +The output should return uncommented: +PerlSwitches -T + Is it the case that it is not? - - Verify the nodev option is configured for the /dev/shm mount point, + + Inspect /etc/login.defs and ensure that if eihter +SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS +are set, they must have the minimum value of 5000. + Is it the case that it does not? + + + + Run the following command to determine if the scap-security-guide package is installed: $ rpm -q scap-security-guide + Is it the case that the package is not installed? + + + + To check the group ownership of /etc/group-, +run the command: +$ ls -lL /etc/group- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/group- does not have a group owner of root? + + + + To determine if NOPASSWD has been configured for sudo, run the following command: +$ sudo grep -ri nopasswd /etc/sudoers /etc/sudoers.d/ +The command should return no output. + Is it the case that nopasswd is specified in the sudo config files? + + + + Verify the noexec option is configured for the /home mount point, run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . nodev . . . + $ sudo mount | grep '\s/home\s' + . . . /home . . . noexec . . . - Is it the case that the "/dev/shm" file system does not have the "nodev" option set? + Is it the case that the "/home" file system does not have the "noexec" option set? - - To check that the abrtd service is disabled in system boot configuration, + + To check that the qpidd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled abrtd -Output should indicate the abrtd service has either not been installed, +$ sudo systemctl is-enabled qpidd +Output should indicate the qpidd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled abrtd disabled +$ sudo systemctl is-enabled qpidd disabled -Run the following command to verify abrtd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active abrtd +Run the following command to verify qpidd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active qpidd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the abrtd is masked, run the following command: -$ sudo systemctl show abrtd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the qpidd is masked, run the following command: +$ sudo systemctl show qpidd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "abrtd" is loaded and not masked? + Is it the case that the "qpidd" is loaded and not masked? - - To determine if logfile has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults\s*\blogfile\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that logfile is not enabled in sudo? + + To check the group ownership of /etc/shadow-, +run the command: +$ ls -lL /etc/shadow- +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/shadow- does not have a group owner of root? - - To check for legacy lines in /etc/passwd, run the following command: - grep '^\+' /etc/passwd -The command should not return any output. - Is it the case that the file contains legacy lines? + + To verify the local initialization files of all local interactive users are group- +owned by the appropriate user, inspect the primary group of the respective +users in /etc/passwd and verify all initialization files under the +respective users home directory. Check the group owner of all local interactive users +initialization files. + Is it the case that they are not? @@ -382104,1225 +382537,1557 @@ The output should return the following: Is it the case that is not configured? - - To check that the atd service is disabled in system boot configuration, + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes page_poison=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*page_poison=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*page_poison=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'page_poison=1' +The command should not return any output. + Is it the case that page allocator poisoning is not enabled? + + + + To check that the cpupower service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled atd -Output should indicate the atd service has either not been installed, +$ sudo systemctl is-enabled cpupower +Output should indicate the cpupower service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled atd disabled +$ sudo systemctl is-enabled cpupower disabled -Run the following command to verify atd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active atd +Run the following command to verify cpupower is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active cpupower If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the atd is masked, run the following command: -$ sudo systemctl show atd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the cpupower is masked, run the following command: +$ sudo systemctl show cpupower | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "atd" is loaded and not masked? + Is it the case that the "cpupower" is loaded and not masked? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-1-create-success.rules -The output has to be exactly as follows: -## Successful file creation (open with O_CREAT) --a always,exit -F arch=b32 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S openat,open_by_handle_at -F a2&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S open -F a1&0100 -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b32 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create --a always,exit -F arch=b64 -S creat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-create - Is it the case that the file does not exist or the content differs? + + To determine if the system is configured to audit calls to the +rmdir system call, run the following command: +$ sudo grep "rmdir" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +rename system call, run the following command: +$ sudo grep "rename" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. +To determine if the system is configured to audit calls to the +renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To ensure that users cannot change session idle and lock settings, run the following: -$ grep 'idle-delay' /etc/dconf/db/local.d/locks/* -If properly configured, the output should return: -/org/gnome/desktop/session/idle-delay - Is it the case that idle-delay is not locked? + + +Run the following command to determine if the exim_read_user_files SELinux boolean is disabled: +$ getsebool exim_read_user_files +If properly configured, the output should show the following: +exim_read_user_files --> off + Is it the case that exim_read_user_files is not disabled? - - To ensure the screensaver is configured to be blank, run the following command: -$ gsettings get org.gnome.desktop.screensaver picture-uri -If properly configured, the output should be ''. - -To ensure that users cannot set the screensaver background, run the following: -$ grep picture-uri /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/picture-uri - Is it the case that it is not set or configured properly? + + To verify the sec option is configured for all NFS mounts, run the following command: +$ grep "sec=" /etc/exports +All configured NFS exports should show the sec=krb5:krb5i:krb5p setting in parentheses. +This is not applicable if NFS is not implemented. + Is it the case that the setting is not configured, has the 'sys' option added, or does not have all Kerberos options added? - - -Run the following command to determine if the pppd_can_insmod SELinux boolean is disabled: -$ getsebool pppd_can_insmod -If properly configured, the output should show the following: -pppd_can_insmod --> off - Is it the case that pppd_can_insmod is not disabled? + + The runtime status of the net.ipv6.conf.default.accept_redirects kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_redirects +0. + + Is it the case that the correct value is not returned? - - To determine how the SSH daemon's PermitRootLogin option is set, run the following command: - -$ sudo grep -i PermitRootLogin /etc/ssh/sshd_config + + The runtime status of the net.ipv6.conf.default.accept_ra_defrtr kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_ra_defrtr +0. -If a line indicating prohibit-password is returned, then the required value is set. - Is it the case that it is commented out or not configured properly? + Is it the case that the correct value is not returned? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_FS /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-failed.rules +The output has to be exactly as follows: +## Unsuccessful ownership change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change +-a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-owner-change + Is it the case that the file does not exist or the content differs? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one lower-case character. - -Check the value for "lcredit" with the following command: + + Verify the nodev option is configured for the /tmp mount point, + run the following command: + $ sudo mount | grep '\s/tmp\s' + . . . /tmp . . . nodev . . . -$ sudo grep lcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + Is it the case that the "/tmp" file system does not have the "nodev" option set? + + + + Interview the SA or web administrator to see where the public web server +is logically located in the data center. Review the site network diagram +to see how the web server is connected to the LAN. Visually check the web +server hardware connections to see if it conforms to the site network +diagram. + Is it the case that the web server is not isolated in an accredited DoD DMZ Extension? + + + + Run the following command to determine if the opensc package is installed: $ rpm -q opensc + Is it the case that the package is not installed? + + + + To determine if the system is configured to audit successful calls +to the open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -/etc/security/pwquality.conf:lcredit = -1 - Is it the case that the value of "lcredit" is a positive number or is commented out? + Is it the case that no line is returned? - + -Run the following command to determine if the ssh_keysign SELinux boolean is disabled: -$ getsebool ssh_keysign +Run the following command to determine if the mcelog_server SELinux boolean is disabled: +$ getsebool mcelog_server If properly configured, the output should show the following: -ssh_keysign --> off - Is it the case that ssh_keysign is not disabled? +mcelog_server --> off + Is it the case that mcelog_server is not disabled? - - To verify the 389-ds-base package is not installed, run the -following command: -$ rpm -q 389-ds-base -The output should show the following: -package 389-ds-base is not installed - Is it the case that the package is installed? + + Run the following command to see if there are some keytabs +that would potentially allow the use of Kerberos by system daemons. +$ ls -la /etc/*.keytab +The expected result is +ls: cannot access '/etc/*.keytab': No such file or directory + Is it the case that a keytab file is present on the system? - - Verify the assigned home directories of all interactive users on the system exist with the following command: + + Make sure that the kernel is configured to trust the CPU RNG by following +commands. To check if the option was correctly configured at kernel compile +time, run the following command: +grep -q CONFIG_RANDOM_TRUST_CPU=y /boot/config-`uname -r` +If the command outputs: +CONFIG_RANDOM_TRUST_CPU=y, +it means that the option is compiled into the kernel. Make sure that the +option is not overridden through a boot parameter: +sudo grep 'kernelopts.*random\.trust_cpu=off.*' /boot/grub2/grubenv +The command should not return any output. If the option is not compiled into +the kernel, check that the option is configured through boot parameter. +Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes random.trust_cpu=on, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*random.trust_cpu=on.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*random.trust_cpu=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'random.trust_cpu=on' +The command should not return any output. + Is it the case that the kernel is not configured to trust the CPU RNG? + + + + Verify Red Hat Enterprise Linux 8 initiates a session lock after 15 minutes of inactivity. -$ sudo pwck -r +Check the value of the system inactivity timeout with the following command: -user 'mailnull': directory 'var/spool/mqueue' does not exist +$ grep -i lock-after-time /etc/tmux.conf -The output should not return any interactive users. - Is it the case that users home directory does not exist? +set -g lock-after-time 900 + +Then, verify that the /etc/tmux.conf file can be read by other users than root: + +$ sudo ls -al /etc/tmux.conf + Is it the case that "lock-after-time" is not set to "900" or less in the global tmux configuration file to enforce session lock after inactivity? - - The file permissions for all log files written by rsyslog should -be set to 640, or more restrictive. These log files are determined by the -second part of each Rule line in /etc/rsyslog.conf and typically -all appear in /var/log. To see the permissions of a given log -file, run the following command: -$ ls -l LOGFILE -The permissions should be 640, or more restrictive. - Is it the case that the permissions are not correct? + + To ensure that remote access requires credentials, run the following command: +$ gsettings get org.gnome.Vino authentication-methods +If properly configured, the output should be false. +To ensure that users cannot disable credentials for remote access, run the following: +$ grep authentication-methods /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/Vino/authentication-methods + Is it the case that wireless network notification is enabled and not disabled? - - The runtime status of the kernel.dmesg_restrict kernel parameter can be queried + + +Run the following command to determine if the logging_syslogd_use_tty SELinux boolean is enabled: +$ getsebool logging_syslogd_use_tty +If properly configured, the output should show the following: +logging_syslogd_use_tty --> on + Is it the case that logging_syslogd_use_tty is not enabled? + + + + The runtime status of the net.ipv6.conf.all.accept_ra_pinfo kernel parameter can be queried by running the following command: -$ sysctl kernel.dmesg_restrict -1. +$ sysctl net.ipv6.conf.all.accept_ra_pinfo +0. Is it the case that the correct value is not returned? - - Find if logging is applied to the FTP daemon. + + To determine if the system is configured to audit successful calls +to the fchown system call, run the following command: +$ sudo grep "fchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -Procedures: + Is it the case that no line is returned? + + + + +If the system is configured to prevent the loading of the tipc kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -If vsftpd is started by xinetd the following command will indicate the xinetd.d startup file: -$ grep vsftpd /etc/xinetd.d/* -$ grep server_args vsftpd xinetd.d startup file -This will indicate the vsftpd config file used when starting through xinetd. -If the server_args line is missing or does not include the vsftpd configuration file, then the default config file (/etc/vsftpd/vsftpd.conf) is used. -$ sudo grep xferlog_enable vsftpd config file - Is it the case that xferlog_enable is missing, or is not set to yes? +These lines can also instruct the module loading system to ignore the tipc kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r tipc /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - - Verify that the files and directories of each instance of Alias, -ScriptAlias, and ScriptAliasMatch that exist -have the correct file and directory permissions applied. - Is it the case that it is not? + + +Run the following command to determine if the tmpreaper_use_nfs SELinux boolean is disabled: +$ getsebool tmpreaper_use_nfs +If properly configured, the output should show the following: +tmpreaper_use_nfs --> off + Is it the case that tmpreaper_use_nfs is not disabled? - - To check that the rpcsvcgssd service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled rpcsvcgssd -Output should indicate the rpcsvcgssd service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled rpcsvcgssd disabled + + Run the following command to determine if the sssd-ipa package is installed: $ rpm -q sssd-ipa + Is it the case that the package is not installed? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_KEXEC /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? + + + + Verify that rules for unsuccessful calls of the open syscall are in the order shown below. -Run the following command to verify rpcsvcgssd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active rpcsvcgssd + If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". + If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. -If the service is not running the command will return the following output: -inactive + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access -The service will also be masked, to check that the rpcsvcgssd is masked, run the following command: -$ sudo systemctl show rpcsvcgssd | grep "LoadState\|UnitFileState" + If the system is 64 bit then also add the following lines: -If the service is masked the command will return the following outputs: + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification + -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access + Is it the case that the rules are in a different order? + + + + The runtime status of the net.ipv6.conf.all.router_solicitations kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.router_solicitations +0. -LoadState=masked + Is it the case that the correct value is not returned? + + + + Verify the system-wide shared library directories are owned by "root" with the following command: -UnitFileState=masked - Is it the case that the "rpcsvcgssd" is loaded and not masked? +$ sudo find /lib /lib64 /usr/lib /usr/lib64 ! -user root -type d -exec stat -c "%n %U" '{}' \; + Is it the case that any system-wide shared library directory is not owned by root? - + + To determine if the system is configured to audit calls to the +fchmod system call, run the following command: +$ sudo grep "fchmod" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + -Run the following command to determine if the xen_use_nfs SELinux boolean is disabled: -$ getsebool xen_use_nfs +Run the following command to determine if the httpd_enable_homedirs SELinux boolean is disabled: +$ getsebool httpd_enable_homedirs If properly configured, the output should show the following: -xen_use_nfs --> off - Is it the case that xen_use_nfs is not disabled? +httpd_enable_homedirs --> off + Is it the case that httpd_enable_homedirs is not disabled? - + -Run the following command to determine if the xguest_connect_network SELinux boolean is disabled: -$ getsebool xguest_connect_network +Run the following command to determine if the selinuxuser_direct_dri_enabled SELinux boolean is disabled: +$ getsebool selinuxuser_direct_dri_enabled If properly configured, the output should show the following: -xguest_connect_network --> off - Is it the case that xguest_connect_network is not disabled? +selinuxuser_direct_dri_enabled --> off + Is it the case that selinuxuser_direct_dri_enabled is not disabled? - - To ensure that XDMCP is disabled in /etc/gdm/custom.conf, run the following command: -grep -Pzo "\[xdmcp\]\nEnable=false" /etc/gdm/custom.conf -The output should return the following: + + To check which SSH protocol version is allowed, check version of openssh-server with following command: -[xdmcp] -Enable=false +$ rpm -qi openssh-server | grep Version - Is it the case that the Enable is not set to false or is missing in the xdmcp section of the /etc/gdm/custom.conf gdm configuration file? +Versions equal to or higher than 7.4 only allow Protocol 2. +If version is lower than 7.4, run the following command to check configuration: +$ sudo grep Protocol /etc/ssh/sshd_config +If configured properly, output should be Protocol 2 + Is it the case that it is commented out or is not set correctly to Protocol 2? - - Verify that cron is logging to rsyslog, -run the following command: -grep -rni "cron\.\*" /etc/rsyslog.* -cron.* /var/log/cron - Is it the case that cron is not logging to rsyslog? + + To determine if the system is configured to audit successful calls +to the setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To determine how the SSH daemon's IgnoreRhosts option is set, run the following command: + + Verify the system commands contained in the following directories are group-owned by "root", or a required system account, with the following command: -$ sudo grep -i IgnoreRhosts /etc/ssh/sshd_config +$ sudo find -L /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin ! -group root -exec ls -l {} \; + Is it the case that any system commands are returned and is not group-owned by a required system account? + + + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chsh" command with the following command: -If a line indicating yes is returned, then the required value is set. +$ sudo auditctl -l | grep chsh - Is it the case that the required value is not set? +-a always,exit -F path=/usr/bin/chsh -F perm=x -F auid>=1000 -F auid!=unset -k privileged-chsh + Is it the case that the command does not return a line, or the line is commented out? - - Verify that Red Hat Enterprise Linux 8 set the days of warning before a password expires to - or more for users with a -password: + + +Run the following command to determine if the httpd_can_connect_mythtv SELinux boolean is disabled: +$ getsebool httpd_can_connect_mythtv +If properly configured, the output should show the following: +httpd_can_connect_mythtv --> off + Is it the case that httpd_can_connect_mythtv is not disabled? + + + + Run the following command to determine if the logrotate package is installed: $ rpm -q logrotate + Is it the case that the package is not installed? + + + + To determine if the system is configured to audit successful calls +to the lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -$ sudo awk -F: '$6 || $6 == "" {print $1}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? + Is it the case that no line is returned? - + + Verify the grpquota option is configured for the /home mount point, + run the following command: + $ sudo mount | grep '\s/home\s' + . . . /home . . . grpquota . . . + + Is it the case that the "/home" file system does not have the "grpquota" option set? + + + + To ensure the gdm package group is removed, run the following command: +$ rpm -qi gdm +The output should be: +package gdm is not installed + Is it the case that gdm has not been removed? + + + -Run the following command to determine if the samba_export_all_ro SELinux boolean is disabled: -$ getsebool samba_export_all_ro +Run the following command to determine if the httpd_read_user_content SELinux boolean is disabled: +$ getsebool httpd_read_user_content If properly configured, the output should show the following: -samba_export_all_ro --> off - Is it the case that samba_export_all_ro is not disabled? +httpd_read_user_content --> off + Is it the case that httpd_read_user_content is not disabled? - - To check that the screen locks immediately when activated, run the following command: -$ gsettings get org.gnome.desktop.screensaver lock-delay -If properly configured, the output should be 'uint32 '. - Is it the case that the screensaver lock delay is missing, or is set to a value greater than <sub idref="var_screensaver_lock_delay" />? + + The file /etc/cron.allow should exist. +This can be checked by running the following command: + +stat /etc/cron.allow + +and the output should list the file. + Is it the case that the file /etc/cron.allow does not exist? - - -To properly set the owner of /etc/audit/, run the command: -$ sudo chown root /etc/audit/ + + Run the following command to determine if the nginx package is installed: +$ rpm -q nginx + Is it the case that the package is installed? + + + + Verify the operating system routinely checks the baseline configuration for unauthorized changes. -To properly set the owner of /etc/audit/rules.d/, run the command: -$ sudo chown root /etc/audit/rules.d/ - Is it the case that ? +To determine that periodic AIDE execution has been scheduled, run the following command: +$ grep aide /etc/crontab +The output should return something similar to the following: +05 4 * * * root /usr/sbin/aide --check + +NOTE: The usage of special cron times, such as @daily or @weekly, is acceptable. + Is it the case that AIDE is not configured to scan periodically? - - To check the group ownership of /etc/motd, + + To check the group ownership of /etc/issue, run the command: -$ ls -lL /etc/motd +$ ls -lL /etc/issue If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/motd does not have a group owner of root? + Is it the case that /etc/issue does not have a group owner of root? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SCHED_STACK_END_CHECK /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the iptables-services package is installed: $ rpm -q iptables-services + Is it the case that the iptables-services package is installed? - - To check the permissions of /etc/motd, -run the command: -$ ls -l /etc/motd -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/motd does not have unix mode -rw-r--r--? + + +Run the following command to determine if the logging_syslogd_can_sendmail SELinux boolean is disabled: +$ getsebool logging_syslogd_can_sendmail +If properly configured, the output should show the following: +logging_syslogd_can_sendmail --> off + Is it the case that logging_syslogd_can_sendmail is not disabled? - - To ensure the MaxAuthTries parameter is set, run the following command: -$ sudo grep MaxAuthTries /etc/ssh/sshd_config -If properly configured, output should be: -MaxAuthTries - Is it the case that it is commented out or not configured properly? + + To ensure that users cannot change how long until the screensaver locks, run the following: +$ grep lock-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output for lock-enabled should be /org/gnome/desktop/screensaver/lock-enabled + Is it the case that screensaver locking is not locked? - - Run the following command to determine if the avahi-autoipd package is installed: -$ rpm -q avahi-autoipd - Is it the case that the package is installed? + + +Run the following command to determine if the httpd_can_network_relay SELinux boolean is disabled: +$ getsebool httpd_can_network_relay +If properly configured, the output should show the following: +httpd_can_network_relay --> off + Is it the case that httpd_can_network_relay is not disabled? - - Verify that Red Hat Enterprise Linux 8 generates an audit record for all uses of the "umount" and system call. -To determine if the system is configured to audit calls to the -"umount" system call, run the following command: -$ sudo grep "umount" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line like the following. --a always,exit -F arch=b32 -S umount -F auid>=1000 -F auid!=unset -k privileged-umount - Is it the case that the command does not return a line, or the line is commented out? + + To check the screensaver mandatory use status, run the following command: +$ gsettings get org.gnome.desktop.screensaver idle-activation-enabled +If properly configured, the output should be true. +To ensure that users cannot disable the screensaver idle inactivity setting, run the following: +$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* +If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled + Is it the case that idle-activation-enabled is not enabled or configured? - - To check the group ownership of /etc/shadow-, -run the command: -$ ls -lL /etc/shadow- -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shadow- does not have a group owner of root? + + The runtime status of the kernel.perf_event_max_sample_rate kernel parameter can be queried +by running the following command: +$ sysctl kernel.perf_event_max_sample_rate +1. + + Is it the case that the correct value is not returned? - - Run the following command to determine if the tmux package is installed: $ rpm -q tmux - Is it the case that the package is not installed? + + To determine if the system is configured to audit calls to the +settimeofday system call, run the following command: +$ sudo grep "settimeofday" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To check the value of the umask, run the following command: -$ grep umask /etc/init.d/functions -The output should show . - Is it the case that it does not? + + To determine if the system is configured to audit accesses to +/var/log/audit directory, run the following command: +$ sudo grep "dir=/var/log/audit" /etc/audit/audit.rules +If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - Verify that authselect is enabled by running -authselect current -If authselect is enabled on the system, the output should show the ID of the profile which is currently in use. - Is it the case that authselect is not used to manage user authentication setup on the system? + + Verify that a separate file system/partition has been created for /opt with the following command: + +$ mountpoint /opt + + Is it the case that "/opt is not a mountpoint" is returned? - - Verify the umask setting is configured correctly in the /etc/profile file -or scripts within /etc/profile.d directory with the following command: -$ grep "umask" /etc/profile* -umask - Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", -or the "umask" parameter is missing or is commented out? + + +Run the following command to determine if the postgresql_selinux_users_ddl SELinux boolean is enabled: +$ getsebool postgresql_selinux_users_ddl +If properly configured, the output should show the following: +postgresql_selinux_users_ddl --> on + Is it the case that postgresql_selinux_users_ddl is not enabled? + + + + Verify that sshd isn't configured to ignore the system wide cryptographic policy. + +Check that the CRYPTO_POLICY variable is not set or is commented out in the +/etc/sysconfig/sshd. + +Run the following command: + +$ sudo grep CRYPTO_POLICY /etc/sysconfig/sshd + Is it the case that the CRYPTO_POLICY variable is set or is not commented out in the /etc/sysconfig/sshd? + + + + +Run the following command to determine if the xend_run_blktap SELinux boolean is enabled: +$ getsebool xend_run_blktap +If properly configured, the output should show the following: +xend_run_blktap --> on + Is it the case that xend_run_blktap is not enabled? - - To determine whether sudo command includes configuration files from the appropriate directory, -run the following command: -$ sudo grep -rP '^[#@]include(dir)?' /etc/sudoers /etc/sudoers.d -If only the line /etc/sudoers:#includedir /etc/sudoers.d is returned, then the drop-in include configuration is set correctly. -Any other line returned is a finding. - Is it the case that the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?? + + To ensure the default password is not set, run the following command: +$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep -E 'public|private' +There should be no output. + Is it the case that the default SNMP passwords public and private have not been changed or removed? - - To verify that Audit Daemon is configured to resolve all uid, gid, syscall, -architecture, and socket address information before writing the event to disk, -run the following command: -$ sudo grep log_format /etc/audit/auditd.conf -The output should return the following: -log_format = ENRICHED - Is it the case that log_format isn't set to ENRICHED? + + + +Run the following command to determine the current status of the +chronyd service: +$ sudo systemctl is-active chronyd +If the service is running, it should return the following: active + Is it the case that the chronyd process is not running? - - The runtime status of the net.ipv4.icmp_echo_ignore_broadcasts kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.icmp_echo_ignore_broadcasts -1. - - Is it the case that the correct value is not returned? + + To check the permissions of /etc/motd, +run the command: +$ ls -l /etc/motd +If properly configured, the output should indicate the following permissions: +-rw-r--r-- + Is it the case that /etc/motd does not have unix mode -rw-r--r--? - - -Run the following command to determine if the httpd_execmem SELinux boolean is disabled: -$ getsebool httpd_execmem -If properly configured, the output should show the following: -httpd_execmem --> off - Is it the case that httpd_execmem is not disabled? + + To check that all boot entries extend the backlog limit; +Check that all boot entries extend the log events queue: +sudo grep -L "^options\s+.*\baudit_backlog_limit=8192\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that does not extend the log events queue. + Is it the case that audit backlog limit is not configured? - - To verify if password complexities are only enforce on local users, run the following command: -$ grep local_users_only /etc/security/pwquality.conf -The output should return local_users_only uncommented. - Is it the case that local_users_only is not uncommented or configured correctly? + + +Run the following command to determine if the virt_transition_userdomain SELinux boolean is disabled: +$ getsebool virt_transition_userdomain +If properly configured, the output should show the following: +virt_transition_userdomain --> off + Is it the case that virt_transition_userdomain is not disabled? - - Run the following command to determine if the dnf-plugin-subscription-manager package is installed: $ rpm -q dnf-plugin-subscription-manager - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SLAB_MERGE_DEFAULT /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify Red Hat Enterprise Linux 8 enforces 24 hours/1 day as the minimum password lifetime for new user accounts. - -Check for the value of "PASS_MIN_DAYS" in "/etc/login.defs" with the following command: - -$ grep -i pass_min_days /etc/login.defs - -PASS_MIN_DAYS - Is it the case that the "PASS_MIN_DAYS" parameter value is not "<sub idref="var_accounts_minimum_age_login_defs" />" or greater, or is commented out? + + To verify that USB Human Interface Devices and hubs will be authorized by the USBGuard daemon, +run the following command: +$ sudo grep allow /etc/usbguard/rules.conf +The output lines should include +allow with-interface match-all { 03:*:* 09:00:* } + Is it the case that USB devices of class 3 and 9:00 are not authorized? - + To determine if the system is configured to audit successful calls -to the setxattr system call, run the following command: -$ sudo grep "setxattr" /etc/audit.* +to the fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "mount" command with the following command: - -$ sudo auditctl -l | grep mount - --a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-mount - Is it the case that the command does not return a line, or the line is commented out? - - - - To determine the status and frequency of logrotate, run the following command: -$ sudo grep logrotate /var/log/cron* -If logrotate is configured properly, output should include references to -/etc/cron.daily. - Is it the case that logrotate is not configured to run daily? + + Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server + Is it the case that the package is not installed? - - System executables are stored in the following directories by default: -/bin -/sbin -/usr/bin -/usr/sbin -/usr/local/bin -/usr/local/sbin -To find system executables directories that are group-writable or -world-writable, run the following command for each directory DIR -which contains system executables: -$ sudo find -L DIR -perm /022 -type d - Is it the case that any of these files are group-writable or world-writable? + + Run the following command to determine if the samba package is installed: +$ rpm -q samba + Is it the case that the package is installed? - - To check if only local user are impacted by pam_faillock, run the following command: -$ grep local_users_only /etc/security/faillock.conf -The output should return local_users_only not commented. - Is it the case that local_users_only is not uncommented or configured correctly? + + To verify the 389-ds-base package is not installed, run the +following command: +$ rpm -q 389-ds-base +The output should show the following: +package 389-ds-base is not installed + Is it the case that the package is installed? - + -Run the following command to determine if the ftpd_use_fusefs SELinux boolean is disabled: -$ getsebool ftpd_use_fusefs +Run the following command to determine if the cobbler_can_network_connect SELinux boolean is disabled: +$ getsebool cobbler_can_network_connect If properly configured, the output should show the following: -ftpd_use_fusefs --> off - Is it the case that ftpd_use_fusefs is not disabled? +cobbler_can_network_connect --> off + Is it the case that cobbler_can_network_connect is not disabled? - + -Run the following command to determine if the cobbler_anon_write SELinux boolean is disabled: -$ getsebool cobbler_anon_write +Run the following command to determine if the virt_use_xserver SELinux boolean is disabled: +$ getsebool virt_use_xserver If properly configured, the output should show the following: -cobbler_anon_write --> off - Is it the case that cobbler_anon_write is not disabled? +virt_use_xserver --> off + Is it the case that virt_use_xserver is not disabled? - - To verify that web content directories should not be shared anonymously over -remote filesystems such as nfs and smb, inspect each instance -of DocumentRoot and serverRoot and verify that no entry in -/etc/fstab exists or no remote filesystem process is running for -any instance. -$ ps -ef | grep "nfs\|smb" - Is it the case that it is not? + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the openat system call with O_CREAT flag. + +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r openat /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep openat /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create + Is it the case that the command does not return a line, or the line is commented out? - - To check the ownership of /var/log/syslog, -run the command: -$ ls -lL /var/log/syslog -If properly configured, the output should indicate the following owner: -syslog - Is it the case that /var/log/syslog does not have an owner of syslog? + + +Check if SSSD allows cached authentications with the following command: + +$ sudo grep cache_credentials /etc/sssd/sssd.conf +cache_credentials = true + +If "cache_credentials" is set to "false" or is missing no further checks are required. + +To verify that SSSD expires offline credentials, run the following command: +$ sudo grep offline_credentials_expiration /etc/sssd/sssd.conf +If configured properly, output should be +offline_credentials_expiration = 1 + Is it the case that it does not exist or is not configured properly? - - -Run the following command to determine if the nfs_export_all_rw SELinux boolean is enabled: -$ getsebool nfs_export_all_rw -If properly configured, the output should show the following: -nfs_export_all_rw --> on - Is it the case that nfs_export_all_rw is not enabled? + + To determine that AIDE is verifying extended file attributes, run the following command: +$ grep xattrs /etc/aide.conf +Verify that the xattrs option is added to the correct ruleset. + Is it the case that the xattrs option is missing or not added to the correct ruleset? - - -Run the following command to determine if the deny_ptrace SELinux boolean is disabled: -$ getsebool deny_ptrace -If properly configured, the output should show the following: -deny_ptrace --> off - Is it the case that deny_ptrace is not disabled? + + Verify the operating system encrypts audit records off-loaded onto a different system +or media from the system being audited with the following commands: + +$ sudo grep -i '$ActionSendStreamDriverMode' /etc/rsyslog.conf /etc/rsyslog.d/*.conf + +The output should be: + +/etc/rsyslog.conf:$ActionSendStreamDriverMode 1 + Is it the case that rsyslogd ActionSendStreamDriverMode is not set to 1? - - -Run the following command to determine if the samba_share_nfs SELinux boolean is disabled: -$ getsebool samba_share_nfs -If properly configured, the output should show the following: -samba_share_nfs --> off - Is it the case that samba_share_nfs is not disabled? + + To check the ownership of /boot/grub2/user.cfg, +run the command: +$ ls -lL /boot/grub2/user.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/grub2/user.cfg does not have an owner of root? - + -Run the following command to determine if the mcelog_foreground SELinux boolean is disabled: -$ getsebool mcelog_foreground +Run the following command to determine if the secure_mode SELinux boolean is disabled: +$ getsebool secure_mode If properly configured, the output should show the following: -mcelog_foreground --> off - Is it the case that mcelog_foreground is not disabled? - - - - To verify that USB Human Interface Devices will be authorized by the USBGuard daemon, -run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -The output lines should include -allow with-interface match-all { 03:*:* } - Is it the case that USB devices of class 3 are not authorized? - - - - To verify if the mod_perl is installed, run the following command: -$ rpm -qa | grep mod_perl -If the mod_perl module is installed, verify that PerlSwitches -T -is enabled in /etc/httpd/conf.d/perl.conf by running the following -command: -$ grep -i "PerlSwitches -T" /etc/httpd/conf.d/perl.conf -The output should return uncommented: -PerlSwitches -T - Is it the case that it is not? +secure_mode --> off + Is it the case that secure_mode is not disabled? - - Run the following command to determine if the postfix package is installed: $ rpm -q postfix - Is it the case that the package is not installed? + + Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one numeric character be used. + +Check the value for "dcredit" with the following command: + +$ sudo grep dcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:dcredit = + Is it the case that the value of "dcredit" is a positive number or is commented out? - + Run the following command to determine the current status of the -ntpd service: -$ sudo systemctl is-active ntpd +iptables service: +$ sudo systemctl is-active iptables If the service is running, it should return the following: active Is it the case that ? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that execution of the command is being audited, run the following command: +$ sudo grep "path=/usr/sbin/seunshare" /etc/audit/audit.rules /etc/audit/rules.d/* +The output should return something similar to: +-a always,exit -F path=/usr/sbin/seunshare -F perm=x -F auid>=1000 -F auid!=unset -F key=privileged + Is it the case that ? - + + +Run the following command to determine if the xguest_exec_content SELinux boolean is disabled: +$ getsebool xguest_exec_content +If properly configured, the output should show the following: +xguest_exec_content --> off + Is it the case that xguest_exec_content is not disabled? + + + + +Run the following command to determine if the httpd_use_sasl SELinux boolean is disabled: +$ getsebool httpd_use_sasl +If properly configured, the output should show the following: +httpd_use_sasl --> off + Is it the case that httpd_use_sasl is not disabled? + + + To determine if the system is configured to audit calls to the -query_module system call, run the following command: -$ sudo grep "query_module" /etc/audit/audit.* +adjtimex system call, run the following command: +$ sudo grep "adjtimex" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To check which SSH protocol version is allowed, check version of openssh-server with following command: - -$ rpm -qi openssh-server | grep Version + + Using a non-privileged account, verify that users cannot modify or change +network settings with the nmcli command with the following command: +$ nmcli general permissions +The output should contain the following: +PERMISSION VALUE +org.freedesktop.NetworkManager.enable-disable-network auth +org.freedesktop.NetworkManager.enable-disable-wifi auth +org.freedesktop.NetworkManager.enable-disable-wwan auth +org.freedesktop.NetworkManager.enable-disable-wimax auth +org.freedesktop.NetworkManager.sleep-wake auth +org.freedesktop.NetworkManager.network-control auth +org.freedesktop.NetworkManager.wifi.share.protected auth +org.freedesktop.NetworkManager.wifi.share.open auth +org.freedesktop.NetworkManager.settings.modify.system auth +org.freedesktop.NetworkManager.settings.modify.own auth +org.freedesktop.NetworkManager.settings.modify.hostname auth +org.freedesktop.NetworkManager.settings.modify.global-dns auth +org.freedesktop.NetworkManager.reload auth +org.freedesktop.NetworkManager.checkpoint-rollback auth +org.freedesktop.NetworkManager.enable-disable-statistics auth +org.freedesktop.NetworkManager.enable-disable-connectivity-check auth +org.freedesktop.NetworkManager.wifi.scan auth -Versions equal to or higher than 7.4 only allow Protocol 2. -If version is lower than 7.4, run the following command to check configuration: -$ sudo grep Protocol /etc/ssh/sshd_config -If configured properly, output should be Protocol 2 - Is it the case that it is commented out or is not set correctly to Protocol 2? - - - - Run the following command to determine if the ntp package is installed: $ rpm -q ntp - Is it the case that the package is not installed? - - - - To check the permissions of /etc/shells, -run the command: -$ ls -l /etc/shells -If properly configured, the output should indicate the following permissions: -0644 - Is it the case that /etc/shells does not have unix mode 0644? - - - - To verify that a remote NTP service is configured for time synchronization, -open the following file: -/etc/ntp.conf -In the file, there should be a section similar to the following: -server ntpserver - Is it the case that this is not the case? + Is it the case that non-privileged users can modify or change network settings? - - To check the group ownership of /usr/bin/sudo, -run the command: -$ ls -lL /usr/bin/sudo -If properly configured, the output should indicate the following group-owner: + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - Is it the case that /usr/bin/sudo does not have a group owner of <sub idref="var_sudo_dedicated_group" />? +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: + +$ sudo grep disk_full_action /etc/audit/auditd.conf + +disk_full_action = + +If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. + Is it the case that there is no evidence of appropriate action? - - To ensure that remote access connections are encrypted, run the following command: -$ gsettings get org.gnome.Vino require-encrpytion -If properly configured, the output should be true. -To ensure that users cannot disable encrypted remote connections, run the following: -$ grep require-encryption /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/Vino/require-encryption - Is it the case that remote access connections are not encrypted? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_FORTIFY_SOURCE /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - + -Run the following command to determine if the webadm_manage_user_files SELinux boolean is disabled: -$ getsebool webadm_manage_user_files +Run the following command to determine if the fenced_can_network_connect SELinux boolean is disabled: +$ getsebool fenced_can_network_connect If properly configured, the output should show the following: -webadm_manage_user_files --> off - Is it the case that webadm_manage_user_files is not disabled? - - - - Run the following command to determine if the abrt-plugin-rhtsupport package is installed: -$ rpm -q abrt-plugin-rhtsupport - Is it the case that the package is installed? - - - - To ensure only SNMPv3 or newer is used, run the following command: -$ sudo grep 'rocommunity\|rwcommunity\|com2sec' /etc/snmp/snmpd.conf | grep -v "^#" -There should be no output. - Is it the case that there is output? +fenced_can_network_connect --> off + Is it the case that fenced_can_network_connect is not disabled? - - To find SGID files, run the following command: -$ sudo find / -xdev -type f -perm -2000 - Is it the case that there is output? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_RANDOMIZE_MEMORY /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "shutdown" command with the following command: + + +To check that the rlogin service is disabled in system boot configuration with xinetd, run the following command: +$ chkconfig rlogin --list +Output should indicate the rlogin service has either not been installed, or has been disabled, as shown in the example below: +$ chkconfig rlogin --list -$ sudo auditctl -l | grep shutdown +Note: This output shows SysV services only and does not include native +systemd services. SysV configuration data might be overridden by native +systemd configuration. --a always,exit -F path=/shutdown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-shutdown - Is it the case that the command does not return a line, or the line is commented out? +If you want to list systemd services use 'systemctl list-unit-files'. +To see services enabled on particular target use +'systemctl list-dependencies [target]'. + +rlogin off + +To check that the rlogin socket is disabled in system boot configuration with systemd, run the following command: +$ systemctl is-enabled rlogin +Output should indicate the rlogin socket has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rlogindisabled + +Run the following command to verify rlogin is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rlogin + +If the socket is not running the command will return the following output: +inactive + +The socket will also be masked, to check that the rlogin is masked, run the following command: +$ sudo systemctl show rlogin | grep "LoadState\|UnitFileState" + +If the socket is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that service and/or socket are running? - + Run the following command to determine the current status of the -sshd service: -$ sudo systemctl is-active sshd +systemd-journald service: +$ sudo systemctl is-active systemd-journald If the service is running, it should return the following: active - Is it the case that sshd service is disabled? + Is it the case that the systemd-journald service is not running? - - Verify that Red Hat Enterprise Linux 8 contains no duplicate User IDs (UIDs) for interactive users. + + To determine how the SSH daemon's GSSAPIAuthentication option is set, run the following command: -Check that the operating system contains no duplicate UIDs for interactive users with the following command: +$ sudo grep -i GSSAPIAuthentication /etc/ssh/sshd_config -$ sudo awk -F ":" 'list[$3]++{print $1, $3}' /etc/passwd - Is it the case that output is produced and the accounts listed are interactive user accounts? +If a line indicating no is returned, then the required value is set. + + Is it the case that the required value is not set? - - To check the group ownership of /etc/gshadow, -run the command: -$ ls -lL /etc/gshadow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/gshadow does not have a group owner of root? + + To ensure TLS is configured with trust certificates, run the following command: +$ grep cert /etc/nslcd.conf + Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? - - -Verify that the libuser is set to encrypt password with a FIPS 140-2 approved cryptographic hashing algorithm. + + To check that the bluetooth service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled bluetooth +Output should indicate the bluetooth service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled bluetooth disabled -Check the hashing algorithm that is being used to hash passwords with the following command: +Run the following command to verify bluetooth is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active bluetooth -$ sudo grep -i crypt_style /etc/libuser.conf +If the service is not running the command will return the following output: +inactive -crypt_style = sha512 - Is it the case that crypt_style is not set to sha512? +The service will also be masked, to check that the bluetooth is masked, run the following command: +$ sudo systemctl show bluetooth | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "bluetooth" is loaded and not masked? - - Check whether the maximum time period for existing passwords is restricted to days with the following commands: + + Verify the value of the "maxrepeat" option in "/etc/security/pwquality.conf" with the following command: -$ sudo awk -F: '$5 > 60 {print $1 " " $5}' /etc/shadow +$ grep maxrepeat /etc/security/pwquality.conf -$ sudo awk -F: '$5 <= 0 {print $1 " " $5}' /etc/shadow - Is it the case that any results are returned that are not associated with a system account? +maxrepeat = + Is it the case that the value of "maxrepeat" is set to more than "<sub idref="var_password_pam_maxrepeat" />" or is commented out? - - To check that SLUB/SLAB poisoning is enabled, check all boot entries with following command; -sudo grep -L "^options\s+.*\bslub_debug=P\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that does not enable poisoning. - Is it the case that SLUB/SLAB poisoning is not enabled? + + Shared libraries are stored in the following directories: +/lib +/lib64 +/usr/lib +/usr/lib64 + +To find shared libraries that are group-writable or world-writable, +run the following command for each directory DIR which contains shared libraries: +$ sudo find -L DIR -perm /022 -type d + Is it the case that any of these files are group-writable or world-writable? - + + To check the ownership of /etc/group, +run the command: +$ ls -lL /etc/group +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/group does not have an owner of root? + + + -Run the following command to determine if the zoneminder_run_sudo SELinux boolean is disabled: -$ getsebool zoneminder_run_sudo +Run the following command to determine if the container_connect_any SELinux boolean is disabled: +$ getsebool container_connect_any If properly configured, the output should show the following: -zoneminder_run_sudo --> off - Is it the case that zoneminder_run_sudo is not disabled? +container_connect_any --> off + Is it the case that container_connect_any is not disabled? - - The runtime status of the kernel.perf_event_max_sample_rate kernel parameter can be queried -by running the following command: -$ sysctl kernel.perf_event_max_sample_rate -1. + + To ensure the X Windows package group is removed, run the following command: - Is it the case that the correct value is not returned? +$ rpm -qi xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-server-Xwayland + +For each package mentioned above you should receive following line: +package <package> is not installed + Is it the case that xorg related packages are not removed and run level is not correctly configured? - - To check the permissions of /etc/audit/rules.d/*.rules, -run the command: -$ ls -l /etc/audit/rules.d/*.rules -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/audit/rules.d/*.rules does not have unix mode -rw-r-----? + + Verify Red Hat Enterprise Linux 8 prevents the use of dictionary words for passwords with the following command: + +$ sudo grep dictcheck /etc/security/pwquality.conf /etc/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:dictcheck=1 + Is it the case that "dictcheck" does not have a value other than "0", or is commented out? - - The following command will discover and print world-writable directories that are not owned by -a system account, given the assumption that only system accounts have a uid lower than 500. -Run it once for each local partition PART: -$ sudo find PART -xdev -type d -perm -0002 -uid +1000 -print - Is it the case that there is output? + + Run the following command to determine if the krb5-server package is installed: $ rpm -q krb5-server + Is it the case that the package is installed? - - To verify the nosuid option is configured for all NFS mounts, run -the following command: -$ mount | grep nfs -All NFS mounts should show the nosuid setting in parentheses. This -is not applicable if NFS is not implemented. - Is it the case that the setting does not show? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine if the system is configured correctly: +space_left SIZE_in_MB + Is it the case that the system is not configured a specfic size in MB to notify administrators of an issue? - - To check the group ownership of /var/log/syslog, -run the command: -$ ls -lL /var/log/syslog -If properly configured, the output should indicate the following group-owner: -adm - Is it the case that /var/log/syslog does not have a group owner of adm? + + To find SUID files, run the following command: +$ sudo find / -xdev -type f -perm -4000 + Is it the case that only authorized files appear in the output of the find command? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-6-owner-change-success.rules -The output has to be exactly as follows: -## Successful ownership change --a always,exit -F arch=b32 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change --a always,exit -F arch=b64 -S lchown,fchown,chown,fchownat -F success=1 -F auid>=1000 -F auid!=unset -F key=successful-owner-change - Is it the case that the file does not exist or the content differs? + + +Run the following command to determine if the sysadm_exec_content SELinux boolean is enabled: +$ getsebool sysadm_exec_content +If properly configured, the output should show the following: +sysadm_exec_content --> on + Is it the case that sysadm_exec_content is not enabled? - - The runtime status of the net.ipv4.conf.default.secure_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.secure_redirects -0. + + - Is it the case that the correct value is not returned? +Run the following command to determine the current status of the +sshd service: +$ sudo systemctl is-active sshd +If the service is running, it should return the following: active + Is it the case that sshd service is disabled? - + + Verify Red Hat Enterprise Linux 8 disables the chrony daemon from acting as a server with the following command: +$ grep -w port /etc/chrony.conf +port 0 + Is it the case that the "port" option is not set to "0", is commented out, or is missing? + + + -Run the following command to determine if the samba_export_all_rw SELinux boolean is disabled: -$ getsebool samba_export_all_rw +Run the following command to determine if the logadm_exec_content SELinux boolean is enabled: +$ getsebool logadm_exec_content If properly configured, the output should show the following: -samba_export_all_rw --> off - Is it the case that samba_export_all_rw is not disabled? +logadm_exec_content --> on + Is it the case that logadm_exec_content is not enabled? - - Run the following command to determine if the pigz package is installed: -$ rpm -q pigz - Is it the case that the package is installed? + + The document, DoDI 8500.01, establishes the policy on the use of DoD +information systems. It requires the use of a standard Notice and Consent Banner +and standard text to be included in user agreements. The banner should be set +to the following: + Is it the case that it is not display the required banner? - - The runtime status of the net.core.bpf_jit_harden kernel parameter can be queried -by running the following command: -$ sysctl net.core.bpf_jit_harden -2. + + To determine if the system is configured to audit unsuccessful calls +to the setxattr system call, run the following command: +$ sudo grep "setxattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the correct value is not returned? + Is it the case that no line is returned? - - -Run the following command to determine if the racoon_read_shadow SELinux boolean is disabled: -$ getsebool racoon_read_shadow -If properly configured, the output should show the following: -racoon_read_shadow --> off - Is it the case that racoon_read_shadow is not disabled? + + Verify that core dumps are disabled for all users, run the following command: +$ grep core /etc/security/limits.conf +* hard core 0 + Is it the case that the "core" item is missing, commented out, or the value is anything other than "0" and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core"? - - -Run the following command to determine if the abrt_anon_write SELinux boolean is disabled: -$ getsebool abrt_anon_write -If properly configured, the output should show the following: -abrt_anon_write --> off - Is it the case that abrt_anon_write is not disabled? + + If the system is not using TLS, set the ldap_id_use_start_tls option +in /etc/sssd/sssd.conf to true. + Is it the case that the 'ldap_id_use_start_tls' option is not set to 'true'? - - To verify if the OpenSSH client uses defined MACs in the Crypto Policy, run: -$ grep -i macs /etc/crypto-policies/back-ends/openssh.config -and verify that the line matches: -MACs - Is it the case that Crypto Policy for OpenSSH client is not configured correctly? + + Run the following command to determine if the syslog-ng-core package is installed: $ rpm -q syslog-ng-core + Is it the case that the package is not installed? - - -Run the following command to determine if the xdm_sysadm_login SELinux boolean is disabled: -$ getsebool xdm_sysadm_login -If properly configured, the output should show the following: -xdm_sysadm_login --> off - Is it the case that xdm_sysadm_login is not disabled? + + To verify if SSLVerifyClient is configured correctly in +/etc/httpd/conf/httpd.conf, run the following command: +$ grep -i sslverifyclient /etc/httpd/conf/httpd.conf +The command should return the following: +SSLVerifyClient require + Is it the case that it is not? - + + Run the following command: +# grep ^\$FileCreateMode /etc/rsyslog.conf /etc/rsyslog.d/*.conf +Verify the output matches: +$FileCreateMode 0640 +Should a site policy dictate less restrictive permissions, ensure to follow +said policy. + Is it the case that $FileCreateMode is not set or is more permissive than 0640? + + + + To determine whether yum has been configured to disable +gpgcheck for any repos, inspect all files in +/etc/yum.repos.d and ensure the following does not appear in any +sections: +gpgcheck=0 +A value of 0 indicates that gpgcheck has been disabled for that repo. + Is it the case that GPG checking is disabled? + + + To determine if the system is configured to audit calls to the -fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit/audit.* +unlink system call, run the following command: +$ sudo grep "unlink" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To verify that Audit Daemon is configured to flush to disk after -every records, run the following command: -$ sudo grep freq /etc/audit/auditd.conf -The output should return the following: -freq = - Is it the case that freq isn't set to <sub idref="var_auditd_freq" />? + + +Run the following command to determine if the httpd_mod_auth_ntlm_winbind SELinux boolean is disabled: +$ getsebool httpd_mod_auth_ntlm_winbind +If properly configured, the output should show the following: +httpd_mod_auth_ntlm_winbind --> off + Is it the case that httpd_mod_auth_ntlm_winbind is not disabled? - + +If the system is configured to prevent the loading of the cfg80211 kernel module, +it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. +These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -Run the following command to determine the current status of the -sshd service: -$ sudo systemctl is-active sshd -If the service is running, it should return the following: active - Is it the case that ? +These lines can also instruct the module loading system to ignore the cfg80211 kernel module via blacklist keyword. + +Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: +$ grep -r cfg80211 /etc/modprobe.conf /etc/modprobe.d + Is it the case that no line is returned? - + -Run the following command to determine if the nagios_run_sudo SELinux boolean is disabled: -$ getsebool nagios_run_sudo +Run the following command to determine if the exim_manage_user_files SELinux boolean is disabled: +$ getsebool exim_manage_user_files If properly configured, the output should show the following: -nagios_run_sudo --> off - Is it the case that nagios_run_sudo is not disabled? +exim_manage_user_files --> off + Is it the case that exim_manage_user_files is not disabled? - - -Run the following command to determine if the cron_userdomain_transition SELinux boolean is enabled: -$ getsebool cron_userdomain_transition -If properly configured, the output should show the following: -cron_userdomain_transition --> on - Is it the case that cron_userdomain_transition is not enabled? + + To determine how the SSH daemon's PrintLastLog option is set, run the following command: + +$ sudo grep -i PrintLastLog /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - -Run the following command to determine if the haproxy_connect_any SELinux boolean is disabled: -$ getsebool haproxy_connect_any -If properly configured, the output should show the following: -haproxy_connect_any --> off - Is it the case that haproxy_connect_any is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes vsyscall=none, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*vsyscall=none.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*vsyscall=none.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'vsyscall=none' +The command should not return any output. + Is it the case that vsyscalls are enabled? - + -Run the following command to determine if the httpd_use_nfs SELinux boolean is disabled: -$ getsebool httpd_use_nfs +Run the following command to determine if the httpd_enable_ftp_server SELinux boolean is disabled: +$ getsebool httpd_enable_ftp_server If properly configured, the output should show the following: -httpd_use_nfs --> off - Is it the case that httpd_use_nfs is not disabled? - - - - To check for legacy lines in /etc/group, run the following command: - grep '^\+' /etc/group -The command should not return any output. - Is it the case that the file contains legacy lines? +httpd_enable_ftp_server --> off + Is it the case that httpd_enable_ftp_server is not disabled? - - To verify the home directory ownership, run the following command: -# ls -ld $(awk -F: '($3>=1000)&&($7 !~ /nologin/){print $6}' /etc/passwd) - Is it the case that the user ownership is incorrect? + + To find world-writable files, run the following command: +$ sudo find / -xdev -type f -perm -002 + Is it the case that there is output? - - To determine how the SSH daemon's KerberosAuthentication option is set, run the following command: - -$ sudo grep -i KerberosAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. + + - Is it the case that the required value is not set? +Run the following command to determine the current status of the +rsyslog service: +$ sudo systemctl is-active rsyslog +If the service is running, it should return the following: active + Is it the case that the "rsyslog" service is disabled, masked, or not started.? - - To check the current idle time-out value, run the following command: -$ gsettings get org.gnome.desktop.session idle-delay -If properly configured, the output should be 'uint32 '. -To ensure that users cannot change the screensaver inactivity timeout setting, run the following: -$ grep idle-delay /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/session/idle-delay - Is it the case that idle-delay is set to 0 or a value greater than <sub idref="inactivity_timeout_value" />? + + Run the following command to check the mode of the httpd log +directory: +$ ls -l /var/log/ | grep httpd +Log directory must be mode 0700 or less permissive. + Is it the case that it is more permissive? - - To verify that USB Human Interface Devices and hubs will be authorized by the USBGuard daemon, + + To check that the ntpdate service is disabled in system boot configuration, run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -The output lines should include -allow with-interface match-all { 03:*:* 09:00:* } - Is it the case that USB devices of class 3 and 9:00 are not authorized? - - - - To check the group ownership of /boot/efi/EFI/redhat/grub.cfg, -run the command: -$ ls -lL /boot/efi/EFI/redhat/grub.cfg -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have a group owner of root? +$ sudo systemctl is-enabled ntpdate +Output should indicate the ntpdate service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled ntpdate disabled + +Run the following command to verify ntpdate is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ntpdate + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the ntpdate is masked, run the following command: +$ sudo systemctl show ntpdate | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "ntpdate" is loaded and not masked? - - To verify if the OpenSSL uses defined TLS Crypto Policy, run: -$ grep -P '^(TLS\.)?MinProtocol' /etc/crypto-policies/back-ends/opensslcnf.config -and verify that the value is -TLSv1.2 - Is it the case that cryptographic policy for openssl is not configured or is configured incorrectly? + + Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/sudoers.d/" with the following command: + +$ sudo auditctl -l | grep/etc/sudoers.d + +-w /etc/sudoers.d/ -p wa -k identity + Is it the case that the command does not return a line, or the line is commented out? - - Verify the system-wide shared library files contained in the following directories have mode "755" or less permissive with the following command: - -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 -perm /022 -type f -exec ls -l {} \; - Is it the case that any system-wide shared library file is found to be group-writable or world-writable? + + +Run the following command to determine if the zoneminder_run_sudo SELinux boolean is disabled: +$ getsebool zoneminder_run_sudo +If properly configured, the output should show the following: +zoneminder_run_sudo --> off + Is it the case that zoneminder_run_sudo is not disabled? - - To check the permissions of /etc/cron.hourly, -run the command: -$ ls -l /etc/cron.hourly -If properly configured, the output should indicate the following permissions: --rwx------ - Is it the case that /etc/cron.hourly does not have unix mode -rwx------? + + To determine whether OpenSSL is wrapped by a shell function that ensures that every invocation +uses a SP800-90A compliant entropy source, +make sure that the /etc/profile.d/openssl-rand.sh file contents exactly match those +that are included in the rule's description. + Is it the case that there is no <tt>/etc/profile.d/openssl-rand.sh</tt> file, or its contents don't match those in the description? - - To determine if negation is used to define commands users are allowed to execute using sudo, run the following command: -$ sudo grep -PR '^(?:\s*[^#=]+)=(?:\s*(?:\([^\)]+\))?\s*(?!\s*\()[^,!\n][^,\n]+,)*\s*(?:\([^\)]+\))?\s*(?!\s*\()(!\S+).*' /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that /etc/sudoers file contains rules that define the set of allowed commands using negation? + + +Run the following command to determine if the dbadm_exec_content SELinux boolean is enabled: +$ getsebool dbadm_exec_content +If properly configured, the output should show the following: +dbadm_exec_content --> on + Is it the case that dbadm_exec_content is not enabled? - + -Run the following command to determine if the domain_fd_use SELinux boolean is enabled: -$ getsebool domain_fd_use +Run the following command to determine if the cobbler_use_cifs SELinux boolean is disabled: +$ getsebool cobbler_use_cifs If properly configured, the output should show the following: -domain_fd_use --> on - Is it the case that domain_fd_use is not enabled? +cobbler_use_cifs --> off + Is it the case that cobbler_use_cifs is not disabled? - - Run the following command to determine if the policycoreutils-python-utils package is installed: $ rpm -q policycoreutils-python-utils - Is it the case that the package is not installed? + + Ensure that debug-shell service is not enabled with the following command: +grep systemd\.debug-shell=1 /boot/grub2/grubenv /etc/default/grub +If the command returns a line, it means that debug-shell service is being enabled. + Is it the case that the comand returns a line? - - To check that the qpidd service is disabled in system boot configuration, + + To verify the nodev option is configured for all NFS mounts, run +the following command: +$ mount | grep nfs +All NFS mounts should show the nodev setting in parentheses. This +is not applicable if NFS is not implemented. + Is it the case that the setting does not show? + + + + To check that the acpid service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled qpidd -Output should indicate the qpidd service has either not been installed, +$ sudo systemctl is-enabled acpid +Output should indicate the acpid service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled qpidd disabled +$ sudo systemctl is-enabled acpid disabled -Run the following command to verify qpidd is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active qpidd +Run the following command to verify acpid is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active acpid If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the qpidd is masked, run the following command: -$ sudo systemctl show qpidd | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the acpid is masked, run the following command: +$ sudo systemctl show acpid | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "qpidd" is loaded and not masked? + Is it the case that the "acpid" is loaded and not masked? - - Run the following command to determine if the opensc package is installed: $ rpm -q opensc - Is it the case that the package is not installed? + + To verify that Samba clients running smbclient must use packet signing, run the following command: +$ grep signing /etc/samba/smb.conf +The output should show: +client signing = mandatory + Is it the case that it is not? - - The reviewed should make a note of the name of the account being used for -the web service. This information may be needed later in the SRR. There -may also be other server services running related to the web server in -support of a particular web application, these passwords must be entrusted -to the SA or Web Manager as well. - -Query the SA or Web Manager to determine if they have the web service -password(s). - -NOTE: For installations that run as a service, or without a password, -the SA or Web Manager having an Admin account on the system would meet -the intent of this check. - Is it the case that the web server password(s) are not entrusted to the SA or Web Manager? + + +Run the following command to determine if the virt_use_rawip SELinux boolean is disabled: +$ getsebool virt_use_rawip +If properly configured, the output should show the following: +virt_use_rawip --> off + Is it the case that virt_use_rawip is not disabled? - - Verify the "/etc/security/faillock.conf" file is configured use a non-default faillock directory to ensure contents persist after reboot: + + Verify Red Hat Enterprise Linux 8 enables the user to initiate a session lock with the following command: -$ sudo grep 'dir =' /etc/security/faillock.conf +$ grep lock-command /etc/tmux.conf -dir = /var/log/faillock - Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? +set -g lock-command vlock + +Then, verify that the /etc/tmux.conf file can be read by other users than root: + +$ sudo ls -al /etc/tmux.conf + Is it the case that the "lock-command" is not set in the global settings to call "vlock"? - - To check that the nfs-server service is disabled in system boot configuration, + + +Run the following command to determine if the tftp_home_dir SELinux boolean is disabled: +$ getsebool tftp_home_dir +If properly configured, the output should show the following: +tftp_home_dir --> off + Is it the case that tftp_home_dir is not disabled? + + + + +Run the following command to determine if the tmpreaper_use_samba SELinux boolean is disabled: +$ getsebool tmpreaper_use_samba +If properly configured, the output should show the following: +tmpreaper_use_samba --> off + Is it the case that tmpreaper_use_samba is not disabled? + + + + To check that audit is enabled at boot time, check all boot entries with following command: +sudo grep -L "^options\s+.*\baudit=1\b" /boot/loader/entries/*.conf +No line should be returned, each line returned is a boot entry that doesn't enable audit. + Is it the case that auditing is not enabled at boot time? + + + + Run the following command to determine if the quagga package is installed: +$ rpm -q quagga + Is it the case that the package is installed? + + + + To verify that Audit Daemon is configured to include local events, run the +following command: +$ sudo grep local_events /etc/audit/auditd.conf +The output should return the following: +local_events = yes + Is it the case that local_events isn't set to yes? + + + + To check the value of the umask, run the following command: +$ grep umask /etc/init.d/functions +The output should show . + Is it the case that it does not? + + + + To verify that auditing of privileged command use is configured, run the +following command: +$ sudo grep usernetctl /etc/audit/audit.rules /etc/audit/rules.d/* +It should return a relevant line in the audit rules. + Is it the case that the command does not return a line, or the line is commented out? + + + + To check that the rhnsd service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled nfs-server -Output should indicate the nfs-server service has either not been installed, +$ sudo systemctl is-enabled rhnsd +Output should indicate the rhnsd service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled nfs-server disabled +$ sudo systemctl is-enabled rhnsd disabled -Run the following command to verify nfs-server is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active nfs-server +Run the following command to verify rhnsd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rhnsd If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the nfs-server is masked, run the following command: -$ sudo systemctl show nfs-server | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the rhnsd is masked, run the following command: +$ sudo systemctl show rhnsd | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "nfs-server" is loaded and not masked? + Is it the case that the "rhnsd" is loaded and not masked? - - Verify "firewalld" is configured to employ a deny-all, allow-by-exception policy for allowing connections to other systems with the following commands: - -$ sudo firewall-cmd --state - -running + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "su" command with the following command: -$ sudo firewall-cmd --get-active-zones +$ sudo auditctl -l | grep su -[custom] -interfaces: ens33 +-a always,exit -F path=/usr/bin/su -F perm=x -F auid>=1000 -F auid!=unset -k privileged-su + Is it the case that the command does not return a line, or the line is commented out? + + + + +Run the following command to determine if the icecast_use_any_tcp_ports SELinux boolean is disabled: +$ getsebool icecast_use_any_tcp_ports +If properly configured, the output should show the following: +icecast_use_any_tcp_ports --> off + Is it the case that icecast_use_any_tcp_ports is not disabled? + + + + Verify the pam_faillock.so module is present in the "/etc/pam.d/password-auth" file: -$ sudo firewall-cmd --info-zone=[custom] | grep target +$ sudo grep pam_faillock.so /etc/pam.d/password-auth -target: DROP - Is it the case that no zones are active on the interfaces or if the target is set to a different option other than "DROP"? +auth required pam_faillock.so preauth +auth required pam_faillock.so authfail +account required pam_faillock.so + Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/password-auth" file with the "preauth" line listed before pam_unix.so? - - To determine if the system is configured to audit unsuccessful calls -to the chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit.* + + To determine if the system is configured to audit successful calls +to the unlinkat system call, run the following command: +$ sudo grep "unlinkat" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To verify that clients cannot automatically update DNS records, perform the +following: +$ grep -i dhcp_hostname /etc/sysconfig/network-scripts/ifcfg-* +$ grep -rni "send host-name" /etc/dhclient.conf /etc/dhcp +The output should return no results. + Is it the case that client Dynamic DNS updates are not disabled? + + + + To determine how the SSH daemon's X11Forwarding option is set, run the following command: - Is it the case that no line is returned? +$ sudo grep -i X11Forwarding /etc/ssh/sshd_config + +If a line indicating yes is returned, then the required value is set. + + Is it the case that the required value is not set? - - -To check that the systemd-journal-remote.socket socket is disabled in system boot configuration with systemd, run the following command: -$ systemctl is-enabled systemd-journal-remote.socket -Output should indicate the systemd-journal-remote.socket socket has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled systemd-journal-remote.socketdisabled + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "mount" command with the following command: -Run the following command to verify systemd-journal-remote.socket is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active systemd-journal-remote.socket +$ sudo auditctl -l | grep mount -If the socket is not running the command will return the following output: -inactive +-a always,exit -F path=/usr/bin/mount -F perm=x -F auid>=1000 -F auid!=unset -k privileged-mount + Is it the case that the command does not return a line, or the line is commented out? + + + + Run the following commands and verify output: -The socket will also be masked, to check that the systemd-journal-remote.socket is masked, run the following command: -$ sudo systemctl show systemd-journal-remote.socket | grep "LoadState\|UnitFileState" +# iptables -L INPUT -v -n | grep lo | grep ACCEPT -If the socket is masked the command will return the following outputs: -LoadState=masked +# iptables -L INPUT -v -n | grep 127.0.0.0\/8 | grep DROP -UnitFileState=masked - Is it the case that the systemd-journal-remote socket is not masked? + +# iptables -L OUTPUT -v -n | grep lo | grep ACCEPT + + Is it the case that loopback traffic is not configured? - + -Run the following command to determine if the piranha_lvs_can_network_connect SELinux boolean is disabled: -$ getsebool piranha_lvs_can_network_connect +Run the following command to determine if the mpd_enable_homedirs SELinux boolean is disabled: +$ getsebool mpd_enable_homedirs If properly configured, the output should show the following: -piranha_lvs_can_network_connect --> off - Is it the case that piranha_lvs_can_network_connect is not disabled? - - - - To check the group ownership of /etc/ssh/*.pub, -run the command: -$ ls -lL /etc/ssh/*.pub -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/*.pub does not have a group owner of root? - - - - To determine if umask has been configured for sudo with the appropriate value, -run the following command: -$ sudo grep -ri '^Defaults.*umask=' /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that umask is not set with the appropriate value for sudo? - - - - To determine if the system is configured to audit successful calls -to the unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? - - - - To verify that USB hubs will be authorized by the USBGuard daemon, -run the following command: -$ sudo grep allow /etc/usbguard/rules.conf -One of the output lines should be -allow with-interface match-all { 09:00:* } - Is it the case that USB devices of class 9 are not authorized? +mpd_enable_homedirs --> off + Is it the case that mpd_enable_homedirs is not disabled? @@ -383334,295 +384099,225 @@ TimedLoginEnable=false Is it the case that GDM allows a guest to login without credentials? - - Verify Red Hat Enterprise Linux 8 notifies the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity with the following command: - -$ sudo grep -w space_left_action /etc/audit/auditd.conf - -space_left_action = - -If the value of the "space_left_action" is not set to "", or if the line is commented out, ask the System Administrator to indicate how the system is providing real-time alerts to the SA and ISSO. - Is it the case that there is no evidence that real-time alerts are configured on the system? - - - - -Run the following command to determine if the git_system_enable_homedirs SELinux boolean is disabled: -$ getsebool git_system_enable_homedirs -If properly configured, the output should show the following: -git_system_enable_homedirs --> off - Is it the case that git_system_enable_homedirs is not disabled? - - - - Verify that rules for unsuccessful calls of the openat syscall are in the order shown below. - - If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), check the order of rules below in a file with suffix ".rules" in the directory "/etc/audit/rules.d". - If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, check the order of rules below in "/etc/audit/audit.rules" file. - - -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - - If the system is 64 bit then also add the following lines: - - -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat -F a2&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-modification - -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-access - Is it the case that the rules are in a different order? - - - - To determine how the SSH daemon's UsePAM option is set, run the following command: - -$ sudo grep -i UsePAM /etc/ssh/sshd_config - -If a line indicating yes is returned, then the required value is set. - - Is it the case that the required value is not set? + + Run the following command to determine open ports: +# ss -6tuln +Run the following command to determine firewall rules: +# ip6tables -L INPUT -v -n +For each port identified in the audit which does not have a firewall +rule, add rule for accepting or denying inbound connections +# ip6tables -A INPUT -p \ --dport \ -m state --state NEW -j ACCEPT + Is it the case that open ports are denied connection? - - -Run the following command to determine if the logrotate_use_nfs SELinux boolean is disabled: -$ getsebool logrotate_use_nfs -If properly configured, the output should show the following: -logrotate_use_nfs --> off - Is it the case that logrotate_use_nfs is not disabled? + + To check the group ownership of /boot/efi/EFI/redhat/grub.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have a group owner of root? - - Check the system partitions to determine if they are encrypted with the following command: -blkid + + Verify that Red Hat Enterprise Linux 8 is configured to notify the SA and/or ISSO (at a minimum) in the event of an audit processing failure with the following command: -Output will be similar to: -/dev/sda1: UUID=" ab12c3de-4f56-789a-8f33-3850cc8ce3a2 -" TYPE="crypto_LUKS" -/dev/sda2: UUID=" bc98d7ef-6g54-321h-1d24-9870de2ge1a2 -" TYPE="crypto_LUKS" +$ sudo grep action_mail_acct /etc/audit/auditd.conf -The boot partition and pseudo-file systems, such as /proc, /sys, and tmpfs, -are not required to use disk encryption and are not a finding. - Is it the case that partitions do not have a type of crypto_LUKS? +action_mail_acct = + Is it the case that the value of the "action_mail_acct" keyword is not set to "<sub idref="var_auditd_action_mail_acct" />" and/or other accounts for security personnel, the "action_mail_acct" keyword is missing, or the retuned line is commented out, ask the system administrator to indicate how they and the ISSO are notified of an audit process failure. If there is no evidence of the proper personnel being notified of an audit processing failure? - - The runtime status of the net.ipv6.conf.default.router_solicitations kernel parameter can be queried + + The runtime status of the kernel.modules_disabled kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.default.router_solicitations -0. +$ sysctl kernel.modules_disabled +1. Is it the case that the correct value is not returned? - - -Run the following command to determine if the unconfined_mozilla_plugin_transition SELinux boolean is enabled: -$ getsebool unconfined_mozilla_plugin_transition -If properly configured, the output should show the following: -unconfined_mozilla_plugin_transition --> on - Is it the case that unconfined_mozilla_plugin_transition is not enabled? + + Verify that cron is logging to rsyslog, +run the following command: +grep -rni "cron\.\*" /etc/rsyslog.* +cron.* /var/log/cron + Is it the case that cron is not logging to rsyslog? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_FORTIFY_SOURCE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Verify the nodev option is configured for the /boot mount point, + run the following command: + $ sudo mount | grep '\s/boot\s' + . . . /boot . . . nodev . . . + + Is it the case that the "/boot" file system does not have the "nodev" option set? - + -Run the following command to determine if the glance_use_execmem SELinux boolean is disabled: -$ getsebool glance_use_execmem +Run the following command to determine if the samba_create_home_dirs SELinux boolean is disabled: +$ getsebool samba_create_home_dirs If properly configured, the output should show the following: -glance_use_execmem --> off - Is it the case that glance_use_execmem is not disabled? +samba_create_home_dirs --> off + Is it the case that samba_create_home_dirs is not disabled? - + -Run the following command to determine if the selinuxuser_tcp_server SELinux boolean is disabled: -$ getsebool selinuxuser_tcp_server +Run the following command to determine if the xdm_exec_bootloader SELinux boolean is disabled: +$ getsebool xdm_exec_bootloader If properly configured, the output should show the following: -selinuxuser_tcp_server --> off - Is it the case that selinuxuser_tcp_server is not disabled? +xdm_exec_bootloader --> off + Is it the case that xdm_exec_bootloader is not disabled? - + -Run the following command to determine if the mplayer_execstack SELinux boolean is disabled: -$ getsebool mplayer_execstack +Run the following command to determine if the httpd_use_fusefs SELinux boolean is disabled: +$ getsebool httpd_use_fusefs If properly configured, the output should show the following: -mplayer_execstack --> off - Is it the case that mplayer_execstack is not disabled? +httpd_use_fusefs --> off + Is it the case that httpd_use_fusefs is not disabled? - - To check if UsePrivilegeSeparation is enabled or set correctly, run the -following command: -$ sudo grep UsePrivilegeSeparation /etc/ssh/sshd_config -If configured properly, output should be . - Is it the case that it is commented out or is not enabled? + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "shutdown" command with the following command: + +$ sudo auditctl -l | grep shutdown + +-a always,exit -F path=/shutdown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-shutdown + Is it the case that the command does not return a line, or the line is commented out? - - To determine if the system is configured to audit changes to its SELinux -configuration files, run the following command: -$ sudo auditctl -l | grep "dir=/etc/selinux" -If the system is configured to watch for changes to its SELinux -configuration, a line should be returned (including -perm=wa indicating permissions that are watched). - Is it the case that the system is not configured to audit attempts to change the MAC policy? + + To verify the audispd plugin off-loads audit records onto a different system or +media from the system being audited, run the following command: +$ sudo grep -i remote_server /etc/audit/audisp-remote.conf +The output should return something similar to +remote_server = + Is it the case that audispd is not sending logs to a remote system? - + -Run the following command to determine if the virt_use_rawip SELinux boolean is disabled: -$ getsebool virt_use_rawip +Run the following command to determine if the selinuxuser_execmod SELinux boolean is enabled: +$ getsebool selinuxuser_execmod If properly configured, the output should show the following: -virt_use_rawip --> off - Is it the case that virt_use_rawip is not disabled? +selinuxuser_execmod --> on + Is it the case that selinuxuser_execmod is not enabled? - - Verify Red Hat Enterprise Linux 8 disables storing core dumps for all users by issuing the following command: - -$ grep -i storage /etc/systemd/coredump.conf + + The runtime status of the net.ipv4.ip_local_port_range kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.ip_local_port_range +32768 65535. -Storage=none - Is it the case that Storage is not set to none or is commented out and the need for core dumps is not documented with the Information System Security Officer (ISSO) as an operational requirement for all domains that have the "core" item assigned? - - - - -Run the following command to determine if the postgresql_selinux_users_ddl SELinux boolean is enabled: -$ getsebool postgresql_selinux_users_ddl -If properly configured, the output should show the following: -postgresql_selinux_users_ddl --> on - Is it the case that postgresql_selinux_users_ddl is not enabled? - - - - To check for serial port entries which permit root login, -run the following command: -$ sudo grep ^ttyS/[0-9] /etc/securetty -If any output is returned, then root login over serial ports is permitted. - Is it the case that root login over serial ports is permitted? - - - - Only FIPS-approved MACs should be used. To verify that only FIPS-approved -MACs are in use, run the following command: -$ sudo grep -i macs /etc/ssh/sshd_config -The output should contain only those MACs which are FIPS-approved. Any use of other -ciphers or algorithms will result in the module entering the non-FIPS mode of -operation. - Is it the case that MACs option is commented out or not using FIPS-approved hash algorithms? + Is it the case that the correct value is not returned? - - -Run the following command to determine if the dhcpd_use_ldap SELinux boolean is disabled: -$ getsebool dhcpd_use_ldap -If properly configured, the output should show the following: -dhcpd_use_ldap --> off - Is it the case that dhcpd_use_ldap is not disabled? + + To determine that periodic AIDE execution has been scheduled, run the following command: + +$ grep aide /etc/crontab +The output should return something similar to the following: +05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost +The email address that the notifications are sent to can be changed by overriding +. + Is it the case that AIDE has not been configured or has not been configured to notify personnel of scan details? - - The runtime status of the net.ipv6.conf.all.autoconf kernel parameter can be queried + + The runtime status of the net.ipv6.conf.default.accept_ra kernel parameter can be queried by running the following command: -$ sysctl net.ipv6.conf.all.autoconf +$ sysctl net.ipv6.conf.default.accept_ra 0. Is it the case that the correct value is not returned? - - -Run the following command to determine if the auditadm_exec_content SELinux boolean is enabled: -$ getsebool auditadm_exec_content -If properly configured, the output should show the following: -auditadm_exec_content --> on - Is it the case that auditadm_exec_content is not enabled? - - - - Run the following command to determine if the samba-common package is installed: $ rpm -q samba-common - Is it the case that the package is not installed? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes ipv6.disable=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*ipv6.disable=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*ipv6.disable=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'ipv6.disable=1' +The command should not return any output. + Is it the case that IPv6 is not disabled? - - -Run the following command to determine if the git_system_use_cifs SELinux boolean is disabled: -$ getsebool git_system_use_cifs -If properly configured, the output should show the following: -git_system_use_cifs --> off - Is it the case that git_system_use_cifs is not disabled? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes slub_debug=, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slub_debug=.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*slub_debug=.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'slub_debug=' +The command should not return any output. + Is it the case that SLUB/SLAB poisoning is not enabled? - - -Run the following command to determine if the named_tcp_bind_http_port SELinux boolean is disabled: -$ getsebool named_tcp_bind_http_port -If properly configured, the output should show the following: -named_tcp_bind_http_port --> off - Is it the case that named_tcp_bind_http_port is not disabled? + + The runtime status of the net.ipv4.conf.default.rp_filter kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.rp_filter +1. + + Is it the case that the correct value is not returned? - - To verify that packages comprising the available updates will be automatically installed by dnf-automatic, run the following command: -$ sudo grep apply_updates /etc/dnf/automatic.conf -The output should return the following: -apply_updates = yes - Is it the case that apply_updates is not set to yes? + + Run the following command to determine if the gnutls-utils package is installed: $ rpm -q gnutls-utils + Is it the case that the package is not installed? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the rename system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r rename /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep rename /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_LEGACY_PTYS /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify the audit system prevents unauthorized changes with the following command: - -$ sudo grep "^\s*[^#]" /etc/audit/audit.rules | tail -1 --e 2 + + To determine if the system is configured to audit calls to the +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the audit system is not set to be immutable by adding the "-e 2" option to the end of "/etc/audit/audit.rules"? + Is it the case that no line is returned? - + -Run the following command to determine if the rsync_full_access SELinux boolean is disabled: -$ getsebool rsync_full_access +Run the following command to determine if the abrt_anon_write SELinux boolean is disabled: +$ getsebool abrt_anon_write If properly configured, the output should show the following: -rsync_full_access --> off - Is it the case that rsync_full_access is not disabled? +abrt_anon_write --> off + Is it the case that abrt_anon_write is not disabled? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_VMAP_STACK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? @@ -383634,294 +384329,175 @@ cdrecord_read_content --> off Is it the case that cdrecord_read_content is not disabled? - - Verify that the interactive user account passwords are using a strong -password hash with the following command: - -$ sudo cut -d: -f2 /etc/shadow - -$6$kcOnRq/5$NUEYPuyL.wghQwWssXRcLRFiiru7f5JPV6GaJhNC2aK5F3PZpE/BCCtwrxRc/AInKMNX3CdMw11m9STiql12f/ + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size. -Password hashes ! or * indicate inactive accounts not -available for logon and are not evaluated. - Is it the case that any interactive user password hash does not begin with "$6"? - - - - -Run the following command to determine if the minidlna_read_generic_user_content SELinux boolean is disabled: -$ getsebool minidlna_read_generic_user_content -If properly configured, the output should show the following: -minidlna_read_generic_user_content --> off - Is it the case that minidlna_read_generic_user_content is not disabled? - - - - To check the group ownership of /etc/ssh/sshd_config, -run the command: -$ ls -lL /etc/ssh/sshd_config -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/ssh/sshd_config does not have a group owner of root? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "sudoedit" command with the following command: +Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit files have reached maximum size with the following command: -$ sudo auditctl -l | grep sudoedit +$ sudo grep max_log_file_action /etc/audit/auditd.conf --a always,exit -F path=/usr/bin/sudoedit -F perm=x -F auid>=1000 -F auid!=unset -k privileged-sudoedit - Is it the case that the command does not return a line, or the line is commented out? +max_log_file_action = + Is it the case that the value of the "max_log_file_action" option is not "ROTATE", "SINGLE", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. If there is no evidence of appropriate action? - - -Run the following command to determine if the authlogin_nsswitch_use_ldap SELinux boolean is disabled: -$ getsebool authlogin_nsswitch_use_ldap -If properly configured, the output should show the following: -authlogin_nsswitch_use_ldap --> off - Is it the case that authlogin_nsswitch_use_ldap is not disabled? + + To ensure there are no read-write users, run the following command: +$ sudo grep -v "^#" /etc/snmp/snmpd.conf| grep 'rwuser' +There should be no output. + Is it the case that there are users who can write to SNMP values? - - The runtime status of the kernel.kexec_load_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.kexec_load_disabled -1. + + Verify Red Hat Enterprise Linux 8 is configured to limit the "pwquality" retry option to . - Is it the case that the correct value is not returned? - - - - Run the following command to determine if the rsync-daemon package is installed: -$ rpm -q rsync-daemon - Is it the case that the package is installed? - - - - To check the permissions of /etc/audit/auditd.conf, -run the command: -$ ls -l /etc/audit/auditd.conf -If properly configured, the output should indicate the following permissions: --rw-r----- - Is it the case that /etc/audit/auditd.conf does not have unix mode -rw-r-----? - - - - To verify that McAfee HIPS is installed, run the following command(s): -$ rpm -q MFEhiplsm - Is it the case that the HBSS HIPS module is not installed? - - - - Run the following command to determine if the sssd-ipa package is installed: $ rpm -q sssd-ipa - Is it the case that the package is not installed? - - - - The runtime status of the net.ipv6.conf.default.accept_source_route kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.default.accept_source_route -0. - Is it the case that the correct value is not returned? +Check for the use of the "pwquality" retry option in the pwquality.conf file with the following command: +$ grep retry /etc/security/pwquality.conf + Is it the case that the value of "retry" is set to "0" or greater than "<sub idref="var_password_pam_retry" />", or is missing? - - -To properly set the owner of /var/log/audit, run the command: -$ sudo chown root /var/log/audit - -To properly set the owner of /var/log/audit/*, run the command: -$ sudo chown root /var/log/audit/* - Is it the case that ? + + Run the following command to check if the group exists: +grep /etc/group +The output should contain the following line: +:x: + Is it the case that group exists and has no user members? - + -Run the following command to determine if the httpd_use_gpg SELinux boolean is disabled: -$ getsebool httpd_use_gpg +Run the following command to determine if the cvs_read_shadow SELinux boolean is disabled: +$ getsebool cvs_read_shadow If properly configured, the output should show the following: -httpd_use_gpg --> off - Is it the case that httpd_use_gpg is not disabled? +cvs_read_shadow --> off + Is it the case that cvs_read_shadow is not disabled? - - To ensure the system is configured to ignore the Ctrl-Alt-Del setting, -enter the following command: -$ sudo grep -i ctrlaltdelburstaction /etc/systemd/system.conf -The output should return: -CtrlAltDelBurstAction=none - Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed more than 7 times in 2 seconds.? + + Run the following command to see what the max sessions number is: +$ sudo grep MaxSessions /etc/ssh/sshd_config +If properly configured, the output should be: +MaxSessions + Is it the case that MaxSessions is not configured or not configured correctly? - - To ensure the tally directory is configured correctly, run the following command: -$ sudo grep 'dir =' /etc/security/faillock.conf -The output should show that dir is set to something other than "/var/run/faillock" - Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? + + To verify if the OpenSSH client uses defined Cipher suite in the Crypto Policy, run: +$ grep -i ciphers /etc/crypto-policies/back-ends/openssh.config +and verify that the line matches: +Ciphers + Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - To check the ownership of /boot/grub2/user.cfg, -run the command: -$ ls -lL /boot/grub2/user.cfg -If properly configured, the output should indicate the following owner: -root - Is it the case that /boot/grub2/user.cfg does not have an owner of root? + + +Run the following command to determine if the irc_use_any_tcp_ports SELinux boolean is disabled: +$ getsebool irc_use_any_tcp_ports +If properly configured, the output should show the following: +irc_use_any_tcp_ports --> off + Is it the case that irc_use_any_tcp_ports is not disabled? - - To check that the tftp service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled tftp -Output should indicate the tftp service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled tftp disabled - -Run the following command to verify tftp is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active tftp - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the tftp is masked, run the following command: -$ sudo systemctl show tftp | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "tftp" is loaded and not masked? + + To verify that the operating system protects against or limits the effects of DoS +attacks by ensuring implementation of rate-limiting measures +on impacted network interfaces, run the following command: +# grep 'net.ipv4.tcp_invalid_ratelimit' /etc/sysctl.conf /etc/sysctl.d/* +The command should output the following line: +/etc/sysctl.conf:net.ipv4.tcp_invalid_ratelimit = +The file where the line has been found can differ, but it must be either /etc/sysctl.conf +or a file located under the /etc/sysctl.d/ directory. + Is it the case that rate limiting of duplicate TCP acknowledgments is not configured? - - To determine if NOPASSWD has been configured for sudo, run the following command: -$ sudo grep -ri nopasswd /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that nopasswd is specified in the sudo config files? + + To ensure that the system prevents messages from being shown when three unsuccessful logon +attempts occur, run the following command: +$ grep silent /etc/security/faillock.conf +The output should show silent. + Is it the case that the system shows messages when three unsuccessful logon attempts occur? - + -Run the following command to determine if the webadm_read_user_files SELinux boolean is disabled: -$ getsebool webadm_read_user_files -If properly configured, the output should show the following: -webadm_read_user_files --> off - Is it the case that webadm_read_user_files is not disabled? +Run the following command to get the current configured value for secure_mode_insmod +SELinux boolean: +$ getsebool secure_mode_insmod +The expected cofiguration is . +"on" means true, and "off" means false + Is it the case that secure_mode_insmod is not set as expected? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_DEBUG_WX /boot/config.* + $ grep CONFIG_COMPAT_BRK /boot/config.* - For each kernel installed, a line with value "y" should be returned. + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. Is it the case that the kernel was not built with the required value? - - To check the ownership of /etc/cron.monthly, -run the command: -$ ls -lL /etc/cron.monthly -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/cron.monthly does not have an owner of root? - - - - To determine if use_pty has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\buse_pty\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that use_pty is not enabled in sudo? - - - - To determine if the system is configured to audit changes to its SELinux -configuration files, run the following command: -$ sudo auditctl -l | grep "dir=/usr/share/selinux" -If the system is configured to watch for changes to its SELinux -configuration, a line should be returned (including -perm=wa indicating permissions that are watched). - Is it the case that the system is not configured to audit attempts to change the MAC policy? + + To verify that packages comprising the available updates will be automatically installed by dnf-automatic, run the following command: +$ sudo grep apply_updates /etc/dnf/automatic.conf +The output should return the following: +apply_updates = yes + Is it the case that apply_updates is not set to yes? - + -Run the following command to determine if the entropyd_use_audio SELinux boolean is disabled: -$ getsebool entropyd_use_audio +Run the following command to determine if the git_session_users SELinux boolean is disabled: +$ getsebool git_session_users If properly configured, the output should show the following: -entropyd_use_audio --> off - Is it the case that entropyd_use_audio is not disabled? - - - - To determine if !authenticate has not been configured for sudo, run the following command: -$ sudo grep -r \!authenticate /etc/sudoers /etc/sudoers.d/ -The command should return no output. - Is it the case that !authenticate is specified in the sudo config files? +git_session_users --> off + Is it the case that git_session_users is not disabled? - + -Run the following command to determine if the httpd_can_network_connect SELinux boolean is disabled: -$ getsebool httpd_can_network_connect +Run the following command to determine if the virt_use_nfs SELinux boolean is disabled: +$ getsebool virt_use_nfs If properly configured, the output should show the following: -httpd_can_network_connect --> off - Is it the case that httpd_can_network_connect is not disabled? +virt_use_nfs --> off + Is it the case that virt_use_nfs is not disabled? - - To verify that remote access methods are logging to rsyslog, -run the following command: -grep -rE '(auth.\*|authpriv.\*|daemon.\*)' /etc/rsyslog.* -The output should contain auth.*, authpriv.*, and daemon.* -pointing to a log file. - Is it the case that remote access methods are not logging to rsyslog? + + To verify that audit is configured for OSPP v4.2.1, run the following commands: +for file in "10-base-config" "11-loginuid" "30-ospp-v42" "43-module-load";do diff /etc/audit/rules.d/$file.rules /usr/share/doc/audit*/rules/$file.rules; done + +If the system is configured properly, no lines should be returned. + Is it the case that the files are not there or differ? - - To check that the ypserv service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled ypserv -Output should indicate the ypserv service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled ypserv disabled - -Run the following command to verify ypserv is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active ypserv - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the ypserv is masked, run the following command: -$ sudo systemctl show ypserv | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "ypserv" is loaded and not masked? + + To determine if the system is configured to audit attempts to +alter time via the /etc/localtime file, run the following +command: +$ sudo auditctl -l | grep "watch=/etc/localtime" +If the system is configured to audit this activity, it will return a line. + Is it the case that the system is not configured to audit time changes? - - To check the group ownership of /etc/at.allow, -run the command: -$ ls -lL /etc/at.allow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/at.allow does not have a group owner of root? + + +Run the following command to determine if the mozilla_read_content SELinux boolean is disabled: +$ getsebool mozilla_read_content +If properly configured, the output should show the following: +mozilla_read_content --> off + Is it the case that mozilla_read_content is not disabled? - + -Run the following command to determine if the gluster_export_all_rw SELinux boolean is disabled: -$ getsebool gluster_export_all_rw -If properly configured, the output should show the following: -gluster_export_all_rw --> off - Is it the case that gluster_export_all_rw is not disabled? + +Run the following command to determine the current status of the +sssd service: +$ sudo systemctl is-active sssd +If the service is running, it should return the following: active + Is it the case that the service is not enabled? @@ -383932,1110 +384508,1016 @@ permissions: -rw------- Is it the case that it does not? - - To verify that null passwords cannot be used, run the following command: - -$ grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth - -If this produces any output, it may be possible to log into accounts -with empty passwords. Remove any instances of the nullok option to -prevent logins with empty passwords. - Is it the case that NULL passwords can be used? - - - - The runtime status of the kernel.core_uses_pid kernel parameter can be queried -by running the following command: -$ sysctl kernel.core_uses_pid -0. - Is it the case that the returned line does not have a value of 0? - - - + -Run the following command to determine if the logging_syslogd_use_tty SELinux boolean is enabled: -$ getsebool logging_syslogd_use_tty +Run the following command to determine if the spamassassin_can_network SELinux boolean is disabled: +$ getsebool spamassassin_can_network If properly configured, the output should show the following: -logging_syslogd_use_tty --> on - Is it the case that logging_syslogd_use_tty is not enabled? +spamassassin_can_network --> off + Is it the case that spamassassin_can_network is not disabled? - - Verify the noexec option is configured for the /home mount point, - run the following command: - $ sudo mount | grep '\s/home\s' - . . . /home . . . noexec . . . + + To verify the system is not configured to use a boot loader on removable media, +check that the grub configuration file has the set root command in each menu +entry with the following commands: +$ sudo grep -cw menuentry /boot/grub2/grub.cfg +Note that the -c option for the grep command will print +only the count of menuentry occurrences. This number should match +the number of occurrences reported by the following command: +$ sudo grep "set root='hd0" /boot/grub2/grub.cfg +The output should return something similar to: +set root='hd0,msdos1' +usb0, cd, fd0, etc. are some examples of removeable +media which should not exist in the lines: +set root='hd0,msdos1' + Is it the case that it is not? + + + + Check that Red Hat Enterprise Linux 8 has the packages for smart card support installed. - Is it the case that the "/home" file system does not have the "noexec" option set? +Run the following command to determine if the openssl-pkcs11 package is installed: +$ rpm -q openssl-pkcs11 + Is it the case that smartcard software is not installed? - + -Run the following command to determine if the polipo_connect_all_unreserved SELinux boolean is disabled: -$ getsebool polipo_connect_all_unreserved +Run the following command to determine if the samba_portmapper SELinux boolean is disabled: +$ getsebool samba_portmapper If properly configured, the output should show the following: -polipo_connect_all_unreserved --> off - Is it the case that polipo_connect_all_unreserved is not disabled? +samba_portmapper --> off + Is it the case that samba_portmapper is not disabled? - - Verify the value of the "difok" option in "/etc/security/pwquality.conf" with the following command: - -$ sudo grep difok /etc/security/pwquality.conf - -difok = - Is it the case that the value of "difok" is set to less than "<sub idref="var_password_pam_difok" />", or is commented out? + + To check the ownership of /boot/efi/EFI/redhat/grub.cfg, +run the command: +$ ls -lL /boot/efi/EFI/redhat/grub.cfg +If properly configured, the output should indicate the following owner: +root + Is it the case that /boot/efi/EFI/redhat/grub.cfg does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 enforces password complexity by requiring that at least one numeric character be used. - -Check the value for "dcredit" with the following command: + + To determine how the SSH daemon's AllowTcpForwarding option is set, run the following command: -$ sudo grep dcredit /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf +$ sudo grep -i AllowTcpForwarding /etc/ssh/sshd_config -/etc/security/pwquality.conf:dcredit = - Is it the case that the value of "dcredit" is a positive number or is commented out? +If a line indicating no is returned, then the required value is set. + Is it the case that The AllowTcpForwarding option exists and is disabled? - - # grep "^OPTIONS.*-u" /etc/sysconfig/chronyd | grep -v -e '-u\s*chrony\b' -returns no output - Is it the case that chronyd is not running under chrony user account? + + +Run the following command to determine if the virt_use_execmem SELinux boolean is disabled: +$ getsebool virt_use_execmem +If properly configured, the output should show the following: +virt_use_execmem --> off + Is it the case that virt_use_execmem is not disabled? - - Run the following command to determine if the rpcbind package is installed: -$ rpm -q rpcbind - Is it the case that the package is installed? + + +Run the following command to determine if the use_ecryptfs_home_dirs SELinux boolean is disabled: +$ getsebool use_ecryptfs_home_dirs +If properly configured, the output should show the following: +use_ecryptfs_home_dirs --> off + Is it the case that use_ecryptfs_home_dirs is not disabled? - - To check that the portreserve service is disabled in system boot configuration, + + To check that the netconsole service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled portreserve -Output should indicate the portreserve service has either not been installed, +$ sudo systemctl is-enabled netconsole +Output should indicate the netconsole service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled portreserve disabled +$ sudo systemctl is-enabled netconsole disabled -Run the following command to verify portreserve is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active portreserve +Run the following command to verify netconsole is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active netconsole If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the portreserve is masked, run the following command: -$ sudo systemctl show portreserve | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the netconsole is masked, run the following command: +$ sudo systemctl show netconsole | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "portreserve" is loaded and not masked? - - - - Run the following command to determine if the libreswan package is installed: $ rpm -q libreswan - Is it the case that the package is not installed? + Is it the case that the "netconsole" is loaded and not masked? - - The runtime status of the kernel.unprivileged_bpf_disabled kernel parameter can be queried -by running the following command: -$ sysctl kernel.unprivileged_bpf_disabled -1. - - Is it the case that the correct value is not returned? + + To verify all squashing has been disabled, run the following command: +$ grep all_squash /etc/exports + Is it the case that there is output? - - Inspect all instances of DocumentRoot and Alias. No -robots.txt file should exist. - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_ARM64_SW_TTBR0_PAN /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check the ownership of /etc/issue.net, + + To check the group ownership of /etc/shells, run the command: -$ ls -lL /etc/issue.net -If properly configured, the output should indicate the following owner: +$ ls -lL /etc/shells +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/issue.net does not have an owner of root? + Is it the case that /etc/shells does not have a group owner of root? - - The runtime status of the net.ipv4.conf.all.rp_filter parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.rp_filter -The output of the command should indicate either: -net.ipv4.conf.all.rp_filter = 1 -or: -net.ipv4.conf.all.rp_filter = 2 -The output of the command should not indicate: -net.ipv4.conf.all.rp_filter = 0 - -The preferable way how to assure the runtime compliance is to have -correct persistent configuration, and rebooting the system. + + Verify that all local interactive user initialization file executable search path statements do not contain statements that will reference a working directory other than user home directories with the following commands: -The persistent sysctl parameter configuration is performed by specifying the appropriate -assignment in any file located in the /etc/sysctl.d directory. -Verify that there is not any existing incorrect configuration by executing the following command: -$ grep -r '^\s*net.ipv4.conf.all.rp_filter\s*=' /etc/sysctl.conf /etc/sysctl.d -The command should not find any assignments other than: -net.ipv4.conf.all.rp_filter = 1 -or: -net.ipv4.conf.all.rp_filter = 2 +$ sudo grep -i path= /home/*/.* -Conflicting assignments are not allowed. - Is it the case that the net.ipv4.conf.all.rp_filter is not set to 1 or 2 or is configured to be 0? +/home/[localinteractiveuser]/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin + Is it the case that any local interactive user initialization files have executable search path statements that include directories outside of their home directory and is not documented with the ISSO as an operational requirement? - - Verify Red Hat Enterprise Linux 8 generates audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group" with the following command: + + Verify that Red Hat Enterprise Linux 8 enforces password complexity rules for the root account. -$ sudo auditctl -l | grep -E '(/etc/group)' +Check if root user is required to use complex passwords with the following command: --w /etc/group -p wa -k identity - Is it the case that the command does not return a line, or the line is commented out? +$ grep enforce_for_root /etc/security/pwquality.conf /etc/security/pwquality.conf.d/*.conf + +/etc/security/pwquality.conf:enforce_for_root + Is it the case that "enforce_for_root" is commented or missing? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PANIC_ON_OOPS /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + Run the following command to determine if the nfs-utils package is installed: +$ rpm -q nfs-utils + Is it the case that the package is installed? - - Query the SA and the Web Manager to determine if a compiler is present on -the server. - Is it the case that the web server is part of an application suite and a comiler is needed -for installation, patching, and upgrading of the suite or if the compiler -is embedded and can't be removed without breaking the suite, document the -installation of the compiler with the ISSO/ISSM and verify that the compiler -is restricted to administrative users only. If documented and restricted to -administrative users, this is not a finding. - -If an undocumented compiler is present, and available to non-administrative -users? + + To check if authentication is required for single-user mode, run the following command: +$ grep sulogin /usr/lib/systemd/system/rescue.service +The output should be similar to the following, and the line must begin with +ExecStart and /usr/lib/systemd/systemd-sulogin-shell. + ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue + Is it the case that the output is different? - - To check that the cpupower service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled cpupower -Output should indicate the cpupower service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cpupower disabled - -Run the following command to verify cpupower is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cpupower - -If the service is not running the command will return the following output: -inactive + + To ensure LDAP is configured to use TLS for all transactions, run the following command: +$ grep start_tls /etc/pam_ldap.conf +The result should contain: +ssl start_tls + Is it the case that LDAP is not in use, the line is commented out, or not configured correctly? + + + + Verify that Red Hat Enterprise Linux 8 disables the use of user namespaces with the following commands: -The service will also be masked, to check that the cpupower is masked, run the following command: -$ sudo systemctl show cpupower | grep "LoadState\|UnitFileState" +Note: User namespaces are used primarily for Linux containers. If containers are in use, this requirement is not applicable. -If the service is masked the command will return the following outputs: +The runtime status of the user.max_user_namespaces kernel parameter can be queried +by running the following command: +$ sysctl user.max_user_namespaces +0. -LoadState=masked + Is it the case that the correct value is not returned? + + + + The runtime status of the net.ipv6.conf.default.autoconf kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.autoconf +0. -UnitFileState=masked - Is it the case that the "cpupower" is loaded and not masked? + Is it the case that the correct value is not returned? - - To verify that SSSD is configured to run as user sssd, run the following command: -$ sudo grep -r '\buser\b' /etc/sssd -If configured properly, output should similar to /etc/sssd/conf.d/ospp.conf:user = sssd. -Sanity of SSSD configuration in general can be checked using $ sudo sssctl config-check - Is it the case that it does not exist or is not configured properly? + + +Run the following command to determine if the httpd_anon_write SELinux boolean is disabled: +$ getsebool httpd_anon_write +If properly configured, the output should show the following: +httpd_anon_write --> off + Is it the case that httpd_anon_write is not disabled? - - To determine how the SSH daemon's PermitUserEnvironment option is set, run the following command: - -$ sudo grep -i PermitUserEnvironment /etc/ssh/sshd_config + + Verify the "/etc/security/faillock.conf" file is configured use a non-default faillock directory to ensure contents persist after reboot: -If a line indicating no is returned, then the required value is set. +$ sudo grep 'dir =' /etc/security/faillock.conf - Is it the case that the required value is not set? +dir = /var/log/faillock + Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? - - To check that the mdmonitor service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled mdmonitor -Output should indicate the mdmonitor service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled mdmonitor disabled - -Run the following command to verify mdmonitor is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active mdmonitor - -If the service is not running the command will return the following output: -inactive - -The service will also be masked, to check that the mdmonitor is masked, run the following command: -$ sudo systemctl show mdmonitor | grep "LoadState\|UnitFileState" - -If the service is masked the command will return the following outputs: - -LoadState=masked - -UnitFileState=masked - Is it the case that the "mdmonitor" is loaded and not masked? + + +Run the following command to determine if the webadm_read_user_files SELinux boolean is disabled: +$ getsebool webadm_read_user_files +If properly configured, the output should show the following: +webadm_read_user_files --> off + Is it the case that webadm_read_user_files is not disabled? - - To verify the operating system prevents non-privileged users from executing -privileged functions to include disabling, circumventing, or altering -implemented security safeguards/countermeasures, run the following -command: -$ sudo semanage login -l -All administrators must be mapped to the sysadm_u or staff_u -users with the appropriate domains (sysadm_t and staff_t). - -All authorized non-administrative -users must be mapped to the user_u role or the appropriate domain -(user_t). - Is it the case that non-admin users are not confined correctly? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_LEGACY_VSYSCALL_EMULATE /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - Verify the nosuid option is configured for the /var mount point, - run the following command: - $ sudo mount | grep '\s/var\s' - . . . /var . . . nosuid . . . - - Is it the case that the "/var" file system does not have the "nosuid" option set? + + +Run the following command to determine if the cobbler_use_nfs SELinux boolean is disabled: +$ getsebool cobbler_use_nfs +If properly configured, the output should show the following: +cobbler_use_nfs --> off + Is it the case that cobbler_use_nfs is not disabled? - - To check the group ownership of /etc/shells, -run the command: -$ ls -lL /etc/shells -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/shells does not have a group owner of root? + + +Run the following command to determine if the selinuxuser_execstack SELinux boolean is disabled: +$ getsebool selinuxuser_execstack +If properly configured, the output should show the following: +selinuxuser_execstack --> off + Is it the case that selinuxuser_execstack is not disabled? - - Determine if "sudoers" file restricts sudo access run the following commands: -$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* -$ sudo grep -PR '^\s*ALL\s+ALL\=\(ALL\:ALL\)\s+ALL\s*$' /etc/sudoers /etc/sudoers.d/* - Is it the case that either of the commands returned a line? + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +$ sudo cat /etc/audit/rules.d/11-loginuid.rules +The output has to be exactly as follows: +## Make the loginuid immutable. This prevents tampering with the auid. +--loginuid-immutable + Is it the case that the file does not exist or the content differs? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_SECCOMP_FILTER /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check the permissions of /etc/cron.allow, +run the command: +$ ls -l /etc/cron.allow +If properly configured, the output should indicate the following permissions: +-rw------- + Is it the case that /etc/cron.allow does not have unix mode -rw-------? - - Verify that only the "root" account has a UID "0" assignment with the -following command: -$ awk -F: '$3 == 0 {print $1}' /etc/passwd -root - Is it the case that any accounts other than "root" have a UID of "0"? + + To ensure only SNMPv3 or newer is used, run the following command: +$ sudo grep 'rocommunity\|rwcommunity\|com2sec' /etc/snmp/snmpd.conf | grep -v "^#" +There should be no output. + Is it the case that there is output? - - The file /etc/cron.allow should exist. -This can be checked by running the following command: - -stat /etc/cron.allow - -and the output should list the file. - Is it the case that the file /etc/cron.allow does not exist? + + Run the following command to determine if the avahi package is installed: +$ rpm -q avahi + Is it the case that the package is installed? - + -If the system is configured to prevent the loading of the iwlwifi kernel module, -it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. -These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. - -These lines can also instruct the module loading system to ignore the iwlwifi kernel module via blacklist keyword. +Run the following command to determine if the gssd_read_tmp SELinux boolean is enabled: +$ getsebool gssd_read_tmp +If properly configured, the output should show the following: +gssd_read_tmp --> on + Is it the case that gssd_read_tmp is not enabled? + + + + The runtime status of the net.core.bpf_jit_harden kernel parameter can be queried +by running the following command: +$ sysctl net.core.bpf_jit_harden +2. -Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r iwlwifi /etc/modprobe.conf /etc/modprobe.d - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + + To verify if the OpenSSL uses defined TLS Crypto Policy, run: +$ grep -P '^(TLS\.)?MinProtocol' /etc/crypto-policies/back-ends/opensslcnf.config +and verify that the value is +TLSv1.2 + Is it the case that cryptographic policy for openssl is not configured or is configured incorrectly? + + + To determine if the system is configured to audit calls to the -finit_module system call, run the following command: -$ sudo grep "finit_module" /etc/audit/audit.* +renameat system call, run the following command: +$ sudo grep "renameat" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To check the ownership of /etc/shadow-, + + To verify that Samba clients using mount.cifs must use packet signing, run the following command: +$ grep sec /etc/fstab +The output should show either krb5i or ntlmv2i in use. + Is it the case that it does not? + + + + To check the permissions of /etc/audit/rules.d/*.rules, run the command: -$ ls -lL /etc/shadow- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/shadow- does not have an owner of root? +$ ls -l /etc/audit/rules.d/*.rules +If properly configured, the output should indicate the following permissions: +-rw-r----- + Is it the case that /etc/audit/rules.d/*.rules does not have unix mode -rw-r-----? - - Verify that GRUB_DISABLE_RECOVERY is set to true in /etc/default/grub to disable recovery boot. -Run the following command: - -$ sudo grep GRUB_DISABLE_RECOVERY /etc/default/grub - Is it the case that GRUB_DISABLE_RECOVERY is not set to true or is missing? + + Run the following command to determine if the dhcp-server package is installed: +$ rpm -q dhcp-server + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to notify the SA and/or ISSO (at a minimum) in the event of an audit processing failure with the following command: - -$ sudo grep action_mail_acct /etc/audit/auditd.conf + + The runtime status of the fs.protected_symlinks kernel parameter can be queried +by running the following command: +$ sysctl fs.protected_symlinks +1. -action_mail_acct = - Is it the case that the value of the "action_mail_acct" keyword is not set to "<sub idref="var_auditd_action_mail_acct" />" and/or other accounts for security personnel, the "action_mail_acct" keyword is missing, or the retuned line is commented out, ask the system administrator to indicate how they and the ISSO are notified of an audit process failure. If there is no evidence of the proper personnel being notified of an audit processing failure? + Is it the case that the correct value is not returned? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "chcon" command with the following command: - -$ sudo auditctl -l | grep chcon + + The runtime status of the net.ipv4.conf.all.arp_ignore kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.arp_ignore +. --a always,exit -F path=/usr/bin/chcon -F perm=x -F auid>=1000 -F auid!=unset -k perm_mod - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the correct value is not returned? - - To verify that auditing of privileged command use is configured, run the -following command: -$ sudo grep usernetctl /etc/audit/audit.rules /etc/audit/rules.d/* -It should return a relevant line in the audit rules. - Is it the case that the command does not return a line, or the line is commented out? + + Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server + Is it the case that the package is installed? - - Verify Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full. - -Check that Red Hat Enterprise Linux 8 takes the appropriate action when the audit storage volume is full with the following command: - -$ sudo grep disk_full_action /etc/audit/auditd.conf + + Verify the value of the "maxclassrepeat" option in "/etc/security/pwquality.conf" with the following command: -disk_full_action = +$ grep maxclassrepeat /etc/security/pwquality.conf -If the value of the "disk_full_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit storage volume is full. - Is it the case that there is no evidence of appropriate action? +maxclassrepeat = + Is it the case that the value of "maxclassrepeat" is set to "0", more than "<sub idref="var_password_pam_maxclassrepeat" />" or is commented out? - - Verify "nftables" is configured to allow rate limits on any connection to the system with the following command: - -Verify "firewalld" has "nftables" set as the default backend: - -$ sudo grep -i firewallbackend /etc/firewalld/firewalld.conf - -# FirewallBackend -FirewallBackend=nftables - Is it the case that the "nftables" is not set as the "firewallbackend"? + + To check if the installed Operating System is 64-bit, run the following command: +$ uname -m +The output should be one of the following: x86_64, aarch64, ppc64le or s390x. +If the output is i686 or i386 the operating system is 32-bit. +Check if the installed CPU supports 64-bit operating systems by running the following command: +$ lscpu | grep "CPU op-mode" +If the output contains 64bit, the CPU supports 64-bit operating systems. + Is it the case that the installed operating sytem is 32-bit but the CPU supports operation in 64-bit? - - Verify the nosuid option is configured for the /var/log mount point, - run the following command: - $ sudo mount | grep '\s/var/log\s' - . . . /var/log . . . nosuid . . . + + To determine if the system is configured to audit calls to the +finit_module system call, run the following command: +$ sudo grep "finit_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/var/log" file system does not have the "nosuid" option set? + Is it the case that no line is returned? - + -Run the following command to determine if the sysadm_exec_content SELinux boolean is enabled: -$ getsebool sysadm_exec_content +Run the following command to determine if the deny_ptrace SELinux boolean is disabled: +$ getsebool deny_ptrace If properly configured, the output should show the following: -sysadm_exec_content --> on - Is it the case that sysadm_exec_content is not enabled? - - - - To check the group ownership of /etc/issue, -run the command: -$ ls -lL /etc/issue -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/issue does not have a group owner of root? +deny_ptrace --> off + Is it the case that deny_ptrace is not disabled? - + -Run the following command to determine if the saslauthd_read_shadow SELinux boolean is disabled: -$ getsebool saslauthd_read_shadow +Run the following command to determine if the squid_connect_any SELinux boolean is disabled: +$ getsebool squid_connect_any If properly configured, the output should show the following: -saslauthd_read_shadow --> off - Is it the case that saslauthd_read_shadow is not disabled? - - - - To determine how the SSH daemon's X11Forwarding option is set, run the following command: - -$ sudo grep -i X11Forwarding /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? - - - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_COMPAT_VDSO /boot/config.* - - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. - - Is it the case that the kernel was not built with the required value? +squid_connect_any --> off + Is it the case that squid_connect_any is not disabled? - - Run the following command to determine if the setroubleshoot-plugins package is installed: -$ rpm -q setroubleshoot-plugins + + Run the following command to determine if the rsh-server package is installed: +$ rpm -q rsh-server Is it the case that the package is installed? - - To verify that null passwords cannot be used, run the following command: -$ sudo awk -F: '!$2 {print $1}' /etc/shadow -If this produces any output, it may be possible to log into accounts -with empty passwords. - Is it the case that Blank or NULL passwords can be used? - - - - Verify that the IPSec service uses the system crypto policy. - -If the ipsec service is not installed is not applicable. - -Check to see if the "IPsec" service is active with the following command: - -$ systemctl status ipsec - -ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec -Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) -Active: inactive (dead) - -If the "IPsec" service is active, check to see if it is using the system crypto policy with the following command: - -$ sudo grep include /etc/ipsec.conf /etc/ipsec.d/*.conf - -/etc/ipsec.conf:include /etc/crypto-policies/back-ends/libreswan.config - Is it the case that the "IPsec" service is active and the ipsec configuration file does not contain does not contain <tt>include /etc/crypto-policies/back-ends/libreswan.config</tt>? - - - + -Run the following command to determine if the awstats_purge_apache_log_files SELinux boolean is disabled: -$ getsebool awstats_purge_apache_log_files +Run the following command to determine if the pcp_bind_all_unreserved_ports SELinux boolean is disabled: +$ getsebool pcp_bind_all_unreserved_ports If properly configured, the output should show the following: -awstats_purge_apache_log_files --> off - Is it the case that awstats_purge_apache_log_files is not disabled? - - - - To ensure that system location tracking is not active, run the following command: -$ gsettings get org.gnome.system.location enabled -$ gsettings get org.gnome.clocks geolocation -If properly configured, the output should be false. -To ensure that users cannot enable system location tracking, run the following: -$ grep location /etc/dconf/db/local.d/locks/* -If properly configured, the output should be -/org/gnome/system/location/enabled and /org/gnome/clocks/geolocation. - Is it the case that geolocation is enabled and not disabled? +pcp_bind_all_unreserved_ports --> off + Is it the case that pcp_bind_all_unreserved_ports is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "init" command with the following command: - -$ sudo auditctl -l | grep init + + Verify Red Hat Enterprise Linux 8 enforces a delay of at least seconds between console logon prompts following a failed logon attempt with the following command: --a always,exit -F path=/init -F perm=x -F auid>=1000 -F auid!=unset -k privileged-init - Is it the case that the command does not return a line, or the line is commented out? +$ sudo grep -i "FAIL_DELAY" /etc/login.defs +FAIL_DELAY + Is it the case that the value of "FAIL_DELAY" is not set to "<sub idref="var_accounts_fail_delay" />" or greater, or the line is commented out? - - To check if compression is enabled or set correctly, run the -following command: -$ sudo grep Compression /etc/ssh/sshd_config -If configured properly, output should be no or delayed. - Is it the case that it is commented out, or is not set to no or delayed? + + To determine if the system is configured to audit unsuccessful calls +to the lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - To verify that the audit system collects unauthorized file accesses, run the following commands: -$ sudo grep EACCES /etc/audit/audit.rules -$ sudo grep EPERM /etc/audit/audit.rules - Is it the case that 32-bit and 64-bit system calls to creat, open, openat, open_by_handle_at, truncate, and ftruncate are not audited during EACCES and EPERM? + + Display the contents of the file /etc/systemd/logind.conf: +cat /etc/systemd/logind.conf +Ensure that there is a section [login] which contains the +configuration StopIdleSessionSec=. + Is it the case that the option is not configured? - - -Run the following command to determine if the nagios_run_pnp4nagios SELinux boolean is disabled: -$ getsebool nagios_run_pnp4nagios -If properly configured, the output should show the following: -nagios_run_pnp4nagios --> off - Is it the case that nagios_run_pnp4nagios is not disabled? + + To verify that the interface(s) follow site policy for zone assignment run the +following command: +$ sudo nmcli -t connection show | awk -F: '{if($4){print $4}}' | while read INT; +do firewall-cmd --get-active-zones | grep -B1 $INT; done +If your have to assign an interface to the appropriate zone run the following command: +$ sudo firewall-cmd --zone= --change-interface= + Is it the case that Your system accepts all incoming packets for unnecessary services and ports? - - To find SUID files, run the following command: -$ sudo find / -xdev -type f -perm -4000 - Is it the case that only authorized files appear in the output of the find command? + + To verify the INACTIVE setting, run the following command: +$ grep "INACTIVE" /etc/default/useradd +The output should indicate the INACTIVE configuration option is set +to an appropriate integer as shown in the example below: +$ grep "INACTIVE" /etc/default/useradd +INACTIVE= + Is it the case that the value of INACTIVE is greater than the expected value or is -1? - - Run the following command to determine if the iprutils package is installed: -$ rpm -q iprutils - Is it the case that the package is installed? + + To determine if the system is configured to audit changes to its network configuration, +run the following command: +auditctl -l | grep -E '(/etc/issue|/etc/issue.net|/etc/hosts|/etc/sysconfig/network)' +If the system is configured to watch for network configuration changes, a line should be returned for +each file specified (and perm=wa should be indicated for each). + Is it the case that the system is not configured to audit changes of the network configuration? - - To verify that cryptography policy has been configured correctly, run the -following command: -$ update-crypto-policies --show -The output should return . -Run the command to check if the policy is correctly applied: -$ update-crypto-policies --is-applied -The output should be The configured policy is applied. -Moreover, check if settings for selected crypto policy are as expected. -List all libraries for which it holds that their crypto policies do not have symbolic link in /etc/crypto-policies/back-ends. -$ ls -l /etc/crypto-policies/back-ends/ | grep '^[^l]' | tail -n +2 | awk -F' ' '{print $NF}' | awk -F'.' '{print $1}' | sort -Subsequently, check if matching libraries have drop in files in the /etc/crypto-policies/local.d directory. -$ ls /etc/crypto-policies/local.d/ | awk -F'-' '{print $1}' | uniq | sort -Outputs of two previous commands should match. - Is it the case that cryptographic policy is not configured or is configured incorrectly? + + Run the following command to determine if the openscap-scanner package is installed: $ rpm -q openscap-scanner + Is it the case that the package is not installed? - - Verify that Red Hat Enterprise Linux 8 enforces a -day maximum password lifetime for new user accounts by running the following command: - -$ grep -i pass_max_days /etc/login.defs - -PASS_MAX_DAYS - Is it the case that the "PASS_MAX_DAYS" parameter value is greater than "<sub idref="var_accounts_maximum_age_login_defs" />", or commented out? + + Inspect the mounts configured in /etc/exports. Each mount should specify a value +greater than UID_MAX and GID_MAX as defined in /etc/login.defs. + Is it the case that anonuid or anongid are not set to a value greater than UID_MAX (for anonuid) and GID_MAX (for anongid)? - - Verify the nosuid option is configured for the /boot/efi mount point, + + Verify the nosuid option is configured for the /var mount point, run the following command: - $ sudo mount | grep '\s/boot/efi\s' - . . . /boot/efi . . . nosuid . . . + $ sudo mount | grep '\s/var\s' + . . . /var . . . nosuid . . . - Is it the case that the "/boot/efi" file system does not have the "nosuid" option set? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes slab_nomerge=yes, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*slab_nomerge=yes.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*slab_nomerge=yes.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'slab_nomerge=yes' -The command should not return any output. - Is it the case that merging of slabs with similar size is enabled? + Is it the case that the "/var" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_mod_auth_pam SELinux boolean is disabled: -$ getsebool httpd_mod_auth_pam +Run the following command to determine if the virt_rw_qemu_ga_data SELinux boolean is disabled: +$ getsebool virt_rw_qemu_ga_data If properly configured, the output should show the following: -httpd_mod_auth_pam --> off - Is it the case that httpd_mod_auth_pam is not disabled? +virt_rw_qemu_ga_data --> off + Is it the case that virt_rw_qemu_ga_data is not disabled? - - -Run the following command to determine if the daemons_dump_core SELinux boolean is disabled: -$ getsebool daemons_dump_core -If properly configured, the output should show the following: -daemons_dump_core --> off - Is it the case that daemons_dump_core is not disabled? + + To determine if the system is configured to audit calls to the +query_module system call, run the following command: +$ sudo grep "query_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - + + To check if pam_namespace.so is required for user login, run the following command: +$ grep pam_namespace.so /etc/pam.d/login +The output should return the following uncommented: +session required pam_namespace.so + Is it the case that pam_namespace.so is not required or is commented out? + + + -Run the following command to determine if the mozilla_plugin_use_gps SELinux boolean is disabled: -$ getsebool mozilla_plugin_use_gps +Run the following command to determine if the neutron_can_network SELinux boolean is disabled: +$ getsebool neutron_can_network If properly configured, the output should show the following: -mozilla_plugin_use_gps --> off - Is it the case that mozilla_plugin_use_gps is not disabled? +neutron_can_network --> off + Is it the case that neutron_can_network is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_PAGE_POISONING /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To check if the system login banner is compliant, run the following command: +$ cat /etc/issue.net + Is it the case that it does not display the required banner? - - Run the following command to determine if the tuned package is installed: -$ rpm -q tuned - Is it the case that the package is installed? + + +Run the following command to determine if the unprivuser_use_svirt SELinux boolean is disabled: +$ getsebool unprivuser_use_svirt +If properly configured, the output should show the following: +unprivuser_use_svirt --> off + Is it the case that unprivuser_use_svirt is not disabled? - + -Run the following command to determine if the httpd_graceful_shutdown SELinux boolean is enabled: -$ getsebool httpd_graceful_shutdown -If properly configured, the output should show the following: -httpd_graceful_shutdown --> on - Is it the case that httpd_graceful_shutdown is not enabled? + +Run the following command to determine the current status of the +rngd service: +$ sudo systemctl is-active rngd +If the service is running, it should return the following: active + Is it the case that the "rngd" service is disabled, masked, or not started.? - - If IPv6 is disabled, this is not applicable. + + Verify Red Hat Enterprise Linux 8 shell initialization file is configured to start each shell with the tmux terminal multiplexer. +Determine the location of the tmux script with the following command: +$ sudo grep tmux /etc/bashrc /etc/profile.d/* -Run the following command to determine the current status of the -ip6tables service: -$ sudo systemctl is-active ip6tables -If the service is running, it should return the following: active - Is it the case that ? +/etc/profile.d/tmux.sh: case "$name" in (sshd|login) tmux ;; esac + +Review the tmux script by using the following example: + +$ cat /etc/profile.d/tmux.sh + +if [ "$PS1" ]; then +parent=$(ps -o ppid= -p $$) +name=$(ps -o comm= -p $parent) +case "$name" in (sshd|login) tmux ;; esac +fi + +If the shell file is not configured as the example above, is commented out, or is missing, this is a finding. + +Determine if tmux is currently running with the following command: + +$ sudo ps all | grep tmux | grep -v grep + Is it the case that the command does not produce output? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_MODULE_SIG_SHA512 /boot/config.* + $ grep CONFIG_LEGACY_VSYSCALL_NONE /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the gnutls-utils package is installed: $ rpm -q gnutls-utils - Is it the case that the package is not installed? - - - - Run the following command to determine if the avahi package is installed: -$ rpm -q avahi - Is it the case that the package is installed? + + +Run the following command to determine if the kerberos_enabled SELinux boolean is enabled: +$ getsebool kerberos_enabled +If properly configured, the output should show the following: +kerberos_enabled --> on + Is it the case that kerberos_enabled is not enabled? - - To verify that Audit Daemon is configured to record the computer node -name in the audit events, run the following command: -$ sudo grep name_format /etc/audit/auditd.conf -The output should return the following: -name_format = - Is it the case that name_format isn't set to <sub idref="var_auditd_name_format" />? + + Verify Red Hat Enterprise Linux 8 audits the execution of privileged functions. + +Check if Red Hat Enterprise Linux 8 is configured to audit the execution of the "execve" system call using the following command: + +$ sudo grep execve /etc/audit/audit.rules + +The output should be the following: + + +-a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid +-a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid +-a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid + Is it the case that the command does not return all lines, or the lines are commented out? - - Verify that there are no shosts.equiv files on the system, run the following command: -$ find / -name shosts.equiv - Is it the case that shosts.equiv files exist? + + The runtime status of the net.ipv4.ip_forward kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.ip_forward +0. +The ability to forward packets is only appropriate for routers. + Is it the case that the correct value is not returned? - - Run the following command to verify that the MTA is not listening on -any non-loopback address (127.0.0.1 or ::1). -# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|::1):25\s' -Nothing should be returned - Is it the case that MTA is listening on any non-loopback address? + + The runtime status of the fs.protected_hardlinks kernel parameter can be queried +by running the following command: +$ sysctl fs.protected_hardlinks +1. + + Is it the case that the correct value is not returned? - - -Run the following command to determine if the cobbler_can_network_connect SELinux boolean is disabled: -$ getsebool cobbler_can_network_connect -If properly configured, the output should show the following: -cobbler_can_network_connect --> off - Is it the case that cobbler_can_network_connect is not disabled? + + To check for legacy lines in /etc/group, run the following command: + grep '^\+' /etc/group +The command should not return any output. + Is it the case that the file contains legacy lines? - - -Run the following command to determine if the polipo_session_users SELinux boolean is disabled: -$ getsebool polipo_session_users -If properly configured, the output should show the following: -polipo_session_users --> off - Is it the case that polipo_session_users is not disabled? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine how much data the system will retain in each audit log file: +$ sudo grep max_log_file /etc/audit/auditd.conf +max_log_file = 6 + Is it the case that the system audit data threshold has not been properly configured? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_STACKPROTECTOR_STRONG /boot/config.* + $ grep CONFIG_DEBUG_NOTIFIERS /boot/config.* For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-agent" command with the following command: -Run the following command to determine the current status of the -postfix service: -$ sudo systemctl is-active postfix -If the service is running, it should return the following: active - Is it the case that the system is not a cross domain solution and the service is not enabled? +$ sudo auditctl -l | grep ssh-agent + +-a always,exit -F path=/usr/bin/ssh-agent -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-agent + Is it the case that the command does not return a line, or the line is commented out? - - + + The runtime status of the net.ipv4.conf.all.arp_filter kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.arp_filter +. -Run the following command to determine the current status of the -usbguard service: -$ sudo systemctl is-active usbguard -If the service is running, it should return the following: active - Is it the case that the service is not enabled? + Is it the case that the correct value is not returned? - - To verify that clients cannot automatically update DNS records, perform the -following: -$ grep -i dhcp_hostname /etc/sysconfig/network-scripts/ifcfg-* -$ grep -rni "send host-name" /etc/dhclient.conf /etc/dhcp -The output should return no results. - Is it the case that client Dynamic DNS updates are not disabled? + + To check the ownership of /etc/shadow-, +run the command: +$ ls -lL /etc/shadow- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/shadow- does not have an owner of root? - - To determine how the SSH daemon's PubkeyAuthentication option is set, run the following command: - -$ sudo grep -i PubkeyAuthentication /etc/ssh/sshd_config - -If a line indicating no is returned, then the required value is set. - - Is it the case that the required value is not set? + + +Run the following command to determine if the telepathy_tcp_connect_generic_network_ports SELinux boolean is disabled: +$ getsebool telepathy_tcp_connect_generic_network_ports +If properly configured, the output should show the following: +telepathy_tcp_connect_generic_network_ports --> off + Is it the case that telepathy_tcp_connect_generic_network_ports is not disabled? - - To verify that McAfee Runtime Libraries (MFErt) and Linux Agent (MFEcma) -are installed, run the following command(s): -$ rpm -q MFEcma -$ rpm -q MFErt - Is it the case that the HBSS HIPS module is not installed? + + Run the following command to determine if the tmux package is installed: $ rpm -q tmux + Is it the case that the package is not installed? - - To verify that Samba clients running smbclient must use packet signing, run the following command: -$ grep signing /etc/samba/smb.conf -The output should show: -client signing = mandatory - Is it the case that it is not? + + +Run the following command to determine if the named_write_master_zones SELinux boolean is disabled: +$ getsebool named_write_master_zones +If properly configured, the output should show the following: +named_write_master_zones --> off + Is it the case that named_write_master_zones is not disabled? - + -To properly set the owner of /var/log/httpd, run the command: -$ sudo chown root /var/log/httpd - -To properly set the owner of /var/log/httpd/*, run the command: -$ sudo chown root /var/log/httpd/* - Is it the case that ? +Run the following command to determine if the xend_run_qemu SELinux boolean is enabled: +$ getsebool xend_run_qemu +If properly configured, the output should show the following: +xend_run_qemu --> on + Is it the case that xend_run_qemu is not enabled? - - Verify Red Hat Enterprise Linux 8 removes all software components after updated versions have been installed. - + + Find the list of alias maps used by the Postfix mail server: +$ sudo postconf alias_maps +Query the Postfix alias maps for an alias for the root user: +$ sudo postmap -q root hash:/etc/aliases +The output should return an alias. + Is it the case that the alias is not set? + + + + root password is not set + Is it the case that Perform the following to determine if a password is set for the +root user: +<pre># grep -Eq '^root:\$[0-9]' /etc/shadow || echo "root is locked"</pre> +No results should be returned. +Otherwise, run the following command and follow the prompts to set a +password for the root user: +<pre># passwd root</pre>? + + + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -$ grep clean_requirements_on_remove /etc/yum.conf -clean_requirements_on_remove=1 - Is it the case that '"clean_requirements_on_remove" is not set to "1"'? + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open system call. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the rename system call. If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: -$ sudo grep -r open /etc/audit/rules.d +$ sudo grep -r rename /etc/audit/rules.d If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ sudo grep open /etc/audit/audit.rules +$ sudo grep rename /etc/audit/audit.rules The output should be the following: --a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access --a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access - Is it the case that the command does not return a line, or the line is commented out? - - - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "unix_update" command with the following command: - -$ sudo auditctl -l | grep unix_update - --a always,exit -F path=/usr/bin/unix_update -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix_update +-a always,exit -F arch=b32 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S rename -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete Is it the case that the command does not return a line, or the line is commented out? - - Run the following command to determine if the vim-enhanced package is installed: $ rpm -q vim-enhanced - Is it the case that the package is not installed? - - - - Run the following command to check the mode of the system audit logs: -$ sudo grep -iw log_file /etc/audit/auditd.conf -log_file=/var/log/audit/audit.log -$ sudo stat -c "%n %a" /var/log/audit/* -$ sudo ls -l /var/log/audit -Audit logs must be mode 0640 or less permissive. - Is it the case that any permissions are more permissive? + + Run the following command to verify that the MTA is not listening on +any non-loopback address (127.0.0.1 or ::1). +# ss -lntu | grep -E ':25\s' | grep -E -v '\s(127.0.0.1|::1):25\s' +Nothing should be returned + Is it the case that MTA is listening on any non-loopback address? - - To check that the bluetooth service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled bluetooth -Output should indicate the bluetooth service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled bluetooth disabled - -Run the following command to verify bluetooth is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active bluetooth + + Verify the "umask" setting is configured correctly in the "/etc/csh.cshrc" file with the following command: -If the service is not running the command will return the following output: -inactive +$ grep umask /etc/csh.cshrc -The service will also be masked, to check that the bluetooth is masked, run the following command: -$ sudo systemctl show bluetooth | grep "LoadState\|UnitFileState" +umask 077 +umask 077 + Is it the case that the value for the "umask" parameter is not "<sub idref="var_accounts_user_umask" />", or the "umask" parameter is missing or is commented out? + + + + Open browser window and browse to the appropriate site. Before entry to the +site, you should be presented with the server's PKI credentials. Review +these credentials for authenticity. -If the service is masked the command will return the following outputs: +For DoD, find an entry which cites: -LoadState=masked +Issuer: +CN = +DOD CLASS 3 CA-3 +OU = PKI +OU = DoD +O = U.S. Government +C = US -UnitFileState=masked - Is it the case that the "bluetooth" is loaded and not masked? + Is it the case that it is not? - - Verify that a separate file system/partition has been created for /opt with the following command: - -$ mountpoint /opt - - Is it the case that "/opt is not a mountpoint" is returned? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_STACKPROTECTOR /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the openssh-server package is installed: $ rpm -q openssh-server - Is it the case that the package is not installed? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes audit=1, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit=1.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*audit=1.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'audit=1' +The command should not return any output. + Is it the case that auditing is not enabled at boot time? - - To determine if the system is configured to audit calls to the -fsetxattr system call, run the following command: -$ sudo grep "fsetxattr" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + Verify the nosuid option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . nosuid . . . - Is it the case that no line is returned? + Is it the case that the "/dev/shm" file system does not have the "nosuid" option set? - + -Run the following command to determine if the httpd_use_openstack SELinux boolean is disabled: -$ getsebool httpd_use_openstack +Run the following command to determine if the domain_kernel_load_modules SELinux boolean is disabled: +$ getsebool domain_kernel_load_modules If properly configured, the output should show the following: -httpd_use_openstack --> off - Is it the case that httpd_use_openstack is not disabled? - - - - To check the ownership of /etc/passwd-, -run the command: -$ ls -lL /etc/passwd- -If properly configured, the output should indicate the following owner: -root - Is it the case that /etc/passwd- does not have an owner of root? - - - - To determine if ignore_dot has been configured for sudo, run the following command: -$ sudo grep -ri "^[\s]*Defaults.*\bignore_dot\b.*" /etc/sudoers /etc/sudoers.d/ -The command should return a matching output. - Is it the case that ignore_dot is not enabled in sudo? +domain_kernel_load_modules --> off + Is it the case that domain_kernel_load_modules is not disabled? - - Verify that the interactive user account passwords last change time is not in the future -The following command should return no output -$ sudo expiration=$(cat /etc/shadow|awk -F ':' '{print $3}'); -for edate in ${expiration[@]}; do if [[ $edate > $(( $(date +%s)/86400 )) ]]; -then echo "Expiry date in future"; -fi; done - Is it the case that any interactive user password that has last change time in the future? + + To check that no password hashes are stored in +/etc/passwd, run the following command: +awk '!/\S:x|\*/ {print}' /etc/passwd +If it produces any output, then a password hash is +stored in /etc/passwd. + Is it the case that any stored hashes are found in /etc/passwd? - - -Run the following command to determine if the secure_mode_policyload SELinux boolean is disabled: -$ getsebool secure_mode_policyload -If properly configured, the output should show the following: -secure_mode_policyload --> off - Is it the case that secure_mode_policyload is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_DEBUG_SG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the dnf-automatic package is installed: $ rpm -q dnf-automatic - Is it the case that the package is not installed? + + To verify that OpenSSL uses the system crypto policy, check out that the OpenSSL config file +/etc/pki/tls/openssl.cnf contains the [ crypto_policy ] section with the +.include /etc/crypto-policies/back-ends/opensslcnf.config directive: + +$ sudo grep '\.include\s* /etc/crypto-policies/back-ends/opensslcnf.config$' /etc/pki/tls/openssl.cnf. + Is it the case that the OpenSSL config file doesn't contain the whole section, +or the section doesn't contain the <pre>.include /etc/crypto-policies/back-ends/opensslcnf.config</pre> directive? - - To check that the cockpit service is disabled in system boot configuration, + + To check that the smb service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled cockpit -Output should indicate the cockpit service has either not been installed, +$ sudo systemctl is-enabled smb +Output should indicate the smb service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled cockpit disabled +$ sudo systemctl is-enabled smb disabled -Run the following command to verify cockpit is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active cockpit +Run the following command to verify smb is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active smb If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the cockpit is masked, run the following command: -$ sudo systemctl show cockpit | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the smb is masked, run the following command: +$ sudo systemctl show smb | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "cockpit" is loaded and not masked? + Is it the case that the "smb" is loaded and not masked? - - To verify if GnuTLS uses defined DoD-approved TLS Crypto Policy, run: -$ sudo grep -'+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0' -/etc/crypto-policies/back-ends/gnutls.config and verify that a match exists. - Is it the case that cryptographic policy for gnutls is not configured or is configured incorrectly? + + To verify that tmux is not listed as allowed shell on the system +run the following command: +$ grep 'tmux$' /etc/shells +The output should be empty. + Is it the case that tmux is listed in /etc/shells? - - Verify Red Hat Enterprise Linux 8 defines default permissions for all authenticated users in such a way that the user can only read and modify their own files with the following command: - -# grep -i umask /etc/login.defs - -UMASK - Is it the case that the value for the "UMASK" parameter is not "<sub idref="var_accounts_user_umask" />", or the "UMASK" parameter is missing or is commented out? + + To determine if logfile has been configured for sudo, run the following command: +$ sudo grep -ri "^[\s]*Defaults\s*\blogfile\b.*" /etc/sudoers /etc/sudoers.d/ +The command should return a matching output. + Is it the case that logfile is not enabled in sudo? - - -Run the following command to determine if the abrt_upload_watch_anon_write SELinux boolean is disabled: -$ getsebool abrt_upload_watch_anon_write -If properly configured, the output should show the following: -abrt_upload_watch_anon_write --> off - Is it the case that abrt_upload_watch_anon_write is not disabled? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_HIBERNATION /boot/config.* + + Configs with value 'n' are not explicitly set in the file, so either commented lines or no + lines should be returned. + + Is it the case that the kernel was not built with the required value? - - To determine if the system is configured to audit calls to the -rmdir system call, run the following command: -$ sudo grep "rmdir" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -unlink system call, run the following command: -$ sudo grep "unlink" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -unlinkat system call, run the following command: -$ sudo grep "unlinkat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -rename system call, run the following command: -$ sudo grep "rename" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. -To determine if the system is configured to audit calls to the -renameat system call, run the following command: -$ sudo grep "renameat" /etc/audit/audit.* + + To determine if the system is configured to audit unsuccessful calls +to the fsetxattr system call, run the following command: +$ sudo grep "fsetxattr" /etc/audit.* If the system is configured to audit this activity, it will return a line. + Is it the case that no line is returned? - - To verify the system is not configured to use a boot loader on removable media, -check that the grub configuration file has the set root command in each menu -entry with the following commands: -$ sudo grep -cw menuentry /boot/efi/EFI/redhat/grub.cfg -Note that the -c option for the grep command will print -only the count of menuentry occurrences. This number should match -the number of occurrences reported by the following command: -$ sudo grep "set root='hd0" /boot/efi/EFI/redhat/grub.cfg -The output should return something similar to: -set root='hd0,msdos1' -usb0, cd, fd0, etc. are some examples of removeable -media which should not exist in the lines: -set root='hd0,msdos1' - Is it the case that it is not? - - - - Find the list of alias maps used by the Postfix mail server: -$ sudo postconf alias_maps -Query the Postfix alias maps for an alias for the root user: -$ sudo postmap -q root hash:/etc/aliases -The output should return an alias. - Is it the case that the alias is not set? - - - - The runtime status of the net.ipv4.conf.all.log_martians kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.all.log_martians -1. + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlink system call. - Is it the case that the correct value is not returned? +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: + +$ sudo grep -r unlink /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep unlink /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete +-a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete + Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the git_session_users SELinux boolean is disabled: -$ getsebool git_session_users +Run the following command to determine if the awstats_purge_apache_log_files SELinux boolean is disabled: +$ getsebool awstats_purge_apache_log_files If properly configured, the output should show the following: -git_session_users --> off - Is it the case that git_session_users is not disabled? +awstats_purge_apache_log_files --> off + Is it the case that awstats_purge_apache_log_files is not disabled? - + -Run the following command to determine if the virt_use_nfs SELinux boolean is disabled: -$ getsebool virt_use_nfs +Run the following command to determine if the virt_use_fusefs SELinux boolean is disabled: +$ getsebool virt_use_fusefs If properly configured, the output should show the following: -virt_use_nfs --> off - Is it the case that virt_use_nfs is not disabled? +virt_use_fusefs --> off + Is it the case that virt_use_fusefs is not disabled? - - Verify the system-wide shared library files are group-owned by "root" with the following command: + + To determine how the SSH daemon's LogLevel option is set, run the following command: -$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -group root -exec ls -l {} \; - Is it the case that any system wide shared library file is returned and is not group-owned by a required system account? +$ sudo grep -i LogLevel /etc/ssh/sshd_config + +If a line indicating INFO is returned, then the required value is set. + + Is it the case that the required value is not set? + + + + # grep "^OPTIONS.*-u" /etc/sysconfig/chronyd | grep -v -e '-u\s*chrony\b' +returns no output + Is it the case that chronyd is not running under chrony user account? + + + + To check the ownership of /etc/issue.net, +run the command: +$ ls -lL /etc/issue.net +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/issue.net does not have an owner of root? + + + + Verify the system-wide shared library files are owned by "root" with the following command: + +$ sudo find -L /lib /lib64 /usr/lib /usr/lib64 ! -user root -exec ls -l {} \; + Is it the case that any system wide shared library file is not owned by root? + + + + To check the group ownership of /etc/cron.daily, +run the command: +$ ls -lL /etc/cron.daily +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/cron.daily does not have a group owner of root? @@ -385051,207 +385533,214 @@ $ sudo ls -al /etc/tmux.conf Is it the case that the "lock-session" is not bound to a specific key? - - These settings can be verified by running the following: -$ gsettings get org.gnome.desktop.media-handling autorun-never -If properly configured, the output for autorun-nevershould be true. -To ensure that users cannot enable autorun in GNOME3, run the following: -$ grep 'autorun-never' /etc/dconf/db/local.d/locks/* -If properly configured, the output for autorun-never should be /org/gnome/desktop/media-handling/autorun-never - Is it the case that GNOME autorun is not disabled? + + To check that the named service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled named +Output should indicate the named service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled named disabled + +Run the following command to verify named is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active named + +If the service is not running the command will return the following output: +inactive + +The service will also be masked, to check that the named is masked, run the following command: +$ sudo systemctl show named | grep "LoadState\|UnitFileState" + +If the service is masked the command will return the following outputs: + +LoadState=masked + +UnitFileState=masked + Is it the case that the "named" is loaded and not masked? - + -Run the following command to determine if the openvpn_can_network_connect SELinux boolean is disabled: -$ getsebool openvpn_can_network_connect +Run the following command to determine if the httpd_execmem SELinux boolean is disabled: +$ getsebool httpd_execmem If properly configured, the output should show the following: -openvpn_can_network_connect --> off - Is it the case that openvpn_can_network_connect is not disabled? - - - - To check the group ownership of /etc/cron.allow, -run the command: -$ ls -lL /etc/cron.allow -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.allow does not have a group owner of root? +httpd_execmem --> off + Is it the case that httpd_execmem is not disabled? - - To determine how the SSH daemon's Banner option is set, run the following command: - -$ sudo grep -i Banner /etc/ssh/sshd_config - -If a line indicating /etc/issue.net is returned, then the required value is set. - - Is it the case that the required value is not set? + + To verify that each web content directory exists on separate partitions, +run the following command: +$ grep `grep -i documentroot /etc/httpd/conf/httpd.conf | awk -F'"' '{print $2}'` /etc/fstab +Each of the corresponding DocumentRoot entries should have a +corresponding entry in /etc/fstab. + Is it the case that it is not? - - Run the following command to determine if the binutils package is installed: $ rpm -q binutils - Is it the case that the package is not installed? + + To ensure that wireless network notification is disabled, run the following command: +$ gsettings get org.gnome.nm-applet suppress-wireless-networks-available +If properly configured, the output should be true. +To ensure that users cannot enable wireless notification, run the following: +$ grep wireless-networks-available /etc/dconf/db/local.d/locks/* +If properly configured, the output should be +/org/gnome/nm-applet/suppress-wireless-networks-available + Is it the case that wireless network notification is enabled and not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "ssh-keysign" command with the following command: + + Verify that a separate file system/partition has been created for /var/log with the following command: -$ sudo auditctl -l | grep ssh-keysign +$ mountpoint /var/log --a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F perm=x -F auid>=1000 -F auid!=unset -k privileged-ssh-keysign - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that "/var/log is not a mountpoint" is returned? - + -Run the following command to determine if the cluster_manage_all_files SELinux boolean is disabled: -$ getsebool cluster_manage_all_files +Run the following command to determine if the abrt_upload_watch_anon_write SELinux boolean is disabled: +$ getsebool abrt_upload_watch_anon_write If properly configured, the output should show the following: -cluster_manage_all_files --> off - Is it the case that cluster_manage_all_files is not disabled? +abrt_upload_watch_anon_write --> off + Is it the case that abrt_upload_watch_anon_write is not disabled? - - To check that the dovecot service is disabled in system boot configuration, + + To check that the squid service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled dovecot -Output should indicate the dovecot service has either not been installed, +$ sudo systemctl is-enabled squid +Output should indicate the squid service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled dovecot disabled +$ sudo systemctl is-enabled squid disabled -Run the following command to verify dovecot is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active dovecot +Run the following command to verify squid is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active squid If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the dovecot is masked, run the following command: -$ sudo systemctl show dovecot | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the squid is masked, run the following command: +$ sudo systemctl show squid | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "dovecot" is loaded and not masked? + Is it the case that the "squid" is loaded and not masked? - - For each private key stored on the system, use the following command: -$ sudo ssh-keygen -y -f /path/to/file -If the contents of the key are displayed, this is a finding. - Is it the case that no ssh private key is accessible without a passcode? + + To check for serial port entries which permit root login, +run the following command: +$ sudo grep ^ttyS/[0-9] /etc/securetty +If any output is returned, then root login over serial ports is permitted. + Is it the case that root login over serial ports is permitted? - - Verify the Red Hat Enterprise Linux 8 "fapolicyd" employs a deny-all, permit-by-exception policy. - -Check that "fapolicyd" is in enforcement mode with the following command: - -$ sudo grep permissive /etc/fapolicyd/fapolicyd.conf - -permissive = 0 - -Check that fapolicyd employs a deny-all policy on system mounts with the following commands: - -For RHEL 8.5 systems and older: -$ sudo tail /etc/fapolicyd/fapolicyd.rules - -For RHEL 8.6 systems and newer: -$ sudo tail /etc/fapolicyd/compiled.rules + + To determine if the system is configured to audit successful calls +to the openat system call, run the following command: +$ sudo grep "openat" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -allow exe=/usr/bin/python3.7 : ftype=text/x-python -deny_audit perm=any pattern=ld_so : all -deny perm=any all : all - Is it the case that fapolicyd is not running in enforcement mode with a deny-all, permit-by-exception policy? + Is it the case that no line is returned? - - To ensure the system is configured to mask the Ctrl-Alt-Del sequence, Check -that the ctrl-alt-del.target is masked and not active with the following -command: -sudo systemctl status ctrl-alt-del.target -The output should indicate that the target is masked and not active. It -might resemble following output: -ctrl-alt-del.target -Loaded: masked (/dev/null; bad) -Active: inactive (dead) - Is it the case that the system is configured to reboot when Ctrl-Alt-Del is pressed? + + Run the following command to determine if the sudo package is installed: $ rpm -q sudo + Is it the case that the package is not installed? - - Storing logs with compression can help avoid filling the system disk. -Run the following command to verify that journald is compressing logs. - -grep "^\sCompress" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf + + Verify Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs. +Check that Red Hat Enterprise Linux 8 takes the appropriate action when an audit processing failure occurs with the following command: -and it should return +$ sudo grep disk_error_action /etc/audit/auditd.conf -Compress=yes +disk_error_action = HALT - Is it the case that is commented out or not configured correctly? +If the value of the "disk_error_action" option is not "SYSLOG", "SINGLE", or "HALT", or the line is commented out, ask the system administrator to indicate how the system takes appropriate action when an audit process failure occurs. + Is it the case that there is no evidence of appropriate action? - - Verify the pam_faillock.so module is present in the "/etc/pam.d/system-auth" file: - -$ sudo grep pam_faillock.so /etc/pam.d/system-auth + + To determine if the system is configured to audit successful calls +to the removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -auth required pam_faillock.so preauth -auth required pam_faillock.so authfail -account required pam_faillock.so - Is it the case that the pam_faillock.so module is not present in the "/etc/pam.d/system-auth" file with the "preauth" line listed before pam_unix.so? + Is it the case that no line is returned? - - Run the following commands and verify output: - -# iptables -L INPUT -v -n | grep lo | grep ACCEPT - - -# iptables -L INPUT -v -n | grep 127.0.0.0\/8 | grep DROP - - -# iptables -L OUTPUT -v -n | grep lo | grep ACCEPT - - Is it the case that loopback traffic is not configured? + + Inspect each <Directory> instance and verify that either +FollowSymLinks does not exist, or +Options SymLinksIfOwnerMatchDisable is configured properly. + Is it the case that it is not? - - To check the group ownership of /var/log/messages, -run the command: -$ ls -lL /var/log/messages -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /var/log/messages does not have a group owner of root? + + +Run the following command to determine if the virt_use_comm SELinux boolean is disabled: +$ getsebool virt_use_comm +If properly configured, the output should show the following: +virt_use_comm --> off + Is it the case that virt_use_comm is not disabled? - + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pam_timestamp_check" command with the following command: + +$ sudo auditctl -l | grep pam_timestamp_check + +-a always,exit -F path=/usr/sbin/pam_timestamp_check -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pam_timestamp_check + Is it the case that the command does not return a line, or the line is commented out? + + + -Run the following command to determine if the dbadm_exec_content SELinux boolean is enabled: -$ getsebool dbadm_exec_content +Run the following command to determine if the cluster_use_execmem SELinux boolean is disabled: +$ getsebool cluster_use_execmem If properly configured, the output should show the following: -dbadm_exec_content --> on - Is it the case that dbadm_exec_content is not enabled? +cluster_use_execmem --> off + Is it the case that cluster_use_execmem is not disabled? - - Verify the audit tools are owned by "root" to prevent any unauthorized access, deletion, or modification. + + Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "reboot" command with the following command: -Check the owner of each audit tool by running the following command: +$ sudo auditctl -l | grep reboot -$ sudo stat -c "%U %n" /sbin/auditctl /sbin/aureport /sbin/ausearch /sbin/autrace /sbin/auditd /sbin/rsyslogd /sbin/augenrules +-a always,exit -F path=/reboot -F perm=x -F auid>=1000 -F auid!=unset -k privileged-reboot + Is it the case that the command does not return a line, or the line is commented out? + + + + To determine whether sudo command includes configuration files from the appropriate directory, +run the following command: +$ sudo grep -rP '^[#@]include(dir)?' /etc/sudoers /etc/sudoers.d +If only the line /etc/sudoers:#includedir /etc/sudoers.d is returned, then the drop-in include configuration is set correctly. +Any other line returned is a finding. + Is it the case that the /etc/sudoers doesn't include /etc/sudores.d or includes other directories?? + + + + To determine if the system is configured to audit calls to the +fchmodat system call, run the following command: +$ sudo grep "fchmodat" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. -root /sbin/auditctl -root /sbin/aureport -root /sbin/ausearch -root /sbin/autrace -root /sbin/auditd -root /sbin/rsyslogd -root /sbin/augenrules - Is it the case that any audit tools are not owned by root? + Is it the case that no line is returned? + + + + +Run the following command to determine if the staff_exec_content SELinux boolean is enabled: +$ getsebool staff_exec_content +If properly configured, the output should show the following: +staff_exec_content --> on + Is it the case that staff_exec_content is not enabled? @@ -385263,405 +385752,469 @@ $ sysctl kernel.yama.ptrace_scope Is it the case that the correct value is not returned? - - -Run the following command to determine if the selinuxuser_execstack SELinux boolean is disabled: -$ getsebool selinuxuser_execstack -If properly configured, the output should show the following: -selinuxuser_execstack --> off - Is it the case that selinuxuser_execstack is not disabled? + + Run the following command to determine if the python3-abrt-addon package is installed: +$ rpm -q python3-abrt-addon + Is it the case that the package is installed? - - Verify the nosuid option is configured for the /var/tmp mount point, - run the following command: - $ sudo mount | grep '\s/var/tmp\s' - . . . /var/tmp . . . nosuid . . . - - Is it the case that the "/var/tmp" file system does not have the "nosuid" option set? + + To check the permissions of /etc/shadow, +run the command: +$ ls -l /etc/shadow +If properly configured, the output should indicate the following permissions: +---------- + Is it the case that /etc/shadow does not have unix mode ----------? - - To verify if MaxKeepAliveRequests is configured correctly in -/etc/httpd/conf/httpd.conf, run the following command: -$ grep -i maxkeepaliverequests /etc/httpd/conf/httpd.conf -The command should return the following: -MaxKeepAliveRequests 100 - Is it the case that it is not? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the syslog-ng-core package is installed: $ rpm -q syslog-ng-core - Is it the case that the package is not installed? + + To check the ownership of /etc/group-, +run the command: +$ ls -lL /etc/group- +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/group- does not have an owner of root? - - To check that the netconsole service is disabled in system boot configuration, -run the following command: -$ sudo systemctl is-enabled netconsole -Output should indicate the netconsole service has either not been installed, -or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled netconsole disabled + + Run the following command to determine if the tftp-server package is installed: +$ rpm -q tftp-server + Is it the case that the package is installed? + + + + If the device or Red Hat Enterprise Linux 8 does not have a camera installed, this requirement is not applicable. -Run the following command to verify netconsole is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active netconsole +This requirement is not applicable to mobile devices (smartphones and tablets), where the use of the camera is a local AO decision. -If the service is not running the command will return the following output: -inactive +This requirement is not applicable to dedicated VTC suites located in approved VTC locations that are centrally managed. -The service will also be masked, to check that the netconsole is masked, run the following command: -$ sudo systemctl show netconsole | grep "LoadState\|UnitFileState" +For an external camera, if there is not a method for the operator to manually disconnect the camera at the end of collaborative computing sessions, this is a finding. -If the service is masked the command will return the following outputs: +For a built-in camera, the camera must be protected by a camera cover (e.g., laptop camera cover slide) when not in use. If the built-in camera is not protected with a camera cover, or is not physically disabled, this is a finding. -LoadState=masked +If the camera is not disconnected, covered, or physically disabled, determine if it is being disabled via software with the following commands: -UnitFileState=masked - Is it the case that the "netconsole" is loaded and not masked? +Verify the operating system disables the ability to load the uvcvideo kernel module. + +$ sudo grep -r uvcvideo /etc/modprobe.d/* | grep "/bin/true" + +install uvcvideo /bin/true + Is it the case that the command does not return any output, or the line is commented out, and the collaborative computing device has not been authorized for use? - - Run the following command to determine if the xinetd package is installed: -$ rpm -q xinetd - Is it the case that the package is installed? + + Run the following command to check for duplicate group names: +Check that the operating system contains no duplicate group names for interactive users by running the following command: + + cut -d : -f 1 /etc/group | uniq -d + +If output is produced, this is a finding. +Configure the operating system to contain no duplicate names for groups. +Edit the file "/etc/group" and provide each group that has a duplicate group name with a unique group name. + Is it the case that has duplicate group names? - - To find world-writable directories that lack the sticky bit, run the following command: -$ sudo find / -type d \( -perm -0002 -a ! -perm -1000 \) -print 2>/dev/null -fixtext: |- -Configure all world-writable directories to have the sticky bit set to prevent unauthorized and unintended information transferred via shared system resources. + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/43-module-load.rules +The output has to be exactly as follows: +## These rules watch for kernel module insertion. By monitoring +## the syscall, we do not need any watches on programs. +-a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load +-a always,exit -F arch=b32 -S delete_module -F key=module-unload +-a always,exit -F arch=b64 -S delete_module -F key=module-unload + Is it the case that the file does not exist or the content differs? + + + + The runtime status of the net.ipv6.conf.all.max_addresses kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.all.max_addresses +1. -Set the sticky bit on all world-writable directories using the command, replace "[World-Writable Directory]" with any directory path missing the sticky bit: + Is it the case that the correct value is not returned? + + + + Inspect /proc/cmdline for any instances of selinux=0 +in the kernel boot arguments. Presence of selinux=0 indicates +that SELinux is disabled at boot time. -$ chmod a+t [World-Writable Directory] -srg_requirement: -A sticky bit must be set on all Red Hat Enterprise Linux 8 public directories to prevent unauthorized and unintended information transferred via shared system resources. - Is it the case that any world-writable directories are missing the sticky bit? +If it would be disabled anywhere, make sure to enable it via a +MachineConfig object. + Is it the case that SELinux is disabled at boot time? - - Run the following command to determine if the abrt package is installed: -$ rpm -q abrt - Is it the case that the package is installed? + + +Run the following command to determine if the privoxy_connect_any SELinux boolean is disabled: +$ getsebool privoxy_connect_any +If properly configured, the output should show the following: +privoxy_connect_any --> off + Is it the case that privoxy_connect_any is not disabled? - + + To determine if the system is configured to audit calls to the +delete_module system call, run the following command: +$ sudo grep "delete_module" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SCHED_STACK_END_CHECK /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? + + + + The runtime status of the net.ipv4.conf.default.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.default.accept_source_route +0. + + Is it the case that the correct value is not returned? + + + -Run the following command to determine if the xguest_use_bluetooth SELinux boolean is disabled: -$ getsebool xguest_use_bluetooth +Run the following command to determine if the mysql_connect_any SELinux boolean is disabled: +$ getsebool mysql_connect_any If properly configured, the output should show the following: -xguest_use_bluetooth --> off - Is it the case that xguest_use_bluetooth is not disabled? +mysql_connect_any --> off + Is it the case that mysql_connect_any is not disabled? + + + + To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: +cat /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules +The output has to be exactly as follows: +## Unsuccessful file delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete +-a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete + Is it the case that the file does not exist or the content differs? + + + + To determine if the system is configured to audit successful calls +to the open system call, run the following command: +$ sudo grep "open" /etc/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? + + + + + Is it the case that the package is not installed? + + + + To determine how the SSH daemon's Banner option is set, run the following command: + +$ sudo grep -i Banner /etc/ssh/sshd_config + +If a line indicating /etc/issue is returned, then the required value is set. + + Is it the case that the required value is not set? + + + + Run the following command to determine if the dnf-plugin-subscription-manager package is installed: $ rpm -q dnf-plugin-subscription-manager + Is it the case that the package is not installed? + + + + + +Run the following command to determine the current status of the +ntp service: +$ sudo systemctl is-active ntp +If the service is running, it should return the following: active + Is it the case that ? - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/43-module-load.rules -The output has to be exactly as follows: -## These rules watch for kernel module insertion. By monitoring -## the syscall, we do not need any watches on programs. --a always,exit -F arch=b32 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b64 -S init_module,finit_module -F key=module-load --a always,exit -F arch=b32 -S delete_module -F key=module-unload --a always,exit -F arch=b64 -S delete_module -F key=module-unload - Is it the case that the file does not exist or the content differs? + + To verify if the OpenSSH client uses defined MACs in the Crypto Policy, run: +$ grep -i macs /etc/crypto-policies/back-ends/openssh.config +and verify that the line matches: +MACs + Is it the case that Crypto Policy for OpenSSH client is not configured correctly? - - Verify the nosuid option is configured for the /srv mount point, - run the following command: - $ sudo mount | grep '\s/srv\s' - . . . /srv . . . nosuid . . . + + To determine if the system is configured to audit calls to the +lchown system call, run the following command: +$ sudo grep "lchown" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/srv" file system does not have the "nosuid" option set? + Is it the case that no line is returned? - + -If the system is configured to prevent the loading of the usb-storage kernel module, +If the system is configured to prevent the loading of the dccp kernel module, it will contain lines inside any file in /etc/modprobe.d or the deprecated /etc/modprobe.conf. These lines instruct the module loading system to run another program (such as /bin/true) upon a module install event. -These lines can also instruct the module loading system to ignore the usb-storage kernel module via blacklist keyword. +These lines can also instruct the module loading system to ignore the dccp kernel module via blacklist keyword. Run the following command to search for such lines in all files in /etc/modprobe.d and the deprecated /etc/modprobe.conf: -$ grep -r usb-storage /etc/modprobe.conf /etc/modprobe.d +$ grep -r dccp /etc/modprobe.conf /etc/modprobe.d Is it the case that no line is returned? - - -Run the following command to determine if the fips_mode SELinux boolean is enabled: -$ getsebool fips_mode -If properly configured, the output should show the following: -fips_mode --> on - Is it the case that fips_mode is not enabled? - - - - Inspect /etc/login.defs and ensure that if eihter -SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS -are set, they must have the minimum value of 5000. - Is it the case that it does not? + + To verify that SSSD is configured for PAM services, run the following command: +$ sudo grep services /etc/sssd/sssd.conf +If configured properly, output should be similar to +services = pam + Is it the case that it does not exist or 'pam' is not added to the 'services' option under the 'sssd' section? - - -Run the following command to determine if the squid_use_tproxy SELinux boolean is disabled: -$ getsebool squid_use_tproxy -If properly configured, the output should show the following: -squid_use_tproxy --> off - Is it the case that squid_use_tproxy is not disabled? + + Run the following command to determine the current status of the logrotate timer: $ sudo systemctl is-active logrotate.timer If the timer is running, it should return the following: active + Is it the case that logrotate timer is not enabled? - - To determine if the system is configured to audit calls to the -open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + Remote web authors should not be able to upload files to the Document Root +directory structure without virus checking and checking for malicious or mobile +code. + Is it the case that it is not? - - To check if pam_pwquality.so is enabled in system-auth, run the following command: -$ grep pam_pwquality /etc/pam.d/system-auth -The output should be similar to the following: -password requisite pam_pwquality.so - Is it the case that pam_pwquality.so is not enabled in system-auth? + + Run the following command to determine if the abrt-addon-ccpp package is installed: +$ rpm -q abrt-addon-ccpp + Is it the case that the package is installed? - - Storing logs remotely protects the integrity of the data from local attacks. -Run the following command to verify that journald is forwarding logs to a remote host. - -grep "^\sForwardToSyslog" /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf - - -and it should return - -ForwardToSyslog=yes + + Verify the noexec option is configured for the /dev/shm mount point, + run the following command: + $ sudo mount | grep '\s/dev/shm\s' + . . . /dev/shm . . . noexec . . . - Is it the case that is commented out or not configured correctly? + Is it the case that the "/dev/shm" file system does not have the "noexec" option set? - + To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_IPV6 /boot/config.* + $ grep CONFIG_PANIC_ON_OOPS /boot/config.* - Configs with value 'n' are not explicitly set in the file, so either commented lines or no - lines should be returned. + For each kernel installed, a line with value "y" should be returned. Is it the case that the kernel was not built with the required value? - - To check if RekeyLimit is set correctly, run the following command: -$ sudo grep RekeyLimit /etc/ssh/ssh_config.d/*.conf -If configured properly, output should be -/etc/ssh/ssh_config.d/02-rekey-limit.conf: -RekeyLimit -Check also the main configuration file with the following command: -$ sudo grep RekeyLimit /etc/ssh/ssh_config -The command should not return any output. - Is it the case that it is commented out or is not set? + + Run the following command to determine if the avahi-autoipd package is installed: +$ rpm -q avahi-autoipd + Is it the case that the package is installed? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "passwd" command with the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the open_by_handle_at system call. -$ sudo auditctl -l | grep passwd +If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: --a always,exit -F path=/usr/bin/passwd -F perm=x -F auid>=1000 -F auid!=unset -k privileged-passwd - Is it the case that the command does not return a line, or the line is commented out? - - - - To check if authentication is required for single-user mode, run the following command: -$ grep sulogin /usr/lib/systemd/system/rescue.service -The output should be similar to the following, and the line must begin with -ExecStart and /usr/lib/systemd/systemd-sulogin-shell. - ExecStart=-/usr/lib/systemd/systemd-sulogin-shell rescue - Is it the case that the output is different? - - - - Only FIPS ciphers should be used. To verify that only FIPS-approved -ciphers are in use, run the following command: -$ sudo grep Ciphers /etc/ssh/sshd_config -The output should contain only those ciphers which are FIPS-approved. - Is it the case that FIPS ciphers are not configured or the enabled ciphers are not FIPS-approved? - - - - Verify Red Hat Enterprise Linux 8 is configured to lock an account until released by an administrator -after unsuccessful logon -attempts with the command: +$ sudo grep -r open_by_handle_at /etc/audit/rules.d +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: -$ grep 'unlock_time =' /etc/security/faillock.conf -unlock_time = - Is it the case that the "unlock_time" option is not set to "<sub idref="var_accounts_passwords_pam_faillock_unlock_time" />", -the line is missing, or commented out? - - - - To ensure that the GPG key is installed, run: -$ rpm -q --queryformat "%{SUMMARY}\n" gpg-pubkey -The command should return the string below: -gpg(Red Hat, Inc. (release key 2) <security@redhat.com> - Is it the case that the Red Hat GPG Key is not installed? +$ sudo grep open_by_handle_at /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access +-a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=unset -k access + Is it the case that the command does not return a line, or the line is commented out? - + -Run the following command to determine if the gpg_web_anon_write SELinux boolean is disabled: -$ getsebool gpg_web_anon_write +Run the following command to determine if the samba_load_libgfapi SELinux boolean is disabled: +$ getsebool samba_load_libgfapi If properly configured, the output should show the following: -gpg_web_anon_write --> off - Is it the case that gpg_web_anon_write is not disabled? - - - - Inspect the form of default GRUB 2 command line for the Linux operating system -in /etc/default/grub. If it includes spectre_v2=on, -then the parameter will be configured for newly installed kernels. -First check if the GRUB recovery is enabled: -$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub -If this option is set to true, then check that a line is output by the following command: -$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*spectre_v2=on.*' /etc/default/grub -If the recovery is disabled, check the line with -$ sudo grep 'GRUB_CMDLINE_LINUX.*spectre_v2=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. -Run the following command: -$ sudo grubby --info=ALL | grep args | grep -v 'spectre_v2=on' -The command should not return any output. - Is it the case that spectre_v2 mitigation is not enforced? +samba_load_libgfapi --> off + Is it the case that samba_load_libgfapi is not disabled? - - Verify Red Hat Enterprise Linux 8 security patches and updates are installed and up to date. -Updates are required to be applied with a frequency determined by organizational policy. - - -Obtain the list of available package security updates from Red Hat. The URL for updates is https://access.redhat.com/errata-search/. -It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. + + To check that the rhsmcertd service is disabled in system boot configuration, +run the following command: +$ sudo systemctl is-enabled rhsmcertd +Output should indicate the rhsmcertd service has either not been installed, +or has been disabled at all runlevels, as shown in the example below: +$ sudo systemctl is-enabled rhsmcertd disabled +Run the following command to verify rhsmcertd is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active rhsmcertd -Check that the available package security updates have been installed on the system with the following command: +If the service is not running the command will return the following output: +inactive -$ sudo yum history list | more +The service will also be masked, to check that the rhsmcertd is masked, run the following command: +$ sudo systemctl show rhsmcertd | grep "LoadState\|UnitFileState" -Loaded plugins: langpacks, product-id, subscription-manager -ID | Command line | Date and time | Action(s) | Altered -------------------------------------------------------------------------------- -70 | install aide | 2020-03-05 10:58 | Install | 1 -69 | update -y | 2020-03-04 14:34 | Update | 18 EE -68 | install vlc | 2020-02-21 17:12 | Install | 21 -67 | update -y | 2020-02-21 17:04 | Update | 7 EE +If the service is masked the command will return the following outputs: +LoadState=masked -Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. - Is it the case that Red Hat Enterprise Linux 8 is in non-compliance with the organizational patching policy? +UnitFileState=masked + Is it the case that the "rhsmcertd" is loaded and not masked? - + -Run the following command to determine if the xend_run_blktap SELinux boolean is enabled: -$ getsebool xend_run_blktap +Run the following command to determine if the virt_sandbox_use_netlink SELinux boolean is disabled: +$ getsebool virt_sandbox_use_netlink If properly configured, the output should show the following: -xend_run_blktap --> on - Is it the case that xend_run_blktap is not enabled? +virt_sandbox_use_netlink --> off + Is it the case that virt_sandbox_use_netlink is not disabled? - - The runtime status of the net.ipv6.conf.all.accept_ra_rtr_pref kernel parameter can be queried -by running the following command: -$ sysctl net.ipv6.conf.all.accept_ra_rtr_pref -0. - - Is it the case that the correct value is not returned? + + +Run the following command to determine if the nscd_use_shm SELinux boolean is enabled: +$ getsebool nscd_use_shm +If properly configured, the output should show the following: +nscd_use_shm --> on + Is it the case that nscd_use_shm is not enabled? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the httpd_setrlimit SELinux boolean is disabled: +$ getsebool httpd_setrlimit +If properly configured, the output should show the following: +httpd_setrlimit --> off + Is it the case that httpd_setrlimit is not disabled? - - To determine the config value the kernel was built with, run the following command: - $ grep CONFIG_LEGACY_VSYSCALL_NONE /boot/config.* - - For each kernel installed, a line with value "y" should be returned. - - Is it the case that the kernel was not built with the required value? + + To verify that HBSS PA is installed, run the following command(s): +$ sudo ls /opt/McAfee/auditengine/bin/auditmanager + Is it the case that the HBSS PA module is not installed? - - To check the group ownership of /etc/cron.hourly, -run the command: -$ ls -lL /etc/cron.hourly -If properly configured, the output should indicate the following group-owner: -root - Is it the case that /etc/cron.hourly does not have a group owner of root? + + Find if logging is applied to the FTP daemon. + +Procedures: + +If vsftpd is started by xinetd the following command will indicate the xinetd.d startup file: +$ grep vsftpd /etc/xinetd.d/* +$ grep server_args vsftpd xinetd.d startup file +This will indicate the vsftpd config file used when starting through xinetd. +If the server_args line is missing or does not include the vsftpd configuration file, then the default config file (/etc/vsftpd/vsftpd.conf) is used. +$ sudo grep xferlog_enable vsftpd config file + Is it the case that xferlog_enable is missing, or is not set to yes? - + + Run the following command to determine if the policycoreutils package is installed: $ rpm -q policycoreutils + Is it the case that the policycoreutils package is not installed? + + + To determine if the system is configured to audit calls to the -chmod system call, run the following command: -$ sudo grep "chmod" /etc/audit/audit.* +open system call, run the following command: +$ sudo grep "open" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - To determine how the SSH daemon's GSSAPIAuthentication option is set, run the following command: + + To check the ownership of /etc/ssh/*.pub, +run the command: +$ ls -lL /etc/ssh/*.pub +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/ssh/*.pub does not have an owner of root? + + + + If IPv6 is disabled, this is not applicable. -$ sudo grep -i GSSAPIAuthentication /etc/ssh/sshd_config -If a line indicating no is returned, then the required value is set. - Is it the case that the required value is not set? +Run the following command to determine the current status of the +ip6tables service: +$ sudo systemctl is-active ip6tables +If the service is running, it should return the following: active + Is it the case that ? - - To verify that DHCP is not being used, examine the following file for each interface: -# /etc/sysconfig/network-scripts/ifcfg-interface -Look for the following: -BOOTPROTO=none -and the following, substituting the appropriate values based on your site's addressing scheme: -NETMASK=255.255.255.0 -IPADDR=192.168.1.2 -GATEWAY=192.168.1.1 - Is it the case that it does not? + + To check for incorrectly labeled device files, run following commands: +$ sudo find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n" +$ sudo find /dev -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z\n" +It should produce no output in a well-configured system. + Is it the case that there is output? - - -Run the following command to determine if the puppetmaster_use_db SELinux boolean is disabled: -$ getsebool puppetmaster_use_db -If properly configured, the output should show the following: -puppetmaster_use_db --> off - Is it the case that puppetmaster_use_db is not disabled? + + To determine whether the SSH service is configured to use strong entropy seed, +run $ sudo grep SSH_USE_STRONG_RNG /etc/sysconfig/sshd +If a line indicating that SSH_USE_STRONG_RNG is set to 32 is returned, +then the option is set correctly. + Is it the case that the SSH_USE_STRONG_RNG is not set to 32 in /etc/sysconfig/sshd? - - Run the following command to determine if the squid package is installed: -$ rpm -q squid - Is it the case that the package is installed? + + The tftp package can be removed with the following command: $ sudo yum erase tftp + Is it the case that ? - - Verify that a separate file system/partition has been created for /usr with the following command: - -$ mountpoint /usr - - Is it the case that "/usr is not a mountpoint" is returned? + + Run the following command to determine if the firewalld package is installed: $ rpm -q firewalld + Is it the case that the package is not installed? + + + + To verify that Audit Daemon is configured to record the computer node +name in the audit events, run the following command: +$ sudo grep name_format /etc/audit/auditd.conf +The output should return the following: +name_format = + Is it the case that name_format isn't set to <sub idref="var_auditd_name_format" />? + + + + The ftp package can be removed with the following command: $ sudo yum erase ftp + Is it the case that ? + + + + +Run the following command to determine if the xen_use_nfs SELinux boolean is disabled: +$ getsebool xen_use_nfs +If properly configured, the output should show the following: +xen_use_nfs --> off + Is it the case that xen_use_nfs is not disabled? @@ -385673,433 +386226,440 @@ ftpd_use_nfs --> off Is it the case that ftpd_use_nfs is not disabled? - - -Run the following command to determine if the unconfined_login SELinux boolean is enabled: -$ getsebool unconfined_login -If properly configured, the output should show the following: -unconfined_login --> on - Is it the case that unconfined_login is not enabled? + + To ensure the tally directory is configured correctly, run the following command: +$ sudo grep 'dir =' /etc/security/faillock.conf +The output should show that dir is set to something other than "/var/run/faillock" + Is it the case that the "dir" option is not set to a non-default documented tally log directory, is missing or commented out? - - The runtime status of the net.ipv4.conf.default.send_redirects kernel parameter can be queried -by running the following command: -$ sysctl net.ipv4.conf.default.send_redirects -0. - - Is it the case that the correct value is not returned? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_SYN_COOKIES /boot/config.* + + For each kernel installed, a line with value "y" should be returned. + + Is it the case that the kernel was not built with the required value? - - Run the following command to determine if the scap-security-guide package is installed: $ rpm -q scap-security-guide - Is it the case that the package is not installed? + + +Run the following command to determine if the nagios_run_sudo SELinux boolean is disabled: +$ getsebool nagios_run_sudo +If properly configured, the output should show the following: +nagios_run_sudo --> off + Is it the case that nagios_run_sudo is not disabled? - - Verify that yum verifies the signature of local packages prior to install with the following command: - -$ grep localpkg_gpgcheck /etc/yum.conf - -localpkg_gpgcheck=1 - -If "localpkg_gpgcheck" is not set to "1", or if the option is missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. - Is it the case that there is no process to validate certificates for local packages that is approved by the organization? + + Check that no boot image file is specified in /etc/zipl.conf: +grep -R "^image\s*=" /etc/zipl.conf +No line should be returned, if a line is returned non BLS compliant boot entries are configured for zIPL. + Is it the case that a non BLS boot entry is configured? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to use the unlink system call. - -If the auditd daemon is configured to use the "augenrules" program to to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r unlink /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep unlink /etc/audit/audit.rules - -The output should be the following: + + Enter the following commands: --a always,exit -F arch=b32 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EPERM -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b32 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete --a always,exit -F arch=b64 -S unlink -F exit=-EACCES -F auid>=1000 -F auid!=unset -k unsuccessful-delete - Is it the case that the command does not return a line, or the line is commented out? - - - - To check that page poisoning is enabled at boot time, check all boot entries with following command: -sudo grep -L "^options\s+.*\bpage_poison=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that doesn't enable page poisoning. - Is it the case that page allocator poisoning is not enabled? - - - - Run the following command to determine if the dhcp-server package is installed: -$ rpm -q dhcp-server - Is it the case that the package is installed? +grep Action /etc/httpd/conf/httpd.conf +grep AddHandler /etc/httpd/conf/httpd.conf + Is it the case that either of these exist and they configure csh, or any other shell as a viewer for documents? - - To verify if the OpenSSH server uses defined MACs in the Crypto Policy, run: -$ grep -Po '(-oMACs=\S+)' /etc/crypto-policies/back-ends/opensshserver.config -and verify that the line matches: --oMACS= - Is it the case that Crypto Policy for OpenSSH Server is not configured correctly? + + Verify the nosuid option is configured for the /opt mount point, + run the following command: + $ sudo mount | grep '\s/opt\s' + . . . /opt . . . nosuid . . . + + Is it the case that the "/opt" file system does not have the "nosuid" option set? - - To check the ownership of /etc/ssh/*.pub, + + To check the group ownership of /var/log/messages, run the command: -$ ls -lL /etc/ssh/*.pub -If properly configured, the output should indicate the following owner: +$ ls -lL /var/log/messages +If properly configured, the output should indicate the following group-owner: root - Is it the case that /etc/ssh/*.pub does not have an owner of root? - - - - To ensure disable and restart on the login screen are disabled, run the following command: -$ grep disable-restart-buttons /etc/dconf/db/gdm.d/* -The output should be true. -To ensure that users cannot enable disable and restart on the login screen, run the following: -$ grep disable-restart-buttons /etc/dconf/db/gdm.d/locks/* -If properly configured, the output should be /org/gnome/login-screen/disable-restart-buttons - Is it the case that disable-restart-buttons has not been configured or is not disabled? - - - - Inspect /etc/default/grub for any instances of selinux=0 -in the kernel boot arguments. Presence of selinux=0 indicates -that SELinux is disabled at boot time. - Is it the case that SELinux is disabled at boot time? - - - - Run the following command to determine if the rsyslog-gnutls package is installed: -$ rpm -q rsyslog-gnutls - Is it the case that the package is installed? + Is it the case that /var/log/messages does not have a group owner of root? - - To check that the psacct service is disabled in system boot configuration, + + To check that the ypbind service is disabled in system boot configuration, run the following command: -$ sudo systemctl is-enabled psacct -Output should indicate the psacct service has either not been installed, +$ sudo systemctl is-enabled ypbind +Output should indicate the ypbind service has either not been installed, or has been disabled at all runlevels, as shown in the example below: -$ sudo systemctl is-enabled psacct disabled +$ sudo systemctl is-enabled ypbind disabled -Run the following command to verify psacct is not active (i.e. not running) through current runtime configuration: -$ sudo systemctl is-active psacct +Run the following command to verify ypbind is not active (i.e. not running) through current runtime configuration: +$ sudo systemctl is-active ypbind If the service is not running the command will return the following output: inactive -The service will also be masked, to check that the psacct is masked, run the following command: -$ sudo systemctl show psacct | grep "LoadState\|UnitFileState" +The service will also be masked, to check that the ypbind is masked, run the following command: +$ sudo systemctl show ypbind | grep "LoadState\|UnitFileState" If the service is masked the command will return the following outputs: LoadState=masked UnitFileState=masked - Is it the case that the "psacct" is loaded and not masked? + Is it the case that the "ypbind" is loaded and not masked? - - -Run the following command to determine if the exim_can_connect_db SELinux boolean is disabled: -$ getsebool exim_can_connect_db -If properly configured, the output should show the following: -exim_can_connect_db --> off - Is it the case that exim_can_connect_db is not disabled? + + To determine if the system is configured to audit calls to the +rmdir system call, run the following command: +$ sudo grep "rmdir" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. + + Is it the case that no line is returned? - - -Run the following command to determine if the logging_syslogd_can_sendmail SELinux boolean is disabled: -$ getsebool logging_syslogd_can_sendmail -If properly configured, the output should show the following: -logging_syslogd_can_sendmail --> off - Is it the case that logging_syslogd_can_sendmail is not disabled? + + To ensure the login screen resets after a specified number of failures, +run the following command: +$ grep allowed-failures /etc/dconf/db/gdm.d/* +The output should be 3 or less. +To ensure that users cannot change or configure the resets after a specified +number of failures on the login screen, run the following: +$ grep allowed-failures /etc/dconf/db/gdm.d/locks/* +If properly configured, the output should be /org/gnome/login-screen/allowed-failures + Is it the case that allowed-failures is not equal to or less than the expected value? - - Run the following command to determine if the chrony package is installed: $ rpm -q chrony - Is it the case that the package is not installed? + + To determine the config value the kernel was built with, run the following command: + $ grep CONFIG_MODULE_SIG_HASH /boot/config.* + + For each kernel installed, a line with value "" should be returned. + + Is it the case that the kernel was not built with the required value? - - To check if RekeyLimit is set correctly, run the -following command: - -$ sudo grep RekeyLimit /etc/ssh/sshd_config + + To determine if the system is configured to audit unsuccessful calls +to the removexattr system call, run the following command: +$ sudo grep "removexattr" /etc/audit.* +If the system is configured to audit this activity, it will return a line. -If configured properly, output should be -RekeyLimit - Is it the case that it is commented out or is not set? + Is it the case that no line is returned? - - Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to create files using the openat system call with O_CREAT flag. - -If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: - -$ sudo grep -r openat /etc/audit/rules.d - -If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: - -$ sudo grep openat /etc/audit/audit.rules - -The output should be the following: - --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b32 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create --a always,exit -F arch=b64 -S openat -F a2&0100 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create - Is it the case that the command does not return a line, or the line is commented out? + + Inspect /etc/audit/auditd.conf and locate the following line to +determine if the system is configured to synchronize audit event data +with the log files on the disk: +$ sudo grep flush /etc/audit/auditd.conf +flush = DATA +Acceptable values are DATA, and SYNC. The setting is +case-insensitive. + Is it the case that auditd is not configured to synchronously write audit event data to disk? - + + To check the group ownership of /etc/group, +run the command: +$ ls -lL /etc/group +If properly configured, the output should indicate the following group-owner: +root + Is it the case that /etc/group does not have a group owner of root? + + + -Run the following command to determine if the mpd_use_nfs SELinux boolean is disabled: -$ getsebool mpd_use_nfs +Run the following command to determine if the openshift_use_nfs SELinux boolean is disabled: +$ getsebool openshift_use_nfs If properly configured, the output should show the following: -mpd_use_nfs --> off - Is it the case that mpd_use_nfs is not disabled? +openshift_use_nfs --> off + Is it the case that openshift_use_nfs is not disabled? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "pt_chown" command with the following command: - -$ sudo auditctl -l | grep pt_chown + + These settings can be verified by running the following: +$ gsettings get org.gnome.desktop.media-handling automount +If properly configured, the output for automount should be false. +To ensure that users cannot enable automount in GNOME3, run the following: +$ grep 'automount' /etc/dconf/db/local.d/locks/* +If properly configured, the output for automount should be /org/gnome/desktop/media-handling/automount + Is it the case that GNOME automounting is not disabled? + + + + Run the following command to determine if the psacct package is installed: $ rpm -q psacct + Is it the case that the package is not installed? + + + + Verify the nodev option is configured for the /var/log mount point, + run the following command: + $ sudo mount | grep '\s/var/log\s' + . . . /var/log . . . nodev . . . --a always,exit -F path=/usr/libexec/pt_chown -F perm=x -F auid>=1000 -F auid!=unset -k privileged-pt_chown - Is it the case that the command does not return a line, or the line is commented out? + Is it the case that the "/var/log" file system does not have the "nodev" option set? - + + Run the following command to determine if the rsyslog package is installed: $ rpm -q rsyslog + Is it the case that the package is not installed? + + + -Run the following command to determine if the cvs_read_shadow SELinux boolean is disabled: -$ getsebool cvs_read_shadow +Run the following command to determine if the httpd_dbus_sssd SELinux boolean is disabled: +$ getsebool httpd_dbus_sssd If properly configured, the output should show the following: -cvs_read_shadow --> off - Is it the case that cvs_read_shadow is not disabled? +httpd_dbus_sssd --> off + Is it the case that httpd_dbus_sssd is not disabled? - - To verify the password reuse setting is compliant, run the following command: -$ grep remember /etc/pam.d/system-auth -The output should show the following at the end of the line: -remember= - - -In newer systems, the pam_pwhistory PAM module options can also be set in -"/etc/security/pwhistory.conf" file. Use the following command to verify: -$ grep remember /etc/security/pwhistory.conf -remember = - -The pam_pwhistory remember option must be configured only in one file. - Is it the case that the value of remember is not equal to or greater than the expected value? + + To check if MaxStartups is configured, run the following command: +$ sudo grep MaxStartups /etc/ssh/sshd_config +If configured, this command should output the configuration. + Is it the case that maxstartups is not configured? - - Ensure that debug-shell service is not enabled with the following command: -sudo grep -L "^options\s+.*\bsystemd.debug-shell=1\b" /boot/loader/entries/*.conf -No line should be returned, each line returned is a boot entry that enables the debug-shell. - Is it the case that the comand returns a line? + + Inspect the form of default GRUB 2 command line for the Linux operating system +in /etc/default/grub. If it includes mce=0, +then the parameter will be configured for newly installed kernels. +First check if the GRUB recovery is enabled: +$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub +If this option is set to true, then check that a line is output by the following command: +$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*mce=0.*' /etc/default/grub +If the recovery is disabled, check the line with +$ sudo grep 'GRUB_CMDLINE_LINUX.*mce=0.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well. +Run the following command: +$ sudo grubby --info=ALL | grep args | grep -v 'mce=0' +The command should not return any output. + Is it the case that MCE tolerance is not set to zero? - - To determine if the system is configured to audit unsuccessful calls -to the chown system call, run the following command: -$ sudo grep "chown" /etc/audit.* -If the system is configured to audit this activity, it will return a line. - - Is it the case that no line is returned? + + +Run the following command to determine if the puppetagent_manage_all_files SELinux boolean is disabled: +$ getsebool puppetagent_manage_all_files +If properly configured, the output should show the following: +puppetagent_manage_all_files --> off + Is it the case that puppetagent_manage_all_files is not disabled? - - To check the permissions of /etc/group, -run the command: -$ ls -l /etc/group -If properly configured, the output should indicate the following permissions: --rw-r--r-- - Is it the case that /etc/group does not have unix mode -rw-r--r--? + + +Run the following command to determine if the ftpd_connect_all_unreserved SELinux boolean is disabled: +$ getsebool ftpd_connect_all_unreserved +If properly configured, the output should show the following: +ftpd_connect_all_unreserved --> off + Is it the case that ftpd_connect_all_unreserved is not disabled? - - To determine if the system is configured to audit successful calls -to the open_by_handle_at system call, run the following command: -$ sudo grep "open_by_handle_at" /etc/audit.* -If the system is configured to audit this activity, it will return a line. + + - Is it the case that no line is returned? +Run the following command to determine the current status of the +sshd service: +$ sudo systemctl is-active sshd +If the service is running, it should return the following: active + Is it the case that ? - + To determine if the system is configured to audit successful calls -to the fchmod system call, run the following command: -$ sudo grep "fchmod" /etc/audit.* +to the chmod system call, run the following command: +$ sudo grep "chmod" /etc/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify the operating system encrypts audit records off-loaded onto a different system -or media from the system being audited with the following commands: + + The runtime status of the net.ipv6.conf.default.accept_source_route kernel parameter can be queried +by running the following command: +$ sysctl net.ipv6.conf.default.accept_source_route +0. -$ sudo grep -i '$DefaultNetstreamDriver' /etc/rsyslog.conf /etc/rsyslog.d/*.conf + Is it the case that the correct value is not returned? + + + + Inspect the password section of /etc/pam.d/system-auth +and ensure that the pam_unix.so module is configured to use the argument +sha512: -The output should be: +$ sudo grep "^password.*pam_unix\.so.*sha512" /etc/pam.d/system-auth -/etc/rsyslog.conf:$DefaultNetstreamDriver gtls - Is it the case that rsyslogd DefaultNetstreamDriver not set to gtls? +password sufficient pam_unix.so sha512 + Is it the case that "sha512" is missing, or is commented out? - + -Run the following command to determine if the virt_use_sanlock SELinux boolean is disabled: -$ getsebool virt_use_sanlock +Run the following command to determine if the unconfined_chrome_sandbox_transition SELinux boolean is enabled: +$ getsebool unconfined_chrome_sandbox_transition If properly configured, the output should show the following: -virt_use_sanlock --> off - Is it the case that virt_use_sanlock is not disabled? - - - - To check the permissions of /var/log, -run the command: -$ ls -l /var/log -If properly configured, the output should indicate the following permissions: -drwxr-xr-x - Is it the case that /var/log does not have unix mode drwxr-xr-x? +unconfined_chrome_sandbox_transition --> on + Is it the case that unconfined_chrome_sandbox_transition is not enabled? - - To determine if the system is configured to audit successful calls -to the fchown system call, run the following command: -$ sudo grep "fchown" /etc/audit.* + + To determine if the system is configured to audit calls to the +lsetxattr system call, run the following command: +$ sudo grep "lsetxattr" /etc/audit/audit.* If the system is configured to audit this activity, it will return a line. Is it the case that no line is returned? - - Verify the noexec option is configured for the /dev/shm mount point, - run the following command: - $ sudo mount | grep '\s/dev/shm\s' - . . . /dev/shm . . . noexec . . . + + To determine if the system is configured to audit calls to the +open_by_handle_at system call, run the following command: +$ sudo grep "open_by_handle_at" /etc/audit/audit.* +If the system is configured to audit this activity, it will return a line. - Is it the case that the "/dev/shm" file system does not have the "noexec" option set? - - - - To verify that the Audit is correctly configured according to recommended rules, check the content of the file with the following command: -cat /etc/audit/rules.d/30-ospp-v42-4-delete-failed.rules -The output has to be exactly as follows: -## Unsuccessful file delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b32 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete --a always,exit -F arch=b64 -S unlink,unlinkat,rename,renameat -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccessful-delete - Is it the case that the file does not exist or the content differs? + Is it the case that no line is returned? - - To verify that the installed operating system is supported, run -the following command: - -$ grep -i "red hat" /etc/redhat-release - -Red Hat Enterprise Linux 8 - Is it the case that the installed operating system is not supported? + + Inspect /etc/audit/audisp-remote.conf and locate the following line to +determine if the system is configured to either send to syslog, switch to single user mode, +or halt when the disk is full: +$ sudo grep -i disk_full_action /etc/audit/audisp-remote.conf +The output should return something similar to: +disk_full_action = single +Acceptable values also include syslog and halt. + Is it the case that the system is not configured to switch to single user mode for corrective action? - - Run the following command to determine if the sudo package is installed: $ rpm -q sudo - Is it the case that the package is not installed? + + To verify that null passwords cannot be used, run the following command: +$ sudo awk -F: '!$2 {print $1}' /etc/shadow +If this produces any output, it may be possible to log into accounts +with empty passwords. + Is it the case that Blank or NULL passwords can be used? - + -Run the following command to determine if the fenced_can_network_connect SELinux boolean is disabled: -$ getsebool fenced_can_network_connect +Run the following command to determine if the httpd_use_openstack SELinux boolean is disabled: +$ getsebool httpd_use_openstack If properly configured, the output should show the following: -fenced_can_network_connect --> off - Is it the case that fenced_can_network_connect is not disabled? +httpd_use_openstack --> off + Is it the case that httpd_use_openstack is not disabled? - - Run the following command to determine if the cups package is installed: -$ rpm -q cups - Is it the case that the package is installed? + + To check the ownership of /etc/issue, +run the command: +$ ls -lL /etc/issue +If properly configured, the output should indicate the following owner: +root + Is it the case that /etc/issue does not have an owner of root? - - Verify that Red Hat Enterprise Linux 8 is configured to audit the execution of the "setfiles" command with the following command: + + Verify Red Hat Enterprise Linux 8 generates an audit record for unsuccessful attempts to modify files using the open system call with O_TRUNC_WRITE flag. -$ sudo auditctl -l | grep setfiles +If the auditd daemon is configured to use the "augenrules" program to read audit rules during daemon startup (the default), run the following command: --a always,exit -F path=/usr/sbin/setfiles -F perm=x -F auid>=1000 -F auid!=unset -k privileged-unix-update +$ sudo grep -r open /etc/audit/rules.d + +If the auditd daemon is configured to use the "auditctl" utility to read audit rules during daemon startup, run the following command: + +$ sudo grep open /etc/audit/audit.rules + +The output should be the following: + +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b32 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EACCES -F auid>=1000 -F auid!=unset -F key=unsuccesful-create +-a always,exit -F arch=b64 -S open -F a1&01003 -F exit=-EPERM -F auid>=1000 -F auid!=unset -F key=unsuccesful-create Is it the case that the command does not return a line, or the line is commented out? - - If IPv6 is disabled, this is not applicable. + + Run the following command to determine if the libreport-plugin-rhtsupport package is installed: +$ rpm -q libreport-plugin-rhtsupport + Is it the case that the package is installed? + + + + The runtime status of the net.ipv4.icmp_echo_ignore_broadcasts kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.icmp_echo_ignore_broadcasts +1. -Inspect the file /etc/sysconfig/ip6tables to determine -the default policy for the INPUT chain. It should be set to DROP: -$ sudo grep ":INPUT" /etc/sysconfig/ip6tables - Is it the case that the default policy for the INPUT chain is not set to DROP? + Is it the case that the correct value is not returned? - + + To verify that root's primary group is zero run the following command: + + grep '^root:' /etc/passwd | cut -d : -f 4 + +The command should return: + +0 + + Is it the case that root has a primary gid not equal to zero? + + + -Run the following command to determine if the virt_sandbox_use_all_caps SELinux boolean is disabled: -$ getsebool virt_sandbox_use_all_caps -If properly configured, the output should show the following: -virt_sandbox_use_all_caps --> off - Is it the case that virt_sandbox_use_all_caps is not disabled? + +Run the following command to determine the current status of the +firewalld service: +$ sudo systemctl is-active firewalld +If the service is running, it should return the following: active + Is it the case that the "firewalld" service is disabled, masked, or not started.? - - To determine if the system is configured to audit calls to the -openat system call, run the following command: -$ sudo grep "openat" /etc/audit/audit.* -If the system is configured to audit this activity, it will return a line. + + To determine that AIDE is configured for FIPS 140-2 file hashing, run the following command: +$ grep sha512 /etc/aide.conf +Verify that the sha512 option is added to the correct ruleset. + Is it the case that the sha512 option is missing or not added to the correct ruleset? + + + + The runtime status of the net.ipv4.conf.all.drop_gratuitous_arp kernel parameter can be queried +by running the following command: +$ sysctl net.ipv4.conf.all.drop_gratuitous_arp +1. - Is it the case that no line is returned? + Is it the case that the correct value is not returned? - + -Run the following command to determine if the selinuxuser_use_ssh_chroot SELinux boolean is disabled: -$ getsebool selinuxuser_use_ssh_chroot +Run the following command to determine if the ftpd_use_passive_mode SELinux boolean is disabled: +$ getsebool ftpd_use_passive_mode If properly configured, the output should show the following: -selinuxuser_use_ssh_chroot --> off - Is it the case that selinuxuser_use_ssh_chroot is not disabled? +ftpd_use_passive_mode --> off + Is it the case that ftpd_use_passive_mode is not disabled? - - To check the screensaver mandatory use status, run the following command: -$ gsettings get org.gnome.desktop.screensaver idle-activation-enabled -If properly configured, the output should be true. -To ensure that users cannot disable the screensaver idle inactivity setting, run the following: -$ grep idle-activation-enabled /etc/dconf/db/local.d/locks/* -If properly configured, the output should be /org/gnome/desktop/screensaver/idle-activation-enabled - Is it the case that idle-activation-enabled is not enabled or configured? + + To check the permissions of /var/log, +run the command: +$ ls -l /var/log +If properly configured, the output should indicate the following permissions: +drwxr-xr-x + Is it the case that /var/log does not have unix mode drwxr-xr-x? - + Script combine_ovals.py from SCAP Security Guide ssg: [0, 1, 72], python: 3.10.12 5.11 - 2024-01-25T00:06:13 + 2024-01-26T00:06:20 diff --git a/ssg-rhel8-guide-stig.html b/ssg-rhel8-guide-stig.html index 6b8f748..f30869f 100644 --- a/ssg-rhel8-guide-stig.html +++ b/ssg-rhel8-guide-stig.html @@ -64,7 +64,7 @@ other parties, and makes no guarantees, expressed or implied, about its quality, reliability, or any other characteristic.

Profile Information

Profile TitleDISA STIG for Red Hat Enterprise Linux 8
Profile IDxccdf_org.ssgproject.content_profile_stig

CPE Platforms

  • cpe:/o:redhat:enterprise_linux:8.0
  • cpe:/o:redhat:enterprise_linux:8.1
  • cpe:/o:redhat:enterprise_linux:8.10
  • cpe:/o:redhat:enterprise_linux:8.2
  • cpe:/o:redhat:enterprise_linux:8.3
  • cpe:/o:redhat:enterprise_linux:8.4
  • cpe:/o:redhat:enterprise_linux:8.5
  • cpe:/o:redhat:enterprise_linux:8.6
  • cpe:/o:redhat:enterprise_linux:8.7
  • cpe:/o:redhat:enterprise_linux:8.8
  • cpe:/o:redhat:enterprise_linux:8.9
  • cpe:/o:redhat:enterprise_linux:8

Revision History

Current version: 0.1.72

  • draft - (as of 2024-01-25) + (as of 2024-01-26)

Table of Contents

  1. System Settings
    1. Installing and Maintaining Software
    2. Account and Access Control
    3. System Accounting with auditd
    4. GRUB2 bootloader configuration
    5. Configure Syslog
    6. Network Configuration and Firewalls
    7. File Permissions and Masks
    8. SELinux
  2. Services
    1. Base Services
    2. Application Whitelisting Daemon
    3. FTP Server
    4. Kerberos
    5. Mail Server Software
    6. NFS and RPC
    7. Network Time Protocol
    8. Obsolete Services
    9. Hardware RNG Entropy Gatherer Daemon
    10. SSH Server
    11. System Security Services Daemon
    12. USBGuard daemon
    13. X Window System

Checklist

Group   Guide to the Secure Configuration of Red Hat Enterprise Linux 8   Group contains 106 groups and 410 rules
Group   @@ -103,36 +103,13 @@ files with previously-gathered information. Ideally, the AIDE database is created immediately after initial system configuration, and then again after any software update. AIDE is highly configurable, with further configuration -information located in /usr/share/doc/aide-VERSION.

Rule   +information located in /usr/share/doc/aide-VERSION.

Rule   Install AIDE   [ref]

The aide package can be installed with the following command:

 $ sudo yum install aide

Rationale:

The AIDE package must be installed if it is to be available for integrity checking.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80844-4

References:  - BP28(R51), 1, 11, 12, 13, 14, 15, 16, 2, 3, 5, 7, 8, 9, 5.10.1.3, APO01.06, BAI01.06, BAI02.01, BAI03.05, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS01.03, DSS03.05, DSS04.07, DSS05.02, DSS05.03, DSS05.05, DSS05.07, DSS06.02, DSS06.06, CCI-002696, CCI-002699, CCI-001744, 4.3.4.3.2, 4.3.4.3.3, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, SR 4.1, SR 6.2, SR 7.6, 1034, 1288, 1341, 1417, A.11.2.4, A.12.1.2, A.12.2.1, A.12.4.1, A.12.5.1, A.12.6.2, A.14.1.2, A.14.1.3, A.14.2.2, A.14.2.3, A.14.2.4, A.14.2.7, A.15.2.1, A.8.2.3, CM-6(a), DE.CM-1, DE.CM-7, PR.DS-1, PR.DS-6, PR.DS-8, PR.IP-1, PR.IP-3, Req-11.5, 11.5.2, SRG-OS-000445-GPOS-00199, RHEL-08-010359, 5.3.1, SV-251710r880730_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable

-package --add=aide
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
include install_aide
-
-class install_aide {
-  package { 'aide':
-    ensure => 'installed',
-  }
-}
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-if ! rpm -q --quiet "aide" ; then
-    yum install -y "aide"
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation script:   (show)


-[[packages]]
-name = "aide"
-version = "*"
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
- name: Ensure aide is installed
   package:
     name: aide
     state: present
@@ -150,7 +127,30 @@
   - medium_severity
   - no_reboot_needed
   - package_aide_installed
-

Rule   +Remediation script:   (show)


+[[packages]]
+name = "aide"
+version = "*"
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
include install_aide
+
+class install_aide {
+  package { 'aide':
+    ensure => 'installed',
+  }
+}
+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable

+package --add=aide
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+if ! rpm -q --quiet "aide" ; then
+    yum install -y "aide"
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Build and Test AIDE Database   [ref]

Run the following command to generate a new database: @@ -172,20 +172,7 @@ If this check produces any unexpected output, investigate.

Rationale:

For AIDE to be effective, an initial database of "known-good" information about files must be captured and it should be able to be verified against the installed files.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80675-2

References:  - BP28(R51), 1, 11, 12, 13, 14, 15, 16, 2, 3, 5, 7, 8, 9, 5.10.1.3, APO01.06, BAI01.06, BAI02.01, BAI03.05, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS01.03, DSS03.05, DSS04.07, DSS05.02, DSS05.03, DSS05.05, DSS05.07, DSS06.02, DSS06.06, 4.3.4.3.2, 4.3.4.3.3, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, SR 4.1, SR 6.2, SR 7.6, A.11.2.4, A.12.1.2, A.12.2.1, A.12.4.1, A.12.5.1, A.12.6.2, A.14.1.2, A.14.1.3, A.14.2.2, A.14.2.3, A.14.2.4, A.14.2.7, A.15.2.1, A.8.2.3, CM-6(a), DE.CM-1, DE.CM-7, PR.DS-1, PR.DS-6, PR.DS-8, PR.IP-1, PR.IP-3, Req-11.5, 11.5.2, SRG-OS-000445-GPOS-00199, RHEL-08-010359, 5.3.1, SV-251710r880730_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-if ! rpm -q --quiet "aide" ; then
-    yum install -y "aide"
-fi
-
-/usr/sbin/aide --init
-/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Build and Test AIDE Database - Ensure AIDE Is Installed
   ansible.builtin.package:
     name: '{{ item }}'
     state: present
@@ -265,7 +252,20 @@
   - medium_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+if ! rpm -q --quiet "aide" ; then
+    yum install -y "aide"
+fi
+
+/usr/sbin/aide --init
+/bin/cp -p /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Configure AIDE to Verify the Audit Tools   [ref]

The operating system file integrity tool must be configured to protect the integrity of the audit tools.

Rationale:

Protecting the integrity of the tools used for auditing purposes is a critical step toward ensuring the integrity of audit information. Audit @@ -287,68 +287,7 @@ manipulated, or replaced. An example is a checksum hash of the file or files.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-85964-5

References:  - CCI-001496, AU-9(3), AU-9(3).1, SRG-OS-000278-GPOS-00108, RHEL-08-030650, SV-230475r880722_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-if ! rpm -q --quiet "aide" ; then
-    yum install -y "aide"
-fi
-
-
-
-
-
-
-
-
-
-
-if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then
-sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
-else
-echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Ensure aide is installed
+            CCI-001496, AU-9(3), AU-9(3).1, SRG-OS-000278-GPOS-00108, RHEL-08-030650, 5.3.3, SV-230475r880722_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Ensure aide is installed
   package:
     name: '{{ item }}'
     state: present
@@ -426,55 +365,87 @@
   - medium_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   - Configure Notification of Post-AIDE Scan Details -   [ref]

AIDE should notify appropriate personnel of the details of a scan after the scan has been run. -If AIDE has already been configured for periodic execution in /etc/crontab, append the -following line to the existing AIDE line: -

 | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost
-Otherwise, add the following line to /etc/crontab: -
05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost
-AIDE can be executed periodically through other means; this is merely one example.

Rationale:

Unauthorized changes to the baseline configuration could make the system vulnerable -to various attacks or allow unauthorized access to the operating system. Changes to -operating system configurations can have unintended side effects, some of which may -be relevant to security. -

-Detecting such changes and providing an automated response can help avoid unintended, -negative consequences that could ultimately affect the security state of the operating -system. The operating system's Information Management Officer (IMO)/Information System -Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or -monitoring system trap when there is an unauthorized modification of a configuration item.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-82891-3

References:  - BP28(R51), 1, 11, 12, 13, 15, 16, 2, 3, 5, 7, 8, 9, BAI01.06, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS01.03, DSS03.05, DSS05.02, DSS05.05, DSS05.07, CCI-001744, CCI-002699, CCI-002702, 4.3.4.3.2, 4.3.4.3.3, SR 6.2, SR 7.6, A.12.1.2, A.12.4.1, A.12.5.1, A.12.6.2, A.14.2.2, A.14.2.3, A.14.2.4, A.14.2.7, A.15.2.1, CM-6(a), CM-3(5), DE.CM-1, DE.CM-7, PR.IP-1, PR.IP-3, SRG-OS-000363-GPOS-00150, SRG-OS-000446-GPOS-00200, SRG-OS-000447-GPOS-00201, RHEL-08-010360, SV-230263r902716_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
# Remediation is applicable only in certain platforms
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 if ! rpm -q --quiet "aide" ; then
     yum install -y "aide"
 fi
-var_aide_scan_notification_email='root@localhost'
 
 
 
-CRONTAB=/etc/crontab
-CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly'
 
-# NOTE: on some platforms, /etc/crontab may not exist
-if [ -f /etc/crontab ]; then
-	CRONTAB_EXIST=/etc/crontab
+
+
+
+
+
+
+if grep -i '^.*/usr/sbin/auditctl.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/auditctl.*#/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/auditctl p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
 fi
 
-if [ -f /var/spool/cron/root ]; then
-	VARSPOOL=/var/spool/cron/root
+if grep -i '^.*/usr/sbin/auditd.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/auditd.*#/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/auditd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
 fi
 
-if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then
-	echo "0 5 * * * root /usr/sbin/aide  --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB
+if grep -i '^.*/usr/sbin/ausearch.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/ausearch.*#/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/ausearch p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
+fi
+
+if grep -i '^.*/usr/sbin/aureport.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/aureport.*#/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/aureport p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
+fi
+
+if grep -i '^.*/usr/sbin/autrace.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/autrace.*#/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/autrace p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
+fi
+
+if grep -i '^.*/usr/sbin/augenrules.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/augenrules.*#/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/augenrules p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
+fi
+
+if grep -i '^.*/usr/sbin/rsyslogd.*$' /etc/aide.conf; then
+sed -i "s#.*/usr/sbin/rsyslogd.*#/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512#" /etc/aide.conf
+else
+echo "/usr/sbin/rsyslogd p+i+n+u+g+s+b+acl+xattrs+sha512" >> /etc/aide.conf
 fi
 
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: XCCDF Value var_aide_scan_notification_email # promote to variable
+

Rule   + Configure Notification of Post-AIDE Scan Details +   [ref]

AIDE should notify appropriate personnel of the details of a scan after the scan has been run. +If AIDE has already been configured for periodic execution in /etc/crontab, append the +following line to the existing AIDE line: +

 | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost
+Otherwise, add the following line to /etc/crontab: +
05 4 * * * root /usr/sbin/aide --check | /bin/mail -s "$(hostname) - AIDE Integrity Check" root@localhost
+AIDE can be executed periodically through other means; this is merely one example.

Rationale:

Unauthorized changes to the baseline configuration could make the system vulnerable +to various attacks or allow unauthorized access to the operating system. Changes to +operating system configurations can have unintended side effects, some of which may +be relevant to security. +

+Detecting such changes and providing an automated response can help avoid unintended, +negative consequences that could ultimately affect the security state of the operating +system. The operating system's Information Management Officer (IMO)/Information System +Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or +monitoring system trap when there is an unauthorized modification of a configuration item.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-82891-3

References:  + BP28(R51), 1, 11, 12, 13, 15, 16, 2, 3, 5, 7, 8, 9, BAI01.06, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS01.03, DSS03.05, DSS05.02, DSS05.05, DSS05.07, CCI-001744, CCI-002699, CCI-002702, 4.3.4.3.2, 4.3.4.3.3, SR 6.2, SR 7.6, A.12.1.2, A.12.4.1, A.12.5.1, A.12.6.2, A.14.2.2, A.14.2.3, A.14.2.4, A.14.2.7, A.15.2.1, CM-6(a), CM-3(5), DE.CM-1, DE.CM-7, PR.IP-1, PR.IP-3, SRG-OS-000363-GPOS-00150, SRG-OS-000446-GPOS-00200, SRG-OS-000447-GPOS-00201, RHEL-08-010360, SV-230263r902716_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: XCCDF Value var_aide_scan_notification_email # promote to variable
   set_fact:
     var_aide_scan_notification_email: !!str root@localhost
   tags:
@@ -520,51 +491,50 @@
   - medium_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   - Configure AIDE to Verify Access Control Lists (ACLs) -   [ref]

By default, the acl option is added to the FIPSR ruleset in AIDE. -If using a custom ruleset or the acl option is missing, add acl -to the appropriate ruleset. -For example, add acl to the following line in /etc/aide.conf: -

FIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
-AIDE rules can be configured in multiple ways; this is merely one example that is already -configured by default. - -The remediation provided with this rule adds acl to all rule sets available in -/etc/aide.conf

Rationale:

ACLs can provide permissions beyond those permitted through the file mode and must be -verified by the file integrity tools.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-84220-3

References:  - BP28(R51), 2, 3, APO01.06, BAI03.05, BAI06.01, DSS06.02, CCI-000366, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, A.11.2.4, A.12.2.1, A.12.5.1, A.14.1.2, A.14.1.3, A.14.2.4, SI-7, SI-7(1), CM-6(a), PR.DS-6, PR.DS-8, SRG-OS-000480-GPOS-00227, RHEL-08-040310, SV-230552r880724_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 if ! rpm -q --quiet "aide" ; then
     yum install -y "aide"
 fi
+var_aide_scan_notification_email='root@localhost'
 
-aide_conf="/etc/aide.conf"
 
-groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
 
-for group in $groups
-do
-	config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ')
+CRONTAB=/etc/crontab
+CRONDIRS='/etc/cron.d /etc/cron.daily /etc/cron.weekly /etc/cron.monthly'
 
-	if ! [[ $config = *acl* ]]
-	then
-		if [[ -z $config ]]
-		then
-			config="acl"
-		else
-			config=$config"+acl"
-		fi
-	fi
-	sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf
-done
+# NOTE: on some platforms, /etc/crontab may not exist
+if [ -f /etc/crontab ]; then
+	CRONTAB_EXIST=/etc/crontab
+fi
+
+if [ -f /var/spool/cron/root ]; then
+	VARSPOOL=/var/spool/cron/root
+fi
+
+if ! grep -qR '^.*/usr/sbin/aide\s*\-\-check.*|.*\/bin\/mail\s*-s\s*".*"\s*.*@.*$' $CRONTAB_EXIST $VARSPOOL $CRONDIRS; then
+	echo "0 5 * * * root /usr/sbin/aide  --check | /bin/mail -s \"\$(hostname) - AIDE Integrity Check\" $var_aide_scan_notification_email" >> $CRONTAB
+fi
 
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather list of packages
+

Rule   + Configure AIDE to Verify Access Control Lists (ACLs) +   [ref]

By default, the acl option is added to the FIPSR ruleset in AIDE. +If using a custom ruleset or the acl option is missing, add acl +to the appropriate ruleset. +For example, add acl to the following line in /etc/aide.conf: +

FIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
+AIDE rules can be configured in multiple ways; this is merely one example that is already +configured by default. + +The remediation provided with this rule adds acl to all rule sets available in +/etc/aide.conf

Rationale:

ACLs can provide permissions beyond those permitted through the file mode and must be +verified by the file integrity tools.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-84220-3

References:  + BP28(R51), 2, 3, APO01.06, BAI03.05, BAI06.01, DSS06.02, CCI-000366, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, A.11.2.4, A.12.2.1, A.12.5.1, A.14.1.2, A.14.1.3, A.14.2.4, SI-7, SI-7(1), CM-6(a), PR.DS-6, PR.DS-8, SRG-OS-000480-GPOS-00227, RHEL-08-040310, SV-230552r880724_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather list of packages
   package_facts:
     manager: auto
   when:
@@ -625,21 +595,7 @@
   - low_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   - Configure AIDE to Verify Extended Attributes -   [ref]

By default, the xattrs option is added to the FIPSR ruleset in AIDE. -If using a custom ruleset or the xattrs option is missing, add xattrs -to the appropriate ruleset. -For example, add xattrs to the following line in /etc/aide.conf: -

FIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
-AIDE rules can be configured in multiple ways; this is merely one example that is already -configured by default. - -The remediation provided with this rule adds xattrs to all rule sets available in -/etc/aide.conf

Rationale:

Extended attributes in file systems are used to contain arbitrary data and file metadata -with security implications.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-83733-6

References:  - BP28(R51), 2, 3, APO01.06, BAI03.05, BAI06.01, DSS06.02, CCI-000366, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, A.11.2.4, A.12.2.1, A.12.5.1, A.14.1.2, A.14.1.3, A.14.2.4, SI-7, SI-7(1), CM-6(a), PR.DS-6, PR.DS-8, SRG-OS-000480-GPOS-00227, RHEL-08-040300, SV-230551r627750_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 if ! rpm -q --quiet "aide" ; then
@@ -654,13 +610,13 @@
 do
 	config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ')
 
-	if ! [[ $config = *xattrs* ]]
+	if ! [[ $config = *acl* ]]
 	then
 		if [[ -z $config ]]
 		then
-			config="xattrs"
+			config="acl"
 		else
-			config=$config"+xattrs"
+			config=$config"+acl"
 		fi
 	fi
 	sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf
@@ -669,7 +625,21 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather list of packages
+

Rule   + Configure AIDE to Verify Extended Attributes +   [ref]

By default, the xattrs option is added to the FIPSR ruleset in AIDE. +If using a custom ruleset or the xattrs option is missing, add xattrs +to the appropriate ruleset. +For example, add xattrs to the following line in /etc/aide.conf: +

FIPSR = p+i+n+u+g+s+m+c+acl+selinux+xattrs+sha256
+AIDE rules can be configured in multiple ways; this is merely one example that is already +configured by default. + +The remediation provided with this rule adds xattrs to all rule sets available in +/etc/aide.conf

Rationale:

Extended attributes in file systems are used to contain arbitrary data and file metadata +with security implications.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-83733-6

References:  + BP28(R51), 2, 3, APO01.06, BAI03.05, BAI06.01, DSS06.02, CCI-000366, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, A.11.2.4, A.12.2.1, A.12.5.1, A.14.1.2, A.14.1.3, A.14.2.4, SI-7, SI-7(1), CM-6(a), PR.DS-6, PR.DS-8, SRG-OS-000480-GPOS-00227, RHEL-08-040300, SV-230551r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather list of packages
   package_facts:
     manager: auto
   when:
@@ -730,7 +700,37 @@
   - low_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+if ! rpm -q --quiet "aide" ; then
+    yum install -y "aide"
+fi
+
+aide_conf="/etc/aide.conf"
+
+groups=$(LC_ALL=C grep "^[A-Z][A-Za-z_]*" $aide_conf | grep -v "^ALLXTRAHASHES" | cut -f1 -d '=' | tr -d ' ' | sort -u)
+
+for group in $groups
+do
+	config=$(grep "^$group\s*=" $aide_conf | cut -f2 -d '=' | tr -d ' ')
+
+	if ! [[ $config = *xattrs* ]]
+	then
+		if [[ -z $config ]]
+		then
+			config="xattrs"
+		else
+			config=$config"+xattrs"
+		fi
+	fi
+	sed -i "s/^$group\s*=.*/$group = $config/g" $aide_conf
+done
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Audit Tools Must Be Group-owned by Root   [ref]

Red Hat Enterprise Linux 8 systems providing tools to interface with audit information will leverage user permissions and roles identifying the user accessing the tools, and the corresponding rights the user enjoys, to make access decisions regarding the access to audit tools. @@ -739,21 +739,7 @@ Audit tools must have the correct group owner.

Rationale:

Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86239-1

References:  - CCI-001493, CCI-001494, CCI-001495, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030640, SV-230474r627750_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-chgrp 0 /sbin/auditctl
-chgrp 0 /sbin/aureport
-chgrp 0 /sbin/ausearch
-chgrp 0 /sbin/autrace
-chgrp 0 /sbin/auditd
-chgrp 0 /sbin/rsyslogd
-chgrp 0 /sbin/augenrules
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
+            CCI-001493, CCI-001494, CCI-001495, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030640, SV-230474r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
   stat:
     path: /sbin/auditctl
   register: file_exists
@@ -990,7 +976,21 @@
   - low_disruption
   - medium_severity
   - no_reboot_needed
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+chgrp 0 /sbin/auditctl
+chgrp 0 /sbin/aureport
+chgrp 0 /sbin/ausearch
+chgrp 0 /sbin/autrace
+chgrp 0 /sbin/auditd
+chgrp 0 /sbin/rsyslogd
+chgrp 0 /sbin/augenrules
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Audit Tools Must Be Owned by Root   [ref]

Red Hat Enterprise Linux 8 systems providing tools to interface with audit information will leverage user permissions and roles identifying the user accessing the tools, and the corresponding rights the user enjoys, to make access decisions regarding the access to audit tools. @@ -999,21 +999,7 @@ Audit tools must have the correct owner.

Rationale:

Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86259-9

References:  - CCI-001493, CCI-001494, CCI-001495, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030630, SV-230473r744008_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-chown 0 /sbin/auditctl
-chown 0 /sbin/aureport
-chown 0 /sbin/ausearch
-chown 0 /sbin/autrace
-chown 0 /sbin/auditd
-chown 0 /sbin/rsyslogd
-chown 0 /sbin/augenrules
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
+            CCI-001493, CCI-001494, CCI-001495, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030630, SV-230473r744008_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
   stat:
     path: /sbin/auditctl
   register: file_exists
@@ -1250,7 +1236,21 @@
   - low_disruption
   - medium_severity
   - no_reboot_needed
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+chown 0 /sbin/auditctl
+chown 0 /sbin/aureport
+chown 0 /sbin/ausearch
+chown 0 /sbin/autrace
+chown 0 /sbin/auditd
+chown 0 /sbin/rsyslogd
+chown 0 /sbin/augenrules
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Audit Tools Must Have a Mode of 0755 or Less Permissive   [ref]

Red Hat Enterprise Linux 8 systems providing tools to interface with audit information will leverage user permissions and roles identifying the user accessing the tools, and the corresponding rights the user enjoys, to make access decisions regarding the access to audit tools. @@ -1259,27 +1259,7 @@ Audit tools must have a mode of 0755 or less permissive.

Rationale:

Protecting audit information also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operations on audit information.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86227-6

References:  - CCI-001493, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030620, SV-230472r627750_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
-
-chmod u-s,g-ws,o-wt /sbin/auditctl
-
-chmod u-s,g-ws,o-wt /sbin/aureport
-
-chmod u-s,g-ws,o-wt /sbin/ausearch
-
-chmod u-s,g-ws,o-wt /sbin/autrace
-
-chmod u-s,g-ws,o-wt /sbin/auditd
-
-chmod u-s,g-ws,o-wt /sbin/rsyslogd
-
-chmod u-s,g-ws,o-wt /sbin/augenrules
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
+            CCI-001493, AU-9, SRG-OS-000256-GPOS-00097, SRG-OS-000257-GPOS-00098, SRG-OS-000258-GPOS-00099, RHEL-08-030620, SV-230472r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Test for existence /sbin/auditctl
   stat:
     path: /sbin/auditctl
   register: file_exists
@@ -1516,6 +1496,26 @@
   - low_disruption
   - medium_severity
   - no_reboot_needed
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
# Remediation is applicable only in certain platforms
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+
+chmod u-s,g-ws,o-wt /sbin/auditctl
+
+chmod u-s,g-ws,o-wt /sbin/aureport
+
+chmod u-s,g-ws,o-wt /sbin/ausearch
+
+chmod u-s,g-ws,o-wt /sbin/autrace
+
+chmod u-s,g-ws,o-wt /sbin/auditd
+
+chmod u-s,g-ws,o-wt /sbin/rsyslogd
+
+chmod u-s,g-ws,o-wt /sbin/augenrules
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
 
Group   Federal Information Processing Standard (FIPS)   Group contains 3 rules

[ref]   @@ -1529,7 +1529,7 @@ utilize authentication that meets industry and government requirements. For government systems, this allows Security Levels 1, 2, 3, or 4 for use on Red Hat Enterprise Linux 8.

-See http://csrc.nist.gov/publications/PubsFIPS.html for more information.

Rule   +See http://csrc.nist.gov/publications/PubsFIPS.html for more information.

Rule   Enable Dracut FIPS Module   [ref]

To enable FIPS mode, run the following command:

fips-mode-setup --enable
@@ -1553,19 +1553,7 @@ standards approved by the federal government since this provides assurance they have been tested and validated.

Severity: 
high
Identifiers and References

Identifiers:  CCE-82155-3

References:  - CCI-000068, CCI-000803, CCI-002450, 1446, CIP-003-8 R4.2, CIP-007-3 R5.1, SC-12(2), SC-12(3), IA-7, SC-13, CM-6(a), SC-12, FCS_RBG_EXT.1, SRG-OS-000478-GPOS-00223, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then
-
-fips-mode-setup --enable
-FIPS_CONF="/etc/dracut.conf.d/40-fips.conf"
-if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then
-    echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:medium
Disruption:medium
Reboot:true
Strategy:restrict
- name: Check to see the current status of FIPS mode
+            CCI-000068, CCI-000803, CCI-002450, 1446, CIP-003-8 R4.2, CIP-007-3 R5.1, SC-12(2), SC-12(3), IA-7, SC-13, CM-6(a), SC-12, FCS_RBG_EXT.1, SRG-OS-000478-GPOS-00223, RHEL-08-010020, SV-230223r928585_rule

Remediation Ansible snippet:   (show)

Complexity:medium
Disruption:medium
Reboot:true
Strategy:restrict
- name: Check to see the current status of FIPS mode
   command: /usr/bin/fips-mode-setup --check
   register: is_fips_enabled
   changed_when: false
@@ -1631,7 +1619,19 @@
   - medium_disruption
   - reboot_required
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ); then
+
+fips-mode-setup --enable
+FIPS_CONF="/etc/dracut.conf.d/40-fips.conf"
+if ! grep "^add_dracutmodules+=\" fips \"" $FIPS_CONF; then
+    echo "add_dracutmodules+=\" fips \"" >> $FIPS_CONF
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Enable FIPS Mode   [ref]

To enable FIPS mode, run the following command: @@ -1649,36 +1649,7 @@ standards approved by the federal government since this provides assurance they have been tested and validated.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80942-6

References:  - CCI-000068, CCI-000803, CCI-002450, 1446, CIP-003-8 R4.2, CIP-007-3 R5.1, CM-3(6), SC-12(2), SC-12(3), IA-7, SC-13, CM-6(a), SC-12, FCS_COP.1(1), FCS_COP.1(2), FCS_COP.1(3), FCS_COP.1(4), FCS_CKM.1, FCS_CKM.2, FCS_TLSC_EXT.1, FCS_RBG_EXT.1, SRG-OS-000478-GPOS-00223, SRG-OS-000396-GPOS-00176, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
-
-var_system_crypto_policy='FIPS'
-
-
-fips-mode-setup --enable
-
-stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null)
-rc=$?
-
-if test "$rc" = 127; then
-	echo "$stderr_of_call" >&2
-	echo "Make sure that the script is installed on the remediated system." >&2
-	echo "See output of the 'dnf provides update-crypto-policies' command" >&2
-	echo "to see what package to (re)install" >&2
-
-	false  # end with an error code
-elif test "$rc" != 0; then
-	echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2
-	false  # end with an error code
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation script:   (show)


-[customizations]
-fips = true
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:medium
Disruption:medium
Reboot:true
Strategy:restrict
- name: XCCDF Value var_system_crypto_policy # promote to variable
   set_fact:
     var_system_crypto_policy: !!str FIPS
   tags:
@@ -1784,7 +1755,36 @@
   - medium_disruption
   - reboot_required
   - restrict_strategy
-

Rule   +Remediation script:   (show)


+[customizations]
+fips = true
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if ( [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && ! ( [ "${container:-}" == "bwrap-osbuild" ] ) ) && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
+
+var_system_crypto_policy='FIPS'
+
+
+fips-mode-setup --enable
+
+stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null)
+rc=$?
+
+if test "$rc" = 127; then
+	echo "$stderr_of_call" >&2
+	echo "Make sure that the script is installed on the remediated system." >&2
+	echo "See output of the 'dnf provides update-crypto-policies' command" >&2
+	echo "to see what package to (re)install" >&2
+
+	false  # end with an error code
+elif test "$rc" != 0; then
+	echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2
+	false  # end with an error code
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Set kernel parameter 'crypto.fips_enabled' to 1   [ref]

System running in FIPS mode is indicated by kernel parameter 'crypto.fips_enabled'. This parameter should be set to 1 in FIPS mode. @@ -1827,7 +1827,7 @@ Currently the supported backends are:

  • GnuTLS library
  • OpenSSL library
  • NSS library
  • OpenJDK
  • Libkrb5
  • BIND
  • OpenSSH
Applications and languages which rely on any of these backends will follow the -system policies as well. Examples are apache httpd, nginx, php, and others.

Rule   +system policies as well. Examples are apache httpd, nginx, php, and others.

Rule   Configure BIND to use System Crypto Policy   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. BIND is supported by crypto policy, but the BIND configuration may be @@ -1840,7 +1840,7 @@ include "/etc/crypto-policies/back-ends/bind.config";

Rationale:

Overriding the system crypto policy makes the behavior of the BIND service violate expectations, and makes system configuration more fragmented.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80934-3

References:  - CIP-003-8 R4.2, CIP-007-3 R5.1, SC-13, SC-12(2), SC-12(3), SRG-OS-000423-GPOS-00187, SRG-OS-000426-GPOS-00190, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)


 function remediate_bind_crypto_policy() {
 	CONFIG_FILE="/etc/named.conf"
 	if test -f "$CONFIG_FILE"; then
@@ -1853,7 +1853,7 @@
 }
 
 remediate_bind_crypto_policy
-

Rule   +

Rule   Configure System Cryptography Policy   [ref]

To configure the system cryptography policy to use ciphers only from the FIPS policy, run the following command: @@ -1880,45 +1880,7 @@ the applications that run on that operating system. Use of weak or untested encryption algorithms undermines the purposes of utilizing encryption to protect data.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80935-0

References:  - 164.308(a)(4)(i), 164.308(b)(1), 164.308(b)(3), 164.312(e)(1), 164.312(e)(2)(ii), 1446, CIP-003-8 R4.2, CIP-007-3 R5.1, CIP-007-3 R7.1, AC-17(a), AC-17(2), CM-6(a), MA-4(6), SC-13, SC-12(2), SC-12(3), FCS_COP.1(1), FCS_COP.1(2), FCS_COP.1(3), FCS_COP.1(4), FCS_CKM.1, FCS_CKM.2, FCS_TLSC_EXT.1, 2.2.7, SRG-OS-000396-GPOS-00176, SRG-OS-000393-GPOS-00173, SRG-OS-000394-GPOS-00174, RHEL-08-010020, 1.6.1, SV-230223r928585_rule

Remediation script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
---
-apiVersion: machineconfiguration.openshift.io/v1
-kind: MachineConfig
-spec:
-  config:
-    ignition:
-      version: 3.1.0
-    systemd:
-      units:
-        - name: configure-crypto-policy.service
-          enabled: true
-          contents: |
-            [Unit]
-            Before=kubelet.service
-            [Service]
-            Type=oneshot
-            ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}}
-            RemainAfterExit=yes
-            [Install]
-            WantedBy=multi-user.target
-
Remediation Shell script:   (show)


-var_system_crypto_policy='FIPS'
-
-
-stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null)
-rc=$?
-
-if test "$rc" = 127; then
-	echo "$stderr_of_call" >&2
-	echo "Make sure that the script is installed on the remediated system." >&2
-	echo "See output of the 'dnf provides update-crypto-policies' command" >&2
-	echo "to see what package to (re)install" >&2
-
-	false  # end with an error code
-elif test "$rc" != 0; then
-	echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2
-	false  # end with an error code
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: XCCDF Value var_system_crypto_policy # promote to variable
   set_fact:
     var_system_crypto_policy: !!str FIPS
   tags:
@@ -1967,7 +1929,45 @@
   - low_disruption
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
---
+apiVersion: machineconfiguration.openshift.io/v1
+kind: MachineConfig
+spec:
+  config:
+    ignition:
+      version: 3.1.0
+    systemd:
+      units:
+        - name: configure-crypto-policy.service
+          enabled: true
+          contents: |
+            [Unit]
+            Before=kubelet.service
+            [Service]
+            Type=oneshot
+            ExecStart=update-crypto-policies --set {{.var_system_crypto_policy}}
+            RemainAfterExit=yes
+            [Install]
+            WantedBy=multi-user.target
+
Remediation Shell script:   (show)


+var_system_crypto_policy='FIPS'
+
+
+stderr_of_call=$(update-crypto-policies --set ${var_system_crypto_policy} 2>&1 > /dev/null)
+rc=$?
+
+if test "$rc" = 127; then
+	echo "$stderr_of_call" >&2
+	echo "Make sure that the script is installed on the remediated system." >&2
+	echo "See output of the 'dnf provides update-crypto-policies' command" >&2
+	echo "to see what package to (re)install" >&2
+
+	false  # end with an error code
+elif test "$rc" != 0; then
+	echo "Error invoking the update-crypto-policies script: $stderr_of_call" >&2
+	false  # end with an error code
+fi
+

Rule   Configure GnuTLS library to use DoD-approved TLS Encryption   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. GnuTLS is supported by system crypto policy, but the GnuTLS configuration may be @@ -1980,7 +1980,88 @@ library violate expectations, and makes system configuration more fragmented.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-84254-2

References:  - CCI-001453, AC-17(2), SRG-OS-000250-GPOS-00093, SRG-OS-000423-GPOS-00187, RHEL-08-010295, SV-230256r877394_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict

+            CCI-001453, AC-17(2), SRG-OS-000250-GPOS-00093, SRG-OS-000423-GPOS-00187, RHEL-08-010295, SV-230256r877394_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: set_fact'
+  set_fact:
+    path: /etc/crypto-policies/back-ends/gnutls.config
+    correct_value: +VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0
+    lineinfile_reg: \+VERS-ALL:-VERS-DTLS0\.9:-VERS-SSL3\.0:-VERS-TLS1\.0:-VERS-TLS1\.1:-VERS-DTLS1\.0
+  tags:
+  - CCE-84254-2
+  - DISA-STIG-RHEL-08-010295
+  - NIST-800-53-AC-17(2)
+  - configure_gnutls_tls_crypto_policy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - reboot_required
+  - restrict_strategy
+
+- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: stat'
+  stat:
+    path: '{{ path }}'
+    follow: true
+  register: gnutls_file
+  tags:
+  - CCE-84254-2
+  - DISA-STIG-RHEL-08-010295
+  - NIST-800-53-AC-17(2)
+  - configure_gnutls_tls_crypto_policy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - reboot_required
+  - restrict_strategy
+
+- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Add'
+  lineinfile:
+    path: '{{ path }}'
+    regexp: '{{ lineinfile_reg }}'
+    line: '{{ correct_value }}'
+    create: true
+  when: not gnutls_file.stat.exists or gnutls_file.stat.size <= correct_value|length
+  tags:
+  - CCE-84254-2
+  - DISA-STIG-RHEL-08-010295
+  - NIST-800-53-AC-17(2)
+  - configure_gnutls_tls_crypto_policy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - reboot_required
+  - restrict_strategy
+
+- name: Configure GnuTLS library to use DoD-approved TLS Encryption
+  block:
+
+  - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Existing value
+      check'
+    lineinfile:
+      path: '{{ path }}'
+      create: false
+      regexp: '{{ lineinfile_reg }}'
+      state: absent
+    check_mode: true
+    changed_when: false
+    register: gnutls
+
+  - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Update'
+    replace:
+      path: '{{ path }}'
+      regexp: (\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)
+      replace: '{{ correct_value }}'
+    when: gnutls.found is defined and gnutls.found != 1
+  when: gnutls_file.stat.exists and gnutls_file.stat.size > correct_value|length
+  tags:
+  - CCE-84254-2
+  - DISA-STIG-RHEL-08-010295
+  - NIST-800-53-AC-17(2)
+  - configure_gnutls_tls_crypto_policy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - reboot_required
+  - restrict_strategy
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict

 CONF_FILE=/etc/crypto-policies/back-ends/gnutls.config
 correct_value='+VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0'
 
@@ -2002,88 +2083,7 @@
         echo ${correct_value} >> ${CONF_FILE}
     fi
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: set_fact'
-  set_fact:
-    path: /etc/crypto-policies/back-ends/gnutls.config
-    correct_value: +VERS-ALL:-VERS-DTLS0.9:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1:-VERS-DTLS1.0
-    lineinfile_reg: \+VERS-ALL:-VERS-DTLS0\.9:-VERS-SSL3\.0:-VERS-TLS1\.0:-VERS-TLS1\.1:-VERS-DTLS1\.0
-  tags:
-  - CCE-84254-2
-  - DISA-STIG-RHEL-08-010295
-  - NIST-800-53-AC-17(2)
-  - configure_gnutls_tls_crypto_policy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - reboot_required
-  - restrict_strategy
-
-- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: stat'
-  stat:
-    path: '{{ path }}'
-    follow: true
-  register: gnutls_file
-  tags:
-  - CCE-84254-2
-  - DISA-STIG-RHEL-08-010295
-  - NIST-800-53-AC-17(2)
-  - configure_gnutls_tls_crypto_policy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - reboot_required
-  - restrict_strategy
-
-- name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Add'
-  lineinfile:
-    path: '{{ path }}'
-    regexp: '{{ lineinfile_reg }}'
-    line: '{{ correct_value }}'
-    create: true
-  when: not gnutls_file.stat.exists or gnutls_file.stat.size <= correct_value|length
-  tags:
-  - CCE-84254-2
-  - DISA-STIG-RHEL-08-010295
-  - NIST-800-53-AC-17(2)
-  - configure_gnutls_tls_crypto_policy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - reboot_required
-  - restrict_strategy
-
-- name: Configure GnuTLS library to use DoD-approved TLS Encryption
-  block:
-
-  - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Existing value
-      check'
-    lineinfile:
-      path: '{{ path }}'
-      create: false
-      regexp: '{{ lineinfile_reg }}'
-      state: absent
-    check_mode: true
-    changed_when: false
-    register: gnutls
-
-  - name: 'Configure GnuTLS library to use DoD-approved TLS Encryption: Update'
-    replace:
-      path: '{{ path }}'
-      regexp: (\+VERS-ALL(?::-VERS-[A-Z]+\d\.\d)+)
-      replace: '{{ correct_value }}'
-    when: gnutls.found is defined and gnutls.found != 1
-  when: gnutls_file.stat.exists and gnutls_file.stat.size > correct_value|length
-  tags:
-  - CCE-84254-2
-  - DISA-STIG-RHEL-08-010295
-  - NIST-800-53-AC-17(2)
-  - configure_gnutls_tls_crypto_policy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - reboot_required
-  - restrict_strategy
-

Rule   +

Rule   Configure Kerberos to use System Crypto Policy   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. Kerberos is supported by crypto policy, but it's configuration may be @@ -2093,10 +2093,7 @@ If the symlink exists, Kerberos is configured to use the system-wide crypto policy settings.

Rationale:

Overriding the system crypto policy makes the behavior of Kerberos violate expectations, and makes system configuration more fragmented.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80936-8

References:  - 0418, 1055, 1402, CIP-003-8 R4.2, CIP-007-3 R5.1, SC-13, SC-12(2), SC-12(3), SRG-OS-000120-GPOS-00061, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:configure

-rm -f /etc/krb5.conf.d/crypto-policies
-ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:configure
- name: Configure Kerberos to use System Crypto Policy
+            0418, 1055, 1402, CIP-003-8 R4.2, CIP-007-3 R5.1, SC-13, SC-12(2), SC-12(3), SRG-OS-000120-GPOS-00061, RHEL-08-010020, SV-230223r928585_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:configure
- name: Configure Kerberos to use System Crypto Policy
   file:
     src: /etc/crypto-policies/back-ends/krb5.config
     path: /etc/krb5.conf.d/crypto-policies
@@ -2113,7 +2110,10 @@
   - low_complexity
   - low_disruption
   - reboot_required
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:configure

+rm -f /etc/krb5.conf.d/crypto-policies
+ln -s /etc/crypto-policies/back-ends/krb5.config /etc/krb5.conf.d/crypto-policies
+

Rule   Configure Libreswan to use System Crypto Policy   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. Libreswan is supported by system crypto policy, but the Libreswan configuration may be @@ -2127,18 +2127,7 @@ service violate expectations, and makes system configuration more fragmented.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80937-6

References:  - CIP-003-8 R4.2, CIP-007-3 R5.1, CM-6(a), MA-4(6), SC-13, SC-12(2), SC-12(3), FCS_IPSEC_EXT.1.4, FCS_IPSEC_EXT.1.6, Req-2.2, SRG-OS-000033-GPOS-00014, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)


-function remediate_libreswan_crypto_policy() {
-    CONFIG_FILE="/etc/ipsec.conf"
-    if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then
-        # the file might not end with a new line
-        echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE"
-    fi
-    return 0
-}
-
-remediate_libreswan_crypto_policy
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Configure Libreswan to use System Crypto Policy
+            CIP-003-8 R4.2, CIP-007-3 R5.1, CM-6(a), MA-4(6), SC-13, SC-12(2), SC-12(3), FCS_IPSEC_EXT.1.4, FCS_IPSEC_EXT.1.6, Req-2.2, SRG-OS-000033-GPOS-00014, RHEL-08-010020, SV-230223r928585_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Configure Libreswan to use System Crypto Policy
   lineinfile:
     path: /etc/ipsec.conf
     line: include /etc/crypto-policies/back-ends/libreswan.config
@@ -2158,7 +2147,18 @@
   - low_disruption
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)


+function remediate_libreswan_crypto_policy() {
+    CONFIG_FILE="/etc/ipsec.conf"
+    if ! grep -qP "^\s*include\s+/etc/crypto-policies/back-ends/libreswan.config\s*(?:#.*)?$" "$CONFIG_FILE" ; then
+        # the file might not end with a new line
+        echo -e '\ninclude /etc/crypto-policies/back-ends/libreswan.config' >> "$CONFIG_FILE"
+    fi
+    return 0
+}
+
+remediate_libreswan_crypto_policy
+

Rule   Configure OpenSSL library to use System Crypto Policy   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. OpenSSL is supported by crypto policy, but the OpenSSL configuration may be @@ -2169,37 +2169,7 @@ if there is a [ crypto_policy ] section that contains the .include /etc/crypto-policies/back-ends/opensslcnf.config directive.

Rationale:

Overriding the system crypto policy makes the behavior of the Java runtime violates expectations, and makes system configuration more fragmented.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80938-4

References:  - CCI-001453, CIP-003-8 R4.2, CIP-007-3 R5.1, CIP-007-3 R7.1, AC-17(a), AC-17(2), CM-6(a), MA-4(6), SC-13, SC-12(2), SC-12(3), Req-2.2, SRG-OS-000250-GPOS-00093, RHEL-08-010293, SV-230254r877394_rule

Remediation Shell script:   (show)


-OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]'
-OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]'
-
-OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config'
-
-OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$'
-
-
-
-  
-
-
-function remediate_openssl_crypto_policy() {
-	CONFIG_FILE=/etc/pki/tls/openssl.cnf
-	if test -f "$CONFIG_FILE"; then
-		if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then
-			printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE"
-			return 0
-		elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then
-			sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE"
-			return 0
-		fi
-	else
-		echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2
-		return 1
-	fi
-}
-
-remediate_openssl_crypto_policy
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Configure OpenSSL library to use System Crypto Policy - Search for crypto_policy
+            CCI-001453, CIP-003-8 R4.2, CIP-007-3 R5.1, CIP-007-3 R7.1, AC-17(a), AC-17(2), CM-6(a), MA-4(6), SC-13, SC-12(2), SC-12(3), Req-2.2, SRG-OS-000250-GPOS-00093, RHEL-08-010293, SV-230254r877394_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Configure OpenSSL library to use System Crypto Policy - Search for crypto_policy
     Section
   ansible.builtin.find:
     paths: /etc/pki/tls
@@ -2303,7 +2273,37 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   +Remediation Shell script:   (show)


+OPENSSL_CRYPTO_POLICY_SECTION='[ crypto_policy ]'
+OPENSSL_CRYPTO_POLICY_SECTION_REGEX='\[\s*crypto_policy\s*\]'
+
+OPENSSL_CRYPTO_POLICY_INCLUSION='.include /etc/crypto-policies/back-ends/opensslcnf.config'
+
+OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX='^\s*\.include\s*(?:=\s*)?/etc/crypto-policies/back-ends/opensslcnf.config$'
+
+
+
+  
+
+
+function remediate_openssl_crypto_policy() {
+	CONFIG_FILE=/etc/pki/tls/openssl.cnf
+	if test -f "$CONFIG_FILE"; then
+		if ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_SECTION_REGEX" "$CONFIG_FILE"; then
+			printf '\n%s\n\n%s' "$OPENSSL_CRYPTO_POLICY_SECTION" "$OPENSSL_CRYPTO_POLICY_INCLUSION" >> "$CONFIG_FILE"
+			return 0
+		elif ! grep -q "^\\s*$OPENSSL_CRYPTO_POLICY_INCLUSION_REGEX" "$CONFIG_FILE"; then
+			sed -i "s|$OPENSSL_CRYPTO_POLICY_SECTION_REGEX|&\\n\\n$OPENSSL_CRYPTO_POLICY_INCLUSION\\n|" "$CONFIG_FILE"
+			return 0
+		fi
+	else
+		echo "Aborting remediation as '$CONFIG_FILE' was not even found." >&2
+		return 1
+	fi
+}
+
+remediate_openssl_crypto_policy
+

Rule   Configure OpenSSL library to use TLS Encryption   [ref]

Crypto Policies are means of enforcing certain cryptographic settings for selected applications including OpenSSL. OpenSSL is by default configured to @@ -2334,7 +2334,7 @@ Crypto Policy that satisfies OpenSSL minimum TLS protocol version 1.2. Custom policies may be applied too.

Rationale:

Without cryptographic integrity protections, information can be altered by unauthorized users without detection.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-84255-9

References:  - CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, SRG-OS-000393-GPOS-00173, SRG-OS-000394-GPOS-00174, RHEL-08-010294, SV-230255r877394_rule

Rule   + CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, SRG-OS-000393-GPOS-00173, SRG-OS-000394-GPOS-00174, RHEL-08-010294, SV-230255r877394_rule

Rule   Configure SSH to use System Crypto Policy   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. SSH is supported by crypto policy, but the SSH configuration may be @@ -2344,11 +2344,7 @@ in the /etc/sysconfig/sshd.

Rationale:

Overriding the system crypto policy makes the behavior of the SSH service violate expectations, and makes system configuration more fragmented.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80939-2

References:  - CCI-001453, 164.308(a)(4)(i), 164.308(b)(1), 164.308(b)(3), 164.312(e)(1), 164.312(e)(2)(ii), CIP-003-8 R4.2, CIP-007-3 R5.1, CIP-007-3 R7.1, AC-17(a), AC-17(2), CM-6(a), MA-4(6), SC-13, FCS_SSH_EXT.1, FCS_SSHS_EXT.1, FCS_SSHC_EXT.1, Req-2.2, 2.2.7, SRG-OS-000250-GPOS-00093, RHEL-08-010287, 5.2.14, SV-244526r877394_rule

Remediation Shell script:   (show)


-SSH_CONF="/etc/sysconfig/sshd"
-
-sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:true
Strategy:disable
- name: Configure SSH to use System Crypto Policy
   lineinfile:
     dest: /etc/sysconfig/sshd
     state: absent
@@ -2369,7 +2365,11 @@
   - medium_disruption
   - medium_severity
   - reboot_required
-

Rule   +Remediation Shell script:   (show)


+SSH_CONF="/etc/sysconfig/sshd"
+
+sed -i "/^\s*CRYPTO_POLICY.*$/Id" $SSH_CONF
+

Rule   Configure SSH Client to Use FIPS 140-2 Validated Ciphers: openssh.config   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. OpenSSH is supported by system crypto policy, but the OpenSSH configuration may be @@ -2401,25 +2401,7 @@ weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections.

Severity: 
high
Identifiers and References

Identifiers:  CCE-85902-5

References:  - CCI-000068, CCI-000877, CCI-001453, CCI-002418, CCI-002890, CCI-003123, AC-17(2), SRG-OS-000033-GPOS-00014, SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, SRG-OS-000393-GPOS-00173, SRG-OS-000394-GPOS-00174, SRG-OS-000423-GPOS-00187, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)


-sshd_approved_ciphers='aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com'
-
-
-if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then
-    
-    LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config"
-else
-    touch "/etc/crypto-policies/back-ends/openssh.config"
-fi
-# make sure file has newline at the end
-sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config"
-
-cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak"
-# Insert at the end of the file
-printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config"
-# Clean up after ourselves.
-rm "/etc/crypto-policies/back-ends/openssh.config.bak"
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_ciphers # promote to variable
   set_fact:
     sshd_approved_ciphers: !!str aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com
   tags:
@@ -2463,7 +2445,25 @@
   - low_disruption
   - reboot_required
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)


+sshd_approved_ciphers='aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com'
+
+
+if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then
+    
+    LC_ALL=C sed -i "/^.*Ciphers\s\+/d" "/etc/crypto-policies/back-ends/openssh.config"
+else
+    touch "/etc/crypto-policies/back-ends/openssh.config"
+fi
+# make sure file has newline at the end
+sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config"
+
+cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak"
+# Insert at the end of the file
+printf '%s\n' "Ciphers ${sshd_approved_ciphers}" >> "/etc/crypto-policies/back-ends/openssh.config"
+# Clean up after ourselves.
+rm "/etc/crypto-policies/back-ends/openssh.config.bak"
+

Rule   Configure SSH Server to Use FIPS 140-2 Validated Ciphers: opensshserver.config   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. OpenSSH is supported by system crypto policy, but the OpenSSH configuration may be @@ -2495,38 +2495,7 @@ weakest” orientation, the system will automatically attempt to use the strongest cipher for securing SSH connections.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-85897-7

References:  - CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010291, SV-230252r917873_rule

Remediation Shell script:   (show)


-sshd_approved_ciphers='aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com'
-
-
-CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config
-correct_value="-oCiphers=${sshd_approved_ciphers}"
-
-# Test if file exists
-test -f ${CONF_FILE} || touch ${CONF_FILE}
-
-# Ensure CRYPTO_POLICY is not commented out
-sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE}
-
-grep -q "'${correct_value}'" ${CONF_FILE}
-
-if [[ $? -ne 0 ]]; then
-    # We need to get the existing value, using PCRE to maintain same regex
-    existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE})
-
-    if [[ ! -z ${existing_value} ]]; then
-        # replace existing_value with correct_value
-        sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE}
-    else
-        # ***NOTE*** #
-        # This probably means this file is not here or it's been modified
-        # unintentionally.
-        # ********** #
-        # echo correct_value to end
-        echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE}
-    fi
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_ciphers # promote to variable
+            CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010291, SV-230252r917873_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_ciphers # promote to variable
   set_fact:
     sshd_approved_ciphers: !!str aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com
   tags:
@@ -2613,7 +2582,38 @@
   - medium_severity
   - reboot_required
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)


+sshd_approved_ciphers='aes256-ctr,aes192-ctr,aes128-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com'
+
+
+CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config
+correct_value="-oCiphers=${sshd_approved_ciphers}"
+
+# Test if file exists
+test -f ${CONF_FILE} || touch ${CONF_FILE}
+
+# Ensure CRYPTO_POLICY is not commented out
+sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE}
+
+grep -q "'${correct_value}'" ${CONF_FILE}
+
+if [[ $? -ne 0 ]]; then
+    # We need to get the existing value, using PCRE to maintain same regex
+    existing_value=$(grep -Po '(-oCiphers=\S+)' ${CONF_FILE})
+
+    if [[ ! -z ${existing_value} ]]; then
+        # replace existing_value with correct_value
+        sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE}
+    else
+        # ***NOTE*** #
+        # This probably means this file is not here or it's been modified
+        # unintentionally.
+        # ********** #
+        # echo correct_value to end
+        echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE}
+    fi
+fi
+

Rule   Configure SSH Client to Use FIPS 140-2 Validated MACs: openssh.config   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. OpenSSH is supported by system crypto policy, but the OpenSSH configuration may be @@ -2643,25 +2643,7 @@ client violate expectations, and makes system configuration more fragmented.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-85870-4

References:  - CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010020, SV-230223r928585_rule

Remediation Shell script:   (show)


-sshd_approved_macs='hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com'
-
-
-if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then
-    
-    LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config"
-else
-    touch "/etc/crypto-policies/back-ends/openssh.config"
-fi
-# make sure file has newline at the end
-sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config"
-
-cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak"
-# Insert at the end of the file
-printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config"
-# Clean up after ourselves.
-rm "/etc/crypto-policies/back-ends/openssh.config.bak"
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_macs # promote to variable
+            CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010020, SV-230223r928585_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_macs # promote to variable
   set_fact:
     sshd_approved_macs: !!str hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
   tags:
@@ -2705,7 +2687,25 @@
   - medium_severity
   - reboot_required
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)


+sshd_approved_macs='hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com'
+
+
+if [ -e "/etc/crypto-policies/back-ends/openssh.config" ] ; then
+    
+    LC_ALL=C sed -i "/^.*MACs\s\+/d" "/etc/crypto-policies/back-ends/openssh.config"
+else
+    touch "/etc/crypto-policies/back-ends/openssh.config"
+fi
+# make sure file has newline at the end
+sed -i -e '$a\' "/etc/crypto-policies/back-ends/openssh.config"
+
+cp "/etc/crypto-policies/back-ends/openssh.config" "/etc/crypto-policies/back-ends/openssh.config.bak"
+# Insert at the end of the file
+printf '%s\n' "MACs ${sshd_approved_macs}" >> "/etc/crypto-policies/back-ends/openssh.config"
+# Clean up after ourselves.
+rm "/etc/crypto-policies/back-ends/openssh.config.bak"
+

Rule   Configure SSH Server to Use FIPS 140-2 Validated MACs: opensshserver.config   [ref]

Crypto Policies provide a centralized control over crypto algorithms usage of many packages. OpenSSH is supported by system crypto policy, but the OpenSSH configuration may be @@ -2735,38 +2735,7 @@ server violate expectations, and makes system configuration more fragmented.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-85899-3

References:  - CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010290, SV-230251r917870_rule

Remediation Shell script:   (show)


-sshd_approved_macs='hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com'
-
-
-CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config
-correct_value="-oMACs=${sshd_approved_macs}"
-
-# Test if file exists
-test -f ${CONF_FILE} || touch ${CONF_FILE}
-
-# Ensure CRYPTO_POLICY is not commented out
-sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE}
-
-grep -q "'${correct_value}'" ${CONF_FILE}
-
-if [[ $? -ne 0 ]]; then
-    # We need to get the existing value, using PCRE to maintain same regex
-    existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE})
-
-    if [[ ! -z ${existing_value} ]]; then
-        # replace existing_value with correct_value
-        sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE}
-    else
-        # ***NOTE*** #
-        # This probably means this file is not here or it's been modified
-        # unintentionally.
-        # ********** #
-        # echo correct_value to end
-        echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE}
-    fi
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_macs # promote to variable
+            CCI-000877, CCI-001453, AC-17(2), SRG-OS-000125-GPOS-00065, SRG-OS-000250-GPOS-00093, RHEL-08-010290, SV-230251r917870_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:true
Strategy:restrict
- name: XCCDF Value sshd_approved_macs # promote to variable
   set_fact:
     sshd_approved_macs: !!str hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com
   tags:
@@ -2853,6 +2822,37 @@
   - medium_severity
   - reboot_required
   - restrict_strategy
+
Remediation Shell script:   (show)


+sshd_approved_macs='hmac-sha2-512,hmac-sha2-256,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com'
+
+
+CONF_FILE=/etc/crypto-policies/back-ends/opensshserver.config
+correct_value="-oMACs=${sshd_approved_macs}"
+
+# Test if file exists
+test -f ${CONF_FILE} || touch ${CONF_FILE}
+
+# Ensure CRYPTO_POLICY is not commented out
+sed -i 's/#CRYPTO_POLICY=/CRYPTO_POLICY=/' ${CONF_FILE}
+
+grep -q "'${correct_value}'" ${CONF_FILE}
+
+if [[ $? -ne 0 ]]; then
+    # We need to get the existing value, using PCRE to maintain same regex
+    existing_value=$(grep -Po '(-oMACs=\S+)' ${CONF_FILE})
+
+    if [[ ! -z ${existing_value} ]]; then
+        # replace existing_value with correct_value
+        sed -i "s/${existing_value}/${correct_value}/g" ${CONF_FILE}
+    else
+        # ***NOTE*** #
+        # This probably means this file is not here or it's been modified
+        # unintentionally.
+        # ********** #
+        # echo correct_value to end
+        echo "CRYPTO_POLICY='${correct_value}'" >> ${CONF_FILE}
+    fi
+fi
 
Group   Operating System Vendor Support and Certification   Group contains 1 rule

[ref]   @@ -2861,7 +2861,7 @@ security over the life of the product. A certified product that follows the necessary standards and government certification requirements guarantees that known software vulnerabilities will be remediated, and proper guidance for -protecting and securing the operating system will be given.

Rule   +protecting and securing the operating system will be given.

Rule   The Installed Operating System Is Vendor Supported   [ref]

The installed operating system must be maintained by a vendor. @@ -2888,7 +2888,7 @@ McAfee Endpoint Security for Linux (ENSL)   Group contains 2 rules

[ref]   McAfee Endpoint Security for Linux (ENSL) is a suite of software applications -used to monitor, detect, and defend computer networks and systems.

Rule   +used to monitor, detect, and defend computer networks and systems.

Rule   Install McAfee Endpoint Security for Linux (ENSL)   [ref]

Install McAfee Endpoint Security for Linux antivirus software which is provided for DoD systems and uses signatures to search for the @@ -2901,7 +2901,7 @@ automated remediation is not available for this configuration check.

Rationale:

Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86260-7

References:  - CCI-001263, CCI-000366, SI-2(2), SRG-OS-000191-GPOS-00080, RHEL-08-010001, SV-245540r754730_rule

Rule   + CCI-001263, CCI-000366, SI-2(2), SRG-OS-000191-GPOS-00080, RHEL-08-010001, SV-245540r942951_rule

Rule   Ensure McAfee Endpoint Security for Linux (ENSL) is running   [ref]

Install McAfee Endpoint Security for Linux antivirus software which is provided for DoD systems and uses signatures to search for the @@ -2910,7 +2910,7 @@ automated remediation is not available for this configuration check.

Rationale:

Virus scanning software can be used to detect if a system has been compromised by computer viruses, as well as to limit their spread to other systems.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86261-5

References:  - CCI-001263, CCI-000366, SI-2(2), SRG-OS-000191-GPOS-00080, RHEL-08-010001, SV-245540r754730_rule

Group   + CCI-001263, CCI-000366, SI-2(2), SRG-OS-000191-GPOS-00080, RHEL-08-010001, SV-245540r942951_rule

Group   Disk Partitioning   Group contains 7 rules

[ref]   To ensure separation and protection of data, there @@ -2934,7 +2934,7 @@ listed above. The Logical Volume Manager (LVM) makes this possible. See the LVM HOWTO at http://tldp.org/HOWTO/LVM-HOWTO/ -for more detailed information on LVM.

Rule   +for more detailed information on LVM.

Rule   Encrypt Partitions   [ref]

Red Hat Enterprise Linux 8 natively supports partition encryption through the Linux Unified Key Setup-on-disk-format (LUKS) technology. The easiest way to @@ -2969,7 +2969,7 @@ laptops, places its data at risk of compromise. Encrypting this data mitigates the risk of its loss if the system is lost.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80789-1

References:  - 13, 14, APO01.06, BAI02.01, BAI06.01, DSS04.07, DSS05.03, DSS05.04, DSS05.07, DSS06.02, DSS06.06, 3.13.16, CCI-001199, CCI-002475, CCI-002476, 164.308(a)(1)(ii)(D), 164.308(b)(1), 164.310(d), 164.312(a)(1), 164.312(a)(2)(iii), 164.312(a)(2)(iv), 164.312(b), 164.312(c), 164.314(b)(2)(i), 164.312(d), SR 3.4, SR 4.1, SR 5.2, A.10.1.1, A.11.1.4, A.11.1.5, A.11.2.1, A.13.1.1, A.13.1.3, A.13.2.1, A.13.2.3, A.13.2.4, A.14.1.2, A.14.1.3, A.6.1.2, A.7.1.1, A.7.1.2, A.7.3.1, A.8.2.2, A.8.2.3, A.9.1.1, A.9.1.2, A.9.2.3, A.9.4.1, A.9.4.4, A.9.4.5, CIP-003-8 R4.2, CIP-007-3 R5.1, CM-6(a), SC-28, SC-28(1), SC-13, AU-9(3), PR.DS-1, PR.DS-5, SRG-OS-000405-GPOS-00184, SRG-OS-000185-GPOS-00079, SRG-OS-000404-GPOS-00183, RHEL-08-010030, SV-230224r917864_rule

Rule   + 13, 14, APO01.06, BAI02.01, BAI06.01, DSS04.07, DSS05.03, DSS05.04, DSS05.07, DSS06.02, DSS06.06, 3.13.16, CCI-001199, CCI-002475, CCI-002476, 164.308(a)(1)(ii)(D), 164.308(b)(1), 164.310(d), 164.312(a)(1), 164.312(a)(2)(iii), 164.312(a)(2)(iv), 164.312(b), 164.312(c), 164.314(b)(2)(i), 164.312(d), SR 3.4, SR 4.1, SR 5.2, A.10.1.1, A.11.1.4, A.11.1.5, A.11.2.1, A.13.1.1, A.13.1.3, A.13.2.1, A.13.2.3, A.13.2.4, A.14.1.2, A.14.1.3, A.6.1.2, A.7.1.1, A.7.1.2, A.7.3.1, A.8.2.2, A.8.2.3, A.9.1.1, A.9.1.2, A.9.2.3, A.9.4.1, A.9.4.4, A.9.4.5, CIP-003-8 R4.2, CIP-007-3 R5.1, CM-6(a), SC-28, SC-28(1), SC-13, AU-9(3), PR.DS-1, PR.DS-5, SRG-OS-000405-GPOS-00184, SRG-OS-000185-GPOS-00079, SRG-OS-000404-GPOS-00183, RHEL-08-010030, SV-230224r917864_rule

Rule   Ensure /home Located On Separate Partition   [ref]

If user home directories will be stored locally, create a separate partition for /home at installation time (or migrate it later using LVM). If @@ -2979,13 +2979,13 @@ setting of more restrictive mount options, and also helps ensure that users cannot trivially fill partitions used for log or audit data storage.

Severity: 
low
Identifiers and References

Identifiers:  CCE-81044-0

References:  - BP28(R12), 12, 15, 8, APO13.01, DSS05.02, CCI-000366, CCI-001208, SR 3.1, SR 3.5, SR 3.8, SR 4.1, SR 4.3, SR 5.1, SR 5.2, SR 5.3, SR 7.1, SR 7.6, A.13.1.1, A.13.2.1, A.14.1.3, CM-6(a), SC-5(2), PR.PT-4, SRG-OS-000480-GPOS-00227, RHEL-08-010800, 1.1.2.3.1, SV-230328r902723_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

-part /home
-
Remediation script:   (show)

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/home"
 size = 1073741824
-

Rule   +Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /home
+

Rule   Ensure /tmp Located On Separate Partition   [ref]

The /tmp directory is a world-writable directory used for temporary file storage. Ensure it has its own partition or @@ -2993,13 +2993,13 @@ Placing /tmp in its own partition enables the setting of more restrictive mount options, which can help protect programs which use it.

Severity: 
low
Identifiers and References

Identifiers:  CCE-80851-9

References:  - BP28(R12), 12, 15, 8, APO13.01, DSS05.02, CCI-000366, SR 3.1, SR 3.5, SR 3.8, SR 4.1, SR 4.3, SR 5.1, SR 5.2, SR 5.3, SR 7.1, SR 7.6, A.13.1.1, A.13.2.1, A.14.1.3, CM-6(a), SC-5(2), PR.PT-4, SRG-OS-000480-GPOS-00227, RHEL-08-010543, 1.1.2.1.1, SV-230295r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

-part /tmp
-
Remediation script:   (show)

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/tmp"
 size = 1073741824
-

Rule   +Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /tmp
+

Rule   Ensure /var Located On Separate Partition   [ref]

The /var directory is used by daemons and other system services to store frequently-changing data. Ensure that /var has its own partition @@ -3009,13 +3009,13 @@ It is not uncommon for the /var directory to contain world-writable directories installed by other software packages.

Severity: 
low
Identifiers and References

Identifiers:  CCE-80852-7

References:  - BP28(R12), 12, 15, 8, APO13.01, DSS05.02, CCI-000366, SR 3.1, SR 3.5, SR 3.8, SR 4.1, SR 4.3, SR 5.1, SR 5.2, SR 5.3, SR 7.1, SR 7.6, A.13.1.1, A.13.2.1, A.14.1.3, CM-6(a), SC-5(2), PR.PT-4, SRG-OS-000480-GPOS-00227, RHEL-08-010540, 1.1.2.4.1, SV-230292r902718_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

-part /var
-
Remediation script:   (show)

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/var"
 size = 3221225472
-

Rule   +Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /var
+

Rule   Ensure /var/log Located On Separate Partition   [ref]

System logs are stored in the /var/log directory. @@ -3024,13 +3024,13 @@ enables better separation between log files and other files in /var/.

Severity: 
low
Identifiers and References

Identifiers:  CCE-80853-5

References:  - BP28(R12), BP28(R47), 1, 12, 14, 15, 16, 3, 5, 6, 8, APO11.04, APO13.01, BAI03.05, DSS05.02, DSS05.04, DSS05.07, MEA02.01, CCI-000366, 4.3.3.3.9, 4.3.3.5.8, 4.3.4.4.7, 4.4.2.1, 4.4.2.2, 4.4.2.4, SR 2.10, SR 2.11, SR 2.12, SR 2.8, SR 2.9, SR 3.1, SR 3.5, SR 3.8, SR 4.1, SR 4.3, SR 5.1, SR 5.2, SR 5.3, SR 7.1, SR 7.6, A.12.4.1, A.12.4.2, A.12.4.3, A.12.4.4, A.12.7.1, A.13.1.1, A.13.2.1, A.14.1.3, CIP-007-3 R6.5, CM-6(a), AU-4, SC-5(2), PR.PT-1, PR.PT-4, SRG-OS-000480-GPOS-00227, RHEL-08-010541, 1.1.2.6.1, SV-230293r902720_rule

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/var/log"
 size = 5368709120
-

Rule   +Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /var/log
+

Rule   Ensure /var/log/audit Located On Separate Partition   [ref]

Audit logs are stored in the /var/log/audit directory. @@ -3043,13 +3043,13 @@ auditing cannot be halted due to the partition running out of space.

Severity: 
low
Identifiers and References

Identifiers:  CCE-80854-3

References:  - BP28(R43), 1, 12, 13, 14, 15, 16, 2, 3, 5, 6, 8, APO11.04, APO13.01, BAI03.05, BAI04.04, DSS05.02, DSS05.04, DSS05.07, MEA02.01, CCI-000366, CCI-001849, 164.312(a)(2)(ii), 4.3.3.3.9, 4.3.3.5.8, 4.3.4.4.7, 4.4.2.1, 4.4.2.2, 4.4.2.4, SR 2.10, SR 2.11, SR 2.12, SR 2.8, SR 2.9, SR 3.1, SR 3.5, SR 3.8, SR 4.1, SR 4.3, SR 5.1, SR 5.2, SR 5.3, SR 7.1, SR 7.2, SR 7.6, A.12.1.3, A.12.4.1, A.12.4.2, A.12.4.3, A.12.4.4, A.12.7.1, A.13.1.1, A.13.2.1, A.14.1.3, A.17.2.1, CIP-007-3 R6.5, CM-6(a), AU-4, SC-5(2), PR.DS-4, PR.PT-1, PR.PT-4, FMT_SMF_EXT.1, SRG-OS-000341-GPOS-00132, SRG-OS-000480-GPOS-00227, SRG-APP-000357-CTR-000800, RHEL-08-010542, 1.1.2.7.1, SV-230294r627750_rule

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/var/log/audit"
 size = 10737418240
-

Rule   +Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /var/log/audit
+

Rule   Ensure /var/tmp Located On Separate Partition   [ref]

The /var/tmp directory is a world-writable directory used for temporary file storage. Ensure it has its own partition or @@ -3057,12 +3057,12 @@ Placing /var/tmp in its own partition enables the setting of more restrictive mount options, which can help protect programs which use it.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82730-3

References:  - BP28(R12), SRG-OS-000480-GPOS-00227, RHEL-08-010544, 1.1.2.5.1, SV-244529r902737_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

-part /var/tmp
-
Remediation script:   (show)

Remediation script:   (show)


 [[customizations.filesystem]]
 mountpoint = "/var/tmp"
 size = 1073741824
+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:high
Reboot:false
Strategy:enable

+part /var/tmp
 
Group   GNOME Desktop Environment   Group contains 3 groups and 10 rules

[ref]   @@ -3086,7 +3086,7 @@

For more information about enforcing preferences in the GNOME3 environment using the DConf -configuration system, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide/> and the man page dconf(1).

Rule   +configuration system, see https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/desktop_migration_and_administration_guide/> and the man page dconf(1).

Rule   Disable the GNOME3 Login User List   [ref]

In the default graphical environment, users logging directly into the system are greeted with a login screen that displays all known users. @@ -3105,68 +3105,7 @@ with physical access to the system to quickly enumerate known user accounts without logging in.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86195-5

References:  - CM-6(a), AC-23, SRG-OS-000480-GPOS-00227, RHEL-08-020032, 1.8.3, SV-244536r743857_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
-
-# Check for setting in any of the DConf db directories
-# If files contain ibus or distro, ignore them.
-# The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \
-                                | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1)
-DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings"
-DBDIR="/etc/dconf/db/gdm.d"
-
-mkdir -p "${DBDIR}"
-
-# Comment out the configurations in databases different from the target one
-if [ "${#SETTINGSFILES[@]}" -ne 0 ]
-then
-    if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}"
-    then
-        
-        sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}"
-    fi
-fi
-
-[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}"
-then
-    printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE}
-fi
-
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")"
-if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}"
-then
-        sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}"
-    else
-        sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}"
-fi
-
-dconf update
-# Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/gdm.d/locks"
-
-mkdir -p "${LOCKSFOLDER}"
-
-# Comment out the configurations in databases different from the target one
-if [[ ! -z "${LOCKFILES}" ]]
-then
-    sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}"
-fi
-
-if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/
-then
-    echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock"
-fi
-
-dconf update
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+            CM-6(a), AC-23, SRG-OS-000480-GPOS-00227, RHEL-08-020032, 1.8.3, SV-244536r743857_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -3241,77 +3180,60 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   - Enable the GNOME3 Screen Locking On Smartcard Removal -   [ref]

In the default graphical environment, screen locking on smartcard removal -can be enabled by setting removal-action -to 'lock-screen'. -

-To enable, add or edit removal-action to -/etc/dconf/db/local.d/00-security-settings. For example: -

[org/gnome/settings-daemon/peripherals/smartcard]
-removal-action='lock-screen'
-Once the setting has been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -
/org/gnome/settings-daemon/peripherals/smartcard/removal-action
-After the settings have been set, run dconf update.

Rationale:

Locking the screen automatically when removing the smartcard can -prevent undesired access to system.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-83910-0

References:  - CCI-000056, CCI-000058, SRG-OS-000028-GPOS-00009, SRG-OS-000030-GPOS-00011, RHEL-08-020050, SV-230351r792899_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
 
 # Check for setting in any of the DConf db directories
 # If files contain ibus or distro, ignore them.
 # The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "/etc/dconf/db/" \
-                                | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
-DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
-DBDIR="/etc/dconf/db/local.d"
+readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \
+                                | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1)
+DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings"
+DBDIR="/etc/dconf/db/gdm.d"
 
 mkdir -p "${DBDIR}"
 
 # Comment out the configurations in databases different from the target one
 if [ "${#SETTINGSFILES[@]}" -ne 0 ]
 then
-    if grep -q "^\\s*removal-action\\s*=" "${SETTINGSFILES[@]}"
+    if grep -q "^\\s*disable-user-list\\s*=" "${SETTINGSFILES[@]}"
     then
         
-        sed -Ei "s/(^\s*)removal-action(\s*=)/#\1removal-action\2/g" "${SETTINGSFILES[@]}"
+        sed -Ei "s/(^\s*)disable-user-list(\s*=)/#\1disable-user-list\2/g" "${SETTINGSFILES[@]}"
     fi
 fi
 
 [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/settings-daemon/peripherals/smartcard\\]" "${DCONFFILE}"
+if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}"
 then
-    printf '%s\n' "[org/gnome/settings-daemon/peripherals/smartcard]" >> ${DCONFFILE}
+    printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE}
 fi
 
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'lock-screen'")"
-if grep -q "^\\s*removal-action\\s*=" "${DCONFFILE}"
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")"
+if grep -q "^\\s*disable-user-list\\s*=" "${DCONFFILE}"
 then
-        sed -i "s/\\s*removal-action\\s*=\\s*.*/removal-action=${escaped_value}/g" "${DCONFFILE}"
+        sed -i "s/\\s*disable-user-list\\s*=\\s*.*/disable-user-list=${escaped_value}/g" "${DCONFFILE}"
     else
-        sed -i "\\|\\[org/gnome/settings-daemon/peripherals/smartcard\\]|a\\removal-action=${escaped_value}" "${DCONFFILE}"
+        sed -i "\\|\\[org/gnome/login-screen\\]|a\\disable-user-list=${escaped_value}" "${DCONFFILE}"
 fi
 
 dconf update
 # Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/local.d/locks"
+LOCKFILES=$(grep -r "^/org/gnome/login-screen/disable-user-list$" "/etc/dconf/db/" \
+            | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1)
+LOCKSFOLDER="/etc/dconf/db/gdm.d/locks"
 
 mkdir -p "${LOCKSFOLDER}"
 
 # Comment out the configurations in databases different from the target one
 if [[ ! -z "${LOCKFILES}" ]]
 then
-    sed -i -E "s|^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$|#&|" "${LOCKFILES[@]}"
+    sed -i -E "s|^/org/gnome/login-screen/disable-user-list$|#&|" "${LOCKFILES[@]}"
 fi
 
-if ! grep -qr "^/org/gnome/settings-daemon/peripherals/smartcard/removal-action$" /etc/dconf/db/local.d/
+if ! grep -qr "^/org/gnome/login-screen/disable-user-list$" /etc/dconf/db/gdm.d/
 then
-    echo "/org/gnome/settings-daemon/peripherals/smartcard/removal-action" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+    echo "/org/gnome/login-screen/disable-user-list" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock"
 fi
 
 dconf update
@@ -3319,7 +3241,24 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+

Rule   + Enable the GNOME3 Screen Locking On Smartcard Removal +   [ref]

In the default graphical environment, screen locking on smartcard removal +can be enabled by setting removal-action +to 'lock-screen'. +

+To enable, add or edit removal-action to +/etc/dconf/db/local.d/00-security-settings. For example: +

[org/gnome/settings-daemon/peripherals/smartcard]
+removal-action='lock-screen'
+Once the setting has been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +
/org/gnome/settings-daemon/peripherals/smartcard/removal-action
+After the settings have been set, run dconf update.

Rationale:

Locking the screen automatically when removing the smartcard can +prevent undesired access to system.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-83910-0

References:  + CCI-000056, CCI-000058, SRG-OS-000028-GPOS-00009, SRG-OS-000030-GPOS-00011, RHEL-08-020050, SV-230351r792899_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -3471,7 +3410,68 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-
Group   Configure GNOME Screen Locking   Group contains 6 rules

[ref]   @@ -3562,7 +3562,7 @@

For more information about enforcing preferences in the GNOME3 environment using the DConf configuration system, see http://wiki.gnome.org/dconf and -the man page dconf(1).

Rule   +the man page dconf(1).

Rule   Set GNOME3 Screensaver Inactivity Timeout   [ref]

The idle time-out value for inactivity in the GNOME3 desktop is configured via the idle-delay setting must be set under an appropriate configuration file(s) in the /etc/dconf/db/local.d directory @@ -3577,52 +3577,7 @@ system session prior to vacating the vicinity, GNOME3 can be configured to identify when a user's session has idled and take action to initiate a session lock.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80775-0

References:  - 1, 12, 15, 16, 5.5.5, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, AC-11(a), CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020060, 1.8.4, SV-230352r646876_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
-
-inactivity_timeout_value='900'
-
-
-# Check for setting in any of the DConf db directories
-# If files contain ibus or distro, ignore them.
-# The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \
-                                | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
-DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
-DBDIR="/etc/dconf/db/local.d"
-
-mkdir -p "${DBDIR}"
-
-# Comment out the configurations in databases different from the target one
-if [ "${#SETTINGSFILES[@]}" -ne 0 ]
-then
-    if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}"
-    then
-        
-        sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}"
-    fi
-fi
-
-[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}"
-then
-    printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE}
-fi
-
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")"
-if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}"
-then
-        sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}"
-    else
-        sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}"
-fi
-
-dconf update
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -3693,27 +3648,16 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   - Set GNOME3 Screensaver Lock Delay After Activation Period -   [ref]

To activate the locking delay of the screensaver in the GNOME3 desktop when -the screensaver is activated, add or set lock-delay to uint32 5 in -/etc/dconf/db/local.d/00-security-settings. For example: -

[org/gnome/desktop/screensaver]
-lock-delay=uint32 5
-
-After the settings have been set, run dconf update.

Rationale:

A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity -of the information system but does not want to logout because of the temporary nature of the absense.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-80776-8

References:  - 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000056, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, AC-11(a), CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020031, 1.8.4, SV-244535r743854_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
 
-var_screensaver_lock_delay='5'
+inactivity_timeout_value='900'
 
 
 # Check for setting in any of the DConf db directories
 # If files contain ibus or distro, ignore them.
 # The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \
+readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/session\\]" "/etc/dconf/db/" \
                                 | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
 DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
 DBDIR="/etc/dconf/db/local.d"
@@ -3723,25 +3667,25 @@
 # Comment out the configurations in databases different from the target one
 if [ "${#SETTINGSFILES[@]}" -ne 0 ]
 then
-    if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}"
+    if grep -q "^\\s*idle-delay\\s*=" "${SETTINGSFILES[@]}"
     then
         
-        sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}"
+        sed -Ei "s/(^\s*)idle-delay(\s*=)/#\1idle-delay\2/g" "${SETTINGSFILES[@]}"
     fi
 fi
 
 [ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}"
+if ! grep -q "\\[org/gnome/desktop/session\\]" "${DCONFFILE}"
 then
-    printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE}
+    printf '%s\n' "[org/gnome/desktop/session]" >> ${DCONFFILE}
 fi
 
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")"
-if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}"
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${inactivity_timeout_value}")"
+if grep -q "^\\s*idle-delay\\s*=" "${DCONFFILE}"
 then
-        sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}"
+        sed -i "s/\\s*idle-delay\\s*=\\s*.*/idle-delay=${escaped_value}/g" "${DCONFFILE}"
     else
-        sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}"
+        sed -i "\\|\\[org/gnome/desktop/session\\]|a\\idle-delay=${escaped_value}" "${DCONFFILE}"
 fi
 
 dconf update
@@ -3749,7 +3693,18 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+

Rule   + Set GNOME3 Screensaver Lock Delay After Activation Period +   [ref]

To activate the locking delay of the screensaver in the GNOME3 desktop when +the screensaver is activated, add or set lock-delay to uint32 5 in +/etc/dconf/db/local.d/00-security-settings. For example: +

[org/gnome/desktop/screensaver]
+lock-delay=uint32 5
+
+After the settings have been set, run dconf update.

Rationale:

A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity +of the information system but does not want to logout because of the temporary nature of the absense.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-80776-8

References:  + 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000056, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, AC-11(a), CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020031, 1.8.4, SV-244535r743854_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -3817,25 +3772,12 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   - Enable GNOME3 Screensaver Lock After Idle Period -   [ref]

-To activate locking of the screensaver in the GNOME3 desktop when it is activated, -add or set lock-enabled to true in -/etc/dconf/db/local.d/00-security-settings. For example: -

[org/gnome/desktop/screensaver]
-lock-enabled=true
-
-Once the settings have been added, add a lock to -/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -
/org/gnome/desktop/screensaver/lock-enabled
-After the settings have been set, run dconf update.

Rationale:

A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity -of the information system but does not want to logout because of the temporary nature of the absense.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-80777-6

References:  - 1, 12, 15, 16, 5.5.5, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000056, CCI-000058, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000028-GPOS-00009, SRG-OS-000030-GPOS-00011, RHEL-08-020030, SV-230347r627750_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
 
+var_screensaver_lock_delay='5'
+
+
 # Check for setting in any of the DConf db directories
 # If files contain ibus or distro, ignore them.
 # The assignment assumes that individual filenames don't contain :
@@ -3849,10 +3791,10 @@
 # Comment out the configurations in databases different from the target one
 if [ "${#SETTINGSFILES[@]}" -ne 0 ]
 then
-    if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}"
+    if grep -q "^\\s*lock-delay\\s*=" "${SETTINGSFILES[@]}"
     then
         
-        sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}"
+        sed -Ei "s/(^\s*)lock-delay(\s*=)/#\1lock-delay\2/g" "${SETTINGSFILES[@]}"
     fi
 fi
 
@@ -3862,31 +3804,12 @@
     printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE}
 fi
 
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")"
-if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}"
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "uint32 ${var_screensaver_lock_delay}")"
+if grep -q "^\\s*lock-delay\\s*=" "${DCONFFILE}"
 then
-        sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}"
+        sed -i "s/\\s*lock-delay\\s*=\\s*.*/lock-delay=${escaped_value}/g" "${DCONFFILE}"
     else
-        sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}"
-fi
-
-dconf update
-# Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/local.d/locks"
-
-mkdir -p "${LOCKSFOLDER}"
-
-# Comment out the configurations in databases different from the target one
-if [[ ! -z "${LOCKFILES}" ]]
-then
-    sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}"
-fi
-
-if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/
-then
-    echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+        sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-delay=${escaped_value}" "${DCONFFILE}"
 fi
 
 dconf update
@@ -3894,7 +3817,23 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+

Rule   + Enable GNOME3 Screensaver Lock After Idle Period +   [ref]

+To activate locking of the screensaver in the GNOME3 desktop when it is activated, +add or set lock-enabled to true in +/etc/dconf/db/local.d/00-security-settings. For example: +

[org/gnome/desktop/screensaver]
+lock-enabled=true
+
+Once the settings have been added, add a lock to +/etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +
/org/gnome/desktop/screensaver/lock-enabled
+After the settings have been set, run dconf update.

Rationale:

A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity +of the information system but does not want to logout because of the temporary nature of the absense.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-80777-6

References:  + 1, 12, 15, 16, 5.5.5, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000056, CCI-000058, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000028-GPOS-00009, SRG-OS-000030-GPOS-00011, RHEL-08-020030, SV-230347r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -4099,7 +4038,68 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
+
+# Check for setting in any of the DConf db directories
+# If files contain ibus or distro, ignore them.
+# The assignment assumes that individual filenames don't contain :
+readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/desktop/screensaver\\]" "/etc/dconf/db/" \
+                                | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
+DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
+DBDIR="/etc/dconf/db/local.d"
+
+mkdir -p "${DBDIR}"
+
+# Comment out the configurations in databases different from the target one
+if [ "${#SETTINGSFILES[@]}" -ne 0 ]
+then
+    if grep -q "^\\s*lock-enabled\\s*=" "${SETTINGSFILES[@]}"
+    then
+        
+        sed -Ei "s/(^\s*)lock-enabled(\s*=)/#\1lock-enabled\2/g" "${SETTINGSFILES[@]}"
+    fi
+fi
+
+[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
+if ! grep -q "\\[org/gnome/desktop/screensaver\\]" "${DCONFFILE}"
+then
+    printf '%s\n' "[org/gnome/desktop/screensaver]" >> ${DCONFFILE}
+fi
+
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")"
+if grep -q "^\\s*lock-enabled\\s*=" "${DCONFFILE}"
+then
+        sed -i "s/\\s*lock-enabled\\s*=\\s*.*/lock-enabled=${escaped_value}/g" "${DCONFFILE}"
+    else
+        sed -i "\\|\\[org/gnome/desktop/screensaver\\]|a\\lock-enabled=${escaped_value}" "${DCONFFILE}"
+fi
+
+dconf update
+# Check for setting in any of the DConf db directories
+LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-enabled$" "/etc/dconf/db/" \
+            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
+LOCKSFOLDER="/etc/dconf/db/local.d/locks"
+
+mkdir -p "${LOCKSFOLDER}"
+
+# Comment out the configurations in databases different from the target one
+if [[ ! -z "${LOCKFILES}" ]]
+then
+    sed -i -E "s|^/org/gnome/desktop/screensaver/lock-enabled$|#&|" "${LOCKFILES[@]}"
+fi
+
+if ! grep -qr "^/org/gnome/desktop/screensaver/lock-enabled$" /etc/dconf/db/local.d/
+then
+    echo "/org/gnome/desktop/screensaver/lock-enabled" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+fi
+
+dconf update
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Ensure Users Cannot Change GNOME3 Screensaver Lock After Idle Period   [ref]

If not already configured, ensure that users cannot change GNOME3 screensaver lock settings by adding

/org/gnome/desktop/screensaver/lock-enabled
@@ -4109,7 +4109,61 @@ After the settings have been set, run dconf update.

Rationale:

A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to logout because of the temporary nature of the absense.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-87261-4

References:  - 1, 12, 15, 16, 5.5.5, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000056, CCI-000057, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, SRG-OS-000028-GPOS-00009, SRG-OS-000030-GPOS-00011, RHEL-08-020082, SV-244539r743866_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+  package_facts:
+    manager: auto
+  tags:
+  - CCE-87261-4
+  - CJIS-5.5.5
+  - DISA-STIG-RHEL-08-020082
+  - NIST-800-171-3.1.10
+  - NIST-800-53-CM-6(a)
+  - PCI-DSS-Req-8.1.8
+  - dconf_gnome_screensaver_lock_locked
+  - low_complexity
+  - medium_disruption
+  - medium_severity
+  - no_reboot_needed
+  - unknown_strategy
+
+- name: Prevent user modification of GNOME Screensaver lock-enabled
+  lineinfile:
+    path: /etc/dconf/db/local.d/locks/00-security-settings-lock
+    regexp: ^/org/gnome/desktop/screensaver/lock-enabled$
+    line: /org/gnome/desktop/screensaver/lock-enabled
+    create: true
+  when: '"gdm" in ansible_facts.packages'
+  tags:
+  - CCE-87261-4
+  - CJIS-5.5.5
+  - DISA-STIG-RHEL-08-020082
+  - NIST-800-171-3.1.10
+  - NIST-800-53-CM-6(a)
+  - PCI-DSS-Req-8.1.8
+  - dconf_gnome_screensaver_lock_locked
+  - low_complexity
+  - medium_disruption
+  - medium_severity
+  - no_reboot_needed
+  - unknown_strategy
+
+- name: Dconf Update
+  command: dconf update
+  when: '"gdm" in ansible_facts.packages'
+  tags:
+  - CCE-87261-4
+  - CJIS-5.5.5
+  - DISA-STIG-RHEL-08-020082
+  - NIST-800-171-3.1.10
+  - NIST-800-53-CM-6(a)
+  - PCI-DSS-Req-8.1.8
+  - dconf_gnome_screensaver_lock_locked
+  - low_complexity
+  - medium_disruption
+  - medium_severity
+  - no_reboot_needed
+  - unknown_strategy
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q gdm; then
 
 # Check for setting in any of the DConf db directories
@@ -4135,61 +4189,7 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
-  package_facts:
-    manager: auto
-  tags:
-  - CCE-87261-4
-  - CJIS-5.5.5
-  - DISA-STIG-RHEL-08-020082
-  - NIST-800-171-3.1.10
-  - NIST-800-53-CM-6(a)
-  - PCI-DSS-Req-8.1.8
-  - dconf_gnome_screensaver_lock_locked
-  - low_complexity
-  - medium_disruption
-  - medium_severity
-  - no_reboot_needed
-  - unknown_strategy
-
-- name: Prevent user modification of GNOME Screensaver lock-enabled
-  lineinfile:
-    path: /etc/dconf/db/local.d/locks/00-security-settings-lock
-    regexp: ^/org/gnome/desktop/screensaver/lock-enabled$
-    line: /org/gnome/desktop/screensaver/lock-enabled
-    create: true
-  when: '"gdm" in ansible_facts.packages'
-  tags:
-  - CCE-87261-4
-  - CJIS-5.5.5
-  - DISA-STIG-RHEL-08-020082
-  - NIST-800-171-3.1.10
-  - NIST-800-53-CM-6(a)
-  - PCI-DSS-Req-8.1.8
-  - dconf_gnome_screensaver_lock_locked
-  - low_complexity
-  - medium_disruption
-  - medium_severity
-  - no_reboot_needed
-  - unknown_strategy
-
-- name: Dconf Update
-  command: dconf update
-  when: '"gdm" in ansible_facts.packages'
-  tags:
-  - CCE-87261-4
-  - CJIS-5.5.5
-  - DISA-STIG-RHEL-08-020082
-  - NIST-800-171-3.1.10
-  - NIST-800-53-CM-6(a)
-  - PCI-DSS-Req-8.1.8
-  - dconf_gnome_screensaver_lock_locked
-  - low_complexity
-  - medium_disruption
-  - medium_severity
-  - no_reboot_needed
-  - unknown_strategy
-

Rule   +

Rule   Ensure Users Cannot Change GNOME3 Screensaver Settings   [ref]

If not already configured, ensure that users cannot change GNOME3 screensaver lock settings by adding /org/gnome/desktop/screensaver/lock-delay @@ -4202,33 +4202,7 @@ GNOME desktops can be configured to identify when a user's session has idled and take action to initiate the session lock. As such, users should not be allowed to change session settings.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80780-0

References:  - 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020080, 1.8.5, SV-230354r743990_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
-
-# Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/local.d/locks"
-
-mkdir -p "${LOCKSFOLDER}"
-
-# Comment out the configurations in databases different from the target one
-if [[ ! -z "${LOCKFILES}" ]]
-then
-    sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}"
-fi
-
-if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/
-then
-    echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
-fi
-
-dconf update
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -4280,24 +4254,11 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   - Ensure Users Cannot Change GNOME3 Session Idle Settings -   [ref]

If not already configured, ensure that users cannot change GNOME3 session idle settings -by adding /org/gnome/desktop/session/idle-delay -to /etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. -For example: -

/org/gnome/desktop/session/idle-delay
-After the settings have been set, run dconf update.

Rationale:

A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate -physical vicinity of the information system but does not logout because of the temporary nature of the absence. -Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, -GNOME desktops can be configured to identify when a user's session has idled and take action to initiate the -session lock. As such, users should not be allowed to change session settings.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-80781-8

References:  - 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020081, 1.8.5, SV-244538r743863_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
 
 # Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \
+LOCKFILES=$(grep -r "^/org/gnome/desktop/screensaver/lock-delay$" "/etc/dconf/db/" \
             | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
 LOCKSFOLDER="/etc/dconf/db/local.d/locks"
 
@@ -4306,12 +4267,12 @@
 # Comment out the configurations in databases different from the target one
 if [[ ! -z "${LOCKFILES}" ]]
 then
-    sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}"
+    sed -i -E "s|^/org/gnome/desktop/screensaver/lock-delay$|#&|" "${LOCKFILES[@]}"
 fi
 
-if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/
+if ! grep -qr "^/org/gnome/desktop/screensaver/lock-delay$" /etc/dconf/db/local.d/
 then
-    echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+    echo "/org/gnome/desktop/screensaver/lock-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
 fi
 
 dconf update
@@ -4319,7 +4280,20 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+

Rule   + Ensure Users Cannot Change GNOME3 Session Idle Settings +   [ref]

If not already configured, ensure that users cannot change GNOME3 session idle settings +by adding /org/gnome/desktop/session/idle-delay +to /etc/dconf/db/local.d/locks/00-security-settings-lock to prevent user modification. +For example: +

/org/gnome/desktop/session/idle-delay
+After the settings have been set, run dconf update.

Rationale:

A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate +physical vicinity of the information system but does not logout because of the temporary nature of the absence. +Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, +GNOME desktops can be configured to identify when a user's session has idled and take action to initiate the +session lock. As such, users should not be allowed to change session settings.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-80781-8

References:  + 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.10, CCI-000057, CCI-000060, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, CM-6(a), PR.AC-7, FMT_MOF_EXT.1, Req-8.1.8, 8.2.8, SRG-OS-000029-GPOS-00010, SRG-OS-000031-GPOS-00012, RHEL-08-020081, 1.8.5, SV-244538r743863_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -4377,6 +4351,32 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
+
+# Check for setting in any of the DConf db directories
+LOCKFILES=$(grep -r "^/org/gnome/desktop/session/idle-delay$" "/etc/dconf/db/" \
+            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
+LOCKSFOLDER="/etc/dconf/db/local.d/locks"
+
+mkdir -p "${LOCKSFOLDER}"
+
+# Comment out the configurations in databases different from the target one
+if [[ ! -z "${LOCKFILES}" ]]
+then
+    sed -i -E "s|^/org/gnome/desktop/session/idle-delay$|#&|" "${LOCKFILES[@]}"
+fi
+
+if ! grep -qr "^/org/gnome/desktop/session/idle-delay$" /etc/dconf/db/local.d/
+then
+    echo "/org/gnome/desktop/session/idle-delay" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+fi
+
+dconf update
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
 
Group   GNOME System Settings   Group contains 1 rule

[ref]   @@ -4385,7 +4385,7 @@ actions that users normally would not be able to do in non-graphical mode such as remote access configuration, power policies, Geo-location, etc. Configuring such settings in GNOME will prevent accidential graphical configuration -changes by users from taking place.

Rule   +changes by users from taking place.

Rule   Disable Ctrl-Alt-Del Reboot Key Sequence in GNOME3   [ref]

By default, GNOME will reboot the system if the Ctrl-Alt-Del key sequence is pressed. @@ -4405,68 +4405,7 @@ the case of mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot.

Severity: 
high
Identifiers and References

Identifiers:  CCE-84028-0

References:  - 12, 13, 14, 15, 16, 18, 3, 5, APO01.06, DSS05.04, DSS05.07, DSS06.02, 3.1.2, CCI-000366, 4.3.3.7.3, SR 2.1, SR 5.2, A.10.1.1, A.11.1.4, A.11.1.5, A.11.2.1, A.13.1.1, A.13.1.3, A.13.2.1, A.13.2.3, A.13.2.4, A.14.1.2, A.14.1.3, A.6.1.2, A.7.1.1, A.7.1.2, A.7.3.1, A.8.2.2, A.8.2.3, A.9.1.1, A.9.1.2, A.9.2.3, A.9.4.1, A.9.4.4, A.9.4.5, CM-6(a), AC-6(1), CM-7(b), PR.AC-4, PR.DS-5, SRG-OS-000480-GPOS-00227, RHEL-08-040171, SV-230530r646883_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
-
-# Check for setting in any of the DConf db directories
-# If files contain ibus or distro, ignore them.
-# The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \
-                                | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
-DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
-DBDIR="/etc/dconf/db/local.d"
-
-mkdir -p "${DBDIR}"
-
-# Comment out the configurations in databases different from the target one
-if [ "${#SETTINGSFILES[@]}" -ne 0 ]
-then
-    if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}"
-    then
-        
-        sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}"
-    fi
-fi
-
-[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}"
-then
-    printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE}
-fi
-
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")"
-if grep -q "^\\s*logout\\s*=" "${DCONFFILE}"
-then
-        sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}"
-    else
-        sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}"
-fi
-
-dconf update
-# Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/local.d/locks"
-
-mkdir -p "${LOCKSFOLDER}"
-
-# Comment out the configurations in databases different from the target one
-if [[ ! -z "${LOCKFILES}" ]]
-then
-    sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}"
-fi
-
-if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/
-then
-    echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
-fi
-
-dconf update
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -4549,6 +4488,67 @@
   - medium_disruption
   - no_reboot_needed
   - unknown_strategy
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q gdm && { [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; }; then
+
+# Check for setting in any of the DConf db directories
+# If files contain ibus or distro, ignore them.
+# The assignment assumes that individual filenames don't contain :
+readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "/etc/dconf/db/" \
+                                | grep -v 'distro\|ibus\|local.d' | cut -d":" -f1)
+DCONFFILE="/etc/dconf/db/local.d/00-security-settings"
+DBDIR="/etc/dconf/db/local.d"
+
+mkdir -p "${DBDIR}"
+
+# Comment out the configurations in databases different from the target one
+if [ "${#SETTINGSFILES[@]}" -ne 0 ]
+then
+    if grep -q "^\\s*logout\\s*=" "${SETTINGSFILES[@]}"
+    then
+        
+        sed -Ei "s/(^\s*)logout(\s*=)/#\1logout\2/g" "${SETTINGSFILES[@]}"
+    fi
+fi
+
+[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
+if ! grep -q "\\[org/gnome/settings-daemon/plugins/media-keys\\]" "${DCONFFILE}"
+then
+    printf '%s\n' "[org/gnome/settings-daemon/plugins/media-keys]" >> ${DCONFFILE}
+fi
+
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "''")"
+if grep -q "^\\s*logout\\s*=" "${DCONFFILE}"
+then
+        sed -i "s/\\s*logout\\s*=\\s*.*/logout=${escaped_value}/g" "${DCONFFILE}"
+    else
+        sed -i "\\|\\[org/gnome/settings-daemon/plugins/media-keys\\]|a\\logout=${escaped_value}" "${DCONFFILE}"
+fi
+
+dconf update
+# Check for setting in any of the DConf db directories
+LOCKFILES=$(grep -r "^/org/gnome/settings-daemon/plugins/media-keys/logout$" "/etc/dconf/db/" \
+            | grep -v 'distro\|ibus\|local.d' | grep ":" | cut -d":" -f1)
+LOCKSFOLDER="/etc/dconf/db/local.d/locks"
+
+mkdir -p "${LOCKSFOLDER}"
+
+# Comment out the configurations in databases different from the target one
+if [[ ! -z "${LOCKFILES}" ]]
+then
+    sed -i -E "s|^/org/gnome/settings-daemon/plugins/media-keys/logout$|#&|" "${LOCKFILES[@]}"
+fi
+
+if ! grep -qr "^/org/gnome/settings-daemon/plugins/media-keys/logout$" /etc/dconf/db/local.d/
+then
+    echo "/org/gnome/settings-daemon/plugins/media-keys/logout" >> "/etc/dconf/db/local.d/locks/00-security-settings-lock"
+fi
+
+dconf update
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
 
Group   Sudo   Group contains 6 rules

[ref]   @@ -4558,7 +4558,7 @@ that normally only root is allowed to execute.

For more information on Sudo and addition Sudo configuration options, see -https://www.sudo.ws.

Rule   +https://www.sudo.ws.

Rule   Ensure Users Re-Authenticate for Privilege Escalation - sudo !authenticate   [ref]

The sudo !authenticate option, when specified, allows a user to execute commands using sudo without having to authenticate. This should be disabled by making sure that the @@ -4569,22 +4569,7 @@ When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82202-3

References:  - BP28(R5), BP28(R59), 1, 12, 15, 16, 5, DSS05.04, DSS05.10, DSS06.03, DSS06.10, CCI-002038, 4.3.3.5.1, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.3, SR 1.4, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.2, A.9.2.3, A.9.2.4, A.9.2.6, A.9.3.1, A.9.4.2, A.9.4.3, IA-11, CM-6(a), PR.AC-1, PR.AC-7, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158, RHEL-08-010381, SV-230272r854027_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict

-for f in /etc/sudoers /etc/sudoers.d/* ; do
-  if [ ! -e "$f" ] ; then
-    continue
-  fi
-  matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq )
-  if ! test -z "$matching_list"; then
-    while IFS= read -r entry; do
-      # comment out "!authenticate" matches to preserve user data
-      sed -i "s/^${entry}$/# &/g" $f
-    done <<< "$matching_list"
-
-    /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo"
-  fi
-done
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Find /etc/sudoers.d/ files
   ansible.builtin.find:
     paths:
     - /etc/sudoers.d/
@@ -4621,7 +4606,22 @@
   - no_reboot_needed
   - restrict_strategy
   - sudo_remove_no_authenticate
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict

+for f in /etc/sudoers /etc/sudoers.d/* ; do
+  if [ ! -e "$f" ] ; then
+    continue
+  fi
+  matching_list=$(grep -P '^(?!#).*[\s]+\!authenticate.*$' $f | uniq )
+  if ! test -z "$matching_list"; then
+    while IFS= read -r entry; do
+      # comment out "!authenticate" matches to preserve user data
+      sed -i "s/^${entry}$/# &/g" $f
+    done <<< "$matching_list"
+
+    /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo"
+  fi
+done
+

Rule   Ensure Users Re-Authenticate for Privilege Escalation - sudo NOPASSWD   [ref]

The sudo NOPASSWD tag, when specified, allows a user to execute commands using sudo without having to authenticate. This should be disabled @@ -4635,22 +4635,7 @@ When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82197-5

References:  - BP28(R5), BP28(R59), 1, 12, 15, 16, 5, DSS05.04, DSS05.10, DSS06.03, DSS06.10, CCI-002038, 4.3.3.5.1, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.3, SR 1.4, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.2, A.9.2.3, A.9.2.4, A.9.2.6, A.9.3.1, A.9.4.2, A.9.4.3, IA-11, CM-6(a), PR.AC-1, PR.AC-7, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158, RHEL-08-010380, SV-230271r854026_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict

-for f in /etc/sudoers /etc/sudoers.d/* ; do
-  if [ ! -e "$f" ] ; then
-    continue
-  fi
-  matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq )
-  if ! test -z "$matching_list"; then
-    while IFS= read -r entry; do
-      # comment out "NOPASSWD" matches to preserve user data
-      sed -i "s/^${entry}$/# &/g" $f
-    done <<< "$matching_list"
-
-    /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo"
-  fi
-done
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Find /etc/sudoers.d/ files
   ansible.builtin.find:
     paths:
     - /etc/sudoers.d/
@@ -4687,7 +4672,22 @@
   - no_reboot_needed
   - restrict_strategy
   - sudo_remove_nopasswd
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict

+for f in /etc/sudoers /etc/sudoers.d/* ; do
+  if [ ! -e "$f" ] ; then
+    continue
+  fi
+  matching_list=$(grep -P '^(?!#).*[\s]+NOPASSWD[\s]*\:.*$' $f | uniq )
+  if ! test -z "$matching_list"; then
+    while IFS= read -r entry; do
+      # comment out "NOPASSWD" matches to preserve user data
+      sed -i "s/^${entry}$/# &/g" $f
+    done <<< "$matching_list"
+
+    /usr/sbin/visudo -cf $f &> /dev/null || echo "Fail to validate $f with visudo"
+  fi
+done
+

Rule   Require Re-Authentication When Using the sudo Command   [ref]

The sudo timestamp_timeout tag sets the amount of time sudo password prompt waits. The default timestamp_timeout value is 5 minutes. @@ -4702,45 +4702,7 @@ When operating systems provide the capability to escalate a functional capability, it is critical that the user re-authenticate.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-87838-9

References:  - CCI-002038, IA-11, 2.2.6, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158, RHEL-08-010384, 5.3.5, 5.3.6, SV-237643r861088_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
# Remediation is applicable only in certain platforms
-if rpm --quiet -q sudo; then
-
-var_sudo_timestamp_timeout='0'
-
-
-if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then
-    find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \;
-fi
-
-if /usr/sbin/visudo -qcf /etc/sudoers; then
-    cp /etc/sudoers /etc/sudoers.bak
-    if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then
-        # sudoers file doesn't define Option timestamp_timeout
-        echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers
-    else
-        # sudoers file defines Option timestamp_timeout, remediate wrong values if present
-        if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then
-            sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers
-        fi
-    fi
-    
-    # Check validity of sudoers and cleanup bak
-    if /usr/sbin/visudo -qcf /etc/sudoers; then
-        rm -f /etc/sudoers.bak
-    else
-        echo "Fail to validate remediated /etc/sudoers, reverting to original file."
-        mv /etc/sudoers.bak /etc/sudoers
-        false
-    fi
-else
-    echo "Skipping remediation, /etc/sudoers failed to validate"
-    false
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather the package facts
+            CCI-002038, IA-11, 2.2.6, SRG-OS-000373-GPOS-00156, SRG-OS-000373-GPOS-00157, SRG-OS-000373-GPOS-00158, RHEL-08-010384, 4.3.6, SV-237643r861088_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -4864,7 +4826,45 @@
   - no_reboot_needed
   - restrict_strategy
   - sudo_require_reauthentication
-

Rule   +Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
# Remediation is applicable only in certain platforms
+if rpm --quiet -q sudo; then
+
+var_sudo_timestamp_timeout='0'
+
+
+if grep -Px '^[\s]*Defaults.*timestamp_timeout[\s]*=.*' /etc/sudoers.d/*; then
+    find /etc/sudoers.d/ -type f -exec sed -Ei "/^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=.*/d" {} \;
+fi
+
+if /usr/sbin/visudo -qcf /etc/sudoers; then
+    cp /etc/sudoers /etc/sudoers.bak
+    if ! grep -P '^[\s]*Defaults.*timestamp_timeout[\s]*=[\s]*[-]?\w+.*$' /etc/sudoers; then
+        # sudoers file doesn't define Option timestamp_timeout
+        echo "Defaults timestamp_timeout=${var_sudo_timestamp_timeout}" >> /etc/sudoers
+    else
+        # sudoers file defines Option timestamp_timeout, remediate wrong values if present
+        if grep -qP "^[\s]*Defaults\s.*\btimestamp_timeout[\s]*=[\s]*(?!${var_sudo_timestamp_timeout}\b)[-]?\w+\b.*$" /etc/sudoers; then
+            sed -Ei "s/(^[[:blank:]]*Defaults.*timestamp_timeout[[:blank:]]*=)[[:blank:]]*[-]?\w+(.*$)/\1${var_sudo_timestamp_timeout}\2/" /etc/sudoers
+        fi
+    fi
+    
+    # Check validity of sudoers and cleanup bak
+    if /usr/sbin/visudo -qcf /etc/sudoers; then
+        rm -f /etc/sudoers.bak
+    else
+        echo "Fail to validate remediated /etc/sudoers, reverting to original file."
+        mv /etc/sudoers.bak /etc/sudoers
+        false
+    fi
+else
+    echo "Skipping remediation, /etc/sudoers failed to validate"
+    false
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   The operating system must restrict privilege elevation to authorized personnel   [ref]

The sudo command allows a user to execute programs with elevated (administrator) privileges. It prompts the user for their password @@ -4877,7 +4877,7 @@ and removing lines from the sudoers file can make the system non-administrable.

Rationale:

If the "sudoers" file is not configured correctly, any user defined on the system can initiate privileged actions on the target system.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-83425-9

References:  - CCI-000366, CM-6(b), CM-6(iv), SRG-OS-000480-GPOS-00227, RHEL-08-010382, SV-237641r646893_rule

Rule   + CCI-000366, CM-6(b), CM-6(iv), SRG-OS-000480-GPOS-00227, RHEL-08-010382, SV-237641r646893_rule

Rule   Ensure sudo only includes the default configuration directory   [ref]

Administrators can configure authorized sudo users via drop-in files, and it is possible to include other directories and configuration files from the file currently being parsed. @@ -4892,27 +4892,7 @@ Use of these configuration options makes it easier for one compromised accound to be used to compromise other accounts.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-86377-9

References:  - CCI-000366, SRG-OS-000480-GPOS-00227, RHEL-08-010379, SV-251711r833385_rule

Remediation Shell script:   (show)


-sudoers_config_file="/etc/sudoers"
-sudoers_config_dir="/etc/sudoers.d"
-sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file")
-if [ "$sudoers_includedir_count" -gt 1 ]; then
-    sed -i "/#includedir/d" "$sudoers_config_file"
-    echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
-elif [ "$sudoers_includedir_count" -eq 0 ]; then
-    echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
-else
-    if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then
-        sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file"
-    fi
-fi
-
-sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file"
-
-if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then
-    sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/*
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Check for duplicate values
+            CCI-000366, SRG-OS-000480-GPOS-00227, RHEL-08-010379, SV-251711r833385_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:configure
- name: Check for duplicate values
   lineinfile:
     path: /etc/sudoers
     create: false
@@ -5029,7 +5009,27 @@
   - medium_severity
   - no_reboot_needed
   - sudoers_default_includedir
-

Rule   +Remediation Shell script:   (show)


+sudoers_config_file="/etc/sudoers"
+sudoers_config_dir="/etc/sudoers.d"
+sudoers_includedir_count=$(grep -c "#includedir" "$sudoers_config_file")
+if [ "$sudoers_includedir_count" -gt 1 ]; then
+    sed -i "/#includedir/d" "$sudoers_config_file"
+    echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
+elif [ "$sudoers_includedir_count" -eq 0 ]; then
+    echo "#includedir /etc/sudoers.d" >> "$sudoers_config_file"
+else
+    if ! grep -q "^#includedir /etc/sudoers.d" "$sudoers_config_file"; then
+        sed -i "s|^#includedir.*|#includedir /etc/sudoers.d|g" "$sudoers_config_file"
+    fi
+fi
+
+sed -Ei "/^#include\s/d; /^@includedir\s/d" "$sudoers_config_file"
+
+if grep -Pr "^[#@]include(dir)?\s" "$sudoers_config_dir" ; then
+    sed -Ei "/^[#@]include(dir)?\s/d" "$sudoers_config_dir"/*
+fi
+

Rule   Ensure invoking users password for privilege escalation when using sudo   [ref]

The sudoers security policy requires that users authenticate themselves before they can use sudo. When sudoers requires authentication, it validates the invoking user's credentials. @@ -5045,75 +5045,7 @@ /etc/sudoers:Defaults !runaspw

Rationale:

If the rootpw, targetpw, or runaspw flags are defined and not disabled, by default the operating system will prompt the invoking user for the "root" user password.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-83422-6

References:  - CCI-000366, CCI-002227, CM-6(b), CM-6.1(iv), SRG-OS-000480-GPOS-00227, RHEL-08-010383, SV-237642r880727_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q sudo; then
-
-if grep -x '^Defaults targetpw$' /etc/sudoers; then
-    sed -i "/Defaults targetpw/d" /etc/sudoers \;
-fi
-if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then
-    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \;
-fi
-if grep -x '^Defaults rootpw$' /etc/sudoers; then
-    sed -i "/Defaults rootpw/d" /etc/sudoers \;
-fi
-if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then
-    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \;
-fi
-if grep -x '^Defaults runaspw$' /etc/sudoers; then
-    sed -i "/Defaults runaspw/d" /etc/sudoers \;
-fi
-if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then
-    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \;
-fi
-
-if [ -e "/etc/sudoers" ] ; then
-    
-    LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers"
-else
-    touch "/etc/sudoers"
-fi
-# make sure file has newline at the end
-sed -i -e '$a\' "/etc/sudoers"
-
-cp "/etc/sudoers" "/etc/sudoers.bak"
-# Insert at the end of the file
-printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers"
-# Clean up after ourselves.
-rm "/etc/sudoers.bak"
-if [ -e "/etc/sudoers" ] ; then
-    
-    LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers"
-else
-    touch "/etc/sudoers"
-fi
-# make sure file has newline at the end
-sed -i -e '$a\' "/etc/sudoers"
-
-cp "/etc/sudoers" "/etc/sudoers.bak"
-# Insert at the end of the file
-printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers"
-# Clean up after ourselves.
-rm "/etc/sudoers.bak"
-if [ -e "/etc/sudoers" ] ; then
-    
-    LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers"
-else
-    touch "/etc/sudoers"
-fi
-# make sure file has newline at the end
-sed -i -e '$a\' "/etc/sudoers"
-
-cp "/etc/sudoers" "/etc/sudoers.bak"
-# Insert at the end of the file
-printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers"
-# Clean up after ourselves.
-rm "/etc/sudoers.bak"
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather the package facts
+            CCI-000366, CCI-002227, CM-6(b), CM-6.1(iv), SRG-OS-000480-GPOS-00227, RHEL-08-010383, SV-237642r880727_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -5490,27 +5422,113 @@
   - no_reboot_needed
   - restrict_strategy
   - sudoers_validate_passwd
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q sudo; then
+
+if grep -x '^Defaults targetpw$' /etc/sudoers; then
+    sed -i "/Defaults targetpw/d" /etc/sudoers \;
+fi
+if grep -x '^Defaults targetpw$' /etc/sudoers.d/*; then
+    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults targetpw/d" {} \;
+fi
+if grep -x '^Defaults rootpw$' /etc/sudoers; then
+    sed -i "/Defaults rootpw/d" /etc/sudoers \;
+fi
+if grep -x '^Defaults rootpw$' /etc/sudoers.d/*; then
+    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults rootpw/d" {} \;
+fi
+if grep -x '^Defaults runaspw$' /etc/sudoers; then
+    sed -i "/Defaults runaspw/d" /etc/sudoers \;
+fi
+if grep -x '^Defaults runaspw$' /etc/sudoers.d/*; then
+    find /etc/sudoers.d/ -type f -exec sed -i "/Defaults runaspw/d" {} \;
+fi
+
+if [ -e "/etc/sudoers" ] ; then
+    
+    LC_ALL=C sed -i "/Defaults !targetpw/d" "/etc/sudoers"
+else
+    touch "/etc/sudoers"
+fi
+# make sure file has newline at the end
+sed -i -e '$a\' "/etc/sudoers"
+
+cp "/etc/sudoers" "/etc/sudoers.bak"
+# Insert at the end of the file
+printf '%s\n' "Defaults !targetpw" >> "/etc/sudoers"
+# Clean up after ourselves.
+rm "/etc/sudoers.bak"
+if [ -e "/etc/sudoers" ] ; then
+    
+    LC_ALL=C sed -i "/Defaults !rootpw/d" "/etc/sudoers"
+else
+    touch "/etc/sudoers"
+fi
+# make sure file has newline at the end
+sed -i -e '$a\' "/etc/sudoers"
+
+cp "/etc/sudoers" "/etc/sudoers.bak"
+# Insert at the end of the file
+printf '%s\n' "Defaults !rootpw" >> "/etc/sudoers"
+# Clean up after ourselves.
+rm "/etc/sudoers.bak"
+if [ -e "/etc/sudoers" ] ; then
+    
+    LC_ALL=C sed -i "/Defaults !runaspw/d" "/etc/sudoers"
+else
+    touch "/etc/sudoers"
+fi
+# make sure file has newline at the end
+sed -i -e '$a\' "/etc/sudoers"
+
+cp "/etc/sudoers" "/etc/sudoers.bak"
+# Insert at the end of the file
+printf '%s\n' "Defaults !runaspw" >> "/etc/sudoers"
+# Clean up after ourselves.
+rm "/etc/sudoers.bak"
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
 
Group   System Tooling / Utilities   Group contains 12 rules

[ref]   The following checks evaluate the system for recommended base packages -- both for installation -and removal.

Rule   +and removal.

Rule   Install rng-tools Package   [ref]

The rng-tools package can be installed with the following command:

 $ sudo yum install rng-tools

Rationale:

rng-tools provides hardware random number generator tools, such as those used in the formation of x509/PKI certificates.

Severity: 
low
Identifiers and References

Identifiers:  CCE-82968-9

References:  - CCI-000366, SRG-OS-000480-GPOS-00227, RHEL-08-010472, SV-244527r743830_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable

-package --add=rng-tools
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
include install_rng-tools
+            CCI-000366, SRG-OS-000480-GPOS-00227, RHEL-08-010472, SV-244527r743830_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
- name: Ensure rng-tools is installed
+  package:
+    name: rng-tools
+    state: present
+  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+  tags:
+  - CCE-82968-9
+  - DISA-STIG-RHEL-08-010472
+  - enable_strategy
+  - low_complexity
+  - low_disruption
+  - low_severity
+  - no_reboot_needed
+  - package_rng-tools_installed
+
Remediation script:   (show)


+[[packages]]
+name = "rng-tools"
+version = "*"
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
include install_rng-tools
 
 class install_rng-tools {
   package { 'rng-tools':
     ensure => 'installed',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
# Remediation is applicable only in certain platforms
+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable

+package --add=rng-tools
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
# Remediation is applicable only in certain platforms
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 if ! rpm -q --quiet "rng-tools" ; then
@@ -5520,41 +5538,36 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation script:   (show)


-[[packages]]
-name = "rng-tools"
-version = "*"
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:enable
- name: Ensure rng-tools is installed
-  package:
-    name: rng-tools
-    state: present
-  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
-  tags:
-  - CCE-82968-9
-  - DISA-STIG-RHEL-08-010472
-  - enable_strategy
-  - low_complexity
-  - low_disruption
-  - low_severity
-  - no_reboot_needed
-  - package_rng-tools_installed
-

Rule   +

Rule   Uninstall abrt-addon-ccpp Package   [ref]

The abrt-addon-ccpp package can be removed with the following command:

 $ sudo yum erase abrt-addon-ccpp

Rationale:

abrt-addon-ccpp contains hooks for C/C++ crashed programs and abrt's C/C++ analyzer plugin.

Severity: 
low
Identifiers and References

Identifiers:  CCE-82919-2

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=abrt-addon-ccpp
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-addon-ccpp
+            CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-addon-ccpp is removed
+  package:
+    name: abrt-addon-ccpp
+    state: absent
+  tags:
+  - CCE-82919-2
+  - DISA-STIG-RHEL-08-040001
+  - disable_strategy
+  - low_complexity
+  - low_disruption
+  - low_severity
+  - no_reboot_needed
+  - package_abrt-addon-ccpp_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-addon-ccpp
 
 class remove_abrt-addon-ccpp {
   package { 'abrt-addon-ccpp':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=abrt-addon-ccpp
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove abrt-addon-ccpp
 #	   from the system, and may remove any packages
 #	   that depend on abrt-addon-ccpp. Execute this
@@ -5566,36 +5579,36 @@
     yum remove -y "abrt-addon-ccpp"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-addon-ccpp is removed
+

Rule   + Uninstall abrt-addon-kerneloops Package +   [ref]

The abrt-addon-kerneloops package can be removed with the following command: +

+$ sudo yum erase abrt-addon-kerneloops

Rationale:

abrt-addon-kerneloops contains plugins for collecting kernel crash information and +reporter plugin which sends this information to a specified server, usually to kerneloops.org.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-82926-7

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-addon-kerneloops is removed
   package:
-    name: abrt-addon-ccpp
+    name: abrt-addon-kerneloops
     state: absent
   tags:
-  - CCE-82919-2
+  - CCE-82926-7
   - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
   - low_severity
   - no_reboot_needed
-  - package_abrt-addon-ccpp_removed
-

Rule   - Uninstall abrt-addon-kerneloops Package -   [ref]

The abrt-addon-kerneloops package can be removed with the following command: -

-$ sudo yum erase abrt-addon-kerneloops

Rationale:

abrt-addon-kerneloops contains plugins for collecting kernel crash information and -reporter plugin which sends this information to a specified server, usually to kerneloops.org.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-82926-7

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=abrt-addon-kerneloops
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-addon-kerneloops
+  - package_abrt-addon-kerneloops_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-addon-kerneloops
 
 class remove_abrt-addon-kerneloops {
   package { 'abrt-addon-kerneloops':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=abrt-addon-kerneloops
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove abrt-addon-kerneloops
 #	   from the system, and may remove any packages
 #	   that depend on abrt-addon-kerneloops. Execute this
@@ -5607,36 +5620,36 @@
     yum remove -y "abrt-addon-kerneloops"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-addon-kerneloops is removed
+

Rule   + Uninstall abrt-cli Package +   [ref]

The abrt-cli package can be removed with the following command: +

+$ sudo yum erase abrt-cli

Rationale:

abrt-cli contains a command line client for controlling abrt daemon +over sockets.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-82907-7

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-cli is removed
   package:
-    name: abrt-addon-kerneloops
+    name: abrt-cli
     state: absent
   tags:
-  - CCE-82926-7
+  - CCE-82907-7
   - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
   - low_severity
   - no_reboot_needed
-  - package_abrt-addon-kerneloops_removed
-

Rule   - Uninstall abrt-cli Package -   [ref]

The abrt-cli package can be removed with the following command: -

-$ sudo yum erase abrt-cli

Rationale:

abrt-cli contains a command line client for controlling abrt daemon -over sockets.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-82907-7

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=abrt-cli
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-cli
+  - package_abrt-cli_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-cli
 
 class remove_abrt-cli {
   package { 'abrt-cli':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=abrt-cli
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove abrt-cli
 #	   from the system, and may remove any packages
 #	   that depend on abrt-cli. Execute this
@@ -5648,35 +5661,35 @@
     yum remove -y "abrt-cli"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-cli is removed
+

Rule   + Uninstall abrt-plugin-sosreport Package +   [ref]

The abrt-plugin-sosreport package can be removed with the following command: +

+$ sudo yum erase abrt-plugin-sosreport

Rationale:

abrt-plugin-sosreport provides a plugin to include an sosreport in an ABRT report.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-82910-1

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-plugin-sosreport is removed
   package:
-    name: abrt-cli
+    name: abrt-plugin-sosreport
     state: absent
   tags:
-  - CCE-82907-7
+  - CCE-82910-1
   - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
   - low_severity
   - no_reboot_needed
-  - package_abrt-cli_removed
-

Rule   - Uninstall abrt-plugin-sosreport Package -   [ref]

The abrt-plugin-sosreport package can be removed with the following command: -

-$ sudo yum erase abrt-plugin-sosreport

Rationale:

abrt-plugin-sosreport provides a plugin to include an sosreport in an ABRT report.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-82910-1

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=abrt-plugin-sosreport
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-plugin-sosreport
+  - package_abrt-plugin-sosreport_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_abrt-plugin-sosreport
 
 class remove_abrt-plugin-sosreport {
   package { 'abrt-plugin-sosreport':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=abrt-plugin-sosreport
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove abrt-plugin-sosreport
 #	   from the system, and may remove any packages
 #	   that depend on abrt-plugin-sosreport. Execute this
@@ -5688,20 +5701,7 @@
     yum remove -y "abrt-plugin-sosreport"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure abrt-plugin-sosreport is removed
-  package:
-    name: abrt-plugin-sosreport
-    state: absent
-  tags:
-  - CCE-82910-1
-  - DISA-STIG-RHEL-08-040001
-  - disable_strategy
-  - low_complexity
-  - low_disruption
-  - low_severity
-  - no_reboot_needed
-  - package_abrt-plugin-sosreport_removed
-

Rule   +

Rule   Uninstall gssproxy Package   [ref]

The gssproxy package can be removed with the following command:

@@ -5709,14 +5709,27 @@
                                         This rule is disabled on Red Hat Virtualization Hosts and Managers, it will report not applicable.
 RHV uses NFS storage, which has dependency on gssproxy.
Rationale:

gssproxy is a proxy for GSS API credential handling.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82943-2

References:  - CCI-000381, CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040370, SV-230559r646887_rule

Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_gssproxy
+            CCI-000381, CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040370, SV-230559r646887_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure gssproxy is removed
+  package:
+    name: gssproxy
+    state: absent
+  tags:
+  - CCE-82943-2
+  - DISA-STIG-RHEL-08-040370
+  - disable_strategy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - no_reboot_needed
+  - package_gssproxy_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_gssproxy
 
 class remove_gssproxy {
   package { 'gssproxy':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove gssproxy
 #	   from the system, and may remove any packages
 #	   that depend on gssproxy. Execute this
@@ -5728,36 +5741,36 @@
     yum remove -y "gssproxy"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure gssproxy is removed
+

Rule   + Uninstall iprutils Package +   [ref]

The iprutils package can be removed with the following command: +

+$ sudo yum erase iprutils

Rationale:

iprutils provides a suite of utlilities to manage and configure SCSI devices +supported by the ipr SCSI storage device driver.

Severity: 
medium
Identifiers and References

Identifiers:  + CCE-82946-5

References:  + CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040380, SV-230560r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure iprutils is removed
   package:
-    name: gssproxy
+    name: iprutils
     state: absent
   tags:
-  - CCE-82943-2
-  - DISA-STIG-RHEL-08-040370
+  - CCE-82946-5
+  - DISA-STIG-RHEL-08-040380
   - disable_strategy
   - low_complexity
   - low_disruption
   - medium_severity
   - no_reboot_needed
-  - package_gssproxy_removed
-

Rule   - Uninstall iprutils Package -   [ref]

The iprutils package can be removed with the following command: -

-$ sudo yum erase iprutils

Rationale:

iprutils provides a suite of utlilities to manage and configure SCSI devices -supported by the ipr SCSI storage device driver.

Severity: 
medium
Identifiers and References

Identifiers:  - CCE-82946-5

References:  - CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040380, SV-230560r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=iprutils
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_iprutils
+  - package_iprutils_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_iprutils
 
 class remove_iprutils {
   package { 'iprutils':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=iprutils
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove iprutils
 #	   from the system, and may remove any packages
 #	   that depend on iprutils. Execute this
@@ -5769,20 +5782,7 @@
     yum remove -y "iprutils"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure iprutils is removed
-  package:
-    name: iprutils
-    state: absent
-  tags:
-  - CCE-82946-5
-  - DISA-STIG-RHEL-08-040380
-  - disable_strategy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - no_reboot_needed
-  - package_iprutils_removed
-

Rule   +

Rule   Uninstall krb5-workstation Package   [ref]

The krb5-workstation package can be removed with the following command:

@@ -5791,16 +5791,29 @@
 RHV hosts require ipa-client package, which has dependency on krb5-workstation.
Rationale:

Kerberos is a network authentication system. The krb5-workstation package contains the basic Kerberos programs (kinit, klist, kdestroy, kpasswd).

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82931-7

References:  - CCI-000803, SRG-OS-000095-GPOS-00049, SRG-OS-000120-GPOS-00061, RHEL-08-010162, SV-230239r646864_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=krb5-workstation
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_krb5-workstation
+            CCI-000803, SRG-OS-000095-GPOS-00049, SRG-OS-000120-GPOS-00061, RHEL-08-010162, SV-230239r646864_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure krb5-workstation is removed
+  package:
+    name: krb5-workstation
+    state: absent
+  tags:
+  - CCE-82931-7
+  - DISA-STIG-RHEL-08-010162
+  - disable_strategy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - no_reboot_needed
+  - package_krb5-workstation_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_krb5-workstation
 
 class remove_krb5-workstation {
   package { 'krb5-workstation':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=krb5-workstation
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove krb5-workstation
 #	   from the system, and may remove any packages
 #	   that depend on krb5-workstation. Execute this
@@ -5812,36 +5825,36 @@
     yum remove -y "krb5-workstation"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure krb5-workstation is removed
+

Rule   + Uninstall libreport-plugin-logger Package +   [ref]

The libreport-plugin-logger package can be removed with the following command: +

+$ sudo yum erase libreport-plugin-logger

Rationale:

libreport-plugin-logger is a ABRT plugin to report bugs into the +Red Hat Support system.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-89201-8

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure libreport-plugin-logger is removed
   package:
-    name: krb5-workstation
+    name: libreport-plugin-logger
     state: absent
   tags:
-  - CCE-82931-7
-  - DISA-STIG-RHEL-08-010162
+  - CCE-89201-8
+  - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
-  - medium_severity
+  - low_severity
   - no_reboot_needed
-  - package_krb5-workstation_removed
-

Rule   - Uninstall libreport-plugin-logger Package -   [ref]

The libreport-plugin-logger package can be removed with the following command: -

-$ sudo yum erase libreport-plugin-logger

Rationale:

libreport-plugin-logger is a ABRT plugin to report bugs into the -Red Hat Support system.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-89201-8

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=libreport-plugin-logger
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_libreport-plugin-logger
+  - package_libreport-plugin-logger_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_libreport-plugin-logger
 
 class remove_libreport-plugin-logger {
   package { 'libreport-plugin-logger':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=libreport-plugin-logger
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove libreport-plugin-logger
 #	   from the system, and may remove any packages
 #	   that depend on libreport-plugin-logger. Execute this
@@ -5853,36 +5866,36 @@
     yum remove -y "libreport-plugin-logger"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure libreport-plugin-logger is removed
+

Rule   + Uninstall libreport-plugin-rhtsupport Package +   [ref]

The libreport-plugin-rhtsupport package can be removed with the following command: +

+$ sudo yum erase libreport-plugin-rhtsupport

Rationale:

libreport-plugin-rhtsupport is a ABRT plugin to report bugs into the +Red Hat Support system.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-88955-0

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure libreport-plugin-rhtsupport is removed
   package:
-    name: libreport-plugin-logger
+    name: libreport-plugin-rhtsupport
     state: absent
   tags:
-  - CCE-89201-8
+  - CCE-88955-0
   - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
   - low_severity
   - no_reboot_needed
-  - package_libreport-plugin-logger_removed
-

Rule   - Uninstall libreport-plugin-rhtsupport Package -   [ref]

The libreport-plugin-rhtsupport package can be removed with the following command: -

-$ sudo yum erase libreport-plugin-rhtsupport

Rationale:

libreport-plugin-rhtsupport is a ABRT plugin to report bugs into the -Red Hat Support system.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-88955-0

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=libreport-plugin-rhtsupport
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_libreport-plugin-rhtsupport
+  - package_libreport-plugin-rhtsupport_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_libreport-plugin-rhtsupport
 
 class remove_libreport-plugin-rhtsupport {
   package { 'libreport-plugin-rhtsupport':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=libreport-plugin-rhtsupport
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove libreport-plugin-rhtsupport
 #	   from the system, and may remove any packages
 #	   that depend on libreport-plugin-rhtsupport. Execute this
@@ -5894,36 +5907,36 @@
     yum remove -y "libreport-plugin-rhtsupport"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure libreport-plugin-rhtsupport is removed
+

Rule   + Uninstall python3-abrt-addon Package +   [ref]

The python3-abrt-addon package can be removed with the following command: +

+$ sudo yum erase python3-abrt-addon

Rationale:

python3-abrt-addon contains python hook and python analyzer +plugin for handling uncaught exceptions in python programs.

Severity: 
low
Identifiers and References

Identifiers:  + CCE-86084-1

References:  + CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure python3-abrt-addon is removed
   package:
-    name: libreport-plugin-rhtsupport
+    name: python3-abrt-addon
     state: absent
   tags:
-  - CCE-88955-0
+  - CCE-86084-1
   - DISA-STIG-RHEL-08-040001
   - disable_strategy
   - low_complexity
   - low_disruption
   - low_severity
   - no_reboot_needed
-  - package_libreport-plugin-rhtsupport_removed
-

Rule   - Uninstall python3-abrt-addon Package -   [ref]

The python3-abrt-addon package can be removed with the following command: -

-$ sudo yum erase python3-abrt-addon

Rationale:

python3-abrt-addon contains python hook and python analyzer -plugin for handling uncaught exceptions in python programs.

Severity: 
low
Identifiers and References

Identifiers:  - CCE-86084-1

References:  - CCI-000381, SRG-OS-000095-GPOS-00049, RHEL-08-040001, SV-230488r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=python3-abrt-addon
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_python3-abrt-addon
+  - package_python3-abrt-addon_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_python3-abrt-addon
 
 class remove_python3-abrt-addon {
   package { 'python3-abrt-addon':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=python3-abrt-addon
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove python3-abrt-addon
 #	   from the system, and may remove any packages
 #	   that depend on python3-abrt-addon. Execute this
@@ -5935,20 +5948,7 @@
     yum remove -y "python3-abrt-addon"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure python3-abrt-addon is removed
-  package:
-    name: python3-abrt-addon
-    state: absent
-  tags:
-  - CCE-86084-1
-  - DISA-STIG-RHEL-08-040001
-  - disable_strategy
-  - low_complexity
-  - low_disruption
-  - low_severity
-  - no_reboot_needed
-  - package_python3-abrt-addon_removed
-

Rule   +

Rule   Uninstall tuned Package   [ref]

The tuned package can be removed with the following command:

@@ -5959,16 +5959,29 @@
 on that information, components will then be put into lower or higher power savings
 modes to adapt to the current usage.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-82904-4

References:  - CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040390, SV-230561r627750_rule

Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

-package --remove=tuned
-
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_tuned
+            CCI-000366, SRG-OS-000095-GPOS-00049, SRG-OS-000480-GPOS-00227, RHEL-08-040390, SV-230561r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure tuned is removed
+  package:
+    name: tuned
+    state: absent
+  tags:
+  - CCE-82904-4
+  - DISA-STIG-RHEL-08-040390
+  - disable_strategy
+  - low_complexity
+  - low_disruption
+  - medium_severity
+  - no_reboot_needed
+  - package_tuned_removed
+
Remediation Puppet snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
include remove_tuned
 
 class remove_tuned {
   package { 'tuned':
     ensure => 'purged',
   }
 }
-
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+
Remediation Anaconda snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

+package --remove=tuned
+
Remediation Shell script:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable

 # CAUTION: This remediation script will remove tuned
 #	   from the system, and may remove any packages
 #	   that depend on tuned. Execute this
@@ -5980,19 +5993,6 @@
     yum remove -y "tuned"
 
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:disable
- name: Ensure tuned is removed
-  package:
-    name: tuned
-    state: absent
-  tags:
-  - CCE-82904-4
-  - DISA-STIG-RHEL-08-040390
-  - disable_strategy
-  - low_complexity
-  - low_disruption
-  - medium_severity
-  - no_reboot_needed
-  - package_tuned_removed
 
Group   Updating Software   Group contains 6 rules

[ref]   @@ -6005,7 +6005,7 @@ the RPM database, which records metadata of installed packages. Consistently using yum or the graphical Software Update for all software installation allows for insight into the current inventory of installed software on the system. -

Rule   +

Rule   Ensure yum Removes Previous Package Versions   [ref]

yum should be configured to remove previous software components after new versions have been installed. To configure yum to remove the @@ -6016,20 +6016,7 @@ to 1 in /etc/yum.conf.

Rationale:

Previous versions of software components that are not removed from the information system after updates have been installed may be exploited by some adversaries.

Severity: 
low
Identifiers and References

Identifiers:  CCE-82476-3

References:  - 18, 20, 4, APO12.01, APO12.02, APO12.03, APO12.04, BAI03.10, DSS05.01, DSS05.02, 3.4.8, CCI-002617, 4.2.3, 4.2.3.12, 4.2.3.7, 4.2.3.9, A.12.6.1, A.14.2.3, A.16.1.3, A.18.2.2, A.18.2.3, SI-2(6), CM-11(a), CM-11(b), CM-6(a), ID.RA-1, PR.IP-12, SRG-OS-000437-GPOS-00194, RHEL-08-010440, SV-230281r854034_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q yum; then
-
-if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then
-        sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf
-else
-        echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf
-        echo "clean_requirements_on_remove=1" >> /etc/yum.conf
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:low
Reboot:false
Strategy:restrict
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -6070,7 +6057,20 @@
   - low_severity
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q yum; then
+
+if grep --silent ^clean_requirements_on_remove /etc/yum.conf ; then
+        sed -i "s/^clean_requirements_on_remove.*/clean_requirements_on_remove=1/g" /etc/yum.conf
+else
+        echo -e "\n# Set clean_requirements_on_remove to 1 per security requirements" >> /etc/yum.conf
+        echo "clean_requirements_on_remove=1" >> /etc/yum.conf
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Ensure gpgcheck Enabled In Main yum Configuration   [ref]

The gpgcheck option controls whether RPM packages' signatures are always checked prior to installation. @@ -6092,35 +6092,7 @@ this requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA).

Severity: 
high
Identifiers and References

Identifiers:  CCE-80790-9

References:  - BP28(R15), 11, 2, 3, 9, 5.10.4.1, APO01.06, BAI03.05, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS06.02, 3.4.8, CCI-001749, 164.308(a)(1)(ii)(D), 164.312(b), 164.312(c)(1), 164.312(c)(2), 164.312(e)(2)(i), 4.3.4.3.2, 4.3.4.3.3, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, SR 7.6, A.11.2.4, A.12.1.2, A.12.2.1, A.12.5.1, A.12.6.2, A.14.1.2, A.14.1.3, A.14.2.2, A.14.2.3, A.14.2.4, CM-5(3), SI-7, SC-12, SC-12(3), CM-6(a), SA-12, SA-12(10), CM-11(a), CM-11(b), PR.DS-6, PR.DS-8, PR.IP-1, FPT_TUD_EXT.1, FPT_TUD_EXT.2, Req-6.2, 6.3.3, SRG-OS-000366-GPOS-00153, RHEL-08-010370, 1.2.2, SV-230264r880711_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q yum; then
-
-# Strip any search characters in the key arg so that the key can be replaced without
-# adding any search characters to the config file.
-stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck")
-
-# shellcheck disable=SC2059
-printf -v formatted_output "%s = %s" "$stripped_key" "1"
-
-# If the key exists, change it. Otherwise, add it to the config_file.
-# We search for the key string followed by a word boundary (matched by \>),
-# so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then
-    escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
-    LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf"
-else
-    if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then
-        LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf"
-    fi
-    cce="CCE-80790-9"
-    printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf"
-    printf '%s\n' "$formatted_output" >> "/etc/yum.conf"
-fi
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:configure
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -6177,23 +6149,12 @@
   - low_complexity
   - medium_disruption
   - no_reboot_needed
-

Rule   - Ensure gpgcheck Enabled for Local Packages -   [ref]

yum should be configured to verify the signature(s) of local packages -prior to installation. To configure yum to verify signatures of local -packages, set the localpkg_gpgcheck to 1 in /etc/yum.conf.

Rationale:

Changes to any software components can have significant effects to the overall security -of the operating system. This requirement ensures the software has not been tampered and -has been provided by a trusted vendor. -

-Accordingly, patches, service packs, device drivers, or operating system components must -be signed with a certificate recognized and approved by the organization.

Severity: 
high
Identifiers and References

Identifiers:  - CCE-80791-7

References:  - BP28(R15), 11, 3, 9, BAI10.01, BAI10.02, BAI10.03, BAI10.05, 3.4.8, CCI-001749, 164.308(a)(1)(ii)(D), 164.312(b), 164.312(c)(1), 164.312(c)(2), 164.312(e)(2)(i), 4.3.4.3.2, 4.3.4.3.3, SR 7.6, A.12.1.2, A.12.5.1, A.12.6.2, A.14.2.2, A.14.2.3, A.14.2.4, CM-11(a), CM-11(b), CM-6(a), CM-5(3), SA-12, SA-12(10), PR.IP-1, FPT_TUD_EXT.1, FPT_TUD_EXT.2, SRG-OS-000366-GPOS-00153, RHEL-08-010371, SV-230265r877463_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if rpm --quiet -q yum; then
 
 # Strip any search characters in the key arg so that the key can be replaced without
 # adding any search characters to the config file.
-stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck")
+stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^gpgcheck")
 
 # shellcheck disable=SC2059
 printf -v formatted_output "%s = %s" "$stripped_key" "1"
@@ -6201,14 +6162,14 @@
 # If the key exists, change it. Otherwise, add it to the config_file.
 # We search for the key string followed by a word boundary (matched by \>),
 # so if we search for 'setting', 'setting2' won't match.
-if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then
+if LC_ALL=C grep -q -m 1 -i -e "^gpgcheck\\>" "/etc/yum.conf"; then
     escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
-    LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf"
+    LC_ALL=C sed -i --follow-symlinks "s/^gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf"
 else
     if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then
         LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf"
     fi
-    cce="CCE-80791-7"
+    cce="CCE-80790-9"
     printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf"
     printf '%s\n' "$formatted_output" >> "/etc/yum.conf"
 fi
@@ -6216,7 +6177,18 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
+

Rule   + Ensure gpgcheck Enabled for Local Packages +   [ref]

yum should be configured to verify the signature(s) of local packages +prior to installation. To configure yum to verify signatures of local +packages, set the localpkg_gpgcheck to 1 in /etc/yum.conf.

Rationale:

Changes to any software components can have significant effects to the overall security +of the operating system. This requirement ensures the software has not been tampered and +has been provided by a trusted vendor. +

+Accordingly, patches, service packs, device drivers, or operating system components must +be signed with a certificate recognized and approved by the organization.

Severity: 
high
Identifiers and References

Identifiers:  + CCE-80791-7

References:  + BP28(R15), 11, 3, 9, BAI10.01, BAI10.02, BAI10.03, BAI10.05, 3.4.8, CCI-001749, 164.308(a)(1)(ii)(D), 164.312(b), 164.312(c)(1), 164.312(c)(2), 164.312(e)(2)(i), 4.3.4.3.2, 4.3.4.3.3, SR 7.6, A.12.1.2, A.12.5.1, A.12.6.2, A.14.2.2, A.14.2.3, A.14.2.4, CM-11(a), CM-11(b), CM-6(a), CM-5(3), SA-12, SA-12(10), PR.IP-1, FPT_TUD_EXT.1, FPT_TUD_EXT.2, SRG-OS-000366-GPOS-00153, RHEL-08-010371, SV-230265r877463_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -6275,7 +6247,35 @@
   - medium_disruption
   - no_reboot_needed
   - unknown_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q yum; then
+
+# Strip any search characters in the key arg so that the key can be replaced without
+# adding any search characters to the config file.
+stripped_key=$(sed 's/[\^=\$,;+]*//g' <<< "^localpkg_gpgcheck")
+
+# shellcheck disable=SC2059
+printf -v formatted_output "%s = %s" "$stripped_key" "1"
+
+# If the key exists, change it. Otherwise, add it to the config_file.
+# We search for the key string followed by a word boundary (matched by \>),
+# so if we search for 'setting', 'setting2' won't match.
+if LC_ALL=C grep -q -m 1 -i -e "^localpkg_gpgcheck\\>" "/etc/yum.conf"; then
+    escaped_formatted_output=$(sed -e 's|/|\\/|g' <<< "$formatted_output")
+    LC_ALL=C sed -i --follow-symlinks "s/^localpkg_gpgcheck\\>.*/$escaped_formatted_output/gi" "/etc/yum.conf"
+else
+    if [[ -s "/etc/yum.conf" ]] && [[ -n "$(tail -c 1 -- "/etc/yum.conf" || true)" ]]; then
+        LC_ALL=C sed -i --follow-symlinks '$a'\\ "/etc/yum.conf"
+    fi
+    cce="CCE-80791-7"
+    printf '# Per %s: Set %s in %s\n' "${cce}" "${formatted_output}" "/etc/yum.conf" >> "/etc/yum.conf"
+    printf '%s\n' "$formatted_output" >> "/etc/yum.conf"
+fi
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Ensure gpgcheck Enabled for All yum Package Repositories   [ref]

To ensure signature checking is not disabled for any repos, remove any lines from files in /etc/yum.repos.d of the form: @@ -6286,9 +6286,7 @@ requirement. Certificates used to verify the software must be from an approved Certificate Authority (CA)."

Severity: 
high
Identifiers and References

Identifiers:  CCE-80792-5

References:  - BP28(R15), 11, 2, 3, 9, 5.10.4.1, APO01.06, BAI03.05, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS06.02, 3.4.8, CCI-001749, 164.308(a)(1)(ii)(D), 164.312(b), 164.312(c)(1), 164.312(c)(2), 164.312(e)(2)(i), 4.3.4.3.2, 4.3.4.3.3, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, SR 7.6, A.11.2.4, A.12.1.2, A.12.2.1, A.12.5.1, A.12.6.2, A.14.1.2, A.14.1.3, A.14.2.2, A.14.2.3, A.14.2.4, CM-5(3), SI-7, SC-12, SC-12(3), CM-6(a), SA-12, SA-12(10), CM-11(a), CM-11(b), PR.DS-6, PR.DS-8, PR.IP-1, FPT_TUD_EXT.1, FPT_TUD_EXT.2, Req-6.2, 6.3.3, SRG-OS-000366-GPOS-00153, RHEL-08-010370, SV-230264r880711_rule

Remediation Shell script:   (show)


-sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/*
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:enable
- name: Grep for yum repo section names
   shell: |
     set -o pipefail
     grep -HEr '^\[.+\]' -r /etc/yum.repos.d/
@@ -6350,7 +6348,9 @@
   - low_complexity
   - medium_disruption
   - no_reboot_needed
-

Rule   +Remediation Shell script:   (show)


+sed -i 's/gpgcheck\s*=.*/gpgcheck=1/g' /etc/yum.repos.d/*
+

Rule   Ensure Red Hat GPG Key Installed   [ref]

To ensure the system can cryptographically verify base software packages come from Red Hat (and to connect to the Red Hat Network to receive them), @@ -6373,34 +6373,7 @@ The Red Hat GPG key is necessary to cryptographically verify packages are from Red Hat.

Severity: 
high
Identifiers and References

Identifiers:  CCE-80795-8

References:  - BP28(R15), 11, 2, 3, 9, 5.10.4.1, APO01.06, BAI03.05, BAI06.01, BAI10.01, BAI10.02, BAI10.03, BAI10.05, DSS06.02, 3.4.8, CCI-001749, 164.308(a)(1)(ii)(D), 164.312(b), 164.312(c)(1), 164.312(c)(2), 164.312(e)(2)(i), 4.3.4.3.2, 4.3.4.3.3, 4.3.4.4.4, SR 3.1, SR 3.3, SR 3.4, SR 3.8, SR 7.6, A.11.2.4, A.12.1.2, A.12.2.1, A.12.5.1, A.12.6.2, A.14.1.2, A.14.1.3, A.14.2.2, A.14.2.3, A.14.2.4, CIP-003-8 R4.2, CIP-003-8 R6, CIP-007-3 R4, CIP-007-3 R4.1, CIP-007-3 R4.2, CIP-007-3 R5.1, CM-5(3), SI-7, SC-12, SC-12(3), CM-6(a), PR.DS-6, PR.DS-8, PR.IP-1, FPT_TUD_EXT.1, FPT_TUD_EXT.2, Req-6.2, 6.3.3, SRG-OS-000366-GPOS-00153, RHEL-08-010019, 1.2.1, SV-256973r902752_rule

Remediation Shell script:   (show)

# The two fingerprints below are retrieved from https://access.redhat.com/security/team/key
-readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51"
-readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792"
-
-# Location of the key we would like to import (once it's integrity verified)
-readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
-
-RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")")
-
-# Verify /etc/pki/rpm-gpg directory permissions are safe
-if [ "${RPM_GPG_DIR_PERMS}" -le "755" ]
-then
-  # If they are safe, try to obtain fingerprints from the key file
-  # (to ensure there won't be e.g. CRC error).
-
-  readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10)
-
-  GPG_RESULT=$?
-  # No CRC error, safe to proceed
-  if [ "${GPG_RESULT}" -eq "0" ]
-  then
-    echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || {
-      # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it
-      rpm --import "${REDHAT_RELEASE_KEY}"
-    }
-  fi
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:medium
Disruption:medium
Reboot:false
Strategy:restrict
- name: Read permission of GPG key directory
   stat:
     path: /etc/pki/rpm-gpg/
   register: gpg_key_directory_permission
@@ -6524,7 +6497,34 @@
   - medium_disruption
   - no_reboot_needed
   - restrict_strategy
-

Rule   +Remediation Shell script:   (show)

# The two fingerprints below are retrieved from https://access.redhat.com/security/team/key
+readonly REDHAT_RELEASE_FINGERPRINT="567E347AD0044ADE55BA8A5F199E2F91FD431D51"
+readonly REDHAT_AUXILIARY_FINGERPRINT="6A6AA7C97C8890AEC6AEBFE2F76F66C3D4082792"
+
+# Location of the key we would like to import (once it's integrity verified)
+readonly REDHAT_RELEASE_KEY="/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
+
+RPM_GPG_DIR_PERMS=$(stat -c %a "$(dirname "$REDHAT_RELEASE_KEY")")
+
+# Verify /etc/pki/rpm-gpg directory permissions are safe
+if [ "${RPM_GPG_DIR_PERMS}" -le "755" ]
+then
+  # If they are safe, try to obtain fingerprints from the key file
+  # (to ensure there won't be e.g. CRC error).
+
+  readarray -t GPG_OUT < <(gpg --show-keys --with-fingerprint --with-colons "$REDHAT_RELEASE_KEY" | grep -A1 "^pub" | grep "^fpr" | cut -d ":" -f 10)
+
+  GPG_RESULT=$?
+  # No CRC error, safe to proceed
+  if [ "${GPG_RESULT}" -eq "0" ]
+  then
+    echo "${GPG_OUT[*]}" | grep -vE "${REDHAT_RELEASE_FINGERPRINT}|${REDHAT_AUXILIARY_FINGERPRINT}" || {
+      # If $REDHAT_RELEASE_KEY file doesn't contain any keys with unknown fingerprint, import it
+      rpm --import "${REDHAT_RELEASE_KEY}"
+    }
+  fi
+fi
+

Rule   Ensure Software Patches Installed   [ref]

If the system is joined to the Red Hat Network, a Red Hat Satellite Server, @@ -6542,10 +6542,7 @@ users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80865-9

References:  - BP28(R08), 18, 20, 4, 5.10.4.1, APO12.01, APO12.02, APO12.03, APO12.04, BAI03.10, DSS05.01, DSS05.02, CCI-000366, CCI-001227, 4.2.3, 4.2.3.12, 4.2.3.7, 4.2.3.9, A.12.6.1, A.14.2.3, A.16.1.3, A.18.2.2, A.18.2.3, SI-2(5), SI-2(c), CM-6(a), ID.RA-1, PR.IP-12, FMT_MOF_EXT.1, Req-6.2, 6.3.3, SRG-OS-000480-GPOS-00227, RHEL-08-010010, 1.2.5, SV-230222r627750_rule

Remediation Shell script:   (show)

Complexity:low
Disruption:high
Reboot:true
Strategy:patch

-
-yum -y update
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:high
Reboot:true
Strategy:patch
- name: Security patches are up to date
   package:
     name: '*'
     state: latest
@@ -6565,7 +6562,10 @@
   - reboot_required
   - security_patches_up_to_date
   - skip_ansible_lint
-
Group   +Remediation Shell script:   (show)

Complexity:low
Disruption:high
Reboot:true
Strategy:patch

+
+yum -y update
+
Group   Account and Access Control   Group contains 18 groups and 79 rules

[ref]   In traditional Unix security, if an attacker gains @@ -6601,7 +6601,7 @@ by the GNOME Display Manager (GDM). The warning banner should be displayed in this graphical environment for these users. The following sections describe how to configure the GDM login -banner.

Rule   +banner.

Rule   Enable GNOME3 Login Warning Banner   [ref]

In the default graphical environment, displaying a login warning banner in the GNOME Display Manager's login screen can be enabled on the login @@ -6623,68 +6623,7 @@ For U.S. Government systems, system use notifications are required only for access via login interfaces with human users and are not required when such human interfaces do not exist.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80768-5

References:  - 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.9, CCI-000048, CCI-000050, CCI-001384, CCI-001385, CCI-001386, CCI-001387, CCI-001388, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, AC-8(a), AC-8(b), AC-8(c), PR.AC-7, FMT_MOF_EXT.1, SRG-OS-000023-GPOS-00006, SRG-OS-000228-GPOS-00088, RHEL-08-010049, 1.8.2, SV-244519r743806_rule

Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
-if rpm --quiet -q gdm; then
-
-# Check for setting in any of the DConf db directories
-# If files contain ibus or distro, ignore them.
-# The assignment assumes that individual filenames don't contain :
-readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \
-                                | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1)
-DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings"
-DBDIR="/etc/dconf/db/gdm.d"
-
-mkdir -p "${DBDIR}"
-
-# Comment out the configurations in databases different from the target one
-if [ "${#SETTINGSFILES[@]}" -ne 0 ]
-then
-    if grep -q "^\\s*banner-message-enable\\s*=" "${SETTINGSFILES[@]}"
-    then
-        
-        sed -Ei "s/(^\s*)banner-message-enable(\s*=)/#\1banner-message-enable\2/g" "${SETTINGSFILES[@]}"
-    fi
-fi
-
-[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
-if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}"
-then
-    printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE}
-fi
-
-escaped_value="$(sed -e 's/\\/\\\\/g' <<< "true")"
-if grep -q "^\\s*banner-message-enable\\s*=" "${DCONFFILE}"
-then
-        sed -i "s/\\s*banner-message-enable\\s*=\\s*.*/banner-message-enable=${escaped_value}/g" "${DCONFFILE}"
-    else
-        sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-enable=${escaped_value}" "${DCONFFILE}"
-fi
-
-dconf update
-# Check for setting in any of the DConf db directories
-LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-enable$" "/etc/dconf/db/" \
-            | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1)
-LOCKSFOLDER="/etc/dconf/db/gdm.d/locks"
-
-mkdir -p "${LOCKSFOLDER}"
-
-# Comment out the configurations in databases different from the target one
-if [[ ! -z "${LOCKFILES}" ]]
-then
-    sed -i -E "s|^/org/gnome/login-screen/banner-message-enable$|#&|" "${LOCKFILES[@]}"
-fi
-
-if ! grep -qr "^/org/gnome/login-screen/banner-message-enable$" /etc/dconf/db/gdm.d/
-then
-    echo "/org/gnome/login-screen/banner-message-enable" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock"
-fi
-
-dconf update
-
-else
-    >&2 echo 'Remediation is not applicable, nothing was done'
-fi
-
Remediation Ansible snippet:   (show)

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: Gather the package facts
   package_facts:
     manager: auto
   tags:
@@ -6761,50 +6700,9 @@
   - medium_severity
   - no_reboot_needed
   - unknown_strategy
-

Rule   +Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
+if rpm --quiet -q gdm; then
+
+login_banner_text='^(You[\s\n]+are[\s\n]+accessing[\s\n]+a[\s\n]+U\.S\.[\s\n]+Government[\s\n]+\(USG\)[\s\n]+Information[\s\n]+System[\s\n]+\(IS\)[\s\n]+that[\s\n]+is[\s\n]+provided[\s\n]+for[\s\n]+USG\-authorized[\s\n]+use[\s\n]+only\.[\s\n]+By[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+\(which[\s\n]+includes[\s\n]+any[\s\n]+device[\s\n]+attached[\s\n]+to[\s\n]+this[\s\n]+IS\),[\s\n]+you[\s\n]+consent[\s\n]+to[\s\n]+the[\s\n]+following[\s\n]+conditions\:(?:[\n]+|(?:\\n)+)\-The[\s\n]+USG[\s\n]+routinely[\s\n]+intercepts[\s\n]+and[\s\n]+monitors[\s\n]+communications[\s\n]+on[\s\n]+this[\s\n]+IS[\s\n]+for[\s\n]+purposes[\s\n]+including,[\s\n]+but[\s\n]+not[\s\n]+limited[\s\n]+to,[\s\n]+penetration[\s\n]+testing,[\s\n]+COMSEC[\s\n]+monitoring,[\s\n]+network[\s\n]+operations[\s\n]+and[\s\n]+defense,[\s\n]+personnel[\s\n]+misconduct[\s\n]+\(PM\),[\s\n]+law[\s\n]+enforcement[\s\n]+\(LE\),[\s\n]+and[\s\n]+counterintelligence[\s\n]+\(CI\)[\s\n]+investigations\.(?:[\n]+|(?:\\n)+)\-At[\s\n]+any[\s\n]+time,[\s\n]+the[\s\n]+USG[\s\n]+may[\s\n]+inspect[\s\n]+and[\s\n]+seize[\s\n]+data[\s\n]+stored[\s\n]+on[\s\n]+this[\s\n]+IS\.(?:[\n]+|(?:\\n)+)\-Communications[\s\n]+using,[\s\n]+or[\s\n]+data[\s\n]+stored[\s\n]+on,[\s\n]+this[\s\n]+IS[\s\n]+are[\s\n]+not[\s\n]+private,[\s\n]+are[\s\n]+subject[\s\n]+to[\s\n]+routine[\s\n]+monitoring,[\s\n]+interception,[\s\n]+and[\s\n]+search,[\s\n]+and[\s\n]+may[\s\n]+be[\s\n]+disclosed[\s\n]+or[\s\n]+used[\s\n]+for[\s\n]+any[\s\n]+USG\-authorized[\s\n]+purpose\.(?:[\n]+|(?:\\n)+)\-This[\s\n]+IS[\s\n]+includes[\s\n]+security[\s\n]+measures[\s\n]+\(e\.g\.,[\s\n]+authentication[\s\n]+and[\s\n]+access[\s\n]+controls\)[\s\n]+to[\s\n]+protect[\s\n]+USG[\s\n]+interests\-\-not[\s\n]+for[\s\n]+your[\s\n]+personal[\s\n]+benefit[\s\n]+or[\s\n]+privacy\.(?:[\n]+|(?:\\n)+)\-Notwithstanding[\s\n]+the[\s\n]+above,[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+does[\s\n]+not[\s\n]+constitute[\s\n]+consent[\s\n]+to[\s\n]+PM,[\s\n]+LE[\s\n]+or[\s\n]+CI[\s\n]+investigative[\s\n]+searching[\s\n]+or[\s\n]+monitoring[\s\n]+of[\s\n]+the[\s\n]+content[\s\n]+of[\s\n]+privileged[\s\n]+communications,[\s\n]+or[\s\n]+work[\s\n]+product,[\s\n]+related[\s\n]+to[\s\n]+personal[\s\n]+representation[\s\n]+or[\s\n]+services[\s\n]+by[\s\n]+attorneys,[\s\n]+psychotherapists,[\s\n]+or[\s\n]+clergy,[\s\n]+and[\s\n]+their[\s\n]+assistants\.[\s\n]+Such[\s\n]+communications[\s\n]+and[\s\n]+work[\s\n]+product[\s\n]+are[\s\n]+private[\s\n]+and[\s\n]+confidential\.[\s\n]+See[\s\n]+User[\s\n]+Agreement[\s\n]+for[\s\n]+details\.|I've[\s\n]+read[\s\n]+\&[\s\n]+consent[\s\n]+to[\s\n]+terms[\s\n]+in[\s\n]+IS[\s\n]+user[\s\n]+agreem't\.)$'
+
+
+# Multiple regexes transform the banner regex into a usable banner
+# 0 - Remove anchors around the banner text
+login_banner_text=$(echo "$login_banner_text" | sed 's/^\^\(.*\)\$$/\1/g')
+# 1 - Keep only the first banners if there are multiple
+#    (dod_banners contains the long and short banner)
+login_banner_text=$(echo "$login_banner_text" | sed 's/^(\(.*\.\)|.*)$/\1/g')
+# 2 - Add spaces ' '. (Transforms regex for "space or newline" into a " ")
+login_banner_text=$(echo "$login_banner_text" | sed 's/\[\\s\\n\]+/ /g')
+# 3 - Adds newline "tokens". (Transforms "(?:\[\\n\]+|(?:\\n)+)" into "(n)*")
+login_banner_text=$(echo "$login_banner_text" | sed 's/(?:\[\\n\]+|(?:\\\\n)+)/(n)*/g')
+# 4 - Remove any leftover backslash. (From any parethesis in the banner, for example).
+login_banner_text=$(echo "$login_banner_text" | sed 's/\\//g')
+# 5 - Removes the newline "token." (Transforms them into newline escape sequences "\n").
+#    ( Needs to be done after 4, otherwise the escapce sequence will become just "n".
+login_banner_text=$(echo "$login_banner_text" | sed 's/(n)\*/\\n/g')
+
+# Check for setting in any of the DConf db directories
+# If files contain ibus or distro, ignore them.
+# The assignment assumes that individual filenames don't contain :
+readarray -t SETTINGSFILES < <(grep -r "\\[org/gnome/login-screen\\]" "/etc/dconf/db/" \
+                                | grep -v 'distro\|ibus\|gdm.d' | cut -d":" -f1)
+DCONFFILE="/etc/dconf/db/gdm.d/00-security-settings"
+DBDIR="/etc/dconf/db/gdm.d"
+
+mkdir -p "${DBDIR}"
+
+# Comment out the configurations in databases different from the target one
+if [ "${#SETTINGSFILES[@]}" -ne 0 ]
+then
+    if grep -q "^\\s*banner-message-text\\s*=" "${SETTINGSFILES[@]}"
+    then
+        
+        sed -Ei "s/(^\s*)banner-message-text(\s*=)/#\1banner-message-text\2/g" "${SETTINGSFILES[@]}"
+    fi
+fi
+
+[ ! -z "${DCONFFILE}" ] && echo "" >> "${DCONFFILE}"
+if ! grep -q "\\[org/gnome/login-screen\\]" "${DCONFFILE}"
+then
+    printf '%s\n' "[org/gnome/login-screen]" >> ${DCONFFILE}
+fi
+
+escaped_value="$(sed -e 's/\\/\\\\/g' <<< "'${login_banner_text}'")"
+if grep -q "^\\s*banner-message-text\\s*=" "${DCONFFILE}"
+then
+        sed -i "s/\\s*banner-message-text\\s*=\\s*.*/banner-message-text=${escaped_value}/g" "${DCONFFILE}"
+    else
+        sed -i "\\|\\[org/gnome/login-screen\\]|a\\banner-message-text=${escaped_value}" "${DCONFFILE}"
+fi
+
+dconf update
+# Check for setting in any of the DConf db directories
+LOCKFILES=$(grep -r "^/org/gnome/login-screen/banner-message-text$" "/etc/dconf/db/" \
+            | grep -v 'distro\|ibus\|gdm.d' | grep ":" | cut -d":" -f1)
+LOCKSFOLDER="/etc/dconf/db/gdm.d/locks"
+
+mkdir -p "${LOCKSFOLDER}"
+
+# Comment out the configurations in databases different from the target one
+if [[ ! -z "${LOCKFILES}" ]]
+then
+    sed -i -E "s|^/org/gnome/login-screen/banner-message-text$|#&|" "${LOCKFILES[@]}"
+fi
+
+if ! grep -qr "^/org/gnome/login-screen/banner-message-text$" /etc/dconf/db/gdm.d/
+then
+    echo "/org/gnome/login-screen/banner-message-text" >> "/etc/dconf/db/gdm.d/locks/00-security-settings-lock"
+fi
+
+dconf update
+
+else
+    >&2 echo 'Remediation is not applicable, nothing was done'
+fi
+

Rule   Modify the System Login Banner   [ref]

To configure the system login banner edit /etc/issue. Replace the @@ -7034,7 +7034,32 @@ with human users and are not required when such human interfaces do not exist.

Severity: 
medium
Identifiers and References

Identifiers:  CCE-80763-6

References:  - 1, 12, 15, 16, DSS05.04, DSS05.10, DSS06.10, 3.1.9, CCI-000048, CCI-000050, CCI-001384, CCI-001385, CCI-001386, CCI-001387, CCI-001388, 4.3.3.6.1, 4.3.3.6.2, 4.3.3.6.3, 4.3.3.6.4, 4.3.3.6.5, 4.3.3.6.6, 4.3.3.6.7, 4.3.3.6.8, 4.3.3.6.9, SR 1.1, SR 1.10, SR 1.2, SR 1.5, SR 1.7, SR 1.8, SR 1.9, A.18.1.4, A.9.2.1, A.9.2.4, A.9.3.1, A.9.4.2, A.9.4.3, AC-8(a), AC-8(c), PR.AC-7, FMT_MOF_EXT.1, SRG-OS-000023-GPOS-00006, SRG-OS-000228-GPOS-00088, RHEL-08-010060, 1.7.2, SV-230227r627750_rule

Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: XCCDF Value login_banner_text # promote to variable
+  set_fact:
+    login_banner_text: !!str ^(You[\s\n]+are[\s\n]+accessing[\s\n]+a[\s\n]+U\.S\.[\s\n]+Government[\s\n]+\(USG\)[\s\n]+Information[\s\n]+System[\s\n]+\(IS\)[\s\n]+that[\s\n]+is[\s\n]+provided[\s\n]+for[\s\n]+USG\-authorized[\s\n]+use[\s\n]+only\.[\s\n]+By[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+\(which[\s\n]+includes[\s\n]+any[\s\n]+device[\s\n]+attached[\s\n]+to[\s\n]+this[\s\n]+IS\),[\s\n]+you[\s\n]+consent[\s\n]+to[\s\n]+the[\s\n]+following[\s\n]+conditions\:(?:[\n]+|(?:\\n)+)\-The[\s\n]+USG[\s\n]+routinely[\s\n]+intercepts[\s\n]+and[\s\n]+monitors[\s\n]+communications[\s\n]+on[\s\n]+this[\s\n]+IS[\s\n]+for[\s\n]+purposes[\s\n]+including,[\s\n]+but[\s\n]+not[\s\n]+limited[\s\n]+to,[\s\n]+penetration[\s\n]+testing,[\s\n]+COMSEC[\s\n]+monitoring,[\s\n]+network[\s\n]+operations[\s\n]+and[\s\n]+defense,[\s\n]+personnel[\s\n]+misconduct[\s\n]+\(PM\),[\s\n]+law[\s\n]+enforcement[\s\n]+\(LE\),[\s\n]+and[\s\n]+counterintelligence[\s\n]+\(CI\)[\s\n]+investigations\.(?:[\n]+|(?:\\n)+)\-At[\s\n]+any[\s\n]+time,[\s\n]+the[\s\n]+USG[\s\n]+may[\s\n]+inspect[\s\n]+and[\s\n]+seize[\s\n]+data[\s\n]+stored[\s\n]+on[\s\n]+this[\s\n]+IS\.(?:[\n]+|(?:\\n)+)\-Communications[\s\n]+using,[\s\n]+or[\s\n]+data[\s\n]+stored[\s\n]+on,[\s\n]+this[\s\n]+IS[\s\n]+are[\s\n]+not[\s\n]+private,[\s\n]+are[\s\n]+subject[\s\n]+to[\s\n]+routine[\s\n]+monitoring,[\s\n]+interception,[\s\n]+and[\s\n]+search,[\s\n]+and[\s\n]+may[\s\n]+be[\s\n]+disclosed[\s\n]+or[\s\n]+used[\s\n]+for[\s\n]+any[\s\n]+USG\-authorized[\s\n]+purpose\.(?:[\n]+|(?:\\n)+)\-This[\s\n]+IS[\s\n]+includes[\s\n]+security[\s\n]+measures[\s\n]+\(e\.g\.,[\s\n]+authentication[\s\n]+and[\s\n]+access[\s\n]+controls\)[\s\n]+to[\s\n]+protect[\s\n]+USG[\s\n]+interests\-\-not[\s\n]+for[\s\n]+your[\s\n]+personal[\s\n]+benefit[\s\n]+or[\s\n]+privacy\.(?:[\n]+|(?:\\n)+)\-Notwithstanding[\s\n]+the[\s\n]+above,[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+does[\s\n]+not[\s\n]+constitute[\s\n]+consent[\s\n]+to[\s\n]+PM,[\s\n]+LE[\s\n]+or[\s\n]+CI[\s\n]+investigative[\s\n]+searching[\s\n]+or[\s\n]+monitoring[\s\n]+of[\s\n]+the[\s\n]+content[\s\n]+of[\s\n]+privileged[\s\n]+communications,[\s\n]+or[\s\n]+work[\s\n]+product,[\s\n]+related[\s\n]+to[\s\n]+personal[\s\n]+representation[\s\n]+or[\s\n]+services[\s\n]+by[\s\n]+attorneys,[\s\n]+psychotherapists,[\s\n]+or[\s\n]+clergy,[\s\n]+and[\s\n]+their[\s\n]+assistants\.[\s\n]+Such[\s\n]+communications[\s\n]+and[\s\n]+work[\s\n]+product[\s\n]+are[\s\n]+private[\s\n]+and[\s\n]+confidential\.[\s\n]+See[\s\n]+User[\s\n]+Agreement[\s\n]+for[\s\n]+details\.|I've[\s\n]+read[\s\n]+\&[\s\n]+consent[\s\n]+to[\s\n]+terms[\s\n]+in[\s\n]+IS[\s\n]+user[\s\n]+agreem't\.)$
+  tags:
+    - always
+
+- name: Modify the System Login Banner - Ensure Correct Banner
+  copy:
+    dest: /etc/issue
+    content: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*\.)\|.*\)$",
+      "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
+      "\n") | regex_replace("\\", "") | wordwrap() }}'
+  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+  tags:
+  - CCE-80763-6
+  - DISA-STIG-RHEL-08-010060
+  - NIST-800-171-3.1.9
+  - NIST-800-53-AC-8(a)
+  - NIST-800-53-AC-8(c)
+  - banner_etc_issue
+  - low_complexity
+  - medium_disruption
+  - medium_severity
+  - no_reboot_needed
+  - unknown_strategy
+
Remediation Shell script:   (show)

# Remediation is applicable only in certain platforms
 if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
 
 login_banner_text='^(You[\s\n]+are[\s\n]+accessing[\s\n]+a[\s\n]+U\.S\.[\s\n]+Government[\s\n]+\(USG\)[\s\n]+Information[\s\n]+System[\s\n]+\(IS\)[\s\n]+that[\s\n]+is[\s\n]+provided[\s\n]+for[\s\n]+USG\-authorized[\s\n]+use[\s\n]+only\.[\s\n]+By[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+\(which[\s\n]+includes[\s\n]+any[\s\n]+device[\s\n]+attached[\s\n]+to[\s\n]+this[\s\n]+IS\),[\s\n]+you[\s\n]+consent[\s\n]+to[\s\n]+the[\s\n]+following[\s\n]+conditions\:(?:[\n]+|(?:\\n)+)\-The[\s\n]+USG[\s\n]+routinely[\s\n]+intercepts[\s\n]+and[\s\n]+monitors[\s\n]+communications[\s\n]+on[\s\n]+this[\s\n]+IS[\s\n]+for[\s\n]+purposes[\s\n]+including,[\s\n]+but[\s\n]+not[\s\n]+limited[\s\n]+to,[\s\n]+penetration[\s\n]+testing,[\s\n]+COMSEC[\s\n]+monitoring,[\s\n]+network[\s\n]+operations[\s\n]+and[\s\n]+defense,[\s\n]+personnel[\s\n]+misconduct[\s\n]+\(PM\),[\s\n]+law[\s\n]+enforcement[\s\n]+\(LE\),[\s\n]+and[\s\n]+counterintelligence[\s\n]+\(CI\)[\s\n]+investigations\.(?:[\n]+|(?:\\n)+)\-At[\s\n]+any[\s\n]+time,[\s\n]+the[\s\n]+USG[\s\n]+may[\s\n]+inspect[\s\n]+and[\s\n]+seize[\s\n]+data[\s\n]+stored[\s\n]+on[\s\n]+this[\s\n]+IS\.(?:[\n]+|(?:\\n)+)\-Communications[\s\n]+using,[\s\n]+or[\s\n]+data[\s\n]+stored[\s\n]+on,[\s\n]+this[\s\n]+IS[\s\n]+are[\s\n]+not[\s\n]+private,[\s\n]+are[\s\n]+subject[\s\n]+to[\s\n]+routine[\s\n]+monitoring,[\s\n]+interception,[\s\n]+and[\s\n]+search,[\s\n]+and[\s\n]+may[\s\n]+be[\s\n]+disclosed[\s\n]+or[\s\n]+used[\s\n]+for[\s\n]+any[\s\n]+USG\-authorized[\s\n]+purpose\.(?:[\n]+|(?:\\n)+)\-This[\s\n]+IS[\s\n]+includes[\s\n]+security[\s\n]+measures[\s\n]+\(e\.g\.,[\s\n]+authentication[\s\n]+and[\s\n]+access[\s\n]+controls\)[\s\n]+to[\s\n]+protect[\s\n]+USG[\s\n]+interests\-\-not[\s\n]+for[\s\n]+your[\s\n]+personal[\s\n]+benefit[\s\n]+or[\s\n]+privacy\.(?:[\n]+|(?:\\n)+)\-Notwithstanding[\s\n]+the[\s\n]+above,[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+does[\s\n]+not[\s\n]+constitute[\s\n]+consent[\s\n]+to[\s\n]+PM,[\s\n]+LE[\s\n]+or[\s\n]+CI[\s\n]+investigative[\s\n]+searching[\s\n]+or[\s\n]+monitoring[\s\n]+of[\s\n]+the[\s\n]+content[\s\n]+of[\s\n]+privileged[\s\n]+communications,[\s\n]+or[\s\n]+work[\s\n]+product,[\s\n]+related[\s\n]+to[\s\n]+personal[\s\n]+representation[\s\n]+or[\s\n]+services[\s\n]+by[\s\n]+attorneys,[\s\n]+psychotherapists,[\s\n]+or[\s\n]+clergy,[\s\n]+and[\s\n]+their[\s\n]+assistants\.[\s\n]+Such[\s\n]+communications[\s\n]+and[\s\n]+work[\s\n]+product[\s\n]+are[\s\n]+private[\s\n]+and[\s\n]+confidential\.[\s\n]+See[\s\n]+User[\s\n]+Agreement[\s\n]+for[\s\n]+details\.|I've[\s\n]+read[\s\n]+\&[\s\n]+consent[\s\n]+to[\s\n]+terms[\s\n]+in[\s\n]+IS[\s\n]+user[\s\n]+agreem't\.)$'
@@ -7060,31 +7085,6 @@
 else
     >&2 echo 'Remediation is not applicable, nothing was done'
 fi
-
Remediation Ansible snippet:   (show)

Complexity:low
Disruption:medium
Reboot:false
Strategy:unknown
- name: XCCDF Value login_banner_text # promote to variable
-  set_fact:
-    login_banner_text: !!str ^(You[\s\n]+are[\s\n]+accessing[\s\n]+a[\s\n]+U\.S\.[\s\n]+Government[\s\n]+\(USG\)[\s\n]+Information[\s\n]+System[\s\n]+\(IS\)[\s\n]+that[\s\n]+is[\s\n]+provided[\s\n]+for[\s\n]+USG\-authorized[\s\n]+use[\s\n]+only\.[\s\n]+By[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+\(which[\s\n]+includes[\s\n]+any[\s\n]+device[\s\n]+attached[\s\n]+to[\s\n]+this[\s\n]+IS\),[\s\n]+you[\s\n]+consent[\s\n]+to[\s\n]+the[\s\n]+following[\s\n]+conditions\:(?:[\n]+|(?:\\n)+)\-The[\s\n]+USG[\s\n]+routinely[\s\n]+intercepts[\s\n]+and[\s\n]+monitors[\s\n]+communications[\s\n]+on[\s\n]+this[\s\n]+IS[\s\n]+for[\s\n]+purposes[\s\n]+including,[\s\n]+but[\s\n]+not[\s\n]+limited[\s\n]+to,[\s\n]+penetration[\s\n]+testing,[\s\n]+COMSEC[\s\n]+monitoring,[\s\n]+network[\s\n]+operations[\s\n]+and[\s\n]+defense,[\s\n]+personnel[\s\n]+misconduct[\s\n]+\(PM\),[\s\n]+law[\s\n]+enforcement[\s\n]+\(LE\),[\s\n]+and[\s\n]+counterintelligence[\s\n]+\(CI\)[\s\n]+investigations\.(?:[\n]+|(?:\\n)+)\-At[\s\n]+any[\s\n]+time,[\s\n]+the[\s\n]+USG[\s\n]+may[\s\n]+inspect[\s\n]+and[\s\n]+seize[\s\n]+data[\s\n]+stored[\s\n]+on[\s\n]+this[\s\n]+IS\.(?:[\n]+|(?:\\n)+)\-Communications[\s\n]+using,[\s\n]+or[\s\n]+data[\s\n]+stored[\s\n]+on,[\s\n]+this[\s\n]+IS[\s\n]+are[\s\n]+not[\s\n]+private,[\s\n]+are[\s\n]+subject[\s\n]+to[\s\n]+routine[\s\n]+monitoring,[\s\n]+interception,[\s\n]+and[\s\n]+search,[\s\n]+and[\s\n]+may[\s\n]+be[\s\n]+disclosed[\s\n]+or[\s\n]+used[\s\n]+for[\s\n]+any[\s\n]+USG\-authorized[\s\n]+purpose\.(?:[\n]+|(?:\\n)+)\-This[\s\n]+IS[\s\n]+includes[\s\n]+security[\s\n]+measures[\s\n]+\(e\.g\.,[\s\n]+authentication[\s\n]+and[\s\n]+access[\s\n]+controls\)[\s\n]+to[\s\n]+protect[\s\n]+USG[\s\n]+interests\-\-not[\s\n]+for[\s\n]+your[\s\n]+personal[\s\n]+benefit[\s\n]+or[\s\n]+privacy\.(?:[\n]+|(?:\\n)+)\-Notwithstanding[\s\n]+the[\s\n]+above,[\s\n]+using[\s\n]+this[\s\n]+IS[\s\n]+does[\s\n]+not[\s\n]+constitute[\s\n]+consent[\s\n]+to[\s\n]+PM,[\s\n]+LE[\s\n]+or[\s\n]+CI[\s\n]+investigative[\s\n]+searching[\s\n]+or[\s\n]+monitoring[\s\n]+of[\s\n]+the[\s\n]+content[\s\n]+of[\s\n]+privileged[\s\n]+communications,[\s\n]+or[\s\n]+work[\s\n]+product,[\s\n]+related[\s\n]+to[\s\n]+personal[\s\n]+representation[\s\n]+or[\s\n]+services[\s\n]+by[\s\n]+attorneys,[\s\n]+psychotherapists,[\s\n]+or[\s\n]+clergy,[\s\n]+and[\s\n]+their[\s\n]+assistants\.[\s\n]+Such[\s\n]+communications[\s\n]+and[\s\n]+work[\s\n]+product[\s\n]+are[\s\n]+private[\s\n]+and[\s\n]+confidential\.[\s\n]+See[\s\n]+User[\s\n]+Agreement[\s\n]+for[\s\n]+details\.|I've[\s\n]+read[\s\n]+\&[\s\n]+consent[\s\n]+to[\s\n]+terms[\s\n]+in[\s\n]+IS[\s\n]+user[\s\n]+agreem't\.)$
-  tags:
-    - always
-
-- name: Modify the System Login Banner - Ensure Correct Banner
-  copy:
-    dest: /etc/issue
-    content: '{{ login_banner_text | regex_replace("^\^(.*)\$$", "\1") | regex_replace("^\((.*\.)\|.*\)$",
-      "\1") | regex_replace("\[\\s\\n\]\+"," ") | regex_replace("\(\?:\[\\n\]\+\|\(\?:\\\\n\)\+\)",
-      "\n") | regex_replace("\\", "") | wordwrap() }}'
-  when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
-  tags:
-  - CCE-80763-6
-  - DISA-STIG-RHEL-08-010060
-  - NIST-800-171-3.1.9
-  - NIST-800-53-AC-8(a)
-  - NIST-800-53-AC-8(c)
-  - banner_etc_issue
-  - low_complexity
-  - medium_disruption
-  - medium_severity
-  - no_reboot_needed
-  - unknown_strategy
 
Group   Protect Accounts by Configuring PAM   Group contains 4 groups and 31 rules

[ref]   @@ -7138,23 +7138,23 @@ risk of a denial-of-service attack. The lockout policy must weigh whether the risk of such a denial-of-service attack outweighs the benefits of thwarting -password guessing attacks.